stream-chat-react 6.8.0 → 6.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/browser.full-bundle.js +1372 -1201
  2. package/dist/browser.full-bundle.js.map +1 -1
  3. package/dist/browser.full-bundle.min.js +2 -2
  4. package/dist/browser.full-bundle.min.js.map +1 -1
  5. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  6. package/dist/components/Avatar/Avatar.js +3 -1
  7. package/dist/components/Channel/Channel.d.ts +2 -0
  8. package/dist/components/Channel/Channel.d.ts.map +1 -1
  9. package/dist/components/Channel/Channel.js +62 -92
  10. package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts +15 -0
  11. package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -0
  12. package/dist/components/Channel/hooks/useCreateChannelStateContext.js +87 -0
  13. package/dist/components/Channel/hooks/useCreateTypingContext.d.ts +4 -0
  14. package/dist/components/Channel/hooks/useCreateTypingContext.d.ts.map +1 -0
  15. package/dist/components/Channel/hooks/useCreateTypingContext.js +9 -0
  16. package/dist/components/ChannelList/ChannelList.d.ts.map +1 -1
  17. package/dist/components/ChannelList/ChannelList.js +2 -2
  18. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts +1 -1
  19. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts.map +1 -1
  20. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.js +2 -4
  21. package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +0 -1
  22. package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
  23. package/dist/components/ChannelList/hooks/usePaginatedChannels.js +7 -15
  24. package/dist/components/Chat/Chat.d.ts.map +1 -1
  25. package/dist/components/Chat/Chat.js +14 -12
  26. package/dist/components/Chat/hooks/useChat.js +1 -1
  27. package/dist/components/Chat/hooks/useCreateChatContext.d.ts +4 -0
  28. package/dist/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -0
  29. package/dist/components/Chat/hooks/useCreateChatContext.js +21 -0
  30. package/dist/components/MessageInput/MessageInput.d.ts +1 -1
  31. package/dist/components/MessageInput/MessageInput.d.ts.map +1 -1
  32. package/dist/components/MessageInput/MessageInput.js +2 -1
  33. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts +4 -0
  34. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts.map +1 -0
  35. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +88 -0
  36. package/dist/components/MessageList/VirtualizedMessageList.d.ts +4 -2
  37. package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
  38. package/dist/components/MessageList/VirtualizedMessageList.js +2 -2
  39. package/dist/index.cjs.js +317 -146
  40. package/dist/index.cjs.js.map +1 -1
  41. package/dist/utils.d.ts +2 -2
  42. package/dist/utils.d.ts.map +1 -1
  43. package/dist/utils.js +22 -15
  44. package/dist/version.d.ts +1 -1
  45. package/dist/version.js +1 -1
  46. package/package.json +2 -2
@@ -11124,8 +11124,8 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
11124
11124
  * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
11125
11125
  * exposing only those methods and properties that are defined in the spec.
11126
11126
  */
11127
- var ResizeObserver$1 = function(callback) {
11128
- if (!(this instanceof ResizeObserver$1)) {
11127
+ var ResizeObserver$2 = function(callback) {
11128
+ if (!(this instanceof ResizeObserver$2)) {
11129
11129
  throw new TypeError('Cannot call a class as a function.');
11130
11130
  }
11131
11131
  if (!arguments.length) {
@@ -11140,7 +11140,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
11140
11140
 
11141
11141
  // Expose public methods of ResizeObserver.
11142
11142
  ['observe', 'unobserve', 'disconnect'].forEach(function (method) {
11143
- ResizeObserver$1.prototype[method] = function () {
11143
+ ResizeObserver$2.prototype[method] = function () {
11144
11144
  return (ref = observers$1.get(this))[method].apply(ref, arguments);
11145
11145
  var ref;
11146
11146
  };
@@ -11152,7 +11152,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
11152
11152
  return global$1$1.ResizeObserver;
11153
11153
  }
11154
11154
 
11155
- return ResizeObserver$1;
11155
+ return ResizeObserver$2;
11156
11156
  })();
11157
11157
 
11158
11158
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
@@ -47047,24 +47047,31 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
47047
47047
  // prettier-ignore
47048
47048
  return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
47049
47049
  }
47050
- var smartRender = function (ElementOrComponentOrLiteral, props, fallback) {
47051
- if (ElementOrComponentOrLiteral === undefined && fallback) {
47052
- ElementOrComponentOrLiteral = fallback;
47050
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt#getting_whole_characters
47051
+ var getWholeChar = function (str, i) {
47052
+ var code = str.charCodeAt(i);
47053
+ if (Number.isNaN(code))
47054
+ return '';
47055
+ if (code < 0xd800 || code > 0xdfff)
47056
+ return str.charAt(i);
47057
+ if (0xd800 <= code && code <= 0xdbff) {
47058
+ if (str.length <= i + 1) {
47059
+ throw 'High surrogate without following low surrogate';
47060
+ }
47061
+ var next = str.charCodeAt(i + 1);
47062
+ if (0xdc00 > next || next > 0xdfff) {
47063
+ throw 'High surrogate without following low surrogate';
47064
+ }
47065
+ return str.charAt(i) + str.charAt(i + 1);
47053
47066
  }
47054
- if (React__default$1['default'].isValidElement(ElementOrComponentOrLiteral)) {
47055
- // Flow cast through any, to make flow believe it's a React.Element
47056
- var element = ElementOrComponentOrLiteral;
47057
- return element;
47067
+ if (i === 0) {
47068
+ throw 'Low surrogate without preceding high surrogate';
47058
47069
  }
47059
- // Flow cast through any to remove React.Element after previous check
47060
- var ComponentOrLiteral = ElementOrComponentOrLiteral;
47061
- if (typeof ComponentOrLiteral === 'string' ||
47062
- typeof ComponentOrLiteral === 'number' ||
47063
- typeof ComponentOrLiteral === 'boolean' ||
47064
- ComponentOrLiteral == null) {
47065
- return ComponentOrLiteral;
47070
+ var prev = str.charCodeAt(i - 1);
47071
+ if (0xd800 > prev || prev > 0xdbff) {
47072
+ throw 'Low surrogate without preceding high surrogate';
47066
47073
  }
47067
- return React__default$1['default'].createElement(ComponentOrLiteral, __assign$2({}, props));
47074
+ return '';
47068
47075
  };
47069
47076
 
47070
47077
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var DefaultSuggestionListHeader = function (_a) {
@@ -48843,7 +48850,8 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
48843
48850
  setError(false);
48844
48851
  setLoaded(false);
48845
48852
  }, [image]);
48846
- var initials = ((name === null || name === void 0 ? void 0 : name.toString()) || '').charAt(0);
48853
+ var nameStr = (name === null || name === void 0 ? void 0 : name.toString()) || '';
48854
+ var initials = getWholeChar(nameStr, 0);
48847
48855
  return (React__default$1['default'].createElement("div", { className: "str-chat__avatar str-chat__avatar--" + shape, "data-testid": 'avatar', onClick: onClick, onMouseOver: onMouseOver, style: {
48848
48856
  flexBasis: size + "px",
48849
48857
  fontSize: size / 2 + "px",
@@ -49856,6 +49864,101 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
49856
49864
  // use this only for small lists like in ReactionSelector
49857
49865
  var getStrippedEmojiData = function (data) { return (__assign$2(__assign$2({}, data), { emojis: {} })); };
49858
49866
 
49867
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCreateChannelStateContext = function (value) {
49868
+ var _a;
49869
+ var acceptedFiles = value.acceptedFiles, channel = value.channel, channelConfig = value.channelConfig, error = value.error, hasMore = value.hasMore, loading = value.loading, loadingMore = value.loadingMore, maxNumberOfFiles = value.maxNumberOfFiles, members = value.members, _b = value.messages, messages = _b === void 0 ? [] : _b, multipleUploads = value.multipleUploads, mutes = value.mutes, notifications = value.notifications, pinnedMessages = value.pinnedMessages, quotedMessage = value.quotedMessage, _c = value.read, read = _c === void 0 ? {} : _c, skipMessageDataMemoization = value.skipMessageDataMemoization, thread = value.thread, threadHasMore = value.threadHasMore, threadLoadingMore = value.threadLoadingMore, _d = value.threadMessages, threadMessages = _d === void 0 ? [] : _d, watcherCount = value.watcherCount, watcher_count = value.watcher_count, watchers = value.watchers;
49870
+ var channelId = channel.cid;
49871
+ var lastRead = channel.initialized && ((_a = channel.lastRead()) === null || _a === void 0 ? void 0 : _a.getTime());
49872
+ var membersLength = Object.keys(members || []).length;
49873
+ var notificationsLength = notifications.length;
49874
+ var readUsers = Object.values(read);
49875
+ var readUsersLength = readUsers.length;
49876
+ var readUsersLastReads = readUsers.map(function (_a) {
49877
+ var last_read = _a.last_read;
49878
+ return last_read.toISOString();
49879
+ }).join();
49880
+ var threadMessagesLength = threadMessages === null || threadMessages === void 0 ? void 0 : threadMessages.length;
49881
+ var memoizedMessageData = skipMessageDataMemoization
49882
+ ? messages
49883
+ : messages
49884
+ .map(function (_a) {
49885
+ var deleted_at = _a.deleted_at, latest_reactions = _a.latest_reactions, pinned = _a.pinned, reply_count = _a.reply_count, status = _a.status, updated_at = _a.updated_at;
49886
+ return "" + deleted_at + (latest_reactions ? latest_reactions.map(function (_a) {
49887
+ var type = _a.type;
49888
+ return type;
49889
+ }).join() : '') + pinned + reply_count + status + (updated_at && (isDayOrMoment(updated_at) || isDate(updated_at))
49890
+ ? updated_at.toISOString()
49891
+ : updated_at || '');
49892
+ })
49893
+ .join();
49894
+ var memoizedThreadMessageData = threadMessages
49895
+ .map(function (_a) {
49896
+ var deleted_at = _a.deleted_at, latest_reactions = _a.latest_reactions, pinned = _a.pinned, status = _a.status, updated_at = _a.updated_at;
49897
+ return "" + deleted_at + (latest_reactions ? latest_reactions.map(function (_a) {
49898
+ var type = _a.type;
49899
+ return type;
49900
+ }).join() : '') + pinned + status + (updated_at && (isDayOrMoment(updated_at) || isDate(updated_at))
49901
+ ? updated_at.toISOString()
49902
+ : updated_at || '');
49903
+ })
49904
+ .join();
49905
+ var channelStateContext = React.useMemo(function () { return ({
49906
+ acceptedFiles: acceptedFiles,
49907
+ channel: channel,
49908
+ channelConfig: channelConfig,
49909
+ error: error,
49910
+ hasMore: hasMore,
49911
+ loading: loading,
49912
+ loadingMore: loadingMore,
49913
+ maxNumberOfFiles: maxNumberOfFiles,
49914
+ members: members,
49915
+ messages: messages,
49916
+ multipleUploads: multipleUploads,
49917
+ mutes: mutes,
49918
+ notifications: notifications,
49919
+ pinnedMessages: pinnedMessages,
49920
+ quotedMessage: quotedMessage,
49921
+ read: read,
49922
+ thread: thread,
49923
+ threadHasMore: threadHasMore,
49924
+ threadLoadingMore: threadLoadingMore,
49925
+ threadMessages: threadMessages,
49926
+ watcher_count: watcher_count,
49927
+ watcherCount: watcherCount,
49928
+ watchers: watchers,
49929
+ }); }, [
49930
+ channelId,
49931
+ error,
49932
+ hasMore,
49933
+ lastRead,
49934
+ loading,
49935
+ loadingMore,
49936
+ membersLength,
49937
+ memoizedMessageData,
49938
+ memoizedThreadMessageData,
49939
+ notificationsLength,
49940
+ quotedMessage,
49941
+ readUsersLength,
49942
+ readUsersLastReads,
49943
+ skipMessageDataMemoization,
49944
+ thread,
49945
+ threadHasMore,
49946
+ threadLoadingMore,
49947
+ threadMessagesLength,
49948
+ watcherCount,
49949
+ ]);
49950
+ return channelStateContext;
49951
+ };
49952
+
49953
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCreateTypingContext = function (value) {
49954
+ var typing = value.typing;
49955
+ var typingValue = Object.keys(typing || {}).join();
49956
+ var typingContext = React.useMemo(function () { return ({
49957
+ typing: typing,
49958
+ }); }, [typingValue]);
49959
+ return typingContext;
49960
+ };
49961
+
49859
49962
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var ChatContext = React__default$1['default'].createContext({});
49860
49963
  var ChatProvider = function (_a) {
49861
49964
  var children = _a.children, value = _a.value;
@@ -51417,7 +51520,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
51417
51520
  var transliterate;
51418
51521
  return __generator$1(this, function (_a) {
51419
51522
  switch (_a.label) {
51420
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return index; })];
51523
+ case 0: return [4 /*yield*/, Promise.resolve().then(function () { return index$1; })];
51421
51524
  case 1:
51422
51525
  transliterate = (_a.sent()).default;
51423
51526
  updatedName = transliterate(user.name || '').toLowerCase();
@@ -53460,13 +53563,101 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53460
53563
  !cooldownRemaining && React__default$1['default'].createElement(SendButton$1, { sendMessage: handleSubmit })))));
53461
53564
  };
53462
53565
 
53566
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCreateMessageInputContext = function (value) {
53567
+ var additionalTextareaProps = value.additionalTextareaProps, attachments = value.attachments, autocompleteTriggers = value.autocompleteTriggers, clearEditingState = value.clearEditingState, closeCommandsList = value.closeCommandsList, closeEmojiPicker = value.closeEmojiPicker, cooldownInterval = value.cooldownInterval, disabled = value.disabled, disableMentions = value.disableMentions, doFileUploadRequest = value.doFileUploadRequest, doImageUploadRequest = value.doImageUploadRequest, emojiIndex = value.emojiIndex, emojiPickerIsOpen = value.emojiPickerIsOpen, emojiPickerRef = value.emojiPickerRef, errorHandler = value.errorHandler, fileOrder = value.fileOrder, fileUploads = value.fileUploads, focus = value.focus, grow = value.grow, handleChange = value.handleChange, handleEmojiKeyDown = value.handleEmojiKeyDown, handleSubmit = value.handleSubmit, imageOrder = value.imageOrder, imageUploads = value.imageUploads, insertText = value.insertText, isUploadEnabled = value.isUploadEnabled, keycodeSubmitKeys = value.keycodeSubmitKeys, maxFilesLeft = value.maxFilesLeft, maxRows = value.maxRows, mentionAllAppUsers = value.mentionAllAppUsers, mentioned_users = value.mentioned_users, mentionQueryParams = value.mentionQueryParams, message = value.message, noFiles = value.noFiles, numberOfUploads = value.numberOfUploads, onPaste = value.onPaste, onSelectEmoji = value.onSelectEmoji, onSelectUser = value.onSelectUser, openCommandsList = value.openCommandsList, openEmojiPicker = value.openEmojiPicker, overrideSubmitHandler = value.overrideSubmitHandler, parent = value.parent, publishTypingEvent = value.publishTypingEvent, removeFile = value.removeFile, removeImage = value.removeImage, setCooldownRemaining = value.setCooldownRemaining, setText = value.setText, showCommandsList = value.showCommandsList, text = value.text, textareaRef = value.textareaRef, uploadFile = value.uploadFile, uploadImage = value.uploadImage, uploadNewFiles = value.uploadNewFiles, useMentionsTransliteration = value.useMentionsTransliteration;
53568
+ var editing = message === null || message === void 0 ? void 0 : message.editing;
53569
+ var fileUploadsValue = Object.entries(fileUploads)
53570
+ // eslint-disable-next-line
53571
+ .map(function (_a) {
53572
+ _a[0]; var value = _a[1];
53573
+ return value.state;
53574
+ })
53575
+ .join();
53576
+ var imageUploadsValue = Object.entries(imageUploads)
53577
+ // eslint-disable-next-line
53578
+ .map(function (_a) {
53579
+ _a[0]; var value = _a[1];
53580
+ return value.state;
53581
+ })
53582
+ .join();
53583
+ var mentionedUsersLength = mentioned_users.length;
53584
+ var parentId = parent === null || parent === void 0 ? void 0 : parent.id;
53585
+ var messageInputContext = React.useMemo(function () { return ({
53586
+ additionalTextareaProps: additionalTextareaProps,
53587
+ attachments: attachments,
53588
+ autocompleteTriggers: autocompleteTriggers,
53589
+ clearEditingState: clearEditingState,
53590
+ closeCommandsList: closeCommandsList,
53591
+ closeEmojiPicker: closeEmojiPicker,
53592
+ cooldownInterval: cooldownInterval,
53593
+ disabled: disabled,
53594
+ disableMentions: disableMentions,
53595
+ doFileUploadRequest: doFileUploadRequest,
53596
+ doImageUploadRequest: doImageUploadRequest,
53597
+ emojiIndex: emojiIndex,
53598
+ emojiPickerIsOpen: emojiPickerIsOpen,
53599
+ emojiPickerRef: emojiPickerRef,
53600
+ errorHandler: errorHandler,
53601
+ fileOrder: fileOrder,
53602
+ fileUploads: fileUploads,
53603
+ focus: focus,
53604
+ grow: grow,
53605
+ handleChange: handleChange,
53606
+ handleEmojiKeyDown: handleEmojiKeyDown,
53607
+ handleSubmit: handleSubmit,
53608
+ imageOrder: imageOrder,
53609
+ imageUploads: imageUploads,
53610
+ insertText: insertText,
53611
+ isUploadEnabled: isUploadEnabled,
53612
+ keycodeSubmitKeys: keycodeSubmitKeys,
53613
+ maxFilesLeft: maxFilesLeft,
53614
+ maxRows: maxRows,
53615
+ mentionAllAppUsers: mentionAllAppUsers,
53616
+ mentioned_users: mentioned_users,
53617
+ mentionQueryParams: mentionQueryParams,
53618
+ message: message,
53619
+ noFiles: noFiles,
53620
+ numberOfUploads: numberOfUploads,
53621
+ onPaste: onPaste,
53622
+ onSelectEmoji: onSelectEmoji,
53623
+ onSelectUser: onSelectUser,
53624
+ openCommandsList: openCommandsList,
53625
+ openEmojiPicker: openEmojiPicker,
53626
+ overrideSubmitHandler: overrideSubmitHandler,
53627
+ parent: parent,
53628
+ publishTypingEvent: publishTypingEvent,
53629
+ removeFile: removeFile,
53630
+ removeImage: removeImage,
53631
+ setCooldownRemaining: setCooldownRemaining,
53632
+ setText: setText,
53633
+ showCommandsList: showCommandsList,
53634
+ text: text,
53635
+ textareaRef: textareaRef,
53636
+ uploadFile: uploadFile,
53637
+ uploadImage: uploadImage,
53638
+ uploadNewFiles: uploadNewFiles,
53639
+ useMentionsTransliteration: useMentionsTransliteration,
53640
+ }); }, [
53641
+ editing,
53642
+ emojiPickerIsOpen,
53643
+ fileUploadsValue,
53644
+ imageUploadsValue,
53645
+ isUploadEnabled,
53646
+ mentionedUsersLength,
53647
+ parentId,
53648
+ publishTypingEvent,
53649
+ text,
53650
+ ]);
53651
+ return messageInputContext;
53652
+ };
53653
+
53463
53654
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedMessageInput = function (props) {
53464
53655
  var PropInput = props.Input;
53465
53656
  var _a = useComponentContext(), ContextInput = _a.Input, _b = _a.TriggerProvider, TriggerProvider = _b === void 0 ? DefaultTriggerProvider : _b;
53466
53657
  var Input = PropInput || ContextInput || MessageInputFlat;
53467
53658
  var messageInputState = useMessageInputState(props);
53468
53659
  var cooldownTimerState = useCooldownTimer();
53469
- var messageInputContextValue = __assign$2(__assign$2(__assign$2({}, cooldownTimerState), messageInputState), props);
53660
+ var messageInputContextValue = useCreateMessageInputContext(__assign$2(__assign$2(__assign$2({}, cooldownTimerState), messageInputState), props));
53470
53661
  return (React__default$1['default'].createElement(MessageInputContextProvider, { value: messageInputContextValue },
53471
53662
  React__default$1['default'].createElement(TriggerProvider, null,
53472
53663
  React__default$1['default'].createElement(Input, null))));
@@ -53866,7 +54057,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53866
54057
  return React__default$1['default'].createElement(ChannelInner, __assign$2({}, props, { channel: channel, key: channel.cid }));
53867
54058
  };
53868
54059
  var ChannelInner = function (props) {
53869
- var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel, children = props.children, doMarkReadRequest = props.doMarkReadRequest, doSendMessageRequest = props.doSendMessageRequest, doUpdateMessageRequest = props.doUpdateMessageRequest, _a = props.emojiData, emojiData = _a === void 0 ? defaultEmojiData : _a, _b = props.LoadingErrorIndicator, LoadingErrorIndicator$1 = _b === void 0 ? LoadingErrorIndicator : _b, _c = props.LoadingIndicator, LoadingIndicator$1 = _c === void 0 ? LoadingIndicator : _c, maxNumberOfFiles = props.maxNumberOfFiles, _d = props.multipleUploads, multipleUploads = _d === void 0 ? true : _d, onMentionsClick = props.onMentionsClick, onMentionsHover = props.onMentionsHover;
54060
+ var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel, children = props.children, doMarkReadRequest = props.doMarkReadRequest, doSendMessageRequest = props.doSendMessageRequest, doUpdateMessageRequest = props.doUpdateMessageRequest, _a = props.emojiData, emojiData = _a === void 0 ? defaultEmojiData : _a, _b = props.LoadingErrorIndicator, LoadingErrorIndicator$1 = _b === void 0 ? LoadingErrorIndicator : _b, _c = props.LoadingIndicator, LoadingIndicator$1 = _c === void 0 ? LoadingIndicator : _c, maxNumberOfFiles = props.maxNumberOfFiles, _d = props.multipleUploads, multipleUploads = _d === void 0 ? true : _d, onMentionsClick = props.onMentionsClick, onMentionsHover = props.onMentionsHover, skipMessageDataMemoization = props.skipMessageDataMemoization;
53870
54061
  var _e = useChatContext(), client = _e.client, customClasses = _e.customClasses, mutes = _e.mutes, theme = _e.theme, useImageFlagEmojisOnWindows = _e.useImageFlagEmojisOnWindows;
53871
54062
  var t = useTranslationContext().t;
53872
54063
  var _f = React.useState([]), notifications = _f[0], setNotifications = _f[1];
@@ -53884,14 +54075,12 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53884
54075
  emojiData: emojiData,
53885
54076
  emojiSetDef: emojiSetDef,
53886
54077
  };
53887
- var throttledCopyStateFromChannel = React.useCallback(lodash_throttle(function () {
53888
- if (!channel)
53889
- return;
53890
- dispatch({ channel: channel, type: 'copyStateFromChannelOnEvent' });
53891
- }, 500, { leading: true, trailing: true }), [channel]);
53892
- var markRead = React.useCallback(function () {
53893
- var _a;
53894
- if (!channel || channel.disconnected || !((_a = channel.getConfig()) === null || _a === void 0 ? void 0 : _a.read_events)) {
54078
+ var throttledCopyStateFromChannel = lodash_throttle(function () { return dispatch({ channel: channel, type: 'copyStateFromChannelOnEvent' }); }, 500, {
54079
+ leading: true,
54080
+ trailing: true,
54081
+ });
54082
+ var markRead = function () {
54083
+ if (channel.disconnected || !(channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events)) {
53895
54084
  return;
53896
54085
  }
53897
54086
  lastRead.current = new Date();
@@ -53904,10 +54093,10 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53904
54093
  if (originalTitle.current) {
53905
54094
  document.title = originalTitle.current;
53906
54095
  }
53907
- }, [channel, doMarkReadRequest]);
53908
- var markReadThrottled = React.useCallback(lodash_throttle(markRead, 500, { leading: true, trailing: true }), [markRead]);
53909
- var handleEvent = React.useCallback(function (event) {
53910
- var _a, _b, _c, _d, _e;
54096
+ };
54097
+ var markReadThrottled = lodash_throttle(markRead, 500, { leading: true, trailing: true });
54098
+ var handleEvent = function (event) {
54099
+ var _a, _b, _c, _d;
53911
54100
  if (event.message) {
53912
54101
  dispatch({
53913
54102
  channel: channel,
@@ -53916,11 +54105,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53916
54105
  });
53917
54106
  }
53918
54107
  if (event.type === 'typing.start' || event.type === 'typing.stop') {
53919
- dispatch({
53920
- channel: channel,
53921
- type: 'setTyping',
53922
- });
53923
- return;
54108
+ return dispatch({ channel: channel, type: 'setTyping' });
53924
54109
  }
53925
54110
  if (event.type === 'connection.changed' && typeof event.online === 'boolean') {
53926
54111
  online.current = event.online;
@@ -53934,7 +54119,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53934
54119
  if (!document.hidden) {
53935
54120
  markReadThrottled();
53936
54121
  }
53937
- else if (((_e = channel.getConfig()) === null || _e === void 0 ? void 0 : _e.read_events) && !channel.muteStatus().muted) {
54122
+ else if ((channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events) && !channel.muteStatus().muted) {
53938
54123
  var unread = channel.countUnread(lastRead.current);
53939
54124
  if (activeUnreadHandler) {
53940
54125
  activeUnreadHandler(unread, originalTitle.current);
@@ -53946,22 +54131,21 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53946
54131
  }
53947
54132
  }
53948
54133
  throttledCopyStateFromChannel();
53949
- }, [channel, client.userID, markReadThrottled, throttledCopyStateFromChannel]);
54134
+ };
53950
54135
  // useLayoutEffect here to prevent spinner. Use Suspense when it is available in stable release
53951
54136
  React.useLayoutEffect(function () {
53952
54137
  var errored = false;
53953
54138
  var done = false;
53954
54139
  var onVisibilityChange = function () {
53955
- if (!document.hidden) {
54140
+ if (!document.hidden)
53956
54141
  markRead();
53957
- }
53958
54142
  };
53959
54143
  (function () { return __awaiter$1(void 0, void 0, void 0, function () {
53960
54144
  var e_1;
53961
54145
  return __generator$1(this, function (_a) {
53962
54146
  switch (_a.label) {
53963
54147
  case 0:
53964
- if (!(channel && !channel.initialized)) return [3 /*break*/, 4];
54148
+ if (!!channel.initialized) return [3 /*break*/, 4];
53965
54149
  _a.label = 1;
53966
54150
  case 1:
53967
54151
  _a.trys.push([1, 3, , 4]);
@@ -53977,7 +54161,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53977
54161
  case 4:
53978
54162
  done = true;
53979
54163
  originalTitle.current = document.title;
53980
- if (channel && !errored) {
54164
+ if (!errored) {
53981
54165
  dispatch({ channel: channel, type: 'initStateFromChannel' });
53982
54166
  if (channel.countUnread() > 0)
53983
54167
  markRead();
@@ -53997,15 +54181,14 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
53997
54181
  if (errored || !done)
53998
54182
  return;
53999
54183
  document.removeEventListener('visibilitychange', onVisibilityChange);
54000
- if (channel)
54001
- channel.off(handleEvent);
54184
+ channel === null || channel === void 0 ? void 0 : channel.off(handleEvent);
54002
54185
  client.off('connection.changed', handleEvent);
54003
54186
  client.off('connection.recovered', handleEvent);
54004
54187
  client.off('user.updated', handleEvent);
54005
54188
  client.off('user.deleted', handleEvent);
54006
54189
  notificationTimeouts.forEach(clearTimeout);
54007
54190
  };
54008
- }, [channel, client, handleEvent, markRead]);
54191
+ }, [channel.cid]);
54009
54192
  React.useEffect(function () {
54010
54193
  var _a;
54011
54194
  if (state.thread && ((_a = state.messages) === null || _a === void 0 ? void 0 : _a.length)) {
@@ -54032,17 +54215,15 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54032
54215
  }, 5000);
54033
54216
  notificationTimeouts.push(timeout);
54034
54217
  };
54035
- var loadMoreFinished = React.useCallback(lodash_debounce(function (hasMore, messages) {
54218
+ var loadMoreFinished = lodash_debounce(function (hasMore, messages) {
54036
54219
  if (!isMounted.current)
54037
54220
  return;
54038
54221
  dispatch({ hasMore: hasMore, messages: messages, type: 'loadMoreFinished' });
54039
54222
  }, 2000, {
54040
54223
  leading: true,
54041
54224
  trailing: true,
54042
- }), []);
54043
- var loadMore = React.useCallback(
54044
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
54045
- function (limit) {
54225
+ });
54226
+ var loadMore = function (limit) {
54046
54227
  if (limit === void 0) { limit = 100; }
54047
54228
  return __awaiter$1(void 0, void 0, void 0, function () {
54048
54229
  var oldestMessage, oldestID, perPage, queryResponse, e_2, hasMoreMessages;
@@ -54050,7 +54231,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54050
54231
  return __generator$1(this, function (_b) {
54051
54232
  switch (_b.label) {
54052
54233
  case 0:
54053
- if (!online.current || !window.navigator.onLine || !channel)
54234
+ if (!online.current || !window.navigator.onLine)
54054
54235
  return [2 /*return*/, 0];
54055
54236
  oldestMessage = (_a = state === null || state === void 0 ? void 0 : state.messages) === null || _a === void 0 ? void 0 : _a[0];
54056
54237
  if (state.loadingMore || (oldestMessage === null || oldestMessage === void 0 ? void 0 : oldestMessage.status) !== 'received')
@@ -54085,27 +54266,22 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54085
54266
  }
54086
54267
  });
54087
54268
  });
54088
- }, [channel, loadMoreFinished, online, state.loadingMore, state.messages]);
54089
- var updateMessage = React.useCallback(function (updatedMessage) {
54090
- if (!channel)
54091
- return;
54092
- // adds the message to the local channel state..
54093
- // this adds to both the main channel state as well as any reply threads
54269
+ };
54270
+ var updateMessage = function (updatedMessage) {
54271
+ // add the message to the local channel state
54094
54272
  channel.state.addMessageSorted(updatedMessage, true);
54095
54273
  dispatch({
54096
54274
  channel: channel,
54097
54275
  parentId: state.thread && updatedMessage.parent_id,
54098
54276
  type: 'copyMessagesFromChannel',
54099
54277
  });
54100
- }, [channel, state.thread]);
54278
+ };
54101
54279
  var isUserResponseArray = function (output) { var _a; return ((_a = output[0]) === null || _a === void 0 ? void 0 : _a.id) != null; };
54102
- var doSendMessage = React.useCallback(function (message, customMessageData) { return __awaiter$1(void 0, void 0, void 0, function () {
54280
+ var doSendMessage = function (message, customMessageData) { return __awaiter$1(void 0, void 0, void 0, function () {
54103
54281
  var attachments, id, _a, mentioned_users, parent_id, text, mentions, messageData, messageResponse, error_1, stringError, parsedError;
54104
54282
  return __generator$1(this, function (_b) {
54105
54283
  switch (_b.label) {
54106
54284
  case 0:
54107
- if (!channel)
54108
- return [2 /*return*/];
54109
54285
  attachments = message.attachments, id = message.id, _a = message.mentioned_users, mentioned_users = _a === void 0 ? [] : _a, parent_id = message.parent_id, text = message.text;
54110
54286
  mentions = isUserResponseArray(mentioned_users)
54111
54287
  ? mentioned_users.map(function (_a) {
@@ -54129,7 +54305,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54129
54305
  _b.label = 5;
54130
54306
  case 5:
54131
54307
  // replace it after send is completed
54132
- if (messageResponse && messageResponse.message) {
54308
+ if (messageResponse === null || messageResponse === void 0 ? void 0 : messageResponse.message) {
54133
54309
  updateMessage(__assign$2(__assign$2({}, messageResponse.message), { status: 'received' }));
54134
54310
  }
54135
54311
  if (quotedMessage)
@@ -54144,25 +54320,20 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54144
54320
  case 7: return [2 /*return*/];
54145
54321
  }
54146
54322
  });
54147
- }); }, [channel, doSendMessageRequest, quotedMessage, updateMessage]);
54148
- var createMessagePreview = React.useCallback(function (text, attachments, parent, mentioned_users) {
54149
- // create a preview of the message
54323
+ }); };
54324
+ var createMessagePreview = function (text, attachments, parent, mentioned_users) {
54150
54325
  var clientSideID = client.userID + "-" + v4();
54151
54326
  return __assign$2({ __html: text, attachments: attachments, created_at: new Date(), html: text, id: clientSideID, mentioned_users: mentioned_users, reactions: [], status: 'sending', text: text, type: 'regular', user: client.user }, ((parent === null || parent === void 0 ? void 0 : parent.id) ? { parent_id: parent.id } : null));
54152
- }, [client.user, client.userID]);
54153
- var sendMessage = React.useCallback(function (_a, customMessageData) {
54327
+ };
54328
+ var sendMessage = function (_a, customMessageData) {
54154
54329
  var _b = _a.attachments, attachments = _b === void 0 ? [] : _b, _c = _a.mentioned_users, mentioned_users = _c === void 0 ? [] : _c, _d = _a.parent, parent = _d === void 0 ? undefined : _d, _e = _a.text, text = _e === void 0 ? '' : _e;
54155
54330
  return __awaiter$1(void 0, void 0, void 0, function () {
54156
54331
  var messagePreview;
54157
54332
  return __generator$1(this, function (_f) {
54158
54333
  switch (_f.label) {
54159
54334
  case 0:
54160
- if (!channel)
54161
- return [2 /*return*/];
54162
- // remove error messages upon submit
54163
54335
  channel.state.filterErrorMessages();
54164
54336
  messagePreview = createMessagePreview(text, attachments, parent, mentioned_users);
54165
- // first we add the message to the UI
54166
54337
  updateMessage(messagePreview);
54167
54338
  return [4 /*yield*/, doSendMessage(messagePreview, customMessageData)];
54168
54339
  case 1:
@@ -54171,62 +54342,55 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54171
54342
  }
54172
54343
  });
54173
54344
  });
54174
- }, [channel === null || channel === void 0 ? void 0 : channel.state, createMessagePreview, doSendMessage, updateMessage]);
54175
- var retrySendMessage = React.useCallback(function (message) { return __awaiter$1(void 0, void 0, void 0, function () {
54345
+ };
54346
+ var retrySendMessage = function (message) { return __awaiter$1(void 0, void 0, void 0, function () {
54176
54347
  return __generator$1(this, function (_a) {
54177
54348
  switch (_a.label) {
54178
54349
  case 0:
54179
- // set the message status to sending
54180
54350
  updateMessage(__assign$2(__assign$2({}, message), { errorStatusCode: undefined, status: 'sending' }));
54181
- // actually try to send the message...
54182
54351
  return [4 /*yield*/, doSendMessage(message)];
54183
54352
  case 1:
54184
- // actually try to send the message...
54185
54353
  _a.sent();
54186
54354
  return [2 /*return*/];
54187
54355
  }
54188
54356
  });
54189
- }); }, [doSendMessage, updateMessage]);
54190
- var removeMessage = React.useCallback(function (message) {
54191
- if (!channel)
54192
- return;
54357
+ }); };
54358
+ var removeMessage = function (message) {
54193
54359
  channel.state.removeMessage(message);
54194
54360
  dispatch({
54195
54361
  channel: channel,
54196
54362
  parentId: state.thread && message.parent_id,
54197
54363
  type: 'copyMessagesFromChannel',
54198
54364
  });
54199
- }, [channel, state.thread]);
54365
+ };
54200
54366
  /** THREAD */
54201
- var openThread = React.useCallback(function (message, event) {
54202
- if (!channel)
54203
- return;
54204
- if (event && event.preventDefault) {
54205
- event.preventDefault();
54206
- }
54367
+ var openThread = function (message, event) {
54368
+ event.preventDefault();
54207
54369
  dispatch({ channel: channel, message: message, type: 'openThread' });
54208
- }, [channel]);
54209
- var loadMoreThreadFinished = React.useCallback(lodash_debounce(function (threadHasMore, threadMessages) {
54370
+ };
54371
+ var closeThread = function (event) {
54372
+ event.preventDefault();
54373
+ dispatch({ type: 'closeThread' });
54374
+ };
54375
+ var loadMoreThreadFinished = lodash_debounce(function (threadHasMore, threadMessages) {
54210
54376
  dispatch({
54211
54377
  threadHasMore: threadHasMore,
54212
54378
  threadMessages: threadMessages,
54213
54379
  type: 'loadMoreThreadFinished',
54214
54380
  });
54215
- }, 2000, { leading: true, trailing: true }), []);
54216
- var loadMoreThread = React.useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
54381
+ }, 2000, { leading: true, trailing: true });
54382
+ var loadMoreThread = function () { return __awaiter$1(void 0, void 0, void 0, function () {
54217
54383
  var parentID, oldMessages, oldestMessageID, limit, queryResponse, threadHasMoreMessages, newThreadMessages;
54218
54384
  var _a;
54219
54385
  return __generator$1(this, function (_b) {
54220
54386
  switch (_b.label) {
54221
54387
  case 0:
54222
- // prevent duplicate loading events...
54223
- if (!channel || state.threadLoadingMore || !state.thread)
54388
+ if (state.threadLoadingMore || !state.thread)
54224
54389
  return [2 /*return*/];
54225
54390
  dispatch({ type: 'startLoadingThread' });
54226
54391
  parentID = state.thread.id;
54227
54392
  if (!parentID) {
54228
- dispatch({ type: 'closeThread' });
54229
- return [2 /*return*/];
54393
+ return [2 /*return*/, dispatch({ type: 'closeThread' })];
54230
54394
  }
54231
54395
  oldMessages = channel.state.threads[parentID] || [];
54232
54396
  oldestMessageID = (_a = oldMessages[0]) === null || _a === void 0 ? void 0 : _a.id;
@@ -54242,7 +54406,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54242
54406
  queryResponse = _b.sent();
54243
54407
  threadHasMoreMessages = queryResponse.messages.length === limit;
54244
54408
  newThreadMessages = channel.state.threads[parentID] || [];
54245
- // next set loadingMore to false so we can start asking for more data...
54409
+ // next set loadingMore to false so we can start asking for more data
54246
54410
  loadMoreThreadFinished(threadHasMoreMessages, newThreadMessages);
54247
54411
  return [3 /*break*/, 4];
54248
54412
  case 3:
@@ -54252,18 +54416,12 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54252
54416
  case 4: return [2 /*return*/];
54253
54417
  }
54254
54418
  });
54255
- }); }, [channel, loadMoreThreadFinished, state.thread, state.threadLoadingMore]);
54256
- var closeThread = React.useCallback(function (event) {
54257
- if (event && event.preventDefault) {
54258
- event.preventDefault();
54259
- }
54260
- dispatch({ type: 'closeThread' });
54261
- }, []);
54419
+ }); };
54262
54420
  var onMentionsHoverOrClick = useMentionsHandlers(onMentionsHover, onMentionsClick);
54263
54421
  var editMessage = useEditMessageHandler(doUpdateMessageRequest);
54264
54422
  var typing = state.typing, restState = __rest(state, ["typing"]);
54265
- var channelStateContextValue = __assign$2(__assign$2({}, restState), { acceptedFiles: acceptedFiles, channel: channel, channelConfig: channelConfig, maxNumberOfFiles: maxNumberOfFiles, multipleUploads: multipleUploads, mutes: mutes, notifications: notifications, quotedMessage: quotedMessage, watcher_count: state.watcherCount });
54266
- var channelActionContextValue = {
54423
+ var channelStateContextValue = useCreateChannelStateContext(__assign$2(__assign$2({}, restState), { acceptedFiles: acceptedFiles, channel: channel, channelConfig: channelConfig, maxNumberOfFiles: maxNumberOfFiles, multipleUploads: multipleUploads, mutes: mutes, notifications: notifications, quotedMessage: quotedMessage, watcher_count: state.watcherCount }));
54424
+ var channelActionContextValue = React.useMemo(function () { return ({
54267
54425
  addNotification: addNotification,
54268
54426
  closeThread: closeThread,
54269
54427
  dispatch: dispatch,
@@ -54277,8 +54435,9 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54277
54435
  retrySendMessage: retrySendMessage,
54278
54436
  sendMessage: sendMessage,
54279
54437
  setQuotedMessage: setQuotedMessage,
54438
+ skipMessageDataMemoization: skipMessageDataMemoization,
54280
54439
  updateMessage: updateMessage,
54281
- };
54440
+ }); }, [channel.cid, loadMore, quotedMessage]);
54282
54441
  var componentContextValue = React.useMemo(function () { return ({
54283
54442
  Attachment: props.Attachment || Attachment,
54284
54443
  AutocompleteSuggestionHeader: props.AutocompleteSuggestionHeader,
@@ -54322,9 +54481,9 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54322
54481
  EmojiIndex: props.EmojiIndex,
54323
54482
  EmojiPicker: props.EmojiPicker,
54324
54483
  }); }, []);
54325
- var typingContextValue = {
54484
+ var typingContextValue = useCreateTypingContext({
54326
54485
  typing: typing,
54327
- };
54486
+ });
54328
54487
  var chatClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.chat) || 'str-chat';
54329
54488
  var channelClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.channel) || 'str-chat-channel';
54330
54489
  var windowsEmojiClass = useImageFlagEmojisOnWindows && navigator.userAgent.match(/Win/)
@@ -54338,7 +54497,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54338
54497
  return (React__default$1['default'].createElement("div", { className: chatClass + " " + channelClass + " " + theme },
54339
54498
  React__default$1['default'].createElement(LoadingIndicator$1, { size: 25 })));
54340
54499
  }
54341
- if (!(channel === null || channel === void 0 ? void 0 : channel.watch)) {
54500
+ if (!channel.watch) {
54342
54501
  return (React__default$1['default'].createElement("div", { className: chatClass + " " + channelClass + " " + theme },
54343
54502
  React__default$1['default'].createElement("div", null, t('Channel Missing'))));
54344
54503
  }
@@ -54667,7 +54826,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54667
54826
  }, [customHandler]);
54668
54827
  };
54669
54828
 
54670
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useNotificationMessageNewListener = function (setChannels, customHandler, setOffset, allowNewMessagesFromUnfilteredChannels) {
54829
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useNotificationMessageNewListener = function (setChannels, customHandler, allowNewMessagesFromUnfilteredChannels) {
54671
54830
  if (allowNewMessagesFromUnfilteredChannels === void 0) { allowNewMessagesFromUnfilteredChannels = true; }
54672
54831
  var client = useChatContext().client;
54673
54832
  React.useEffect(function () {
@@ -54687,9 +54846,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54687
54846
  channel_1 = _b.sent();
54688
54847
  setChannels(function (channels) { return lodash_uniqby(__spreadArray([channel_1], channels), 'cid'); });
54689
54848
  _b.label = 3;
54690
- case 3:
54691
- setOffset === null || setOffset === void 0 ? void 0 : setOffset(function (prevOffset) { return prevOffset + 1; });
54692
- return [2 /*return*/];
54849
+ case 3: return [2 /*return*/];
54693
54850
  }
54694
54851
  });
54695
54852
  }); };
@@ -54723,12 +54880,11 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54723
54880
  var _b = React.useState(false), error = _b[0], setError = _b[1];
54724
54881
  var _c = React.useState(true), hasNextPage = _c[0], setHasNextPage = _c[1];
54725
54882
  var _d = React.useState(true), loadingChannels = _d[0], setLoadingChannels = _d[1];
54726
- var _e = React.useState(0), offset = _e[0], setOffset = _e[1];
54727
- var _f = React.useState(true), refreshing = _f[0], setRefreshing = _f[1];
54883
+ var _e = React.useState(true), refreshing = _e[0], setRefreshing = _e[1];
54728
54884
  var filterString = React.useMemo(function () { return JSON.stringify(filters); }, [filters]);
54729
54885
  var sortString = React.useMemo(function () { return JSON.stringify(sort); }, [sort]);
54730
54886
  var queryChannels = function (queryType) { return __awaiter$1(void 0, void 0, void 0, function () {
54731
- var newOptions, channelQueryResponse, newChannels, err_1;
54887
+ var offset, newOptions, channelQueryResponse, newChannels, err_1;
54732
54888
  var _a;
54733
54889
  return __generator$1(this, function (_b) {
54734
54890
  switch (_b.label) {
@@ -54738,27 +54894,21 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54738
54894
  setLoadingChannels(true);
54739
54895
  }
54740
54896
  setRefreshing(true);
54741
- newOptions = __assign$2({ limit: (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : MAX_QUERY_CHANNELS_LIMIT, offset: queryType === 'reload' ? 0 : offset }, options);
54897
+ offset = queryType === 'reload' ? 0 : channels.length;
54898
+ newOptions = __assign$2({ limit: (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : MAX_QUERY_CHANNELS_LIMIT, offset: offset }, options);
54742
54899
  _b.label = 1;
54743
54900
  case 1:
54744
54901
  _b.trys.push([1, 3, , 4]);
54745
54902
  return [4 /*yield*/, client.queryChannels(filters, sort || {}, newOptions)];
54746
54903
  case 2:
54747
54904
  channelQueryResponse = _b.sent();
54748
- newChannels = void 0;
54749
- if (queryType === 'reload') {
54750
- newChannels = channelQueryResponse;
54751
- }
54752
- else {
54753
- newChannels = __spreadArray(__spreadArray([], channels), channelQueryResponse);
54754
- }
54905
+ newChannels = queryType === 'reload' ? channelQueryResponse : __spreadArray(__spreadArray([], channels), channelQueryResponse);
54755
54906
  setChannels(newChannels);
54756
54907
  setHasNextPage(channelQueryResponse.length >= newOptions.limit);
54757
- // Set active channel only after first page.
54758
- if (offset === 0 && activeChannelHandler) {
54908
+ // Set active channel only on load of first page
54909
+ if (!offset && activeChannelHandler) {
54759
54910
  activeChannelHandler(newChannels, setChannels);
54760
54911
  }
54761
- setOffset(newChannels.length);
54762
54912
  return [3 /*break*/, 4];
54763
54913
  case 3:
54764
54914
  err_1 = _b.sent();
@@ -54783,7 +54933,6 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
54783
54933
  hasNextPage: hasNextPage,
54784
54934
  loadNextPage: loadNextPage,
54785
54935
  setChannels: setChannels,
54786
- setOffset: setOffset,
54787
54936
  status: {
54788
54937
  error: error,
54789
54938
  loadingChannels: loadingChannels,
@@ -55235,11 +55384,11 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
55235
55384
  * force a re-render. Incrementing this dummy variable ensures the channel previews update.
55236
55385
  */
55237
55386
  var forceUpdate = function () { return setChannelUpdateCount(function (count) { return count + 1; }); };
55238
- var _r = usePaginatedChannels(client, filters || DEFAULT_FILTERS, sort || DEFAULT_SORT, options || DEFAULT_OPTIONS, activeChannelHandler), channels = _r.channels, hasNextPage = _r.hasNextPage, loadNextPage = _r.loadNextPage, setChannels = _r.setChannels, setOffset = _r.setOffset, status = _r.status;
55387
+ var _r = usePaginatedChannels(client, filters || DEFAULT_FILTERS, sort || DEFAULT_SORT, options || DEFAULT_OPTIONS, activeChannelHandler), channels = _r.channels, hasNextPage = _r.hasNextPage, loadNextPage = _r.loadNextPage, setChannels = _r.setChannels, status = _r.status;
55239
55388
  var loadedChannels = channelRenderFilterFn ? channelRenderFilterFn(channels) : channels;
55240
55389
  useMobileNavigation(channelListRef, navOpen, closeMobileNav);
55241
55390
  useMessageNewListener(setChannels, lockChannelOrder, allowNewMessagesFromUnfilteredChannels);
55242
- useNotificationMessageNewListener(setChannels, onMessageNew, setOffset, allowNewMessagesFromUnfilteredChannels);
55391
+ useNotificationMessageNewListener(setChannels, onMessageNew, allowNewMessagesFromUnfilteredChannels);
55243
55392
  useNotificationAddedToChannelListener(setChannels, onAddedToChannel, allowNewMessagesFromUnfilteredChannels);
55244
55393
  useNotificationRemovedFromChannelListener(setChannels, onRemovedFromChannel);
55245
55394
  useChannelDeletedListener(setChannels, onChannelDeleted);
@@ -58417,7 +58566,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
58417
58566
 
58418
58567
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
58419
58568
 
58420
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '6.8.0';
58569
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '6.9.0';
58421
58570
 
58422
58571
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
58423
58572
  var _b;
@@ -58430,7 +58579,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
58430
58579
  var _e = React.useState(), channel = _e[0], setChannel = _e[1];
58431
58580
  var _f = React.useState([]), mutes = _f[0], setMutes = _f[1];
58432
58581
  var _g = React.useState(initialNavOpen), navOpen = _g[0], setNavOpen = _g[1];
58433
- var clientMutes = (_b = client === null || client === void 0 ? void 0 : client.user) === null || _b === void 0 ? void 0 : _b.mutes;
58582
+ var clientMutes = (_b = client.user) === null || _b === void 0 ? void 0 : _b.mutes;
58434
58583
  var closeMobileNav = function () { return setNavOpen(false); };
58435
58584
  var openMobileNav = function () { return setTimeout(function () { return setNavOpen(true); }, 100); };
58436
58585
  React.useEffect(function () {
@@ -58500,6 +58649,27 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
58500
58649
  };
58501
58650
  };
58502
58651
 
58652
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCreateChatContext = function (value) {
58653
+ var _a;
58654
+ var channel = value.channel, client = value.client, closeMobileNav = value.closeMobileNav, customClasses = value.customClasses, mutes = value.mutes, navOpen = value.navOpen, openMobileNav = value.openMobileNav, setActiveChannel = value.setActiveChannel, theme = value.theme, useImageFlagEmojisOnWindows = value.useImageFlagEmojisOnWindows;
58655
+ var channelCid = channel === null || channel === void 0 ? void 0 : channel.cid;
58656
+ var clientValues = "" + client.clientID + Object.keys(client.activeChannels).length + Object.keys(client.listeners).length + client.mutedChannels.length + "\n " + ((_a = client.user) === null || _a === void 0 ? void 0 : _a.id);
58657
+ var mutedUsersLength = mutes.length;
58658
+ var chatContext = React.useMemo(function () { return ({
58659
+ channel: channel,
58660
+ client: client,
58661
+ closeMobileNav: closeMobileNav,
58662
+ customClasses: customClasses,
58663
+ mutes: mutes,
58664
+ navOpen: navOpen,
58665
+ openMobileNav: openMobileNav,
58666
+ setActiveChannel: setActiveChannel,
58667
+ theme: theme,
58668
+ useImageFlagEmojisOnWindows: useImageFlagEmojisOnWindows,
58669
+ }); }, [channelCid, clientValues, mutedUsersLength, navOpen]);
58670
+ return chatContext;
58671
+ };
58672
+
58503
58673
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var darkModeTheme = {
58504
58674
  '--bg-gradient-end': '#101214',
58505
58675
  '--bg-gradient-start': '#070a0d',
@@ -58538,20 +58708,21 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
58538
58708
  var children = props.children, client = props.client, customClasses = props.customClasses, customStyles = props.customStyles, _a = props.darkMode, darkMode = _a === void 0 ? false : _a, defaultLanguage = props.defaultLanguage, i18nInstance = props.i18nInstance, _b = props.initialNavOpen, initialNavOpen = _b === void 0 ? true : _b, _c = props.theme, theme = _c === void 0 ? 'messaging light' : _c, _d = props.useImageFlagEmojisOnWindows, useImageFlagEmojisOnWindows = _d === void 0 ? false : _d;
58539
58709
  var _e = useChat({ client: client, defaultLanguage: defaultLanguage, i18nInstance: i18nInstance, initialNavOpen: initialNavOpen }), channel = _e.channel, closeMobileNav = _e.closeMobileNav, mutes = _e.mutes, navOpen = _e.navOpen, openMobileNav = _e.openMobileNav, setActiveChannel = _e.setActiveChannel, translators = _e.translators;
58540
58710
  useCustomStyles(darkMode ? darkModeTheme : customStyles);
58711
+ var chatContextValue = useCreateChatContext({
58712
+ channel: channel,
58713
+ client: client,
58714
+ closeMobileNav: closeMobileNav,
58715
+ customClasses: customClasses,
58716
+ mutes: mutes,
58717
+ navOpen: navOpen,
58718
+ openMobileNav: openMobileNav,
58719
+ setActiveChannel: setActiveChannel,
58720
+ theme: theme,
58721
+ useImageFlagEmojisOnWindows: useImageFlagEmojisOnWindows,
58722
+ });
58541
58723
  if (!translators.t)
58542
58724
  return null;
58543
- return (React__default$1['default'].createElement(ChatProvider, { value: {
58544
- channel: channel,
58545
- client: client,
58546
- closeMobileNav: closeMobileNav,
58547
- customClasses: customClasses,
58548
- mutes: mutes,
58549
- navOpen: navOpen,
58550
- openMobileNav: openMobileNav,
58551
- setActiveChannel: setActiveChannel,
58552
- theme: theme,
58553
- useImageFlagEmojisOnWindows: useImageFlagEmojisOnWindows,
58554
- } },
58725
+ return (React__default$1['default'].createElement(ChatProvider, { value: chatContextValue },
58555
58726
  React__default$1['default'].createElement(TranslationProvider, { value: translators }, children)));
58556
58727
  };
58557
58728
 
@@ -60932,1045 +61103,117 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
60932
61103
  };
60933
61104
  }
60934
61105
 
60935
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
60936
- /**
60937
- * A collection of shims that provide minimal functionality of the ES6 collections.
60938
- *
60939
- * These implementations are not meant to be used outside of the ResizeObserver
60940
- * modules as they cover only a limited range of use cases.
60941
- */
60942
- /* eslint-disable require-jsdoc, valid-jsdoc */
60943
- var MapShim = (function () {
60944
- if (typeof Map !== 'undefined') {
60945
- return Map;
60946
- }
60947
- /**
60948
- * Returns index in provided array that matches the specified key.
60949
- *
60950
- * @param {Array<Array>} arr
60951
- * @param {*} key
60952
- * @returns {number}
60953
- */
60954
- function getIndex(arr, key) {
60955
- var result = -1;
60956
- arr.some(function (entry, index) {
60957
- if (entry[0] === key) {
60958
- result = index;
60959
- return true;
60960
- }
60961
- return false;
60962
- });
60963
- return result;
60964
- }
60965
- return /** @class */ (function () {
60966
- function class_1() {
60967
- this.__entries__ = [];
60968
- }
60969
- Object.defineProperty(class_1.prototype, "size", {
60970
- /**
60971
- * @returns {boolean}
60972
- */
60973
- get: function () {
60974
- return this.__entries__.length;
60975
- },
60976
- enumerable: true,
60977
- configurable: true
60978
- });
60979
- /**
60980
- * @param {*} key
60981
- * @returns {*}
60982
- */
60983
- class_1.prototype.get = function (key) {
60984
- var index = getIndex(this.__entries__, key);
60985
- var entry = this.__entries__[index];
60986
- return entry && entry[1];
60987
- };
60988
- /**
60989
- * @param {*} key
60990
- * @param {*} value
60991
- * @returns {void}
60992
- */
60993
- class_1.prototype.set = function (key, value) {
60994
- var index = getIndex(this.__entries__, key);
60995
- if (~index) {
60996
- this.__entries__[index][1] = value;
60997
- }
60998
- else {
60999
- this.__entries__.push([key, value]);
61000
- }
61001
- };
61002
- /**
61003
- * @param {*} key
61004
- * @returns {void}
61005
- */
61006
- class_1.prototype.delete = function (key) {
61007
- var entries = this.__entries__;
61008
- var index = getIndex(entries, key);
61009
- if (~index) {
61010
- entries.splice(index, 1);
61011
- }
61012
- };
61013
- /**
61014
- * @param {*} key
61015
- * @returns {void}
61016
- */
61017
- class_1.prototype.has = function (key) {
61018
- return !!~getIndex(this.__entries__, key);
61019
- };
61020
- /**
61021
- * @returns {void}
61022
- */
61023
- class_1.prototype.clear = function () {
61024
- this.__entries__.splice(0);
61025
- };
61026
- /**
61027
- * @param {Function} callback
61028
- * @param {*} [ctx=null]
61029
- * @returns {void}
61030
- */
61031
- class_1.prototype.forEach = function (callback, ctx) {
61032
- if (ctx === void 0) { ctx = null; }
61033
- for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
61034
- var entry = _a[_i];
61035
- callback.call(ctx, entry[1], entry[0]);
61036
- }
61037
- };
61038
- return class_1;
61039
- }());
61040
- })();
61106
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function P(){return (P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);}return e}).apply(this,arguments)}function F$1(e,t){if(null==e)return {};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function A$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function W$1(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return A$1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return "Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A$1(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (n=e[Symbol.iterator]()).next.bind(n)}function G$1(e,t){return !(!e||e[0]!==t[0]||e[1]!==t[1])}function N$1(e,t){return !(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}var V$1,D$1,U$1="up",_$1=system(function(){var e=stream(),t=statefulStream(0),a=stream(),s=statefulStream(0),c=stream(),f=statefulStream(0),d=statefulStream(0),m=stream(),h=stream(),p=statefulStream(!1);connect(e,s);var v=statefulStream("down");return connect(pipe(e,scan(function(e,t){return {direction:t<e.prevScrollTop?U$1:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),map(function(e){return e.direction})),v),{scrollTop:e,viewportHeight:c,headerHeight:f,footerHeight:d,smoothScrollTargetReached:a,scrollTo:m,scrollBy:h,scrollDirection:v,statefulScrollTop:s,deviation:t,scrollingInProgress:p}},[],{singleton:!0});!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR";}(D$1||(D$1={}));var j$1=((V$1={})[D$1.DEBUG]="debug",V$1[D$1.INFO]="log",V$1[D$1.WARN]="warn",V$1[D$1.ERROR]="error",V$1),K$1=system(function(){var e=statefulStream(D$1.ERROR);return {log:statefulStream(function(t,n,o){var r;void 0===o&&(o=D$1.INFO),o>=(null!=(r=globalThis.VIRTUOSO_LOG_LEVEL)?r:getValue(e))&&console[j$1[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: black",t,n);}),logLevel:e}},[],{singleton:!0}),Y$1=system(function(e){var t=e[0].log,n=statefulStream(!1),r=streamFromEmitter(pipe(n,filter(function(e){return e}),distinctUntilChanged()));return subscribe(n,function(e){e&&getValue(t)("props updated",{},D$1.DEBUG);}),{propsReady:n,didMount:r}},tup(K$1),{singleton:!0}),Z$1={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,totalHeight:0}},q$1=system(function(e){var t=e[0],a=t.scrollTop,c=t.viewportHeight,m=t.headerHeight,x=t.footerHeight,T=statefulStream(!1),w=statefulStream(!0),y=stream(),b=stream(),R=stream(),z=streamFromEmitter(pipe(merge(pipe(duc(a),skip(1),mapTo(!0)),pipe(duc(a),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()));connect(pipe(duc(a),map(function(e){return 0===e}),distinctUntilChanged()),w),connect(w,b);var H=streamFromEmitter(pipe(combineLatest(R,duc(a),duc(c),duc(m),duc(x)),scan(function(e,t){var n=t[0],o=n.bottom,r=n.offsetBottom,i=t[1],l=t[2],u={viewportHeight:l,scrollTop:i,offsetBottom:r,totalHeight:o+r};return 0===r&&i+l-(o+t[3]+t[4])>-4?{atBottom:!0,state:u}:{atBottom:!1,notAtBottomBecause:u.totalHeight>e.state.totalHeight?"SIZE_INCREASED":0!==r?"NOT_SHOWING_LAST_ITEM":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:u}},Z$1),distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom})));return connect(pipe(H,map(function(e){return e.atBottom})),T),subscribe(T,function(e){setTimeout(function(){return publish(y,e)});}),{isScrolling:z,isAtTop:w,isAtBottom:T,atBottomState:H,atTopStateChange:b,atBottomStateChange:y,listStateListener:R}},tup(_$1)),$$1=system(function(e){var t=e[0].scrollTop,a=e[1].isScrolling,s=statefulStream(0),m=statefulStream(!1),h=stream(),p=statefulStream(!1);return connect(pipe(a,filter(function(e){return !e}),mapTo(0)),s),connect(pipe(t,throttleTime(100),withLatestFrom(a),filter(function(e){return !!e[1]}),scan(function(e,t){return [e[1],t[0]]},[0,0]),map(function(e){return e[1]-e[0]})),s),connect(pipe(s,withLatestFrom(p,m,h),filter(function(e){return !!e[1]}),map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=n.enter;if(o){if((0, n.exit)(t,r))return !1}else if(i(t,r))return !0;return o}),distinctUntilChanged()),m),subscribe(pipe(combineLatest(m,s,h),withLatestFrom(p)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:m,scrollSeekConfiguration:p,scrollVelocity:s,scrollSeekRangeChanged:h}},tup(_$1,q$1),{singleton:!0}),J$1={lvl:0};function Q$1(e,t,n,o,r){return void 0===o&&(o=J$1),void 0===r&&(r=J$1),{k:e,v:t,lvl:n,l:o,r:r}}function X$1(e){return e===J$1}function ee$1(){return J$1}function te$1(e,t){if(X$1(e))return J$1;var n=e.k,o=e.l,r=e.r;if(t===n){if(X$1(o))return r;if(X$1(r))return o;var i=le$1(o);return ce$1(ae$1(e,{k:i[0],v:i[1],l:ue$1(o)}))}return ce$1(ae$1(e,t<n?{l:te$1(o,t)}:{r:te$1(r,t)}))}function ne$1(e,t,n){if(void 0===n&&(n="k"),X$1(e))return [-Infinity,void 0];if(e[n]===t)return [e.k,e.v];if(e[n]<t){var o=ne$1(e.r,t,n);return -Infinity===o[0]?[e.k,e.v]:o}return ne$1(e.l,t,n)}function oe$1(e,t,n){return X$1(e)?Q$1(t,n,1):t===e.k?ae$1(e,{k:t,v:n}):function(e){return me$1(he$1(e))}(ae$1(e,t<e.k?{l:oe$1(e.l,t,n)}:{r:oe$1(e.r,t,n)}))}function re$1(e,t,n){if(X$1(e))return [];var o=e.k,r=e.v,i=e.r,l=[];return o>t&&(l=l.concat(re$1(e.l,t,n))),o>=t&&o<=n&&l.push({k:o,v:r}),o<=n&&(l=l.concat(re$1(i,t,n))),l}function ie$1(e){return X$1(e)?[]:[].concat(ie$1(e.l),[{k:e.k,v:e.v}],ie$1(e.r))}function le$1(e){return X$1(e.r)?[e.k,e.v]:le$1(e.r)}function ue$1(e){return X$1(e.r)?e.l:ce$1(ae$1(e,{r:ue$1(e.r)}))}function ae$1(e,t){return Q$1(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function se$1(e){return X$1(e)||e.lvl>e.r.lvl}function ce$1(e){var t=e.l,n=e.r,o=e.lvl;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(se$1(t))return he$1(ae$1(e,{lvl:o-1}));if(X$1(t)||X$1(t.r))throw new Error("Unexpected empty nodes");return ae$1(t.r,{l:ae$1(t,{r:t.r.l}),r:ae$1(e,{l:t.r.r,lvl:o-1}),lvl:o})}if(se$1(e))return me$1(ae$1(e,{lvl:o-1}));if(X$1(n)||X$1(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=se$1(r)?n.lvl-1:n.lvl;return ae$1(r,{l:ae$1(e,{r:r.l,lvl:o-1}),r:me$1(ae$1(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function fe$1(e,t,n){return X$1(e)?[]:de$1(re$1(e,ne$1(e,t)[0],n),function(e){return {index:e.k,value:e.v}})}function de$1(e,t){var n=e.length;if(0===n)return [];for(var o=t(e[0]),r=o.index,i=o.value,l=[],u=1;u<n;u++){var a=t(e[u]),s=a.index,c=a.value;l.push({start:r,end:s-1,value:i}),r=s,i=c;}return l.push({start:r,end:Infinity,value:i}),l}function me$1(e){var t=e.r,n=e.lvl;return X$1(t)||X$1(t.r)||t.lvl!==n||t.r.lvl!==n?e:ae$1(t,{l:ae$1(e,{r:t.l}),lvl:n+1})}function he$1(e){var t=e.l;return X$1(t)||t.lvl!==e.lvl?e:ae$1(t,{r:ae$1(e,{l:t.r})})}function pe$1(e,t,n,o){void 0===o&&(o=0);for(var r=e.length-1;o<=r;){var i=Math.floor((o+r)/2),l=n(e[i],t);if(0===l)return i;if(-1===l){if(r-o<2)return i-1;r=i-1;}else {if(r===o)return i;o=i+1;}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function ve$1(e,t,n){return e[pe$1(e,t,n)]}function ge$1(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ie$1(e){var t=e.size,n=e.startIndex,o=e.endIndex;return function(e){return e.start===n&&(e.end===o||Infinity===e.end)&&e.value===t}}function Ce$1(e,t){var n=e.index;return t===n?0:t<n?-1:1}function Se$1(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function xe$1(e){return {index:e.index,value:e}}function Te$1(e,t){var n=t[0],o=t[1];n.length>0&&(0, t[2])("received item sizes",n,D$1.DEBUG);var r=e.sizeTree,i=e.offsetTree,l=r,u=0;if(o.length>0&&X$1(r)&&2===n.length){var a=n[0].size,s=n[1].size;l=o.reduce(function(e,t){return oe$1(oe$1(e,t,a),t+1,s)},l);}else {var c=function(e,t){for(var n,o=X$1(e)?0:Infinity,r=W$1(t);!(n=r()).done;){var i=n.value,l=i.size,u=i.startIndex,a=i.endIndex;if(o=Math.min(o,u),X$1(e))e=oe$1(e,0,l);else {var s=fe$1(e,u-1,a+1);if(!s.some(Ie$1(i))){for(var c,f=!1,d=!1,m=W$1(s);!(c=m()).done;){var h=c.value,p=h.start,v=h.end,g=h.value;f?(a>=p||l===g)&&(e=te$1(e,p)):(d=g!==l,f=!0),v>a&&a>=p&&g!==l&&(e=oe$1(e,a+1,g));}d&&(e=oe$1(e,u,l));}}}return [e,o]}(l,n);l=c[0],u=c[1];}if(l===r)return e;var f=0,d=0,m=0,h=0;if(0!==u){h=pe$1(i,u-1,Ce$1),m=i[h].offset;var p=ne$1(l,u-1);f=p[0],d=p[1],i.length&&i[h].size===ne$1(l,u)[1]&&(h-=1),i=i.slice(0,h+1);}else i=[];for(var v,g=W$1(fe$1(l,u,Infinity));!(v=g()).done;){var I=v.value,C=I.start,S=I.value,x=(C-f)*d+m;i.push({offset:x,size:S,index:C}),f=C,m=x,d=S;}return {sizeTree:l,offsetTree:i,groupOffsetTree:o.reduce(function(e,t){return oe$1(e,t,we$1(t,i))},ee$1()),lastIndex:f,lastOffset:m,lastSize:d,groupIndices:o}}function we$1(e,t){if(0===t.length)return 0;var n=ve$1(t,e,Ce$1);return n.size*(e-n.index)+n.offset}function ye$1(e,t){if(!be$1(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function be$1(e){return !X$1(e.groupOffsetTree)}var Re$1={offsetHeight:"height",offsetWidth:"width"},ze$1=system(function(e){var t=e[0].log,m=stream(),h=stream(),p=stream(),v=statefulStream(0),g=statefulStream([]),I=statefulStream(void 0),C=statefulStream(void 0),S=statefulStream(function(e,t){return ge$1(e,Re$1[t])}),x=statefulStream(void 0),y={offsetTree:[],sizeTree:ee$1(),groupOffsetTree:ee$1(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},b=statefulStreamFromEmitter(pipe(m,withLatestFrom(g,t),scan(Te$1,y),distinctUntilChanged()),y);connect(pipe(g,filter(function(e){return e.length>0}),withLatestFrom(b),map(function(e){var t=e[0],n=e[1],o=t.reduce(function(e,t,o){return oe$1(e,t,we$1(t,n.offsetTree)||o)},ee$1());return P({},n,{groupIndices:t,groupOffsetTree:o})})),b),connect(pipe(h,withLatestFrom(b),filter(function(e){return e[0]<e[1].lastIndex}),map(function(e){var t=e[1];return [{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),m),connect(I,C);var R=statefulStreamFromEmitter(pipe(I,map(function(e){return void 0===e})),!0);connect(pipe(C,filter(function(e){return void 0!==e&&X$1(getValue(b).sizeTree)}),map(function(e){return [{startIndex:0,endIndex:0,size:e}]})),m);var z=streamFromEmitter(pipe(m,withLatestFrom(b),scan(function(e,t){var n=t[1];return {changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:y}),map(function(e){return e.changed})));connect(pipe(v,scan(function(e,t){return {diff:e.prev-t,prev:t}},{diff:0,prev:0}),map(function(e){return e.diff}),filter(function(e){return e>0})),p),subscribe(pipe(v,withLatestFrom(t)),function(e){e[0]<0&&(0, e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:v},D$1.ERROR);});var H=streamFromEmitter(p);return connect(pipe(p,withLatestFrom(b),map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return ie$1(n.sizeTree).reduce(function(e,n){var o=n.k,r=n.v;return {ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:o+t-1,size:e.prevSize}]),prevIndex:o+t,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),m),{data:x,totalCount:h,sizeRanges:m,groupIndices:g,defaultItemSize:C,fixedItemSize:I,unshiftWith:p,beforeUnshiftWith:H,firstItemIndex:v,sizes:b,listRefresh:z,trackItemSizes:R,itemSize:S}},tup(K$1),{singleton:!0}),He$1="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function ke$1(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&He$1||(t.behavior="auto"),t.offset||(t.offset=0),t}var Be$1=system(function(e){var t=e[0],l=t.sizes,a=t.totalCount,s=t.listRefresh,c=e[1],f=c.scrollingInProgress,m=c.viewportHeight,h=c.scrollTo,p=c.smoothScrollTargetReached,v=c.headerHeight,g=c.footerHeight,I=e[2].log,C=stream(),x=statefulStream(0),w=null,b=null,R=null;function z(){w&&(w(),w=null),R&&(R(),R=null),b&&(clearTimeout(b),b=null),publish(f,!1);}return connect(pipe(C,withLatestFrom(l,m,a,x,v,g,I),map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],l=e[4],u=e[5],a=e[6],c=e[7],m=ke$1(t),h=m.align,v=m.behavior,g=m.offset,I=r-1,x=m.index;x=ye$1(x,n);var T=we$1(x=Math.max(0,x,Math.min(I,x)),n.offsetTree)+u;"end"===h?(T=Math.round(T-o+ne$1(n.sizeTree,x)[1]),x===I&&(T+=a)):"center"===h?T=Math.round(T-o/2+ne$1(n.sizeTree,x)[1]/2):T-=l,g&&(T+=g);var H=function(e){z(),e?(c("retrying to scroll to",{location:t},D$1.DEBUG),publish(C,t)):c("list did not change, scroll successful",{},D$1.DEBUG);};if(z(),"smooth"===v){var k=!1;R=subscribe(s,function(e){k=k||e;}),w=handleNext(p,function(){H(k);});}else w=handleNext(pipe(s,function(e){var t=setTimeout(function(){e(!1);},50);return function(n){n&&(e(!0),clearTimeout(t));}}),H);return b=setTimeout(function(){z();},1200),publish(f,!0),c("scrolling from index to",{index:x,top:T,behavior:v},D$1.DEBUG),{top:T,behavior:v}})),h),{scrollToIndex:C,topListHeight:x}},tup(ze$1,_$1,K$1),{singleton:!0});function Ee$1(e,t,n){return "number"==typeof e?n===U$1&&"top"===t||"down"===n&&"bottom"===t?e:0:n===U$1?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function Le$1(e,t){return "number"==typeof e?e:e[t]||0}var Oe$1=system(function(e){var t=e[0],r=t.scrollTop,l=t.viewportHeight,a=t.deviation,s=t.headerHeight,d=stream(),m=statefulStream(0),h=statefulStream(0),v=statefulStream(0);return {listBoundary:d,overscan:v,topListHeight:m,increaseViewportBy:h,visibleRange:statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(l),duc(s),duc(d,G$1),duc(v),duc(m),duc(a),duc(h)),map(function(e){var t=e[0],n=e[1],o=e[2],r=e[3],i=r[0],l=r[1],u=e[4],a=e[5],s=e[6],c=e[7],f=t-s,d=Math.max(o-f,0),m="none",h=Le$1(c,"top"),p=Le$1(c,"bottom");return i-=s,l+=o,(i+=o)>t+a-h&&(m=U$1),(l-=s)<t-d+n+p&&(m="down"),"none"!==m?[Math.max(f-o-Ee$1(u,"top",m)-h,0),f-d+n+Ee$1(u,"bottom",m)+p]:null}),filter(function(e){return null!=e}),distinctUntilChanged(G$1)),[0,0])}},tup(_$1),{singleton:!0}),Me$1=system(function(e){var t=e[0],l=t.scrollTop,a=t.scrollTo,s=stream(),c=stream(),f=stream(),d=statefulStream(!1);return connect(pipe(combineLatest(c,s),map(function(e){return Math.max(0,e[0]-e[1].offsetTop)})),l),connect(pipe(a,withLatestFrom(s),map(function(e){var t=e[0];return P({},t,{top:t.top+e[1].offsetTop})})),f),{useWindowScroll:d,windowScrollTop:c,windowViewportRect:s,windowScrollTo:f}},tup(_$1)),Pe$1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Fe$1={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ae$1=Math.ceil,We$1=Math.floor,Ge=Math.min,Ne$1=Math.max;function Ve$1(e){return Ae$1(e)-e<.03?Ae$1(e):We$1(e)}function De$1(e,t){return Array.from({length:t-e+1}).map(function(t,n){return {index:n+e}})}var Ue$1=system(function(e){var t=e[0],l=t.overscan,a=t.visibleRange,d=t.listBoundary,m=e[1],h=m.scrollTop,v=m.viewportHeight,I=m.scrollBy,S=m.scrollTo,x=m.smoothScrollTargetReached,y=e[2],b=e[3],R=e[4],z=R.propsReady,H=R.didMount,k=e[5],B=k.windowViewportRect,E=k.windowScrollTo,L=k.useWindowScroll,O=k.windowScrollTop,M=statefulStream(0),F=statefulStream(0),A=statefulStream(Pe$1),W=statefulStream({height:0,width:0}),V=statefulStream({height:0,width:0}),D=stream();connect(pipe(H,withLatestFrom(F),filter(function(e){return 0!==e[1]}),map(function(e){return {items:De$1(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),A),connect(pipe(combineLatest(duc(M),a,duc(V,function(e,t){return e&&e.width===t.width&&e.height===t.height})),withLatestFrom(W),map(function(e){var t=e[0],n=t[0],o=t[1],r=o[0],i=o[1],l=t[2],u=e[1],a=l.height,s=l.width,c=u.width;if(0===n||0===c)return Pe$1;if(0===s)return Fe$1;var f=Ve$1(c/s),d=f*We$1(r/a),m=f*Ae$1(i/a)-1;m=Ge(n-1,m);var h=De$1(d=Ge(m,Ne$1(0,d)),m),p=_e$1(u,l,h),v=p.top,g=p.bottom;return {items:h,offsetTop:v,offsetBottom:Ae$1(n/f)*a-g,top:v,bottom:g,itemHeight:a,itemWidth:s}})),A),connect(pipe(W,map(function(e){return e.height})),v),connect(pipe(combineLatest(W,V,A),map(function(e){var t=_e$1(e[0],e[1],e[2].items);return [t.top,t.bottom]}),distinctUntilChanged(G$1)),d),connect(pipe(d,withLatestFrom(A),map(function(e){return {bottom:e[0][1],offsetBottom:e[1].offsetBottom}})),y.listStateListener);var U=streamFromEmitter(pipe(duc(A),filter(function(e){return e.items.length>0}),withLatestFrom(M),filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),map(function(e){return e[1]-1}),distinctUntilChanged())),_=streamFromEmitter(pipe(duc(A),filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),mapTo(0),distinctUntilChanged())),j=streamFromEmitter(pipe(duc(A),filter(function(e){return e.items.length>0}),map(function(e){var t=e.items;return {startIndex:t[0].index,endIndex:t[t.length-1].index}}),distinctUntilChanged(N$1)));connect(j,b.scrollSeekRangeChanged),connect(pipe(D,withLatestFrom(W,V,M),map(function(e){var t=e[1],n=e[2],o=e[3],r=ke$1(e[0]),i=r.align,l=r.behavior,u=r.offset,a=r.index,s=je$1(t,n,a=Math.max(0,a,Math.min(o-1,a)));return "end"===i?s=Math.round(s-t.height+n.height):"center"===i&&(s=Math.round(s-t.height/2+n.height/2)),u&&(s+=u),{top:s,behavior:l}})),S);var K=statefulStreamFromEmitter(pipe(A,map(function(e){return e.offsetBottom+e.bottom})),0);return connect(pipe(B,map(function(e){return {width:e.visibleWidth,height:e.visibleHeight}})),W),P({totalCount:M,viewportDimensions:W,itemDimensions:V,scrollTop:h,overscan:l,scrollBy:I,scrollTo:S,scrollToIndex:D,smoothScrollTargetReached:x,windowViewportRect:B,windowScrollTo:E,useWindowScroll:L,windowScrollTop:O,initialItemCount:F},b,{gridState:A,totalListHeight:K},y,{startReached:_,endReached:U,rangeChanged:j,propsReady:z})},tup(Oe$1,_$1,q$1,$$1,Y$1,Me$1));function _e$1(e,t,n){var o=t.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:je$1(e,t,n[0].index),bottom:je$1(e,t,n[n.length-1].index)+o}}function je$1(e,t,n){var o=Ve$1(e.width/t.width);return We$1(n/o)*t.height}function Ke$1(e,t){void 0===t&&(t=!0);var n=React.useRef(null),o=function(e){};if("undefined"!=typeof ResizeObserver){var r=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n);});o=function(e){e&&t?(r.observe(e),n.current=e):(n.current&&r.unobserve(n.current),n.current=null);};}return {ref:n,callbackRef:o}}function Ye$1(e,t){return void 0===t&&(t=!0),Ke$1(e,t).callbackRef}function Ze$1(e){var t=React.useRef(null),n=React.useCallback(function(n){if(null!==n){var o=n.getBoundingClientRect(),r=window.innerHeight-Math.max(0,o.top),i=o.top+window.pageYOffset;t.current={offsetTop:i,visibleHeight:r,visibleWidth:o.width},e(t.current);}},[e]),o=Ke$1(n),r=o.callbackRef,i=o.ref,l=React.useCallback(function(){n(i.current);},[n,i]);return React.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l);}},[l]),r}var qe="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function $e(e,t,n,o){void 0===o&&(o=noop);var r=React.useRef(null),i=React.useRef(null),l=React.useRef(null),u=React.useCallback(function(n){var o=n.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop;e(Math.max(r,0)),null!==i.current&&(r===i.current||r<=0||r===o.scrollHeight-ge$1(o,"height"))&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null));},[e,t]);return React.useEffect(function(){var e=r.current;return o(r.current),u({target:e}),e.addEventListener("scroll",u,{passive:!0}),function(){o(null),e.removeEventListener("scroll",u);}},[r,u,n,o]),{scrollerRef:r,scrollByCallback:function(e){null===i.current&&r.current.scrollBy(e);},scrollToCallback:function(n){var o=r.current;if(o){var u,a,s,c="smooth"===n.behavior;if(o===window?(a=Math.max(ge$1(document.documentElement,"height"),document.documentElement.scrollHeight),u=window.innerHeight,s=document.documentElement.scrollTop):(a=o.scrollHeight,u=ge$1(o,"height"),s=o.scrollTop),Math.abs(u-a)<1||n.top===s)return e(s),void(c&&t(!0));n.top=Math.max(Math.min(a-u,n.top),0),c?(i.current=n.top,l.current&&clearTimeout(l.current),l.current=setTimeout(function(){l.current=null,i.current=null,t(!0);},1e3)):i.current=null,o.scrollTo(n);}}}}var Je=system(function(e){var t=e[0],n=t.sizes,l=t.listRefresh,u=t.defaultItemSize,a=e[1].scrollTop,s=e[2].scrollToIndex,f=e[3].didMount,m=statefulStream(!0),h=statefulStream(0);return connect(pipe(f,withLatestFrom(h),filter(function(e){return 0!==e[1]}),mapTo(!1)),m),subscribe(pipe(combineLatest(l,f),withLatestFrom(m,n,u),filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!X$1(e[2].sizeTree)||void 0!==n)&&!t}),withLatestFrom(h)),function(e){var t=e[1];handleNext(a,function(){publish(m,!0);}),setTimeout(function(){publish(s,t);});}),{scrolledToInitialItem:m,initialTopMostItemIndex:h}},tup(ze$1,_$1,Be$1,Y$1),{singleton:!0});function Qe(e){return !!e&&("smooth"===e?"smooth":"auto")}var Xe=system(function(e){var t=e[0],n=t.totalCount,r=t.listRefresh,s=e[1],f=s.isAtBottom,m=s.atBottomState,h=e[2].scrollToIndex,g=e[3].scrolledToInitialItem,I=e[4],x=I.propsReady,w=I.didMount,b=e[5].log,R=statefulStream(!1),z=null;function H(e,t){publish(h,{index:e-1,align:"end",behavior:t});}return subscribe(pipe(combineLatest(pipe(duc(n),skip(1)),w),withLatestFrom(duc(R),f,g),map(function(e){var t=e[0],n=t[0],o=t[1]&&e[3],r="auto";return o&&(r=function(e,t){return "function"==typeof e?Qe(e(t)):t&&Qe(e)}(e[1],e[2]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;z&&(z(),z=null),z=handleNext(r,function(){H(t,n),z=null;});}),subscribe(pipe(combineLatest(duc(R),n,x),filter(function(e){return e[0]&&e[2]}),scan(function(e,t){var n=t[1];return {refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),filter(function(e){return e.refreshed}),withLatestFrom(R,n)),function(e){var t=e[1],n=e[2],o=handleNext(m,function(e){!t||e.atBottom||"SIZE_INCREASED"!==e.notAtBottomBecause||z||(getValue(b)("scrolling to bottom due to increased size",{totalCount:n},D$1.DEBUG),H(n,"auto"));});setTimeout(o,100);}),subscribe(pipe(combineLatest(duc(R),m),withLatestFrom(n)),function(e){var t=e[0],n=t[1];t[0]&&!n.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===n.notAtBottomBecause&&H(e[1],"auto");}),{followOutput:R}},tup(ze$1,q$1,Be$1,Je,Y$1,K$1));function et$1(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var tt$1=system(function(e){var t=e[0],o=t.totalCount,l=t.groupIndices,a=t.sizes,d=e[1],m=d.scrollTop,h=d.headerHeight,p=stream(),v=stream(),g=streamFromEmitter(pipe(p,map(et$1)));return connect(pipe(g,map(prop("totalCount"))),o),connect(pipe(g,map(prop("groupIndices"))),l),connect(pipe(combineLatest(m,a,h),filter(function(e){return be$1(e[1])}),map(function(e){return ne$1(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),distinctUntilChanged(),map(function(e){return [e]})),v),{groupCounts:p,topItemsIndexes:v}},tup(ze$1,_$1)),nt$1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function ot$1(e,t,n){if(0===e.length)return [];if(!be$1(t))return e.map(function(e){return P({},e,{index:e.index+n,originalIndex:e.index})});for(var o,r=[],i=fe$1(t.groupOffsetTree,e[0].index,e[e.length-1].index),l=void 0,u=0,a=W$1(e);!(o=a()).done;){var s=o.value;(!l||l.end<s.index)&&(l=i.shift(),u=t.groupIndices.indexOf(l.start)),r.push(P({},s.index===l.start?{type:"group",index:u}:{index:s.index-(u+1)+n,groupIndex:u},{size:s.size,offset:s.offset,originalIndex:s.index,data:s.data}));}return r}function rt$1(e,t,n,o,r){var i=0,l=0;if(e.length>0){i=e[0].offset;var u=e[e.length-1];l=u.offset+u.size;}var a=i,s=o.lastOffset+(n-o.lastIndex)*o.lastSize-l;return {items:ot$1(e,o,r),topItems:ot$1(t,o,r),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:i,offsetBottom:s,top:a,bottom:l,totalCount:n}}var it$1,lt$1,ut$1,at$1=system(function(e){var t=e[0],l=t.sizes,a=t.totalCount,d=t.data,m=t.firstItemIndex,h=e[1],v=e[2],g=v.visibleRange,I=v.listBoundary,S=v.topListHeight,y=e[3],b=y.scrolledToInitialItem,H=y.initialTopMostItemIndex,k=e[4].topListHeight,B=e[5],E=e[6].didMount,L=statefulStream([]),O=stream();connect(h.topItemsIndexes,L);var M=statefulStreamFromEmitter(pipe(combineLatest(E,duc(g),duc(a),duc(l),duc(H),b,duc(L),duc(m),d),filter(function(e){return e[0]}),map(function(e){var t=e[1],n=t[0],o=t[1],r=e[2],i=e[4],l=e[5],u=e[6],a=e[7],s=e[8],c=e[3],f=c.sizeTree,d=c.offsetTree;if(0===r||0===n&&0===o)return nt$1;if(X$1(f))return rt$1(function(e,t,n){if(be$1(t)){var o=ye$1(e,t);return [{index:ne$1(t.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return [{index:e,size:0,offset:0,data:n&&n[0]}]}(i,c,s),[],r,c,a);var m=[];if(u.length>0)for(var h,p=u[0],v=u[u.length-1],g=0,I=W$1(fe$1(f,p,v));!(h=I()).done;)for(var C=h.value,S=C.value,x=Math.max(C.start,p),T=Math.min(C.end,v),w=x;w<=T;w++)m.push({index:w,size:S,offset:g,data:s&&s[w]}),g+=S;if(!l)return rt$1([],m,r,c,a);var y=u.length>0?u[u.length-1]+1:0,b=function(e,t,n,o){return void 0===o&&(o=0),o>0&&(t=Math.max(t,ve$1(e,o,Ce$1).offset)),de$1((i=n,u=pe$1(r=e,t,l=Se$1),a=pe$1(r,i,l,u),r.slice(u,a+1)),xe$1);var r,i,l,u,a;}(d,n,o,y);if(0===b.length)return null;var R=r-1;return rt$1(tap([],function(e){for(var t,r=W$1(b);!(t=r()).done;){var i=t.value,l=i.value,u=l.offset,a=i.start,c=l.size;l.offset<n&&(u+=((a+=Math.floor((n-l.offset)/c))-i.start)*c),a<y&&(u+=(y-a)*c,a=y);for(var f=Math.min(i.end,R),d=a;d<=f&&!(u>=o);d++)e.push({index:d,size:c,offset:u,data:s&&s[d]}),u+=c;}}),m,r,c,a)}),filter(function(e){return null!==e}),distinctUntilChanged()),nt$1);return connect(pipe(d,filter(function(e){return void 0!==e}),map(function(e){return e.length})),a),connect(pipe(M,map(prop("topListHeight"))),k),connect(k,S),connect(M,B.listStateListener),connect(pipe(M,map(function(e){return [e.top,e.bottom]})),I),connect(pipe(M,map(function(e){return e.items})),O),P({listState:M,topItemsIndexes:L,endReached:streamFromEmitter(pipe(M,filter(function(e){return e.items.length>0}),withLatestFrom(a,d),filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),map(function(e){return [e[1]-1,e[2]]}),distinctUntilChanged(G$1),map(function(e){return e[0]}))),startReached:streamFromEmitter(pipe(M,throttleTime(200),filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),map(function(e){return e.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(M,filter(function(e){return e.items.length>0}),map(function(e){var t=e.items;return {startIndex:t[0].index,endIndex:t[t.length-1].index}}),distinctUntilChanged(N$1))),itemsRendered:O},B)},tup(ze$1,tt$1,Oe$1,Je,Be$1,q$1,Y$1),{singleton:!0}),st$1=system(function(e){var t=e[0],n=t.sizes,l=t.firstItemIndex,a=t.data,s=e[1].listState,f=e[2].didMount,d=statefulStream(0);return connect(pipe(f,withLatestFrom(d),filter(function(e){return 0!==e[1]}),withLatestFrom(n,l,a),map(function(e){var t=e[0][1],n=e[1],o=e[2],r=e[3],i=void 0===r?[]:r,l=0;if(n.groupIndices.length>0)for(var u,a=W$1(n.groupIndices);!((u=a()).done||u.value-l>=t);)l++;var s=t+l;return rt$1(Array.from({length:s}).map(function(e,t){return {index:t,size:0,offset:0,data:i[t]}}),[],s,n,o)})),s),{initialItemCount:d}},tup(ze$1,at$1,Y$1),{singleton:!0}),ct$1=system(function(e){var t=e[0].topItemsIndexes,n=statefulStream(0);return connect(pipe(n,filter(function(e){return e>0}),map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),t),{topItemCount:n}},tup(at$1)),ft$1=system(function(e){var t=e[0],o=t.footerHeight,l=t.headerHeight,a=e[1].listState,s=stream(),c=statefulStreamFromEmitter(pipe(combineLatest(o,l,a),map(function(e){var t=e[2];return e[0]+e[1]+t.offsetBottom+t.bottom})),0);return connect(duc(c),s),{totalListHeight:c,totalListHeightChanged:s}},tup(_$1,at$1),{singleton:!0}),dt$1=system(function(e){var t=e[0],n=t.scrollBy,o=t.scrollTop,a=t.scrollDirection,f=t.deviation,m=t.scrollingInProgress,h=e[1].isScrolling,p=e[3],v=p.beforeUnshiftWith,g=p.sizes,I=e[4].log,y=streamFromEmitter(pipe(e[2].listState,scan(function(e,t){var n=e[1],o=t.items,r=0;if(n.length>0&&o.length>0){var i=o[0].originalIndex,l=n[0].originalIndex;if(0!==i||0!==l)if(i===l)r=o[0].size-n[0].size;else for(var u=function(e){var t=o[e],i=n.find(function(e){return e.originalIndex===t.originalIndex});return i?t.offset!==i.offset?(r=t.offset-i.offset,"break"):void 0:"continue"},a=o.length-1;a>=0;a--){var s=u(a);if("continue"!==s&&"break"===s)break}}return [r,o]},[0,[]]),filter(function(e){return 0!==e[0]}),withLatestFrom(o,a,m,I),filter(function(e){return !e[3]&&0!==e[1]&&e[2]===U$1}),map(function(e){var t=e[0][0];return (0, e[4])("Upward scrolling compensation",{amount:t},D$1.DEBUG),t})));return connect(pipe(y,withLatestFrom(f),map(function(e){return e[1]-e[0]})),f),subscribe(pipe(combineLatest(statefulStreamFromEmitter(h,!1),f),filter(function(e){return !e[0]&&0!==e[1]}),map(function(e){return e[1]}),throttleTime(1)),function(e){e>0?(publish(n,{top:-e,behavior:"auto"}),publish(f,0)):(publish(f,0),publish(n,{top:-e,behavior:"auto"}));}),connect(pipe(v,withLatestFrom(g),map(function(e){return e[0]*e[1].lastSize})),y),{deviation:f}},tup(_$1,q$1,at$1,ze$1,K$1)),mt$1=system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,r=e[2].scrollTo,l=statefulStream(0);return subscribe(pipe(n,withLatestFrom(l),filter(function(e){return 0!==e[1]}),map(function(e){return {top:e[1]}})),function(e){handleNext(pipe(t,filter(function(e){return 0!==e})),function(){setTimeout(function(){publish(r,e);});});}),{initialScrollTop:l}},tup(ft$1,Y$1,_$1),{singleton:!0}),ht$1=system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,r=statefulStream(!1);return {alignToBottom:r,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(r,t,n),filter(function(e){return e[0]}),map(function(e){return Math.max(0,e[1]-e[2])}),distinctUntilChanged()),0)}},tup(_$1,ft$1),{singleton:!0}),pt$1=system(function(e){var t=e[0],o=t.sizes,l=t.totalCount,a=e[1],s=a.scrollTop,f=a.viewportHeight,d=a.headerHeight,m=a.scrollingInProgress,h=e[2].scrollToIndex,p=stream();return connect(pipe(p,withLatestFrom(o,f,l,d,s),map(function(e){var t=e[0],n=t.index,o=t.behavior,r=void 0===o?"auto":o,l=t.done,u=e[1],a=e[2],s=e[4],f=e[5],d=e[3]-1,h=null;n=ye$1(n,u);var p=we$1(n=Math.max(0,n,Math.min(d,n)),u.offsetTree)+s;return p<f?h={index:n,behavior:r,align:"start"}:p+ne$1(u.sizeTree,n)[1]>f+a&&(h={index:n,behavior:r,align:"end"}),h?l&&handleNext(pipe(m,skip(1),filter(function(e){return !1===e})),l):l&&l(),h}),filter(function(e){return null!==e})),h),{scrollIntoView:p}},tup(ze$1,_$1,Be$1,at$1,K$1),{singleton:!0}),vt$1=system(function(e){return P({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},tup(Oe$1,st$1,Y$1,$$1,ft$1,mt$1,ht$1,Me$1,pt$1)),gt$1=system(function(e){var t=e[0],n=t.totalCount,o=t.sizeRanges,l=t.fixedItemSize,a=t.defaultItemSize,s=t.trackItemSizes,c=t.itemSize,f=t.data,d=t.firstItemIndex,m=t.groupIndices,h=e[1],p=h.initialTopMostItemIndex,v=h.scrolledToInitialItem,g=e[2],I=e[3],C=e[4],S=C.listState,x=C.topItemsIndexes,T=F$1(C,["listState","topItemsIndexes"]),w=e[5].scrollToIndex,y=e[7].topItemCount,b=e[8].groupCounts,z=e[9],H=e[10];return connect(T.rangeChanged,z.scrollSeekRangeChanged),connect(pipe(z.windowViewportRect,map(prop("visibleHeight"))),g.viewportHeight),P({totalCount:n,data:f,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:p,scrolledToInitialItem:v,topItemsIndexes:x,topItemCount:y,groupCounts:b,fixedItemHeight:l,defaultItemHeight:a},I,{listState:S,scrollToIndex:w,trackItemSizes:s,itemSize:c,groupIndices:m},T,z,g,H)},tup(ze$1,Je,_$1,Xe,at$1,Be$1,dt$1,ct$1,tt$1,vt$1,K$1)),It$1=(it$1=function(){if("undefined"==typeof document)return "sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"},ut$1=!1,function(){return ut$1||(ut$1=!0,lt$1=it$1()),lt$1});function Ct$1(e){return e}var St$1=system(function(){var e=statefulStream(function(e){return "Item "+e}),t=statefulStream(function(e){return "Group "+e}),n=statefulStream({}),r=statefulStream(Ct$1),l=statefulStream("div"),a=statefulStream(noop),s=function(e,t){return void 0===t&&(t=null),statefulStreamFromEmitter(pipe(n,map(function(t){return t[e]}),distinctUntilChanged()),t)};return {itemContent:e,groupContent:t,components:n,computeItemKey:r,headerFooterTag:l,scrollerRef:a,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function xt$1(e,t){var o=stream();return subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+t,"color: red;","color: inherit;","color: blue;")}),connect(o,e),o}var Tt$1=system(function(e){var t=e[0],o=e[1],l={item:xt$1(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:xt$1(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:xt$1(t.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:xt$1(t.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:xt$1(t.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function s(e,t,n){connect(pipe(e,withLatestFrom(o.components),map(function(e){var o,r=e[0],i=e[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+t+" instead."),P({},i,((o={})[t]=r,o))})),o.components);}return subscribe(l.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(l.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(l.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(l.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(l.scrollSeek,function(e){var n=e.placeholder,r=F$1(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,P({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(t.scrollSeekConfiguration,r);}),s(l.footer,"Footer","footer"),s(l.header,"Header","header"),s(l.ItemContainer,"Item","ItemContainer"),s(l.ListContainer,"List","ListContainer"),s(l.ScrollContainer,"Scroller","ScrollContainer"),s(l.emptyComponent,"EmptyPlaceholder","emptyComponent"),s(l.GroupContainer,"Group","GroupContainer"),P({},t,o,l)},tup(gt$1,St$1)),wt$1=function(e){return React.createElement("div",{style:{height:e.height}})},yt$1={position:It$1(),zIndex:1},bt$1=React.memo(function(e){var t,n,o,r,i=e.showTopList,l=void 0!==i&&i,u=Gt$1("listState"),a=Gt$1("deviation"),s=Wt$1("sizeRanges"),c=Gt$1("itemContent"),f=Gt$1("groupContent"),d=Gt$1("trackItemSizes"),m=(t=s,n=Gt$1("itemSize"),o=d,r=Gt$1("log"),Ye$1(function(e){var o=function(e,t,n,o){var r=e.length;if(0===r)return null;for(var i=[],l=0;l<r;l++){var u=e.item(l);if(u&&void 0!==u.dataset.index){var a=parseInt(u.dataset.index),s=parseFloat(u.dataset.knownSize),c=t(u,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:u},D$1.ERROR),c!==s){var f=i[i.length-1];0===i.length||f.size!==c||f.endIndex!==a-1?i.push({startIndex:a,endIndex:a,size:c}):i[i.length-1].endIndex++;}}}return i}(e.children,n,0,r);null!==o&&t(o);},o)),h=Gt$1("EmptyPlaceholder"),p=Gt$1("ScrollSeekPlaceholder")||wt$1,v=Gt$1("ListComponent"),g=Gt$1("ItemComponent"),I=Gt$1("GroupComponent"),C=Gt$1("computeItemKey"),S=Gt$1("isSeeking"),x=Gt$1("groupIndices").length>0,T=Gt$1("paddingTopAddition"),w=Gt$1("scrolledToInitialItem"),y=Gt$1("firstItemIndex"),b=l?{}:{boxSizing:"border-box",paddingTop:u.offsetTop+T,paddingBottom:u.offsetBottom,marginTop:a};return !l&&0===u.items.length&&h&&w?React.createElement(h):React.createElement(v,{ref:m,style:b,"data-test-id":l?"virtuoso-top-item-list":"virtuoso-item-list"},(l?u.topItems:u.items).map(function(e){var t=e.originalIndex,n=C(t+y,e.data);return S?React.createElement(p,{key:n,index:e.index,height:e.size}):"group"===e.type?React.createElement(I,{key:n,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:yt$1},f(e.index)):React.createElement(g,{key:n,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex},x?c(e.index,e.groupIndex,e.data):c(e.index,e.data))}))}),Rt$1={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},zt$1={width:"100%",height:"100%",position:"absolute",top:0},Ht$1={width:"100%",position:It$1(),top:0},kt$1=React.memo(function(){var e=Gt$1("HeaderComponent"),t=Wt$1("headerHeight"),n=Gt$1("headerFooterTag"),o=Ye$1(function(e){return t(ge$1(e,"height"))});return e?React.createElement(n,{ref:o},React.createElement(e)):null}),Bt$1=React.memo(function(){var e=Gt$1("FooterComponent"),t=Wt$1("footerHeight"),n=Gt$1("headerFooterTag"),o=Ye$1(function(e){return t(ge$1(e,"height"))});return e?React.createElement(n,{ref:o},React.createElement(e)):null});function Et$1(e){var t=e.usePublisher,n=e.useEmitter,o=e.useEmitterValue;return React.memo(function(e){var r=e.style,i=e.children,l=F$1(e,["style","children"]),u=t("scrollTop"),a=o("ScrollerComponent"),s=$e(u,t("smoothScrollTargetReached"),a,o("scrollerRef")),c=s.scrollerRef,f=s.scrollByCallback;return n("scrollTo",s.scrollToCallback),n("scrollBy",f),React.createElement(a,P({ref:c,style:P({},Rt$1,r),tabIndex:0},l),i)})}function Lt$1(e){var t=e.usePublisher,n=e.useEmitter,o=e.useEmitterValue;return React.memo(function(e){var r=e.style,i=e.children,l=F$1(e,["style","children"]),u=t("windowScrollTop"),a=o("ScrollerComponent"),s=t("smoothScrollTargetReached"),c=o("totalListHeight"),f=$e(u,s,a),d=f.scrollerRef,m=f.scrollByCallback,h=f.scrollToCallback;return qe(function(){return d.current=window,function(){d.current=null;}},[d]),n("windowScrollTo",h),n("scrollBy",m),React.createElement(a,P({style:P({position:"relative"},r,0!==c?{height:c}:{})},l),i)})}var Ot$1=function(e){var t=e.children,n=Wt$1("viewportHeight"),o=Ye$1(compose(n,function(e){return ge$1(e,"height")}));return React.createElement("div",{style:zt$1,ref:o},t)},Mt$1=function(e){var t=e.children,n=Ze$1(Wt$1("windowViewportRect"));return React.createElement("div",{ref:n,style:zt$1},t)},Pt$1=function(e){var t=e.children,n=Gt$1("TopItemListComponent"),o=Gt$1("headerHeight"),r=P({},Ht$1,{marginTop:o+"px"});return React.createElement(n||"div",{style:r},t)},Ft$1=systemToComponent(Tt$1,{required:{},optional:{followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",logLevel:"logLevel",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React.memo(function(e){var t=Gt$1("useWindowScroll"),n=Gt$1("topItemsIndexes").length>0,o=t?Mt$1:Ot$1;return React.createElement(t?Dt$1:Vt$1,P({},e),React.createElement(o,null,React.createElement(kt$1,null),React.createElement(bt$1,null),React.createElement(Bt$1,null)),n&&React.createElement(Pt$1,null,React.createElement(bt$1,{showTopList:!0})))})),At$1=Ft$1.Component,Wt$1=Ft$1.usePublisher,Gt$1=Ft$1.useEmitterValue,Nt$1=Ft$1.useEmitter,Vt$1=Et$1({usePublisher:Wt$1,useEmitterValue:Gt$1,useEmitter:Nt$1}),Dt$1=Lt$1({usePublisher:Wt$1,useEmitterValue:Gt$1,useEmitter:Nt$1}),Ut$1=system(function(){var e=statefulStream(function(e){return "Item "+e}),t=statefulStream({}),n=statefulStream("virtuoso-grid-item"),r=statefulStream("virtuoso-grid-list"),l=statefulStream(Ct$1),a=statefulStream(noop),s=function(e,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(t,map(function(t){return t[e]}),distinctUntilChanged()),n)};return {itemContent:e,components:t,computeItemKey:l,itemClassName:n,listClassName:r,scrollerRef:a,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),_t$1=system(function(e){var t=e[0],o=e[1],l={item:xt$1(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function s(e,t,n){connect(pipe(e,withLatestFrom(o.components),map(function(e){var o,r=e[0],i=e[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+t+" instead."),P({},i,((o={})[t]=r,o))})),o.components);}return subscribe(l.scrollSeek,function(e){var n=e.placeholder,r=F$1(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,P({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(t.scrollSeekConfiguration,r);}),s(l.ItemContainer,"Item","ItemContainer"),s(l.ListContainer,"List","ListContainer"),s(l.ScrollContainer,"Scroller","ScrollContainer"),P({},t,o,l)},tup(Ue$1,Ut$1)),jt$1=React.memo(function(){var e=Jt$1("gridState"),t=Jt$1("listClassName"),n=Jt$1("itemClassName"),o=Jt$1("itemContent"),r=Jt$1("computeItemKey"),i=Jt$1("isSeeking"),l=Jt$1("ItemComponent"),u=Jt$1("ListComponent"),a=Jt$1("ScrollSeekPlaceholder"),s=$t$1("itemDimensions"),c=Ye$1(function(e){var t=e.firstChild;t&&s(t.getBoundingClientRect());});return React.createElement(u,{ref:c,className:t,style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}},e.items.map(function(t){var u=r(t.index);return i?React.createElement(a,{key:u,style:{height:e.itemHeight,width:e.itemWidth}}):React.createElement(l,{className:n,"data-index":t.index,key:u},o(t.index))}))}),Kt$1=function(e){var t=e.children,n=$t$1("viewportDimensions"),o=Ye$1(function(e){n(e.getBoundingClientRect());});return React.createElement("div",{style:zt$1,ref:o},t)},Yt$1=function(e){var t=e.children,n=Ze$1($t$1("windowViewportRect"));return React.createElement("div",{ref:n,style:zt$1},t)},Zt$1=systemToComponent(_t$1,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React.memo(function(e){var t=P({},e),n=Jt$1("useWindowScroll"),o=n?Yt$1:Kt$1;return React.createElement(n?en:Xt$1,P({},t),React.createElement(o,null,React.createElement(jt$1,null)))})),$t$1=Zt$1.usePublisher,Jt$1=Zt$1.useEmitterValue,Qt$1=Zt$1.useEmitter,Xt$1=Et$1({usePublisher:$t$1,useEmitterValue:Jt$1,useEmitter:Qt$1}),en=Lt$1({usePublisher:$t$1,useEmitterValue:Jt$1,useEmitter:Qt$1}),tn=At$1;
61041
61107
 
61042
- /**
61043
- * Detects whether window and document objects are available in current environment.
61044
- */
61045
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
61108
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useGiphyPreview = function (separateGiphyPreview) {
61109
+ var _a = React.useState(), giphyPreviewMessage = _a[0], setGiphyPreviewMessage = _a[1];
61110
+ var client = useChatContext().client;
61111
+ React.useEffect(function () {
61112
+ var handleEvent = function (event) {
61113
+ var message = event.message, user = event.user;
61114
+ if ((message === null || message === void 0 ? void 0 : message.command) === 'giphy' && (user === null || user === void 0 ? void 0 : user.id) === client.userID) {
61115
+ setGiphyPreviewMessage(undefined);
61116
+ }
61117
+ };
61118
+ if (separateGiphyPreview)
61119
+ client.on('message.new', handleEvent);
61120
+ return function () { return client.off('message.new', handleEvent); };
61121
+ }, [separateGiphyPreview]);
61122
+ return { giphyPreviewMessage: giphyPreviewMessage, setGiphyPreviewMessage: setGiphyPreviewMessage };
61123
+ };
61046
61124
 
61047
- // Returns global object of a current environment.
61048
- var global$1 = (function () {
61049
- if (typeof global$2 !== 'undefined' && global$2.Math === Math) {
61050
- return global$2;
61051
- }
61052
- if (typeof self !== 'undefined' && self.Math === Math) {
61053
- return self;
61054
- }
61055
- if (typeof window !== 'undefined' && window.Math === Math) {
61056
- return window;
61057
- }
61058
- // eslint-disable-next-line no-new-func
61059
- return Function('return this')();
61060
- })();
61125
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function useNewMessageNotification(messages, currentUserId) {
61126
+ var _a = React.useState(false), newMessagesNotification = _a[0], setNewMessagesNotification = _a[1];
61127
+ /**
61128
+ * use the flag to avoid the initial "new messages" quick blink
61129
+ */
61130
+ var didMount = React.useRef(false);
61131
+ var lastMessageId = React.useRef('');
61132
+ var atBottom = React.useRef(false);
61133
+ React.useEffect(function () {
61134
+ var _a;
61135
+ /* handle scrolling behavior for new messages */
61136
+ if (!(messages === null || messages === void 0 ? void 0 : messages.length))
61137
+ return;
61138
+ var lastMessage = messages[messages.length - 1];
61139
+ var prevMessageId = lastMessageId.current;
61140
+ lastMessageId.current = lastMessage.id || ''; // update last message id
61141
+ /* do nothing if new messages are loaded from top(loadMore) */
61142
+ if (lastMessage.id === prevMessageId)
61143
+ return;
61144
+ /* if list is already at the bottom return, followOutput will do the job */
61145
+ if (atBottom.current)
61146
+ return;
61147
+ /* if the new message belongs to current user scroll to bottom */
61148
+ if (((_a = lastMessage.user) === null || _a === void 0 ? void 0 : _a.id) !== currentUserId && didMount.current) {
61149
+ /* otherwise just show newMessage notification */
61150
+ setNewMessagesNotification(true);
61151
+ }
61152
+ didMount.current = true;
61153
+ }, [currentUserId, messages]);
61154
+ return { atBottom: atBottom, newMessagesNotification: newMessagesNotification, setNewMessagesNotification: setNewMessagesNotification };
61155
+ }
61061
61156
 
61062
- /**
61063
- * A shim for the requestAnimationFrame which falls back to the setTimeout if
61064
- * first one is not supported.
61065
- *
61066
- * @returns {number} Requests' identifier.
61067
- */
61068
- var requestAnimationFrame$1 = (function () {
61069
- if (typeof requestAnimationFrame === 'function') {
61070
- // It's required to use a bounded function because IE sometimes throws
61071
- // an "Invalid calling object" error if rAF is invoked without the global
61072
- // object on the left hand side.
61073
- return requestAnimationFrame.bind(global$1);
61074
- }
61075
- return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
61076
- })();
61157
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function usePrependedMessagesCount(messages) {
61158
+ var _a;
61159
+ var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[0]) === null || _a === void 0 ? void 0 : _a.id;
61160
+ var firstMessageId = React.useRef(currentFirstMessageId);
61161
+ var earliestMessageId = React.useRef(currentFirstMessageId);
61162
+ var previousNumItemsPrepended = React.useRef(0);
61163
+ var numItemsPrepended = React.useMemo(function () {
61164
+ if (!messages || !messages.length) {
61165
+ return 0;
61166
+ }
61167
+ // if no new messages were prepended, return early (same amount as before)
61168
+ if (currentFirstMessageId === earliestMessageId.current) {
61169
+ return previousNumItemsPrepended.current;
61170
+ }
61171
+ if (!firstMessageId.current) {
61172
+ firstMessageId.current = currentFirstMessageId;
61173
+ }
61174
+ earliestMessageId.current = currentFirstMessageId;
61175
+ // if new messages were prepended, find out how many
61176
+ // start with this number because there cannot be fewer prepended items than before
61177
+ for (var i = previousNumItemsPrepended.current; i < messages.length; i += 1) {
61178
+ if (messages[i].id === firstMessageId.current) {
61179
+ previousNumItemsPrepended.current = i;
61180
+ return i;
61181
+ }
61182
+ }
61183
+ return 0;
61184
+ // TODO: there's a bug here, the messages prop is the same array instance (something mutates it)
61185
+ // that's why the second dependency is necessary
61186
+ }, [messages, messages === null || messages === void 0 ? void 0 : messages.length]);
61187
+ return numItemsPrepended;
61188
+ }
61077
61189
 
61078
- // Defines minimum timeout before adding a trailing call.
61079
- var trailingTimeout = 2;
61080
- /**
61081
- * Creates a wrapper function which ensures that provided callback will be
61082
- * invoked only once during the specified delay period.
61083
- *
61084
- * @param {Function} callback - Function to be invoked after the delay period.
61085
- * @param {number} delay - Delay after which to invoke callback.
61086
- * @returns {Function}
61087
- */
61088
- function throttle (callback, delay) {
61089
- var leadingCall = false, trailingCall = false, lastCallTime = 0;
61090
- /**
61091
- * Invokes the original callback function and schedules new invocation if
61092
- * the "proxy" was called during current request.
61093
- *
61094
- * @returns {void}
61095
- */
61096
- function resolvePending() {
61097
- if (leadingCall) {
61098
- leadingCall = false;
61099
- callback();
61100
- }
61101
- if (trailingCall) {
61102
- proxy();
61103
- }
61104
- }
61105
- /**
61106
- * Callback invoked after the specified delay. It will further postpone
61107
- * invocation of the original function delegating it to the
61108
- * requestAnimationFrame.
61109
- *
61110
- * @returns {void}
61111
- */
61112
- function timeoutCallback() {
61113
- requestAnimationFrame$1(resolvePending);
61114
- }
61115
- /**
61116
- * Schedules invocation of the original function.
61117
- *
61118
- * @returns {void}
61119
- */
61120
- function proxy() {
61121
- var timeStamp = Date.now();
61122
- if (leadingCall) {
61123
- // Reject immediately following calls.
61124
- if (timeStamp - lastCallTime < trailingTimeout) {
61125
- return;
61126
- }
61127
- // Schedule new call to be in invoked when the pending one is resolved.
61128
- // This is important for "transitions" which never actually start
61129
- // immediately so there is a chance that we might miss one if change
61130
- // happens amids the pending invocation.
61131
- trailingCall = true;
61132
- }
61133
- else {
61134
- leadingCall = true;
61135
- trailingCall = false;
61136
- setTimeout(timeoutCallback, delay);
61137
- }
61138
- lastCallTime = timeStamp;
61139
- }
61140
- return proxy;
61141
- }
61142
-
61143
- // Minimum delay before invoking the update of observers.
61144
- var REFRESH_DELAY = 20;
61145
- // A list of substrings of CSS properties used to find transition events that
61146
- // might affect dimensions of observed elements.
61147
- var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
61148
- // Check if MutationObserver is available.
61149
- var mutationObserverSupported = typeof MutationObserver !== 'undefined';
61150
- /**
61151
- * Singleton controller class which handles updates of ResizeObserver instances.
61152
- */
61153
- var ResizeObserverController = /** @class */ (function () {
61154
- /**
61155
- * Creates a new instance of ResizeObserverController.
61156
- *
61157
- * @private
61158
- */
61159
- function ResizeObserverController() {
61160
- /**
61161
- * Indicates whether DOM listeners have been added.
61162
- *
61163
- * @private {boolean}
61164
- */
61165
- this.connected_ = false;
61166
- /**
61167
- * Tells that controller has subscribed for Mutation Events.
61168
- *
61169
- * @private {boolean}
61170
- */
61171
- this.mutationEventsAdded_ = false;
61172
- /**
61173
- * Keeps reference to the instance of MutationObserver.
61174
- *
61175
- * @private {MutationObserver}
61176
- */
61177
- this.mutationsObserver_ = null;
61178
- /**
61179
- * A list of connected observers.
61180
- *
61181
- * @private {Array<ResizeObserverSPI>}
61182
- */
61183
- this.observers_ = [];
61184
- this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
61185
- this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
61186
- }
61187
- /**
61188
- * Adds observer to observers list.
61189
- *
61190
- * @param {ResizeObserverSPI} observer - Observer to be added.
61191
- * @returns {void}
61192
- */
61193
- ResizeObserverController.prototype.addObserver = function (observer) {
61194
- if (!~this.observers_.indexOf(observer)) {
61195
- this.observers_.push(observer);
61196
- }
61197
- // Add listeners if they haven't been added yet.
61198
- if (!this.connected_) {
61199
- this.connect_();
61200
- }
61201
- };
61202
- /**
61203
- * Removes observer from observers list.
61204
- *
61205
- * @param {ResizeObserverSPI} observer - Observer to be removed.
61206
- * @returns {void}
61207
- */
61208
- ResizeObserverController.prototype.removeObserver = function (observer) {
61209
- var observers = this.observers_;
61210
- var index = observers.indexOf(observer);
61211
- // Remove observer if it's present in registry.
61212
- if (~index) {
61213
- observers.splice(index, 1);
61214
- }
61215
- // Remove listeners if controller has no connected observers.
61216
- if (!observers.length && this.connected_) {
61217
- this.disconnect_();
61218
- }
61219
- };
61220
- /**
61221
- * Invokes the update of observers. It will continue running updates insofar
61222
- * it detects changes.
61223
- *
61224
- * @returns {void}
61225
- */
61226
- ResizeObserverController.prototype.refresh = function () {
61227
- var changesDetected = this.updateObservers_();
61228
- // Continue running updates if changes have been detected as there might
61229
- // be future ones caused by CSS transitions.
61230
- if (changesDetected) {
61231
- this.refresh();
61232
- }
61233
- };
61234
- /**
61235
- * Updates every observer from observers list and notifies them of queued
61236
- * entries.
61237
- *
61238
- * @private
61239
- * @returns {boolean} Returns "true" if any observer has detected changes in
61240
- * dimensions of it's elements.
61241
- */
61242
- ResizeObserverController.prototype.updateObservers_ = function () {
61243
- // Collect observers that have active observations.
61244
- var activeObservers = this.observers_.filter(function (observer) {
61245
- return observer.gatherActive(), observer.hasActive();
61246
- });
61247
- // Deliver notifications in a separate cycle in order to avoid any
61248
- // collisions between observers, e.g. when multiple instances of
61249
- // ResizeObserver are tracking the same element and the callback of one
61250
- // of them changes content dimensions of the observed target. Sometimes
61251
- // this may result in notifications being blocked for the rest of observers.
61252
- activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
61253
- return activeObservers.length > 0;
61254
- };
61255
- /**
61256
- * Initializes DOM listeners.
61257
- *
61258
- * @private
61259
- * @returns {void}
61260
- */
61261
- ResizeObserverController.prototype.connect_ = function () {
61262
- // Do nothing if running in a non-browser environment or if listeners
61263
- // have been already added.
61264
- if (!isBrowser || this.connected_) {
61265
- return;
61266
- }
61267
- // Subscription to the "Transitionend" event is used as a workaround for
61268
- // delayed transitions. This way it's possible to capture at least the
61269
- // final state of an element.
61270
- document.addEventListener('transitionend', this.onTransitionEnd_);
61271
- window.addEventListener('resize', this.refresh);
61272
- if (mutationObserverSupported) {
61273
- this.mutationsObserver_ = new MutationObserver(this.refresh);
61274
- this.mutationsObserver_.observe(document, {
61275
- attributes: true,
61276
- childList: true,
61277
- characterData: true,
61278
- subtree: true
61279
- });
61280
- }
61281
- else {
61282
- document.addEventListener('DOMSubtreeModified', this.refresh);
61283
- this.mutationEventsAdded_ = true;
61284
- }
61285
- this.connected_ = true;
61286
- };
61287
- /**
61288
- * Removes DOM listeners.
61289
- *
61290
- * @private
61291
- * @returns {void}
61292
- */
61293
- ResizeObserverController.prototype.disconnect_ = function () {
61294
- // Do nothing if running in a non-browser environment or if listeners
61295
- // have been already removed.
61296
- if (!isBrowser || !this.connected_) {
61297
- return;
61298
- }
61299
- document.removeEventListener('transitionend', this.onTransitionEnd_);
61300
- window.removeEventListener('resize', this.refresh);
61301
- if (this.mutationsObserver_) {
61302
- this.mutationsObserver_.disconnect();
61303
- }
61304
- if (this.mutationEventsAdded_) {
61305
- document.removeEventListener('DOMSubtreeModified', this.refresh);
61306
- }
61307
- this.mutationsObserver_ = null;
61308
- this.mutationEventsAdded_ = false;
61309
- this.connected_ = false;
61310
- };
61311
- /**
61312
- * "Transitionend" event handler.
61313
- *
61314
- * @private
61315
- * @param {TransitionEvent} event
61316
- * @returns {void}
61317
- */
61318
- ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
61319
- var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
61320
- // Detect whether transition may affect dimensions of an element.
61321
- var isReflowProperty = transitionKeys.some(function (key) {
61322
- return !!~propertyName.indexOf(key);
61323
- });
61324
- if (isReflowProperty) {
61325
- this.refresh();
61326
- }
61327
- };
61328
- /**
61329
- * Returns instance of the ResizeObserverController.
61330
- *
61331
- * @returns {ResizeObserverController}
61332
- */
61333
- ResizeObserverController.getInstance = function () {
61334
- if (!this.instance_) {
61335
- this.instance_ = new ResizeObserverController();
61336
- }
61337
- return this.instance_;
61338
- };
61339
- /**
61340
- * Holds reference to the controller's instance.
61341
- *
61342
- * @private {ResizeObserverController}
61343
- */
61344
- ResizeObserverController.instance_ = null;
61345
- return ResizeObserverController;
61346
- }());
61347
-
61348
- /**
61349
- * Defines non-writable/enumerable properties of the provided target object.
61350
- *
61351
- * @param {Object} target - Object for which to define properties.
61352
- * @param {Object} props - Properties to be defined.
61353
- * @returns {Object} Target object.
61354
- */
61355
- var defineConfigurable = (function (target, props) {
61356
- for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
61357
- var key = _a[_i];
61358
- Object.defineProperty(target, key, {
61359
- value: props[key],
61360
- enumerable: false,
61361
- writable: false,
61362
- configurable: true
61363
- });
61364
- }
61365
- return target;
61366
- });
61367
-
61368
- /**
61369
- * Returns the global object associated with provided element.
61370
- *
61371
- * @param {Object} target
61372
- * @returns {Object}
61373
- */
61374
- var getWindowOf = (function (target) {
61375
- // Assume that the element is an instance of Node, which means that it
61376
- // has the "ownerDocument" property from which we can retrieve a
61377
- // corresponding global object.
61378
- var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
61379
- // Return the local global object if it's not possible extract one from
61380
- // provided element.
61381
- return ownerGlobal || global$1;
61382
- });
61383
-
61384
- // Placeholder of an empty content rectangle.
61385
- var emptyRect = createRectInit(0, 0, 0, 0);
61386
- /**
61387
- * Converts provided string to a number.
61388
- *
61389
- * @param {number|string} value
61390
- * @returns {number}
61391
- */
61392
- function toFloat(value) {
61393
- return parseFloat(value) || 0;
61394
- }
61395
- /**
61396
- * Extracts borders size from provided styles.
61397
- *
61398
- * @param {CSSStyleDeclaration} styles
61399
- * @param {...string} positions - Borders positions (top, right, ...)
61400
- * @returns {number}
61401
- */
61402
- function getBordersSize(styles) {
61403
- var positions = [];
61404
- for (var _i = 1; _i < arguments.length; _i++) {
61405
- positions[_i - 1] = arguments[_i];
61406
- }
61407
- return positions.reduce(function (size, position) {
61408
- var value = styles['border-' + position + '-width'];
61409
- return size + toFloat(value);
61410
- }, 0);
61411
- }
61412
- /**
61413
- * Extracts paddings sizes from provided styles.
61414
- *
61415
- * @param {CSSStyleDeclaration} styles
61416
- * @returns {Object} Paddings box.
61417
- */
61418
- function getPaddings(styles) {
61419
- var positions = ['top', 'right', 'bottom', 'left'];
61420
- var paddings = {};
61421
- for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
61422
- var position = positions_1[_i];
61423
- var value = styles['padding-' + position];
61424
- paddings[position] = toFloat(value);
61425
- }
61426
- return paddings;
61427
- }
61428
- /**
61429
- * Calculates content rectangle of provided SVG element.
61430
- *
61431
- * @param {SVGGraphicsElement} target - Element content rectangle of which needs
61432
- * to be calculated.
61433
- * @returns {DOMRectInit}
61434
- */
61435
- function getSVGContentRect(target) {
61436
- var bbox = target.getBBox();
61437
- return createRectInit(0, 0, bbox.width, bbox.height);
61438
- }
61439
- /**
61440
- * Calculates content rectangle of provided HTMLElement.
61441
- *
61442
- * @param {HTMLElement} target - Element for which to calculate the content rectangle.
61443
- * @returns {DOMRectInit}
61444
- */
61445
- function getHTMLElementContentRect(target) {
61446
- // Client width & height properties can't be
61447
- // used exclusively as they provide rounded values.
61448
- var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
61449
- // By this condition we can catch all non-replaced inline, hidden and
61450
- // detached elements. Though elements with width & height properties less
61451
- // than 0.5 will be discarded as well.
61452
- //
61453
- // Without it we would need to implement separate methods for each of
61454
- // those cases and it's not possible to perform a precise and performance
61455
- // effective test for hidden elements. E.g. even jQuery's ':visible' filter
61456
- // gives wrong results for elements with width & height less than 0.5.
61457
- if (!clientWidth && !clientHeight) {
61458
- return emptyRect;
61459
- }
61460
- var styles = getWindowOf(target).getComputedStyle(target);
61461
- var paddings = getPaddings(styles);
61462
- var horizPad = paddings.left + paddings.right;
61463
- var vertPad = paddings.top + paddings.bottom;
61464
- // Computed styles of width & height are being used because they are the
61465
- // only dimensions available to JS that contain non-rounded values. It could
61466
- // be possible to utilize the getBoundingClientRect if only it's data wasn't
61467
- // affected by CSS transformations let alone paddings, borders and scroll bars.
61468
- var width = toFloat(styles.width), height = toFloat(styles.height);
61469
- // Width & height include paddings and borders when the 'border-box' box
61470
- // model is applied (except for IE).
61471
- if (styles.boxSizing === 'border-box') {
61472
- // Following conditions are required to handle Internet Explorer which
61473
- // doesn't include paddings and borders to computed CSS dimensions.
61474
- //
61475
- // We can say that if CSS dimensions + paddings are equal to the "client"
61476
- // properties then it's either IE, and thus we don't need to subtract
61477
- // anything, or an element merely doesn't have paddings/borders styles.
61478
- if (Math.round(width + horizPad) !== clientWidth) {
61479
- width -= getBordersSize(styles, 'left', 'right') + horizPad;
61480
- }
61481
- if (Math.round(height + vertPad) !== clientHeight) {
61482
- height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
61483
- }
61484
- }
61485
- // Following steps can't be applied to the document's root element as its
61486
- // client[Width/Height] properties represent viewport area of the window.
61487
- // Besides, it's as well not necessary as the <html> itself neither has
61488
- // rendered scroll bars nor it can be clipped.
61489
- if (!isDocumentElement(target)) {
61490
- // In some browsers (only in Firefox, actually) CSS width & height
61491
- // include scroll bars size which can be removed at this step as scroll
61492
- // bars are the only difference between rounded dimensions + paddings
61493
- // and "client" properties, though that is not always true in Chrome.
61494
- var vertScrollbar = Math.round(width + horizPad) - clientWidth;
61495
- var horizScrollbar = Math.round(height + vertPad) - clientHeight;
61496
- // Chrome has a rather weird rounding of "client" properties.
61497
- // E.g. for an element with content width of 314.2px it sometimes gives
61498
- // the client width of 315px and for the width of 314.7px it may give
61499
- // 314px. And it doesn't happen all the time. So just ignore this delta
61500
- // as a non-relevant.
61501
- if (Math.abs(vertScrollbar) !== 1) {
61502
- width -= vertScrollbar;
61503
- }
61504
- if (Math.abs(horizScrollbar) !== 1) {
61505
- height -= horizScrollbar;
61506
- }
61507
- }
61508
- return createRectInit(paddings.left, paddings.top, width, height);
61509
- }
61510
- /**
61511
- * Checks whether provided element is an instance of the SVGGraphicsElement.
61512
- *
61513
- * @param {Element} target - Element to be checked.
61514
- * @returns {boolean}
61515
- */
61516
- var isSVGGraphicsElement = (function () {
61517
- // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
61518
- // interface.
61519
- if (typeof SVGGraphicsElement !== 'undefined') {
61520
- return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
61521
- }
61522
- // If it's so, then check that element is at least an instance of the
61523
- // SVGElement and that it has the "getBBox" method.
61524
- // eslint-disable-next-line no-extra-parens
61525
- return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
61526
- typeof target.getBBox === 'function'); };
61527
- })();
61528
- /**
61529
- * Checks whether provided element is a document element (<html>).
61530
- *
61531
- * @param {Element} target - Element to be checked.
61532
- * @returns {boolean}
61533
- */
61534
- function isDocumentElement(target) {
61535
- return target === getWindowOf(target).document.documentElement;
61536
- }
61537
- /**
61538
- * Calculates an appropriate content rectangle for provided html or svg element.
61539
- *
61540
- * @param {Element} target - Element content rectangle of which needs to be calculated.
61541
- * @returns {DOMRectInit}
61542
- */
61543
- function getContentRect(target) {
61544
- if (!isBrowser) {
61545
- return emptyRect;
61546
- }
61547
- if (isSVGGraphicsElement(target)) {
61548
- return getSVGContentRect(target);
61549
- }
61550
- return getHTMLElementContentRect(target);
61551
- }
61552
- /**
61553
- * Creates rectangle with an interface of the DOMRectReadOnly.
61554
- * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
61555
- *
61556
- * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
61557
- * @returns {DOMRectReadOnly}
61558
- */
61559
- function createReadOnlyRect(_a) {
61560
- var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
61561
- // If DOMRectReadOnly is available use it as a prototype for the rectangle.
61562
- var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
61563
- var rect = Object.create(Constr.prototype);
61564
- // Rectangle's properties are not writable and non-enumerable.
61565
- defineConfigurable(rect, {
61566
- x: x, y: y, width: width, height: height,
61567
- top: y,
61568
- right: x + width,
61569
- bottom: height + y,
61570
- left: x
61571
- });
61572
- return rect;
61573
- }
61574
- /**
61575
- * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
61576
- * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
61577
- *
61578
- * @param {number} x - X coordinate.
61579
- * @param {number} y - Y coordinate.
61580
- * @param {number} width - Rectangle's width.
61581
- * @param {number} height - Rectangle's height.
61582
- * @returns {DOMRectInit}
61583
- */
61584
- function createRectInit(x, y, width, height) {
61585
- return { x: x, y: y, width: width, height: height };
61586
- }
61587
-
61588
- /**
61589
- * Class that is responsible for computations of the content rectangle of
61590
- * provided DOM element and for keeping track of it's changes.
61591
- */
61592
- var ResizeObservation = /** @class */ (function () {
61593
- /**
61594
- * Creates an instance of ResizeObservation.
61595
- *
61596
- * @param {Element} target - Element to be observed.
61597
- */
61598
- function ResizeObservation(target) {
61599
- /**
61600
- * Broadcasted width of content rectangle.
61601
- *
61602
- * @type {number}
61603
- */
61604
- this.broadcastWidth = 0;
61605
- /**
61606
- * Broadcasted height of content rectangle.
61607
- *
61608
- * @type {number}
61609
- */
61610
- this.broadcastHeight = 0;
61611
- /**
61612
- * Reference to the last observed content rectangle.
61613
- *
61614
- * @private {DOMRectInit}
61615
- */
61616
- this.contentRect_ = createRectInit(0, 0, 0, 0);
61617
- this.target = target;
61618
- }
61619
- /**
61620
- * Updates content rectangle and tells whether it's width or height properties
61621
- * have changed since the last broadcast.
61622
- *
61623
- * @returns {boolean}
61624
- */
61625
- ResizeObservation.prototype.isActive = function () {
61626
- var rect = getContentRect(this.target);
61627
- this.contentRect_ = rect;
61628
- return (rect.width !== this.broadcastWidth ||
61629
- rect.height !== this.broadcastHeight);
61630
- };
61631
- /**
61632
- * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
61633
- * from the corresponding properties of the last observed content rectangle.
61634
- *
61635
- * @returns {DOMRectInit} Last observed content rectangle.
61636
- */
61637
- ResizeObservation.prototype.broadcastRect = function () {
61638
- var rect = this.contentRect_;
61639
- this.broadcastWidth = rect.width;
61640
- this.broadcastHeight = rect.height;
61641
- return rect;
61642
- };
61643
- return ResizeObservation;
61644
- }());
61645
-
61646
- var ResizeObserverEntry = /** @class */ (function () {
61647
- /**
61648
- * Creates an instance of ResizeObserverEntry.
61649
- *
61650
- * @param {Element} target - Element that is being observed.
61651
- * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
61652
- */
61653
- function ResizeObserverEntry(target, rectInit) {
61654
- var contentRect = createReadOnlyRect(rectInit);
61655
- // According to the specification following properties are not writable
61656
- // and are also not enumerable in the native implementation.
61657
- //
61658
- // Property accessors are not being used as they'd require to define a
61659
- // private WeakMap storage which may cause memory leaks in browsers that
61660
- // don't support this type of collections.
61661
- defineConfigurable(this, { target: target, contentRect: contentRect });
61662
- }
61663
- return ResizeObserverEntry;
61664
- }());
61665
-
61666
- var ResizeObserverSPI = /** @class */ (function () {
61667
- /**
61668
- * Creates a new instance of ResizeObserver.
61669
- *
61670
- * @param {ResizeObserverCallback} callback - Callback function that is invoked
61671
- * when one of the observed elements changes it's content dimensions.
61672
- * @param {ResizeObserverController} controller - Controller instance which
61673
- * is responsible for the updates of observer.
61674
- * @param {ResizeObserver} callbackCtx - Reference to the public
61675
- * ResizeObserver instance which will be passed to callback function.
61676
- */
61677
- function ResizeObserverSPI(callback, controller, callbackCtx) {
61678
- /**
61679
- * Collection of resize observations that have detected changes in dimensions
61680
- * of elements.
61681
- *
61682
- * @private {Array<ResizeObservation>}
61683
- */
61684
- this.activeObservations_ = [];
61685
- /**
61686
- * Registry of the ResizeObservation instances.
61687
- *
61688
- * @private {Map<Element, ResizeObservation>}
61689
- */
61690
- this.observations_ = new MapShim();
61691
- if (typeof callback !== 'function') {
61692
- throw new TypeError('The callback provided as parameter 1 is not a function.');
61693
- }
61694
- this.callback_ = callback;
61695
- this.controller_ = controller;
61696
- this.callbackCtx_ = callbackCtx;
61697
- }
61698
- /**
61699
- * Starts observing provided element.
61700
- *
61701
- * @param {Element} target - Element to be observed.
61702
- * @returns {void}
61703
- */
61704
- ResizeObserverSPI.prototype.observe = function (target) {
61705
- if (!arguments.length) {
61706
- throw new TypeError('1 argument required, but only 0 present.');
61707
- }
61708
- // Do nothing if current environment doesn't have the Element interface.
61709
- if (typeof Element === 'undefined' || !(Element instanceof Object)) {
61710
- return;
61711
- }
61712
- if (!(target instanceof getWindowOf(target).Element)) {
61713
- throw new TypeError('parameter 1 is not of type "Element".');
61714
- }
61715
- var observations = this.observations_;
61716
- // Do nothing if element is already being observed.
61717
- if (observations.has(target)) {
61718
- return;
61719
- }
61720
- observations.set(target, new ResizeObservation(target));
61721
- this.controller_.addObserver(this);
61722
- // Force the update of observations.
61723
- this.controller_.refresh();
61724
- };
61725
- /**
61726
- * Stops observing provided element.
61727
- *
61728
- * @param {Element} target - Element to stop observing.
61729
- * @returns {void}
61730
- */
61731
- ResizeObserverSPI.prototype.unobserve = function (target) {
61732
- if (!arguments.length) {
61733
- throw new TypeError('1 argument required, but only 0 present.');
61734
- }
61735
- // Do nothing if current environment doesn't have the Element interface.
61736
- if (typeof Element === 'undefined' || !(Element instanceof Object)) {
61737
- return;
61738
- }
61739
- if (!(target instanceof getWindowOf(target).Element)) {
61740
- throw new TypeError('parameter 1 is not of type "Element".');
61741
- }
61742
- var observations = this.observations_;
61743
- // Do nothing if element is not being observed.
61744
- if (!observations.has(target)) {
61745
- return;
61746
- }
61747
- observations.delete(target);
61748
- if (!observations.size) {
61749
- this.controller_.removeObserver(this);
61750
- }
61751
- };
61752
- /**
61753
- * Stops observing all elements.
61754
- *
61755
- * @returns {void}
61756
- */
61757
- ResizeObserverSPI.prototype.disconnect = function () {
61758
- this.clearActive();
61759
- this.observations_.clear();
61760
- this.controller_.removeObserver(this);
61761
- };
61762
- /**
61763
- * Collects observation instances the associated element of which has changed
61764
- * it's content rectangle.
61765
- *
61766
- * @returns {void}
61767
- */
61768
- ResizeObserverSPI.prototype.gatherActive = function () {
61769
- var _this = this;
61770
- this.clearActive();
61771
- this.observations_.forEach(function (observation) {
61772
- if (observation.isActive()) {
61773
- _this.activeObservations_.push(observation);
61774
- }
61775
- });
61776
- };
61777
- /**
61778
- * Invokes initial callback function with a list of ResizeObserverEntry
61779
- * instances collected from active resize observations.
61780
- *
61781
- * @returns {void}
61782
- */
61783
- ResizeObserverSPI.prototype.broadcastActive = function () {
61784
- // Do nothing if observer doesn't have active observations.
61785
- if (!this.hasActive()) {
61786
- return;
61787
- }
61788
- var ctx = this.callbackCtx_;
61789
- // Create ResizeObserverEntry instance for every active observation.
61790
- var entries = this.activeObservations_.map(function (observation) {
61791
- return new ResizeObserverEntry(observation.target, observation.broadcastRect());
61792
- });
61793
- this.callback_.call(ctx, entries, ctx);
61794
- this.clearActive();
61795
- };
61796
- /**
61797
- * Clears the collection of active observations.
61798
- *
61799
- * @returns {void}
61800
- */
61801
- ResizeObserverSPI.prototype.clearActive = function () {
61802
- this.activeObservations_.splice(0);
61803
- };
61804
- /**
61805
- * Tells whether observer has active observations.
61806
- *
61807
- * @returns {boolean}
61808
- */
61809
- ResizeObserverSPI.prototype.hasActive = function () {
61810
- return this.activeObservations_.length > 0;
61811
- };
61812
- return ResizeObserverSPI;
61813
- }());
61814
-
61815
- // Registry of internal observers. If WeakMap is not available use current shim
61816
- // for the Map collection as it has all required methods and because WeakMap
61817
- // can't be fully polyfilled anyway.
61818
- var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
61819
- /**
61820
- * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
61821
- * exposing only those methods and properties that are defined in the spec.
61822
- */
61823
- var ResizeObserver = /** @class */ (function () {
61824
- /**
61825
- * Creates a new instance of ResizeObserver.
61826
- *
61827
- * @param {ResizeObserverCallback} callback - Callback that is invoked when
61828
- * dimensions of the observed elements change.
61829
- */
61830
- function ResizeObserver(callback) {
61831
- if (!(this instanceof ResizeObserver)) {
61832
- throw new TypeError('Cannot call a class as a function.');
61833
- }
61834
- if (!arguments.length) {
61835
- throw new TypeError('1 argument required, but only 0 present.');
61836
- }
61837
- var controller = ResizeObserverController.getInstance();
61838
- var observer = new ResizeObserverSPI(callback, controller, this);
61839
- observers.set(this, observer);
61840
- }
61841
- return ResizeObserver;
61842
- }());
61843
- // Expose public methods of ResizeObserver.
61844
- [
61845
- 'observe',
61846
- 'unobserve',
61847
- 'disconnect'
61848
- ].forEach(function (method) {
61849
- ResizeObserver.prototype[method] = function () {
61850
- var _a;
61851
- return (_a = observers.get(this))[method].apply(_a, arguments);
61852
- };
61853
- });
61854
-
61855
- var index$1 = (function () {
61856
- // Export existing implementation if available.
61857
- if (typeof global$1.ResizeObserver !== 'undefined') {
61858
- return global$1.ResizeObserver;
61859
- }
61860
- return ResizeObserver;
61861
- })();
61862
-
61863
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function A$1(){return (A$1=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);}return t}).apply(this,arguments)}function F$1(t,e){if(null==t)return {};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function W$1(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function N$1(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return W$1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W$1(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (n=t[Symbol.iterator]()).next.bind(n)}function _$1(t,e){return !(!t||t[0]!==e[0]||t[1]!==e[1])}function V$1(t,e){return !(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}var G$1="up",j$1=system(function(){var t=stream(),e=statefulStream(0),a=stream(),s=statefulStream(0),c=stream(),f=statefulStream(0),d=statefulStream(0),m=stream(),h=stream(),p=statefulStream(!1);connect(t,s);var v=statefulStream("down");return connect(pipe(t,scan(function(t,e){return {direction:e<t.prevScrollTop?G$1:"down",prevScrollTop:e}},{direction:"down",prevScrollTop:0}),map(function(t){return t.direction})),v),{scrollTop:t,viewportHeight:c,headerHeight:f,footerHeight:d,smoothScrollTargetReached:a,scrollTo:m,scrollBy:h,scrollDirection:v,statefulScrollTop:s,deviation:e,scrollingInProgress:p}},[],{singleton:!0}),D$1=system(function(){var t=statefulStream(!1);return {propsReady:t,didMount:streamFromEmitter(pipe(t,filter(function(t){return t}),distinctUntilChanged()))}},[],{singleton:!0}),U$1={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,totalHeight:0}},K$1=system(function(t){var e=t[0],s=e.scrollTop,C=e.viewportHeight,S=statefulStream(!1),x=statefulStream(!0),T=stream(),w=stream(),y=stream(),b=streamFromEmitter(pipe(merge(pipe(duc(s),skip(1),mapTo(!0)),pipe(duc(s),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()));connect(pipe(duc(s),map(function(t){return 0===t}),distinctUntilChanged()),x),connect(x,w);var k=streamFromEmitter(pipe(combineLatest(y,duc(s),duc(C)),scan(function(t,e){var n=e[0],o=n.bottom,r=n.offsetBottom,i=e[1],l=e[2],u={viewportHeight:l,scrollTop:i,offsetBottom:r,totalHeight:o+r};return 0===r&&i+l-o>-4?{atBottom:!0,state:u}:{atBottom:!1,notAtBottomBecause:u.totalHeight>t.state.totalHeight?"SIZE_INCREASED":0!==r?"NOT_SHOWING_LAST_ITEM":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:u}},U$1),distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom})));return connect(pipe(k,map(function(t){return t.atBottom})),S),subscribe(S,function(t){setTimeout(function(){return publish(T,t)});}),{isScrolling:b,isAtTop:x,isAtBottom:S,atBottomState:k,atTopStateChange:w,atBottomStateChange:T,listStateListener:y}},tup(j$1)),Y$1=system(function(t){var e=t[0].scrollTop,a=t[1].isScrolling,f=statefulStream(0),d=statefulStream(!1),m=stream(),p=statefulStream(!1);return connect(pipe(a,filter(function(t){return !t}),mapTo(0)),f),connect(pipe(e,throttleTime(100),withLatestFrom(a),filter(function(t){return !!t[1]}),scan(function(t,e){return [t[1],e[0]]},[0,0]),map(function(t){return t[1]-t[0]})),f),connect(pipe(f,withLatestFrom(p,d,m),filter(function(t){return !!t[1]}),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0, n.exit)(e,r))return !1}else if(i(e,r))return !0;return o}),distinctUntilChanged()),d),subscribe(pipe(combineLatest(d,f,m),withLatestFrom(p)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:d,scrollSeekConfiguration:p,scrollVelocity:f,scrollSeekRangeChanged:m}},tup(j$1,K$1),{singleton:!0}),Z$1={lvl:0};function q$1(t,e,n,o,r){return void 0===o&&(o=Z$1),void 0===r&&(r=Z$1),{k:t,v:e,lvl:n,l:o,r:r}}function $$1(t){return t===Z$1}function J$1(){return Z$1}function Q$1(t,e){if($$1(t))return Z$1;var n=t.k,o=t.l,r=t.r;if(e===n){if($$1(o))return r;if($$1(r))return o;var i=ot$1(o);return ut$1(it$1(t,{k:i[0],v:i[1],l:rt$1(o)}))}return ut$1(it$1(t,e<n?{l:Q$1(o,e)}:{r:Q$1(r,e)}))}function X$1(t,e,n){if(void 0===n&&(n="k"),$$1(t))return [-Infinity,void 0];if(t[n]===e)return [t.k,t.v];if(t[n]<e){var o=X$1(t.r,e,n);return -Infinity===o[0]?[t.k,t.v]:o}return X$1(t.l,e,n)}function tt$1(t,e,n){return $$1(t)?q$1(e,n,1):e===t.k?it$1(t,{k:e,v:n}):function(t){return ct$1(ft$1(t))}(it$1(t,e<t.k?{l:tt$1(t.l,e,n)}:{r:tt$1(t.r,e,n)}))}function et$1(t,e,n){if($$1(t))return [];var o=t.k,r=t.v,i=t.r,l=[];return o>e&&(l=l.concat(et$1(t.l,e,n))),o>=e&&o<=n&&l.push({k:o,v:r}),o<=n&&(l=l.concat(et$1(i,e,n))),l}function nt$1(t){return $$1(t)?[]:[].concat(nt$1(t.l),[{k:t.k,v:t.v}],nt$1(t.r))}function ot$1(t){return $$1(t.r)?[t.k,t.v]:ot$1(t.r)}function rt$1(t){return $$1(t.r)?t.l:ut$1(it$1(t,{r:rt$1(t.r)}))}function it$1(t,e){return q$1(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function lt$1(t){return $$1(t)||t.lvl>t.r.lvl}function ut$1(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(lt$1(e))return ft$1(it$1(t,{lvl:o-1}));if($$1(e)||$$1(e.r))throw new Error("Unexpected empty nodes");return it$1(e.r,{l:it$1(e,{r:e.r.l}),r:it$1(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(lt$1(t))return ct$1(it$1(t,{lvl:o-1}));if($$1(n)||$$1(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=lt$1(r)?n.lvl-1:n.lvl;return it$1(r,{l:it$1(t,{r:r.l,lvl:o-1}),r:ct$1(it$1(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function at$1(t,e,n){return $$1(t)?[]:st$1(et$1(t,X$1(t,e)[0],n),function(t){return {index:t.k,value:t.v}})}function st$1(t,e){var n=t.length;if(0===n)return [];for(var o=e(t[0]),r=o.index,i=o.value,l=[],u=1;u<n;u++){var a=e(t[u]),s=a.index,c=a.value;l.push({start:r,end:s-1,value:i}),r=s,i=c;}return l.push({start:r,end:Infinity,value:i}),l}function ct$1(t){var e=t.r,n=t.lvl;return $$1(e)||$$1(e.r)||e.lvl!==n||e.r.lvl!==n?t:it$1(e,{l:it$1(t,{r:e.l}),lvl:n+1})}function ft$1(t){var e=t.l;return $$1(e)||e.lvl!==t.lvl?t:it$1(e,{r:it$1(t,{l:e.r})})}function dt$1(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),l=n(t[i],e);if(0===l)return i;if(-1===l){if(r-o<2)return i-1;r=i-1;}else {if(r===o)return i;o=i+1;}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function mt$1(t,e,n){return t[dt$1(t,e,n)]}function ht$1(t,e){return t.getBoundingClientRect()[e]}function pt$1(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function vt$1(t,e){var n=t.index;return e===n?0:e<n?-1:1}function gt$1(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function It$1(t){return {index:t.index,value:t}}function Ct$1(t,e){var n=e[0],o=e[1],r=t.sizeTree,i=t.offsetTree,l=r,u=0;if(o.length>0&&$$1(r)&&2===n.length){var a=n[0].size,s=n[1].size;l=o.reduce(function(t,e){return tt$1(tt$1(t,e,a),e+1,s)},l);}else {var c=function(t,e){for(var n,o=$$1(t)?0:Infinity,r=N$1(e);!(n=r()).done;){var i=n.value,l=i.size,u=i.startIndex,a=i.endIndex;if(o=Math.min(o,u),$$1(t))t=tt$1(t,0,l);else {var s=at$1(t,u-1,a+1);if(!s.some(pt$1(i))){for(var c,f=!1,d=!1,m=N$1(s);!(c=m()).done;){var h=c.value,p=h.start,v=h.end,g=h.value;f?(a>=p||l===g)&&(t=Q$1(t,p)):(d=g!==l,f=!0),v>a&&a>=p&&g!==l&&(t=tt$1(t,a+1,g));}d&&(t=tt$1(t,u,l));}}}return [t,o]}(l,n);l=c[0],u=c[1];}if(l===r)return t;var f=0,d=0,m=0,h=0;if(0!==u){h=dt$1(i,u-1,vt$1),m=i[h].offset;var p=X$1(l,u-1);f=p[0],d=p[1],i.length&&i[h].size===X$1(l,u)[1]&&(h-=1),i=i.slice(0,h+1);}else i=[];for(var v,g=N$1(at$1(l,u,Infinity));!(v=g()).done;){var I=v.value,C=I.start,S=I.value,x=(C-f)*d+m;i.push({offset:x,size:S,index:C}),f=C,m=x,d=S;}return {sizeTree:l,offsetTree:i,groupOffsetTree:o.reduce(function(t,e){return tt$1(t,e,St$1(e,i))},J$1()),lastIndex:f,lastOffset:m,lastSize:d,groupIndices:o}}function St$1(t,e){if(0===e.length)return 0;var n=mt$1(e,t,vt$1);return n.size*(t-n.index)+n.offset}function xt$1(t,e){if(!Tt$1(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function Tt$1(t){return !$$1(t.groupOffsetTree)}var wt$1={offsetHeight:"height",offsetWidth:"width"},yt$1=system(function(){var t=stream(),e=stream(),f=stream(),d=statefulStream(0),m=statefulStream([]),h=statefulStream(void 0),p=statefulStream(void 0),v=statefulStream(function(t,e){return ht$1(t,wt$1[e])}),g=statefulStream(void 0),I={offsetTree:[],sizeTree:J$1(),groupOffsetTree:J$1(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},C=statefulStreamFromEmitter(pipe(t,withLatestFrom(m),scan(Ct$1,I),distinctUntilChanged()),I);connect(pipe(m,filter(function(t){return t.length>0}),withLatestFrom(C),map(function(t){var e=t[0],n=t[1],o=e.reduce(function(t,e,o){return tt$1(t,e,St$1(e,n.offsetTree)||o)},J$1());return A$1({},n,{groupIndices:e,groupOffsetTree:o})})),C),connect(pipe(e,withLatestFrom(C),filter(function(t){return t[0]<t[1].lastIndex}),map(function(t){var e=t[1];return [{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),t),connect(h,p);var S=statefulStreamFromEmitter(pipe(h,map(function(t){return void 0===t})),!0);connect(pipe(p,filter(function(t){return void 0!==t}),map(function(t){return [{startIndex:0,endIndex:0,size:t}]})),t);var w=streamFromEmitter(pipe(t,withLatestFrom(C),scan(function(t,e){var n=e[1];return {changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:I}),map(function(t){return t.changed})));connect(pipe(d,scan(function(t,e){return {diff:t.prev-e,prev:e}},{diff:0,prev:0}),map(function(t){return t.diff}),filter(function(t){return t>0})),f);var y=streamFromEmitter(f);return connect(pipe(f,withLatestFrom(C),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return nt$1(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return {ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),t),{data:g,totalCount:e,sizeRanges:t,groupIndices:m,defaultItemSize:p,fixedItemSize:h,unshiftWith:f,beforeUnshiftWith:y,firstItemIndex:d,sizes:C,listRefresh:w,trackItemSizes:S,itemSize:v}},[],{singleton:!0}),bt$1="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function kt$1(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&bt$1||(e.behavior="auto"),e.offset||(e.offset=0),e}var Ht$1=system(function(t){var e=t[0],l=e.sizes,a=e.totalCount,s=e.listRefresh,c=t[1],f=c.scrollingInProgress,d=c.viewportHeight,m=c.scrollTo,h=c.smoothScrollTargetReached,p=c.headerHeight,v=c.footerHeight,C=stream(),S=statefulStream(0),T=null,y=null,b=null,k=function(){T&&(T(),T=null),b&&(b(),b=null),y&&(clearTimeout(y),y=null),publish(f,!1);};return connect(pipe(C,withLatestFrom(l,d,a,S,p,v),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],l=t[4],u=t[5],a=t[6],c=kt$1(e),d=c.align,m=c.behavior,p=c.offset,v=r-1,S=c.index;S=xt$1(S,n);var x=St$1(S=Math.max(0,S,Math.min(v,S)),n.offsetTree)+u;"end"===d?(x=Math.round(x-o+X$1(n.sizeTree,S)[1]),S===v&&(x+=a)):"center"===d?x=Math.round(x-o/2+X$1(n.sizeTree,S)[1]/2):x-=l,p&&(x+=p);var H,z,R=function(t){k(),t&&publish(C,e);};if(k(),"smooth"===m){var B=!1;b=subscribe(s,function(t){B=B||t;}),T=handleNext(h,function(){R(B);});}else T=handleNext(pipe(s,function(t){return function(e){H=H||e,z||(z=setTimeout(function(){z=void 0,t(H);},0));}}),R);return y=setTimeout(function(){k();},1200),publish(f,!0),{top:x,behavior:m}})),m),{scrollToIndex:C,topListHeight:S}},tup(yt$1,j$1),{singleton:!0}),zt$1=function(t,e,n){return "number"==typeof t?n===G$1&&"top"===e||"down"===n&&"bottom"===e?t:0:n===G$1?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse},Rt$1=system(function(t){var e=t[0],r=e.scrollTop,l=e.viewportHeight,a=e.deviation,f=e.headerHeight,m=stream(),h=statefulStream(0),p=statefulStream(0);return {listBoundary:m,overscan:p,topListHeight:h,visibleRange:statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(l),duc(f),duc(m,_$1),duc(p),duc(h),duc(a)),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=r[0],l=r[1],u=t[4],a=t[5],s=t[6],c=e-s,f=Math.max(o-c,0),d="none";return i-=s,l+=o,(i+=o)>e+a&&(d=G$1),(l-=s)<e-f+n&&(d="down"),"none"!==d?[Math.max(c-o-zt$1(u,"top",d),0),c-f+n+zt$1(u,"bottom",d)]:null}),filter(function(t){return null!=t}),distinctUntilChanged(_$1)),[0,0])}},tup(j$1),{singleton:!0}),Bt$1=system(function(t){var e=t[0],l=e.scrollTop,a=e.scrollTo,s=stream(),c=stream(),f=stream(),d=statefulStream(!1);return connect(pipe(combineLatest(c,s),map(function(t){return Math.max(0,t[0]-t[1].offsetTop)})),l),connect(pipe(a,withLatestFrom(s),map(function(t){var e=t[0];return A$1({},e,{top:e.top+t[1].offsetTop})})),f),{useWindowScroll:d,windowScrollTop:c,windowViewportRect:s,windowScrollTo:f}},tup(j$1)),Et$1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Lt$1={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Mt$1=Math.ceil,Ot$1=Math.floor,Pt$1=Math.min,At$1=Math.max;function Ft$1(t){return Mt$1(t)-t<.03?Mt$1(t):Ot$1(t)}function Wt$1(t,e){return Array.from({length:e-t+1}).map(function(e,n){return {index:n+t}})}var Nt$1=system(function(t){var e=t[0],l=e.overscan,f=e.visibleRange,m=e.listBoundary,p=t[1],g=p.scrollTop,I=p.viewportHeight,C=p.scrollBy,S=p.scrollTo,w=p.smoothScrollTargetReached,y=t[2],b=t[3],k=t[4],H=k.propsReady,z=k.didMount,R=t[5],B=R.windowViewportRect,E=R.windowScrollTo,L=R.useWindowScroll,M=R.windowScrollTop,O=statefulStream(0),P=statefulStream(0),F=statefulStream(Et$1),W=statefulStream({height:0,width:0}),N=statefulStream({height:0,width:0}),G=stream();connect(pipe(z,withLatestFrom(P),filter(function(t){return 0!==t[1]}),map(function(t){return {items:Wt$1(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),F),connect(pipe(combineLatest(duc(O),f,duc(N,function(t,e){return t&&t.width===e.width&&t.height===e.height})),withLatestFrom(W),map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],l=e[2],u=t[1],a=l.height,s=l.width,c=u.width;if(0===n||0===c)return Et$1;if(0===s)return Lt$1;var f=Ft$1(c/s),d=f*Ot$1(r/a),m=f*Mt$1(i/a)-1;m=Pt$1(n-1,m);var h=Wt$1(d=Pt$1(m,At$1(0,d)),m),p=_t$1(u,l,h),v=p.top,g=p.bottom;return {items:h,offsetTop:v,offsetBottom:Mt$1(n/f)*a-g,top:v,bottom:g,itemHeight:a,itemWidth:s}})),F),connect(pipe(W,map(function(t){return t.height})),I),connect(pipe(combineLatest(W,N,F),map(function(t){var e=_t$1(t[0],t[1],t[2].items);return [e.top,e.bottom]}),distinctUntilChanged(_$1)),m),connect(pipe(m,withLatestFrom(F),map(function(t){return {bottom:t[0][1],offsetBottom:t[1].offsetBottom}})),y.listStateListener);var j=streamFromEmitter(pipe(duc(F),filter(function(t){return t.items.length>0}),withLatestFrom(O),filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),map(function(t){return t[1]-1}),distinctUntilChanged())),D=streamFromEmitter(pipe(duc(F),filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),mapTo(0),distinctUntilChanged())),U=streamFromEmitter(pipe(duc(F),filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V$1)));connect(U,b.scrollSeekRangeChanged),connect(pipe(G,withLatestFrom(W,N,O),map(function(t){var e=t[1],n=t[2],o=t[3],r=kt$1(t[0]),i=r.align,l=r.behavior,u=r.offset,a=r.index,s=Vt$1(e,n,a=Math.max(0,a,Math.min(o-1,a)));return "end"===i?s=Math.round(s-e.height+n.height):"center"===i&&(s=Math.round(s-e.height/2+n.height/2)),u&&(s+=u),{top:s,behavior:l}})),S);var K=statefulStreamFromEmitter(pipe(F,map(function(t){return t.offsetBottom+t.bottom})),0);return connect(pipe(B,map(function(t){return {width:t.visibleWidth,height:t.visibleHeight}})),W),A$1({totalCount:O,viewportDimensions:W,itemDimensions:N,scrollTop:g,overscan:l,scrollBy:C,scrollTo:S,scrollToIndex:G,smoothScrollTargetReached:w,windowViewportRect:B,windowScrollTo:E,useWindowScroll:L,windowScrollTop:M,initialItemCount:P},b,{gridState:F,totalListHeight:K},y,{startReached:D,endReached:j,rangeChanged:U,propsReady:H})},tup(Rt$1,j$1,K$1,Y$1,D$1,Bt$1));function _t$1(t,e,n){var o=e.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:Vt$1(t,e,n[0].index),bottom:Vt$1(t,e,n[n.length-1].index)+o}}function Vt$1(t,e,n){var o=Ft$1(t.width/e.width);return Ot$1(n/o)*e.height}function Gt$1(t,e){void 0===e&&(e=!0);var n=React.useRef(null),o=new index$1(function(e){var n=e[0].target;null!==n.offsetParent&&t(n);});return {ref:n,callbackRef:function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null);}}}function jt$1(t,e){return void 0===e&&(e=!0),Gt$1(t,e).callbackRef}function Dt$1(t){var e=React.useRef(null),n=React.useCallback(function(n){if(null!==n){var o=n.getBoundingClientRect(),r=window.innerHeight-Math.max(0,o.top),i=o.top+window.pageYOffset;e.current={offsetTop:i,visibleHeight:r,visibleWidth:o.width},t(e.current);}},[t]),o=Gt$1(n),r=o.callbackRef,i=o.ref,l=React.useCallback(function(){n(i.current);},[n,i]);return React.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l);}},[l]),r}var Ut$1="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function Kt$1(t,e,n,o){void 0===o&&(o=noop);var r=React.useRef(null),i=React.useRef(null),l=React.useRef(null),u=React.useCallback(function(n){var o=n.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop;t(Math.max(r,0)),null!==i.current&&(r===i.current||r<=0||r===o.scrollHeight-ht$1(o,"height"))&&(i.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null));},[t,e]);return React.useEffect(function(){var t=r.current;return o(r.current),u({target:t}),t.addEventListener("scroll",u,{passive:!0}),function(){o(null),t.removeEventListener("scroll",u);}},[r,u,n,o]),{scrollerRef:r,scrollByCallback:function(t){null===i.current&&r.current.scrollBy(t);},scrollToCallback:function(n){var o=r.current;if(o){var u,a,s,c="smooth"===n.behavior;if(o===window?(a=Math.max(ht$1(document.documentElement,"height"),document.documentElement.scrollHeight),u=window.innerHeight,s=document.documentElement.scrollTop):(a=o.scrollHeight,u=ht$1(o,"height"),s=o.scrollTop),u===a||n.top===s)return t(s),void(c&&e(!0));n.top=Math.max(Math.min(a-u,n.top),0),c?(i.current=n.top,l.current&&clearTimeout(l.current),l.current=setTimeout(function(){l.current=null,i.current=null,e(!0);},1e3)):i.current=null,o.scrollTo(n);}}}}var Yt$1=system(function(t){var e=t[0],n=e.sizes,l=e.listRefresh,u=t[1].scrollTop,a=t[2].scrollToIndex,c=t[3].didMount,f=statefulStream(!0),d=statefulStream(0);return connect(pipe(c,withLatestFrom(d),filter(function(t){return 0!==t[1]}),mapTo(!1)),f),subscribe(pipe(l,withLatestFrom(f,n),filter(function(t){var e=t[1];return !$$1(t[2].sizeTree)&&!e}),withLatestFrom(d)),function(t){var e=t[1];handleNext(u,function(){publish(f,!0);}),setTimeout(function(){publish(a,e);});}),{scrolledToInitialItem:f,initialTopMostItemIndex:d}},tup(yt$1,j$1,Ht$1,D$1),{singleton:!0});function Zt$1(t){return !!t&&("smooth"===t?"smooth":"auto")}var qt$1=system(function(t){var e=t[0],n=e.totalCount,r=e.listRefresh,a=t[1],c=a.isAtBottom,f=a.atBottomState,h=t[2].scrollToIndex,p=t[3].scrolledToInitialItem,C=t[4],S=C.propsReady,T=C.didMount,y=statefulStream(!1),b=null;function k(t,e){publish(h,{index:t-1,align:"end",behavior:e});}return subscribe(pipe(combineLatest(pipe(duc(n),skip(1)),T),withLatestFrom(duc(y),c,p),map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return "function"==typeof t?Zt$1(t(e)):e&&Zt$1(t)}(t[1],t[2]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),filter(function(t){return t.shouldFollow})),function(t){var e=t.totalCount,n=t.followOutputBehavior;b&&(b(),b=null),b=handleNext(r,function(){k(e,n),b=null;});}),subscribe(pipe(combineLatest(duc(y),n,S),filter(function(t){return t[0]&&t[2]}),scan(function(t,e){var n=e[1];return {refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),filter(function(t){return t.refreshed}),withLatestFrom(y,n)),function(t){var e=t[1],n=t[2],o=handleNext(f,function(t){!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||b||k(n,"auto");});setTimeout(o,100);}),subscribe(pipe(combineLatest(duc(y),f),withLatestFrom(n)),function(t){var e=t[0],n=e[1];e[0]&&!n.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===n.notAtBottomBecause&&k(t[1],"auto");}),{followOutput:y}},tup(yt$1,K$1,Ht$1,Yt$1,D$1));function $t$1(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var Jt$1=system(function(t){var e=t[0],o=e.totalCount,l=e.groupIndices,f=e.sizes,d=t[1],m=d.scrollTop,h=d.headerHeight,p=stream(),g=stream(),I=streamFromEmitter(pipe(p,map($t$1)));return connect(pipe(I,map(prop("totalCount"))),o),connect(pipe(I,map(prop("groupIndices"))),l),connect(pipe(combineLatest(m,f,h),filter(function(t){return Tt$1(t[1])}),map(function(t){return X$1(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),distinctUntilChanged(),map(function(t){return [t]})),g),{groupCounts:p,topItemsIndexes:g}},tup(yt$1,j$1)),Qt$1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function Xt$1(t,e,n){if(0===t.length)return [];if(!Tt$1(e))return t.map(function(t){return A$1({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=at$1(e.groupOffsetTree,t[0].index,t[t.length-1].index),l=void 0,u=0,a=N$1(t);!(o=a()).done;){var s=o.value;(!l||l.end<s.index)&&(l=i.shift(),u=e.groupIndices.indexOf(l.start)),r.push(A$1({},s.index===l.start?{type:"group",index:u}:{index:s.index-(u+1)+n,groupIndex:u},{size:s.size,offset:s.offset,originalIndex:s.index,data:s.data}));}return r}function te$1(t,e,n,o,r){var i=0,l=0;if(t.length>0){i=t[0].offset;var u=t[t.length-1];l=u.offset+u.size;}var a=i,s=o.lastOffset+(n-o.lastIndex)*o.lastSize-l;return {items:Xt$1(t,o,r),topItems:Xt$1(e,o,r),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:s,top:a,bottom:l,totalCount:n}}var ee$1,ne$1,oe$1,re$1=system(function(t){var e=t[0],l=e.sizes,f=e.totalCount,m=e.data,h=e.firstItemIndex,p=t[1],g=t[2],I=g.visibleRange,C=g.listBoundary,w=g.topListHeight,y=t[3],H=y.scrolledToInitialItem,z=y.initialTopMostItemIndex,R=t[4].topListHeight,B=t[5],E=t[6].didMount,L=statefulStream([]),M=stream();connect(p.topItemsIndexes,L);var O=statefulStreamFromEmitter(pipe(combineLatest(E,duc(I),duc(f),duc(l),duc(z),H,duc(L),duc(h),m),filter(function(t){return t[0]}),map(function(t){var e=t[1],n=e[0],o=e[1],r=t[2],i=t[4],l=t[5],u=t[6],a=t[7],s=t[8],c=t[3],f=c.sizeTree,d=c.offsetTree;if(0===r||0===n&&0===o)return Qt$1;if($$1(f))return te$1(function(t,e,n){if(Tt$1(e)){var o=xt$1(t,e);return [{index:X$1(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return [{index:t,size:0,offset:0,data:n&&n[0]}]}(i,c,s),[],r,c,a);var m=[];if(u.length>0)for(var h,p=u[0],v=u[u.length-1],g=0,I=N$1(at$1(f,p,v));!(h=I()).done;)for(var C=h.value,S=C.value,x=Math.max(C.start,p),T=Math.min(C.end,v),w=x;w<=T;w++)m.push({index:w,size:S,offset:g,data:s&&s[w]}),g+=S;if(!l)return te$1([],m,r,c,a);var y=u.length>0?u[u.length-1]+1:0,b=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,mt$1(t,o,vt$1).offset)),st$1((i=n,u=dt$1(r=t,e,l=gt$1),a=dt$1(r,i,l,u),r.slice(u,a+1)),It$1);var r,i,l,u,a;}(d,n,o,y);if(0===b.length)return null;var H=r-1;return te$1(tap([],function(t){for(var e,r=N$1(b);!(e=r()).done;){var i=e.value,l=i.value,u=l.offset,a=i.start,c=l.size;l.offset<n&&(u+=((a+=Math.floor((n-l.offset)/c))-i.start)*c),a<y&&(u+=(y-a)*c,a=y);for(var f=Math.min(i.end,H),d=a;d<=f&&!(u>=o);d++)t.push({index:d,size:c,offset:u,data:s&&s[d]}),u+=c;}}),m,r,c,a)}),filter(function(t){return null!==t}),distinctUntilChanged()),Qt$1);return connect(pipe(m,filter(function(t){return void 0!==t}),map(function(t){return t.length})),f),connect(pipe(O,map(prop("topListHeight"))),R),connect(R,w),connect(O,B.listStateListener),connect(pipe(O,map(function(t){return [t.top,t.bottom]})),C),connect(pipe(O,map(function(t){return t.items})),M),A$1({listState:O,topItemsIndexes:L,endReached:streamFromEmitter(pipe(O,filter(function(t){return t.items.length>0}),withLatestFrom(f,m),filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),map(function(t){return [t[1]-1,t[2]]}),distinctUntilChanged(_$1),map(function(t){return t[0]}))),startReached:streamFromEmitter(pipe(O,throttleTime(200),filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),map(function(t){return t.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(O,filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V$1))),itemsRendered:M},B)},tup(yt$1,Jt$1,Rt$1,Yt$1,Ht$1,K$1,D$1),{singleton:!0}),ie$1=system(function(t){var e=t[0],n=e.sizes,l=e.firstItemIndex,a=e.data,c=t[1].listState,f=t[2].didMount,d=statefulStream(0);return connect(pipe(f,withLatestFrom(d),filter(function(t){return 0!==t[1]}),withLatestFrom(n,l,a),map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=void 0===r?[]:r,l=0;if(n.groupIndices.length>0)for(var u,a=N$1(n.groupIndices);!((u=a()).done||u.value-l>=e);)l++;var s=e+l;return te$1(Array.from({length:s}).map(function(t,e){return {index:e,size:0,offset:0,data:i[e]}}),[],s,n,o)})),c),{initialItemCount:d}},tup(yt$1,re$1,D$1),{singleton:!0}),le$1=system(function(t){var e=t[0].topItemsIndexes,n=statefulStream(0);return connect(pipe(n,filter(function(t){return t>0}),map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),e),{topItemCount:n}},tup(re$1)),ue$1=system(function(t){var e=t[0],o=e.footerHeight,l=e.headerHeight,a=t[1].listState,s=stream(),c=statefulStreamFromEmitter(pipe(combineLatest(o,l,a),map(function(t){var e=t[2];return t[0]+t[1]+e.offsetBottom+e.bottom})),0);return connect(duc(c),s),{totalListHeight:c,totalListHeightChanged:s}},tup(j$1,re$1),{singleton:!0}),ae$1=system(function(t){var e=t[0],n=e.scrollBy,o=e.scrollTop,c=e.scrollDirection,f=e.deviation,d=e.scrollingInProgress,m=t[1].isScrolling,h=t[3],p=h.beforeUnshiftWith,C=h.sizes,w=streamFromEmitter(pipe(t[2].listState,scan(function(t,e){var n=t[1],o=e.items,r=0;if(n.length>0&&o.length>0){var i=o[0].originalIndex,l=n[0].originalIndex;if(0!==i||0!==l)if(i===l)r=o[0].size-n[0].size;else for(var u=function(t){var e=o[t],i=n.find(function(t){return t.originalIndex===e.originalIndex});return i?e.offset!==i.offset?(r=e.offset-i.offset,"break"):void 0:"continue"},a=o.length-1;a>=0;a--){var s=u(a);if("continue"!==s&&"break"===s)break}}return [r,o]},[0,[]]),filter(function(t){return 0!==t[0]}),withLatestFrom(o,c,d),filter(function(t){return !t[3]&&0!==t[1]&&t[2]===G$1}),map(function(t){return t[0][0]})));return connect(pipe(w,withLatestFrom(f),map(function(t){return t[1]-t[0]})),f),subscribe(pipe(combineLatest(statefulStreamFromEmitter(m,!1),f),filter(function(t){return !t[0]&&0!==t[1]}),map(function(t){return t[1]}),throttleTime(1)),function(t){t>0?(publish(n,{top:-t,behavior:"auto"}),publish(f,0)):(publish(f,0),publish(n,{top:-t,behavior:"auto"}));}),connect(pipe(p,withLatestFrom(C),map(function(t){return t[0]*t[1].lastSize})),w),{deviation:f}},tup(j$1,K$1,re$1,yt$1)),se$1=system(function(t){var e=t[0].totalListHeight,n=t[1].didMount,r=t[2].scrollTo,l=statefulStream(0);return subscribe(pipe(n,withLatestFrom(l),filter(function(t){return 0!==t[1]}),map(function(t){return {top:t[1]}})),function(t){handleNext(pipe(e,filter(function(t){return 0!==t})),function(){setTimeout(function(){publish(r,t);});});}),{initialScrollTop:l}},tup(ue$1,D$1,j$1),{singleton:!0}),ce$1=system(function(t){var e=t[0].viewportHeight,n=t[1].totalListHeight,r=statefulStream(!1);return {alignToBottom:r,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(r,e,n),filter(function(t){return t[0]}),map(function(t){return Math.max(0,t[1]-t[2])}),distinctUntilChanged()),0)}},tup(j$1,ue$1),{singleton:!0}),fe$1=system(function(t){return A$1({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])},tup(Rt$1,ie$1,D$1,Y$1,ue$1,se$1,ce$1,Bt$1)),de$1=system(function(t){var e=t[0],n=e.totalCount,o=e.sizeRanges,l=e.fixedItemSize,a=e.defaultItemSize,s=e.trackItemSizes,c=e.itemSize,f=e.data,d=e.firstItemIndex,m=e.groupIndices,h=t[1],p=h.initialTopMostItemIndex,v=h.scrolledToInitialItem,g=t[2],I=t[3],C=t[4],S=C.listState,x=C.topItemsIndexes,T=F$1(C,["listState","topItemsIndexes"]),w=t[5].scrollToIndex,y=t[7].topItemCount,k=t[8].groupCounts,H=t[9];return connect(T.rangeChanged,H.scrollSeekRangeChanged),connect(pipe(H.windowViewportRect,map(prop("visibleHeight"))),g.viewportHeight),A$1({totalCount:n,data:f,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:p,scrolledToInitialItem:v,topItemsIndexes:x,topItemCount:y,groupCounts:k,fixedItemHeight:l,defaultItemHeight:a},I,{listState:S,scrollToIndex:w,trackItemSizes:s,itemSize:c,groupIndices:m},T,H,g)},tup(yt$1,Yt$1,j$1,qt$1,re$1,Ht$1,ae$1,le$1,Jt$1,fe$1)),me$1=(ee$1=function(){if("undefined"==typeof document)return "sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"},oe$1=!1,function(){return oe$1||(oe$1=!0,ne$1=ee$1()),ne$1});function he$1(t){return t}var pe$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream(function(t){return "Group "+t}),n=statefulStream({}),r=statefulStream(he$1),l=statefulStream("div"),a=statefulStream(noop),s=function(t,e){return void 0===e&&(e=null),statefulStreamFromEmitter(pipe(n,map(function(e){return e[t]}),distinctUntilChanged()),e)};return {itemContent:t,groupContent:e,components:n,computeItemKey:r,headerFooterTag:l,scrollerRef:a,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function ve$1(t,e){var o=stream();return subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+e,"color: red;","color: inherit;","color: blue;")}),connect(o,t),o}var ge$1=system(function(t){var e=t[0],o=t[1],l={item:ve$1(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:ve$1(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:ve$1(e.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:ve$1(e.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:ve$1(e.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function a(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),A$1({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(l.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(l.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(l.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=F$1(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,A$1({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),a(l.footer,"Footer","footer"),a(l.header,"Header","header"),a(l.ItemContainer,"Item","ItemContainer"),a(l.ListContainer,"List","ListContainer"),a(l.ScrollContainer,"Scroller","ScrollContainer"),a(l.emptyComponent,"EmptyPlaceholder","emptyComponent"),a(l.GroupContainer,"Group","GroupContainer"),A$1({},e,o,l)},tup(de$1,pe$1)),Ie$1=function(t){return React.createElement("div",{style:{height:t.height}})},Ce$1={position:me$1(),zIndex:1},Se$1=React.memo(function(t){var e,n,o=t.showTopList,r=void 0!==o&&o,i=Oe$1("listState"),l=Oe$1("deviation"),u=Me$1("sizeRanges"),a=Oe$1("itemContent"),s=Oe$1("groupContent"),c=Oe$1("trackItemSizes"),f=(e=u,n=Oe$1("itemSize"),jt$1(function(t){var o=function(t,e,n){var o=t.length;if(0===o)return null;for(var r=[],i=0;i<o;i++){var l=t.item(i);if(l&&void 0!==l.dataset.index){var u=parseInt(l.dataset.index),a=parseInt(l.dataset.knownSize),s=e(l,"offsetHeight");if(0===s)throw new Error("Zero-sized element, this should not happen");if(s!==a){var c=r[r.length-1];0===r.length||c.size!==s||c.endIndex!==u-1?r.push({startIndex:u,endIndex:u,size:s}):r[r.length-1].endIndex++;}}}return r}(t.children,n);null!==o&&e(o);},c)),d=Oe$1("EmptyPlaceholder"),m=Oe$1("ScrollSeekPlaceholder")||Ie$1,h=Oe$1("ListComponent"),p=Oe$1("ItemComponent"),v=Oe$1("GroupComponent"),g=Oe$1("computeItemKey"),I=Oe$1("isSeeking"),C=Oe$1("groupIndices").length>0,S=Oe$1("paddingTopAddition"),x=Oe$1("scrolledToInitialItem"),T=r?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+S,paddingBottom:i.offsetBottom,marginTop:l};return !r&&0===i.items.length&&d&&x?React.createElement(d):React.createElement(h,{ref:f,style:T},(r?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=g(e,t.data);return I?React.createElement(m,{key:n,index:t.index,height:t.size}):"group"===t.type?React.createElement(v,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Ce$1},s(t.index)):React.createElement(p,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex},C?a(t.index,t.groupIndex,t.data):a(t.index,t.data))}))}),xe$1={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Te$1={width:"100%",height:"100%",position:"absolute",top:0},we$1={width:"100%",position:me$1(),top:0},ye$1=React.memo(function(){var t=Oe$1("HeaderComponent"),e=Me$1("headerHeight"),n=Oe$1("headerFooterTag"),o=jt$1(function(t){return e(ht$1(t,"height"))});return t?React.createElement(n,{ref:o},React.createElement(t)):null}),be$1=React.memo(function(){var t=Oe$1("FooterComponent"),e=Me$1("footerHeight"),n=Oe$1("headerFooterTag"),o=jt$1(function(t){return e(ht$1(t,"height"))});return t?React.createElement(n,{ref:o},React.createElement(t)):null});function ke$1(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=F$1(t,["style","children"]),u=e("scrollTop"),a=o("ScrollerComponent"),s=Kt$1(u,e("smoothScrollTargetReached"),a,o("scrollerRef")),c=s.scrollerRef,f=s.scrollByCallback;return n("scrollTo",s.scrollToCallback),n("scrollBy",f),React.createElement(a,A$1({ref:c,style:A$1({},xe$1,r),tabIndex:0},l),i)})}function He$1(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=F$1(t,["style","children"]),u=e("windowScrollTop"),a=o("ScrollerComponent"),s=e("smoothScrollTargetReached"),c=o("totalListHeight"),f=Kt$1(u,s,a),d=f.scrollerRef,m=f.scrollByCallback,h=f.scrollToCallback;return Ut$1(function(){return d.current=window,function(){d.current=null;}},[d]),n("windowScrollTo",h),n("scrollBy",m),React.createElement(a,A$1({style:A$1({position:"relative"},r,0!==c?{height:c}:{})},l),i)})}var ze$1=function(t){var e=t.children,n=Me$1("viewportHeight"),o=jt$1(compose(n,function(t){return ht$1(t,"height")}));return React.createElement("div",{style:Te$1,ref:o},e)},Re$1=function(t){var e=t.children,n=Dt$1(Me$1("windowViewportRect"));return React.createElement("div",{ref:n,style:Te$1},e)},Be$1=function(t){var e=t.children,n=Oe$1("TopItemListComponent"),o=Oe$1("headerHeight"),r=A$1({},we$1,{marginTop:o+"px"});return React.createElement(n||"div",{style:r},e)},Ee$1=systemToComponent(ge$1,{required:{},optional:{followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React.memo(function(t){var e=Oe$1("useWindowScroll"),n=Oe$1("topItemsIndexes").length>0,o=e?Re$1:ze$1;return React.createElement(e?Fe$1:Ae$1,Object.assign({},t),React.createElement(o,null,React.createElement(ye$1,null),React.createElement(Se$1,null),React.createElement(be$1,null)),n&&React.createElement(Be$1,null,React.createElement(Se$1,{showTopList:!0})))})),Le$1=Ee$1.Component,Me$1=Ee$1.usePublisher,Oe$1=Ee$1.useEmitterValue,Pe$1=Ee$1.useEmitter,Ae$1=ke$1({usePublisher:Me$1,useEmitterValue:Oe$1,useEmitter:Pe$1}),Fe$1=He$1({usePublisher:Me$1,useEmitterValue:Oe$1,useEmitter:Pe$1}),We$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream({}),n=statefulStream("virtuoso-grid-item"),r=statefulStream("virtuoso-grid-list"),l=statefulStream(he$1),a=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(e,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {itemContent:t,components:e,computeItemKey:l,itemClassName:n,listClassName:r,scrollerRef:a,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ne$1=system(function(t){var e=t[0],o=t[1],l={item:ve$1(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function a(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),A$1({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=F$1(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,A$1({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),a(l.ItemContainer,"Item","ItemContainer"),a(l.ListContainer,"List","ListContainer"),a(l.ScrollContainer,"Scroller","ScrollContainer"),A$1({},e,o,l)},tup(Nt$1,We$1)),_e$1=React.memo(function(){var t=Ke$1("gridState"),e=Ke$1("listClassName"),n=Ke$1("itemClassName"),o=Ke$1("itemContent"),r=Ke$1("computeItemKey"),i=Ke$1("isSeeking"),l=Ke$1("ItemComponent"),u=Ke$1("ListComponent"),a=Ke$1("ScrollSeekPlaceholder"),s=Ue$1("itemDimensions"),c=jt$1(function(t){var e=t.firstChild;e&&s(e.getBoundingClientRect());});return React.createElement(u,{ref:c,className:e,style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}},t.items.map(function(e){var u=r(e.index);return i?React.createElement(a,{key:u,style:{height:t.itemHeight,width:t.itemWidth}}):React.createElement(l,{className:n,"data-index":e.index,key:u},o(e.index))}))}),Ve$1=function(t){var e=t.children,n=Ue$1("viewportDimensions"),o=jt$1(function(t){n(t.getBoundingClientRect());});return React.createElement("div",{style:Te$1,ref:o},e)},Ge=function(t){var e=t.children,n=Dt$1(Ue$1("windowViewportRect"));return React.createElement("div",{ref:n,style:Te$1},e)},je$1=systemToComponent(Ne$1,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React.memo(function(t){var e=A$1({},t),n=Ke$1("useWindowScroll"),o=n?Ge:Ve$1;return React.createElement(n?qe:Ze$1,Object.assign({},e),React.createElement(o,null,React.createElement(_e$1,null)))})),Ue$1=je$1.usePublisher,Ke$1=je$1.useEmitterValue,Ye$1=je$1.useEmitter,Ze$1=ke$1({usePublisher:Ue$1,useEmitterValue:Ke$1,useEmitter:Ye$1}),qe=He$1({usePublisher:Ue$1,useEmitterValue:Ke$1,useEmitter:Ye$1}),$e=Le$1;
61864
-
61865
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useGiphyPreview = function (separateGiphyPreview) {
61866
- var _a = React.useState(), giphyPreviewMessage = _a[0], setGiphyPreviewMessage = _a[1];
61867
- var client = useChatContext().client;
61868
- React.useEffect(function () {
61869
- var handleEvent = function (event) {
61870
- var message = event.message, user = event.user;
61871
- if ((message === null || message === void 0 ? void 0 : message.command) === 'giphy' && (user === null || user === void 0 ? void 0 : user.id) === client.userID) {
61872
- setGiphyPreviewMessage(undefined);
61873
- }
61874
- };
61875
- if (separateGiphyPreview)
61876
- client.on('message.new', handleEvent);
61877
- return function () { return client.off('message.new', handleEvent); };
61878
- }, [separateGiphyPreview]);
61879
- return { giphyPreviewMessage: giphyPreviewMessage, setGiphyPreviewMessage: setGiphyPreviewMessage };
61880
- };
61881
-
61882
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function useNewMessageNotification(messages, currentUserId) {
61883
- var _a = React.useState(false), newMessagesNotification = _a[0], setNewMessagesNotification = _a[1];
61884
- /**
61885
- * use the flag to avoid the initial "new messages" quick blink
61886
- */
61887
- var didMount = React.useRef(false);
61888
- var lastMessageId = React.useRef('');
61889
- var atBottom = React.useRef(false);
61890
- React.useEffect(function () {
61891
- var _a;
61892
- /* handle scrolling behavior for new messages */
61893
- if (!(messages === null || messages === void 0 ? void 0 : messages.length))
61894
- return;
61895
- var lastMessage = messages[messages.length - 1];
61896
- var prevMessageId = lastMessageId.current;
61897
- lastMessageId.current = lastMessage.id || ''; // update last message id
61898
- /* do nothing if new messages are loaded from top(loadMore) */
61899
- if (lastMessage.id === prevMessageId)
61900
- return;
61901
- /* if list is already at the bottom return, followOutput will do the job */
61902
- if (atBottom.current)
61903
- return;
61904
- /* if the new message belongs to current user scroll to bottom */
61905
- if (((_a = lastMessage.user) === null || _a === void 0 ? void 0 : _a.id) !== currentUserId && didMount.current) {
61906
- /* otherwise just show newMessage notification */
61907
- setNewMessagesNotification(true);
61908
- }
61909
- didMount.current = true;
61910
- }, [currentUserId, messages]);
61911
- return { atBottom: atBottom, newMessagesNotification: newMessagesNotification, setNewMessagesNotification: setNewMessagesNotification };
61912
- }
61913
-
61914
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function usePrependedMessagesCount(messages) {
61915
- var _a;
61916
- var currentFirstMessageId = (_a = messages === null || messages === void 0 ? void 0 : messages[0]) === null || _a === void 0 ? void 0 : _a.id;
61917
- var firstMessageId = React.useRef(currentFirstMessageId);
61918
- var earliestMessageId = React.useRef(currentFirstMessageId);
61919
- var previousNumItemsPrepended = React.useRef(0);
61920
- var numItemsPrepended = React.useMemo(function () {
61921
- if (!messages || !messages.length) {
61922
- return 0;
61923
- }
61924
- // if no new messages were prepended, return early (same amount as before)
61925
- if (currentFirstMessageId === earliestMessageId.current) {
61926
- return previousNumItemsPrepended.current;
61927
- }
61928
- if (!firstMessageId.current) {
61929
- firstMessageId.current = currentFirstMessageId;
61930
- }
61931
- earliestMessageId.current = currentFirstMessageId;
61932
- // if new messages were prepended, find out how many
61933
- // start with this number because there cannot be fewer prepended items than before
61934
- for (var i = previousNumItemsPrepended.current; i < messages.length; i += 1) {
61935
- if (messages[i].id === firstMessageId.current) {
61936
- previousNumItemsPrepended.current = i;
61937
- return i;
61938
- }
61939
- }
61940
- return 0;
61941
- // TODO: there's a bug here, the messages prop is the same array instance (something mutates it)
61942
- // that's why the second dependency is necessary
61943
- }, [messages, messages === null || messages === void 0 ? void 0 : messages.length]);
61944
- return numItemsPrepended;
61945
- }
61946
-
61947
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function useShouldForceScrollToBottom(messages, currentUserId) {
61948
- var lastFocusedOwnMessage = React.useRef('');
61949
- var initialFocusRegistered = React.useRef(false);
61950
- function recheckForNewOwnMessage() {
61951
- var _a;
61952
- if (messages && messages.length > 0) {
61953
- var lastMessage = messages[messages.length - 1];
61954
- if (((_a = lastMessage.user) === null || _a === void 0 ? void 0 : _a.id) === currentUserId &&
61955
- lastFocusedOwnMessage.current !== lastMessage.id) {
61956
- lastFocusedOwnMessage.current = lastMessage.id;
61957
- return true;
61958
- }
61959
- }
61960
- return false;
61961
- }
61962
- React.useEffect(function () {
61963
- if (messages && messages.length && !initialFocusRegistered.current) {
61964
- initialFocusRegistered.current = true;
61965
- recheckForNewOwnMessage();
61966
- }
61967
- }, [messages, messages === null || messages === void 0 ? void 0 : messages.length]);
61968
- return recheckForNewOwnMessage;
61190
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function useShouldForceScrollToBottom(messages, currentUserId) {
61191
+ var lastFocusedOwnMessage = React.useRef('');
61192
+ var initialFocusRegistered = React.useRef(false);
61193
+ function recheckForNewOwnMessage() {
61194
+ var _a;
61195
+ if (messages && messages.length > 0) {
61196
+ var lastMessage = messages[messages.length - 1];
61197
+ if (((_a = lastMessage.user) === null || _a === void 0 ? void 0 : _a.id) === currentUserId &&
61198
+ lastFocusedOwnMessage.current !== lastMessage.id) {
61199
+ lastFocusedOwnMessage.current = lastMessage.id;
61200
+ return true;
61201
+ }
61202
+ }
61203
+ return false;
61204
+ }
61205
+ React.useEffect(function () {
61206
+ if (messages && messages.length && !initialFocusRegistered.current) {
61207
+ initialFocusRegistered.current = true;
61208
+ recheckForNewOwnMessage();
61209
+ }
61210
+ }, [messages, messages === null || messages === void 0 ? void 0 : messages.length]);
61211
+ return recheckForNewOwnMessage;
61969
61212
  }
61970
61213
 
61971
61214
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var PREPEND_OFFSET = Math.pow(10, 7);
61972
61215
  var VirtualizedMessageListWithContext = function (props) {
61973
- var channel = props.channel, closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, customMessageRenderer = props.customMessageRenderer, defaultItemHeight = props.defaultItemHeight, _a = props.disableDateSeparator, disableDateSeparator = _a === void 0 ? true : _a, hasMore = props.hasMore, _b = props.hideDeletedMessages, hideDeletedMessages = _b === void 0 ? false : _b, _c = props.hideNewMessageSeparator, hideNewMessageSeparator = _c === void 0 ? false : _c, loadingMore = props.loadingMore, loadMore = props.loadMore, propMessage = props.Message, _d = props.messageLimit, messageLimit = _d === void 0 ? 100 : _d, messages = props.messages, _e = props.overscan, overscan = _e === void 0 ? 0 : _e,
61216
+ var additionalVirtuosoProps = props.additionalVirtuosoProps, channel = props.channel, closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, customMessageRenderer = props.customMessageRenderer, defaultItemHeight = props.defaultItemHeight, _a = props.disableDateSeparator, disableDateSeparator = _a === void 0 ? true : _a, hasMore = props.hasMore, _b = props.hideDeletedMessages, hideDeletedMessages = _b === void 0 ? false : _b, _c = props.hideNewMessageSeparator, hideNewMessageSeparator = _c === void 0 ? false : _c, loadingMore = props.loadingMore, loadMore = props.loadMore, propMessage = props.Message, _d = props.messageLimit, messageLimit = _d === void 0 ? 100 : _d, messages = props.messages, _e = props.overscan, overscan = _e === void 0 ? 0 : _e,
61974
61217
  // TODO: refactor to scrollSeekPlaceHolderConfiguration and components.ScrollSeekPlaceholder, like the Virtuoso Component
61975
61218
  scrollSeekPlaceHolder = props.scrollSeekPlaceHolder, _f = props.scrollToLatestMessageOnFocus, scrollToLatestMessageOnFocus = _f === void 0 ? false : _f, _g = props.separateGiphyPreview, separateGiphyPreview = _g === void 0 ? false : _g, _h = props.shouldGroupByUser, shouldGroupByUser = _h === void 0 ? false : _h, _j = props.stickToBottomScrollBehavior, stickToBottomScrollBehavior = _j === void 0 ? 'smooth' : _j;
61976
61219
  var _k = useComponentContext(), _l = _k.DateSeparator, DateSeparator$1 = _l === void 0 ? DateSeparator : _l, _m = _k.EmptyStateIndicator, EmptyStateIndicator$1 = _m === void 0 ? EmptyStateIndicator : _m, _o = _k.GiphyPreviewMessage, GiphyPreviewMessage$1 = _o === void 0 ? GiphyPreviewMessage : _o, _p = _k.LoadingIndicator, LoadingIndicator$1 = _p === void 0 ? LoadingIndicator : _p, _q = _k.MessageNotification, MessageNotification$1 = _q === void 0 ? MessageNotification : _q, _r = _k.MessageSystem, MessageSystem = _r === void 0 ? EventComponent : _r, _s = _k.TypingIndicator, TypingIndicator = _s === void 0 ? null : _s, _t = _k.VirtualMessage, contextMessage = _t === void 0 ? MessageSimple : _t;
@@ -62098,7 +61341,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
62098
61341
  var virtualizedMessageListClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.virtualizedMessageList) || 'str-chat__virtual-list';
62099
61342
  return (React__default$1['default'].createElement(React__default$1['default'].Fragment, null,
62100
61343
  React__default$1['default'].createElement("div", { className: virtualizedMessageListClass },
62101
- React__default$1['default'].createElement($e, __assign$2({ atBottomStateChange: atBottomStateChange, components: virtuosoComponents, firstItemIndex: PREPEND_OFFSET - numItemsPrepended, followOutput: followOutput, initialTopMostItemIndex: processedMessages.length ? processedMessages.length - 1 : 0, itemContent: function (i) { return messageRenderer(processedMessages, i); }, overscan: overscan, ref: virtuoso, startReached: startReached, style: { overflowX: 'hidden' }, totalCount: processedMessages.length }, (scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {}), (defaultItemHeight ? { defaultItemHeight: defaultItemHeight } : {}))),
61344
+ React__default$1['default'].createElement(tn, __assign$2({ atBottomStateChange: atBottomStateChange, components: virtuosoComponents, firstItemIndex: PREPEND_OFFSET - numItemsPrepended, followOutput: followOutput, initialTopMostItemIndex: processedMessages.length ? processedMessages.length - 1 : 0, itemContent: function (i) { return messageRenderer(processedMessages, i); }, overscan: overscan, ref: virtuoso, startReached: startReached, style: { overflowX: 'hidden' }, totalCount: processedMessages.length }, additionalVirtuosoProps, (scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {}), (defaultItemHeight ? { defaultItemHeight: defaultItemHeight } : {}))),
62102
61345
  React__default$1['default'].createElement("div", { className: 'str-chat__list-notifications' },
62103
61346
  React__default$1['default'].createElement(MessageNotification$1, { onClick: scrollToBottom, showNotification: newMessagesNotification }, t('New Messages!')))),
62104
61347
  giphyPreviewMessage && React__default$1['default'].createElement(GiphyPreviewMessage$1, { message: giphyPreviewMessage })));
@@ -64563,7 +63806,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
64563
63806
  return string;
64564
63807
  }
64565
63808
 
64566
- var index = /*#__PURE__*/Object.freeze({
63809
+ var index$1 = /*#__PURE__*/Object.freeze({
64567
63810
  __proto__: null,
64568
63811
  'default': transliterate
64569
63812
  });
@@ -78574,32 +77817,960 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
78574
77817
  return this.between(undefined, before);
78575
77818
  }
78576
77819
 
78577
- after(after) {
78578
- return this.between(after);
78579
- }
77820
+ after(after) {
77821
+ return this.between(after);
77822
+ }
77823
+
77824
+ all() {
77825
+ return this.between();
77826
+ }
77827
+ }
77828
+
77829
+ function registerTimezones() {
77830
+ Object.keys(timezones).forEach((key) => {
77831
+ const icsData = timezones[key];
77832
+ const icsTimezone = `BEGIN:VTIMEZONE\r\nTZID:${key}\r\n${icsData}\r\nEND:VTIMEZONE`;
77833
+ const parsed = ical.parse(`BEGIN:VCALENDAR\nPRODID:-//tzurl.org//NONSGML Olson 2012h//EN\nVERSION:2.0\n${icsTimezone}\nEND:VCALENDAR`);
77834
+ const comp = new ical.Component(parsed);
77835
+ const vtimezone = comp.getFirstSubcomponent('vtimezone');
77836
+
77837
+ ical.TimezoneService.register(key, new ical.Timezone(vtimezone));
77838
+ });
77839
+ }
77840
+
77841
+ registerTimezones();
77842
+
77843
+ var icalExpander = IcalExpander;
77844
+
77845
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
77846
+ /**
77847
+ * A collection of shims that provide minimal functionality of the ES6 collections.
77848
+ *
77849
+ * These implementations are not meant to be used outside of the ResizeObserver
77850
+ * modules as they cover only a limited range of use cases.
77851
+ */
77852
+ /* eslint-disable require-jsdoc, valid-jsdoc */
77853
+ var MapShim = (function () {
77854
+ if (typeof Map !== 'undefined') {
77855
+ return Map;
77856
+ }
77857
+ /**
77858
+ * Returns index in provided array that matches the specified key.
77859
+ *
77860
+ * @param {Array<Array>} arr
77861
+ * @param {*} key
77862
+ * @returns {number}
77863
+ */
77864
+ function getIndex(arr, key) {
77865
+ var result = -1;
77866
+ arr.some(function (entry, index) {
77867
+ if (entry[0] === key) {
77868
+ result = index;
77869
+ return true;
77870
+ }
77871
+ return false;
77872
+ });
77873
+ return result;
77874
+ }
77875
+ return /** @class */ (function () {
77876
+ function class_1() {
77877
+ this.__entries__ = [];
77878
+ }
77879
+ Object.defineProperty(class_1.prototype, "size", {
77880
+ /**
77881
+ * @returns {boolean}
77882
+ */
77883
+ get: function () {
77884
+ return this.__entries__.length;
77885
+ },
77886
+ enumerable: true,
77887
+ configurable: true
77888
+ });
77889
+ /**
77890
+ * @param {*} key
77891
+ * @returns {*}
77892
+ */
77893
+ class_1.prototype.get = function (key) {
77894
+ var index = getIndex(this.__entries__, key);
77895
+ var entry = this.__entries__[index];
77896
+ return entry && entry[1];
77897
+ };
77898
+ /**
77899
+ * @param {*} key
77900
+ * @param {*} value
77901
+ * @returns {void}
77902
+ */
77903
+ class_1.prototype.set = function (key, value) {
77904
+ var index = getIndex(this.__entries__, key);
77905
+ if (~index) {
77906
+ this.__entries__[index][1] = value;
77907
+ }
77908
+ else {
77909
+ this.__entries__.push([key, value]);
77910
+ }
77911
+ };
77912
+ /**
77913
+ * @param {*} key
77914
+ * @returns {void}
77915
+ */
77916
+ class_1.prototype.delete = function (key) {
77917
+ var entries = this.__entries__;
77918
+ var index = getIndex(entries, key);
77919
+ if (~index) {
77920
+ entries.splice(index, 1);
77921
+ }
77922
+ };
77923
+ /**
77924
+ * @param {*} key
77925
+ * @returns {void}
77926
+ */
77927
+ class_1.prototype.has = function (key) {
77928
+ return !!~getIndex(this.__entries__, key);
77929
+ };
77930
+ /**
77931
+ * @returns {void}
77932
+ */
77933
+ class_1.prototype.clear = function () {
77934
+ this.__entries__.splice(0);
77935
+ };
77936
+ /**
77937
+ * @param {Function} callback
77938
+ * @param {*} [ctx=null]
77939
+ * @returns {void}
77940
+ */
77941
+ class_1.prototype.forEach = function (callback, ctx) {
77942
+ if (ctx === void 0) { ctx = null; }
77943
+ for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
77944
+ var entry = _a[_i];
77945
+ callback.call(ctx, entry[1], entry[0]);
77946
+ }
77947
+ };
77948
+ return class_1;
77949
+ }());
77950
+ })();
77951
+
77952
+ /**
77953
+ * Detects whether window and document objects are available in current environment.
77954
+ */
77955
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
77956
+
77957
+ // Returns global object of a current environment.
77958
+ var global$1 = (function () {
77959
+ if (typeof global$2 !== 'undefined' && global$2.Math === Math) {
77960
+ return global$2;
77961
+ }
77962
+ if (typeof self !== 'undefined' && self.Math === Math) {
77963
+ return self;
77964
+ }
77965
+ if (typeof window !== 'undefined' && window.Math === Math) {
77966
+ return window;
77967
+ }
77968
+ // eslint-disable-next-line no-new-func
77969
+ return Function('return this')();
77970
+ })();
77971
+
77972
+ /**
77973
+ * A shim for the requestAnimationFrame which falls back to the setTimeout if
77974
+ * first one is not supported.
77975
+ *
77976
+ * @returns {number} Requests' identifier.
77977
+ */
77978
+ var requestAnimationFrame$1 = (function () {
77979
+ if (typeof requestAnimationFrame === 'function') {
77980
+ // It's required to use a bounded function because IE sometimes throws
77981
+ // an "Invalid calling object" error if rAF is invoked without the global
77982
+ // object on the left hand side.
77983
+ return requestAnimationFrame.bind(global$1);
77984
+ }
77985
+ return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
77986
+ })();
77987
+
77988
+ // Defines minimum timeout before adding a trailing call.
77989
+ var trailingTimeout = 2;
77990
+ /**
77991
+ * Creates a wrapper function which ensures that provided callback will be
77992
+ * invoked only once during the specified delay period.
77993
+ *
77994
+ * @param {Function} callback - Function to be invoked after the delay period.
77995
+ * @param {number} delay - Delay after which to invoke callback.
77996
+ * @returns {Function}
77997
+ */
77998
+ function throttle (callback, delay) {
77999
+ var leadingCall = false, trailingCall = false, lastCallTime = 0;
78000
+ /**
78001
+ * Invokes the original callback function and schedules new invocation if
78002
+ * the "proxy" was called during current request.
78003
+ *
78004
+ * @returns {void}
78005
+ */
78006
+ function resolvePending() {
78007
+ if (leadingCall) {
78008
+ leadingCall = false;
78009
+ callback();
78010
+ }
78011
+ if (trailingCall) {
78012
+ proxy();
78013
+ }
78014
+ }
78015
+ /**
78016
+ * Callback invoked after the specified delay. It will further postpone
78017
+ * invocation of the original function delegating it to the
78018
+ * requestAnimationFrame.
78019
+ *
78020
+ * @returns {void}
78021
+ */
78022
+ function timeoutCallback() {
78023
+ requestAnimationFrame$1(resolvePending);
78024
+ }
78025
+ /**
78026
+ * Schedules invocation of the original function.
78027
+ *
78028
+ * @returns {void}
78029
+ */
78030
+ function proxy() {
78031
+ var timeStamp = Date.now();
78032
+ if (leadingCall) {
78033
+ // Reject immediately following calls.
78034
+ if (timeStamp - lastCallTime < trailingTimeout) {
78035
+ return;
78036
+ }
78037
+ // Schedule new call to be in invoked when the pending one is resolved.
78038
+ // This is important for "transitions" which never actually start
78039
+ // immediately so there is a chance that we might miss one if change
78040
+ // happens amids the pending invocation.
78041
+ trailingCall = true;
78042
+ }
78043
+ else {
78044
+ leadingCall = true;
78045
+ trailingCall = false;
78046
+ setTimeout(timeoutCallback, delay);
78047
+ }
78048
+ lastCallTime = timeStamp;
78049
+ }
78050
+ return proxy;
78051
+ }
78052
+
78053
+ // Minimum delay before invoking the update of observers.
78054
+ var REFRESH_DELAY = 20;
78055
+ // A list of substrings of CSS properties used to find transition events that
78056
+ // might affect dimensions of observed elements.
78057
+ var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
78058
+ // Check if MutationObserver is available.
78059
+ var mutationObserverSupported = typeof MutationObserver !== 'undefined';
78060
+ /**
78061
+ * Singleton controller class which handles updates of ResizeObserver instances.
78062
+ */
78063
+ var ResizeObserverController = /** @class */ (function () {
78064
+ /**
78065
+ * Creates a new instance of ResizeObserverController.
78066
+ *
78067
+ * @private
78068
+ */
78069
+ function ResizeObserverController() {
78070
+ /**
78071
+ * Indicates whether DOM listeners have been added.
78072
+ *
78073
+ * @private {boolean}
78074
+ */
78075
+ this.connected_ = false;
78076
+ /**
78077
+ * Tells that controller has subscribed for Mutation Events.
78078
+ *
78079
+ * @private {boolean}
78080
+ */
78081
+ this.mutationEventsAdded_ = false;
78082
+ /**
78083
+ * Keeps reference to the instance of MutationObserver.
78084
+ *
78085
+ * @private {MutationObserver}
78086
+ */
78087
+ this.mutationsObserver_ = null;
78088
+ /**
78089
+ * A list of connected observers.
78090
+ *
78091
+ * @private {Array<ResizeObserverSPI>}
78092
+ */
78093
+ this.observers_ = [];
78094
+ this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
78095
+ this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
78096
+ }
78097
+ /**
78098
+ * Adds observer to observers list.
78099
+ *
78100
+ * @param {ResizeObserverSPI} observer - Observer to be added.
78101
+ * @returns {void}
78102
+ */
78103
+ ResizeObserverController.prototype.addObserver = function (observer) {
78104
+ if (!~this.observers_.indexOf(observer)) {
78105
+ this.observers_.push(observer);
78106
+ }
78107
+ // Add listeners if they haven't been added yet.
78108
+ if (!this.connected_) {
78109
+ this.connect_();
78110
+ }
78111
+ };
78112
+ /**
78113
+ * Removes observer from observers list.
78114
+ *
78115
+ * @param {ResizeObserverSPI} observer - Observer to be removed.
78116
+ * @returns {void}
78117
+ */
78118
+ ResizeObserverController.prototype.removeObserver = function (observer) {
78119
+ var observers = this.observers_;
78120
+ var index = observers.indexOf(observer);
78121
+ // Remove observer if it's present in registry.
78122
+ if (~index) {
78123
+ observers.splice(index, 1);
78124
+ }
78125
+ // Remove listeners if controller has no connected observers.
78126
+ if (!observers.length && this.connected_) {
78127
+ this.disconnect_();
78128
+ }
78129
+ };
78130
+ /**
78131
+ * Invokes the update of observers. It will continue running updates insofar
78132
+ * it detects changes.
78133
+ *
78134
+ * @returns {void}
78135
+ */
78136
+ ResizeObserverController.prototype.refresh = function () {
78137
+ var changesDetected = this.updateObservers_();
78138
+ // Continue running updates if changes have been detected as there might
78139
+ // be future ones caused by CSS transitions.
78140
+ if (changesDetected) {
78141
+ this.refresh();
78142
+ }
78143
+ };
78144
+ /**
78145
+ * Updates every observer from observers list and notifies them of queued
78146
+ * entries.
78147
+ *
78148
+ * @private
78149
+ * @returns {boolean} Returns "true" if any observer has detected changes in
78150
+ * dimensions of it's elements.
78151
+ */
78152
+ ResizeObserverController.prototype.updateObservers_ = function () {
78153
+ // Collect observers that have active observations.
78154
+ var activeObservers = this.observers_.filter(function (observer) {
78155
+ return observer.gatherActive(), observer.hasActive();
78156
+ });
78157
+ // Deliver notifications in a separate cycle in order to avoid any
78158
+ // collisions between observers, e.g. when multiple instances of
78159
+ // ResizeObserver are tracking the same element and the callback of one
78160
+ // of them changes content dimensions of the observed target. Sometimes
78161
+ // this may result in notifications being blocked for the rest of observers.
78162
+ activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
78163
+ return activeObservers.length > 0;
78164
+ };
78165
+ /**
78166
+ * Initializes DOM listeners.
78167
+ *
78168
+ * @private
78169
+ * @returns {void}
78170
+ */
78171
+ ResizeObserverController.prototype.connect_ = function () {
78172
+ // Do nothing if running in a non-browser environment or if listeners
78173
+ // have been already added.
78174
+ if (!isBrowser || this.connected_) {
78175
+ return;
78176
+ }
78177
+ // Subscription to the "Transitionend" event is used as a workaround for
78178
+ // delayed transitions. This way it's possible to capture at least the
78179
+ // final state of an element.
78180
+ document.addEventListener('transitionend', this.onTransitionEnd_);
78181
+ window.addEventListener('resize', this.refresh);
78182
+ if (mutationObserverSupported) {
78183
+ this.mutationsObserver_ = new MutationObserver(this.refresh);
78184
+ this.mutationsObserver_.observe(document, {
78185
+ attributes: true,
78186
+ childList: true,
78187
+ characterData: true,
78188
+ subtree: true
78189
+ });
78190
+ }
78191
+ else {
78192
+ document.addEventListener('DOMSubtreeModified', this.refresh);
78193
+ this.mutationEventsAdded_ = true;
78194
+ }
78195
+ this.connected_ = true;
78196
+ };
78197
+ /**
78198
+ * Removes DOM listeners.
78199
+ *
78200
+ * @private
78201
+ * @returns {void}
78202
+ */
78203
+ ResizeObserverController.prototype.disconnect_ = function () {
78204
+ // Do nothing if running in a non-browser environment or if listeners
78205
+ // have been already removed.
78206
+ if (!isBrowser || !this.connected_) {
78207
+ return;
78208
+ }
78209
+ document.removeEventListener('transitionend', this.onTransitionEnd_);
78210
+ window.removeEventListener('resize', this.refresh);
78211
+ if (this.mutationsObserver_) {
78212
+ this.mutationsObserver_.disconnect();
78213
+ }
78214
+ if (this.mutationEventsAdded_) {
78215
+ document.removeEventListener('DOMSubtreeModified', this.refresh);
78216
+ }
78217
+ this.mutationsObserver_ = null;
78218
+ this.mutationEventsAdded_ = false;
78219
+ this.connected_ = false;
78220
+ };
78221
+ /**
78222
+ * "Transitionend" event handler.
78223
+ *
78224
+ * @private
78225
+ * @param {TransitionEvent} event
78226
+ * @returns {void}
78227
+ */
78228
+ ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
78229
+ var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
78230
+ // Detect whether transition may affect dimensions of an element.
78231
+ var isReflowProperty = transitionKeys.some(function (key) {
78232
+ return !!~propertyName.indexOf(key);
78233
+ });
78234
+ if (isReflowProperty) {
78235
+ this.refresh();
78236
+ }
78237
+ };
78238
+ /**
78239
+ * Returns instance of the ResizeObserverController.
78240
+ *
78241
+ * @returns {ResizeObserverController}
78242
+ */
78243
+ ResizeObserverController.getInstance = function () {
78244
+ if (!this.instance_) {
78245
+ this.instance_ = new ResizeObserverController();
78246
+ }
78247
+ return this.instance_;
78248
+ };
78249
+ /**
78250
+ * Holds reference to the controller's instance.
78251
+ *
78252
+ * @private {ResizeObserverController}
78253
+ */
78254
+ ResizeObserverController.instance_ = null;
78255
+ return ResizeObserverController;
78256
+ }());
78257
+
78258
+ /**
78259
+ * Defines non-writable/enumerable properties of the provided target object.
78260
+ *
78261
+ * @param {Object} target - Object for which to define properties.
78262
+ * @param {Object} props - Properties to be defined.
78263
+ * @returns {Object} Target object.
78264
+ */
78265
+ var defineConfigurable = (function (target, props) {
78266
+ for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
78267
+ var key = _a[_i];
78268
+ Object.defineProperty(target, key, {
78269
+ value: props[key],
78270
+ enumerable: false,
78271
+ writable: false,
78272
+ configurable: true
78273
+ });
78274
+ }
78275
+ return target;
78276
+ });
78277
+
78278
+ /**
78279
+ * Returns the global object associated with provided element.
78280
+ *
78281
+ * @param {Object} target
78282
+ * @returns {Object}
78283
+ */
78284
+ var getWindowOf = (function (target) {
78285
+ // Assume that the element is an instance of Node, which means that it
78286
+ // has the "ownerDocument" property from which we can retrieve a
78287
+ // corresponding global object.
78288
+ var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
78289
+ // Return the local global object if it's not possible extract one from
78290
+ // provided element.
78291
+ return ownerGlobal || global$1;
78292
+ });
78580
78293
 
78581
- all() {
78582
- return this.between();
78583
- }
78294
+ // Placeholder of an empty content rectangle.
78295
+ var emptyRect = createRectInit(0, 0, 0, 0);
78296
+ /**
78297
+ * Converts provided string to a number.
78298
+ *
78299
+ * @param {number|string} value
78300
+ * @returns {number}
78301
+ */
78302
+ function toFloat(value) {
78303
+ return parseFloat(value) || 0;
78304
+ }
78305
+ /**
78306
+ * Extracts borders size from provided styles.
78307
+ *
78308
+ * @param {CSSStyleDeclaration} styles
78309
+ * @param {...string} positions - Borders positions (top, right, ...)
78310
+ * @returns {number}
78311
+ */
78312
+ function getBordersSize(styles) {
78313
+ var positions = [];
78314
+ for (var _i = 1; _i < arguments.length; _i++) {
78315
+ positions[_i - 1] = arguments[_i];
78316
+ }
78317
+ return positions.reduce(function (size, position) {
78318
+ var value = styles['border-' + position + '-width'];
78319
+ return size + toFloat(value);
78320
+ }, 0);
78321
+ }
78322
+ /**
78323
+ * Extracts paddings sizes from provided styles.
78324
+ *
78325
+ * @param {CSSStyleDeclaration} styles
78326
+ * @returns {Object} Paddings box.
78327
+ */
78328
+ function getPaddings(styles) {
78329
+ var positions = ['top', 'right', 'bottom', 'left'];
78330
+ var paddings = {};
78331
+ for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
78332
+ var position = positions_1[_i];
78333
+ var value = styles['padding-' + position];
78334
+ paddings[position] = toFloat(value);
78335
+ }
78336
+ return paddings;
78337
+ }
78338
+ /**
78339
+ * Calculates content rectangle of provided SVG element.
78340
+ *
78341
+ * @param {SVGGraphicsElement} target - Element content rectangle of which needs
78342
+ * to be calculated.
78343
+ * @returns {DOMRectInit}
78344
+ */
78345
+ function getSVGContentRect(target) {
78346
+ var bbox = target.getBBox();
78347
+ return createRectInit(0, 0, bbox.width, bbox.height);
78348
+ }
78349
+ /**
78350
+ * Calculates content rectangle of provided HTMLElement.
78351
+ *
78352
+ * @param {HTMLElement} target - Element for which to calculate the content rectangle.
78353
+ * @returns {DOMRectInit}
78354
+ */
78355
+ function getHTMLElementContentRect(target) {
78356
+ // Client width & height properties can't be
78357
+ // used exclusively as they provide rounded values.
78358
+ var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
78359
+ // By this condition we can catch all non-replaced inline, hidden and
78360
+ // detached elements. Though elements with width & height properties less
78361
+ // than 0.5 will be discarded as well.
78362
+ //
78363
+ // Without it we would need to implement separate methods for each of
78364
+ // those cases and it's not possible to perform a precise and performance
78365
+ // effective test for hidden elements. E.g. even jQuery's ':visible' filter
78366
+ // gives wrong results for elements with width & height less than 0.5.
78367
+ if (!clientWidth && !clientHeight) {
78368
+ return emptyRect;
78369
+ }
78370
+ var styles = getWindowOf(target).getComputedStyle(target);
78371
+ var paddings = getPaddings(styles);
78372
+ var horizPad = paddings.left + paddings.right;
78373
+ var vertPad = paddings.top + paddings.bottom;
78374
+ // Computed styles of width & height are being used because they are the
78375
+ // only dimensions available to JS that contain non-rounded values. It could
78376
+ // be possible to utilize the getBoundingClientRect if only it's data wasn't
78377
+ // affected by CSS transformations let alone paddings, borders and scroll bars.
78378
+ var width = toFloat(styles.width), height = toFloat(styles.height);
78379
+ // Width & height include paddings and borders when the 'border-box' box
78380
+ // model is applied (except for IE).
78381
+ if (styles.boxSizing === 'border-box') {
78382
+ // Following conditions are required to handle Internet Explorer which
78383
+ // doesn't include paddings and borders to computed CSS dimensions.
78384
+ //
78385
+ // We can say that if CSS dimensions + paddings are equal to the "client"
78386
+ // properties then it's either IE, and thus we don't need to subtract
78387
+ // anything, or an element merely doesn't have paddings/borders styles.
78388
+ if (Math.round(width + horizPad) !== clientWidth) {
78389
+ width -= getBordersSize(styles, 'left', 'right') + horizPad;
78390
+ }
78391
+ if (Math.round(height + vertPad) !== clientHeight) {
78392
+ height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
78393
+ }
78394
+ }
78395
+ // Following steps can't be applied to the document's root element as its
78396
+ // client[Width/Height] properties represent viewport area of the window.
78397
+ // Besides, it's as well not necessary as the <html> itself neither has
78398
+ // rendered scroll bars nor it can be clipped.
78399
+ if (!isDocumentElement(target)) {
78400
+ // In some browsers (only in Firefox, actually) CSS width & height
78401
+ // include scroll bars size which can be removed at this step as scroll
78402
+ // bars are the only difference between rounded dimensions + paddings
78403
+ // and "client" properties, though that is not always true in Chrome.
78404
+ var vertScrollbar = Math.round(width + horizPad) - clientWidth;
78405
+ var horizScrollbar = Math.round(height + vertPad) - clientHeight;
78406
+ // Chrome has a rather weird rounding of "client" properties.
78407
+ // E.g. for an element with content width of 314.2px it sometimes gives
78408
+ // the client width of 315px and for the width of 314.7px it may give
78409
+ // 314px. And it doesn't happen all the time. So just ignore this delta
78410
+ // as a non-relevant.
78411
+ if (Math.abs(vertScrollbar) !== 1) {
78412
+ width -= vertScrollbar;
78413
+ }
78414
+ if (Math.abs(horizScrollbar) !== 1) {
78415
+ height -= horizScrollbar;
78416
+ }
78417
+ }
78418
+ return createRectInit(paddings.left, paddings.top, width, height);
78419
+ }
78420
+ /**
78421
+ * Checks whether provided element is an instance of the SVGGraphicsElement.
78422
+ *
78423
+ * @param {Element} target - Element to be checked.
78424
+ * @returns {boolean}
78425
+ */
78426
+ var isSVGGraphicsElement = (function () {
78427
+ // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
78428
+ // interface.
78429
+ if (typeof SVGGraphicsElement !== 'undefined') {
78430
+ return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
78431
+ }
78432
+ // If it's so, then check that element is at least an instance of the
78433
+ // SVGElement and that it has the "getBBox" method.
78434
+ // eslint-disable-next-line no-extra-parens
78435
+ return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
78436
+ typeof target.getBBox === 'function'); };
78437
+ })();
78438
+ /**
78439
+ * Checks whether provided element is a document element (<html>).
78440
+ *
78441
+ * @param {Element} target - Element to be checked.
78442
+ * @returns {boolean}
78443
+ */
78444
+ function isDocumentElement(target) {
78445
+ return target === getWindowOf(target).document.documentElement;
78446
+ }
78447
+ /**
78448
+ * Calculates an appropriate content rectangle for provided html or svg element.
78449
+ *
78450
+ * @param {Element} target - Element content rectangle of which needs to be calculated.
78451
+ * @returns {DOMRectInit}
78452
+ */
78453
+ function getContentRect(target) {
78454
+ if (!isBrowser) {
78455
+ return emptyRect;
78456
+ }
78457
+ if (isSVGGraphicsElement(target)) {
78458
+ return getSVGContentRect(target);
78459
+ }
78460
+ return getHTMLElementContentRect(target);
78461
+ }
78462
+ /**
78463
+ * Creates rectangle with an interface of the DOMRectReadOnly.
78464
+ * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
78465
+ *
78466
+ * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
78467
+ * @returns {DOMRectReadOnly}
78468
+ */
78469
+ function createReadOnlyRect(_a) {
78470
+ var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
78471
+ // If DOMRectReadOnly is available use it as a prototype for the rectangle.
78472
+ var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
78473
+ var rect = Object.create(Constr.prototype);
78474
+ // Rectangle's properties are not writable and non-enumerable.
78475
+ defineConfigurable(rect, {
78476
+ x: x, y: y, width: width, height: height,
78477
+ top: y,
78478
+ right: x + width,
78479
+ bottom: height + y,
78480
+ left: x
78481
+ });
78482
+ return rect;
78483
+ }
78484
+ /**
78485
+ * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
78486
+ * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
78487
+ *
78488
+ * @param {number} x - X coordinate.
78489
+ * @param {number} y - Y coordinate.
78490
+ * @param {number} width - Rectangle's width.
78491
+ * @param {number} height - Rectangle's height.
78492
+ * @returns {DOMRectInit}
78493
+ */
78494
+ function createRectInit(x, y, width, height) {
78495
+ return { x: x, y: y, width: width, height: height };
78584
78496
  }
78585
78497
 
78586
- function registerTimezones() {
78587
- Object.keys(timezones).forEach((key) => {
78588
- const icsData = timezones[key];
78589
- const icsTimezone = `BEGIN:VTIMEZONE\r\nTZID:${key}\r\n${icsData}\r\nEND:VTIMEZONE`;
78590
- const parsed = ical.parse(`BEGIN:VCALENDAR\nPRODID:-//tzurl.org//NONSGML Olson 2012h//EN\nVERSION:2.0\n${icsTimezone}\nEND:VCALENDAR`);
78591
- const comp = new ical.Component(parsed);
78592
- const vtimezone = comp.getFirstSubcomponent('vtimezone');
78498
+ /**
78499
+ * Class that is responsible for computations of the content rectangle of
78500
+ * provided DOM element and for keeping track of it's changes.
78501
+ */
78502
+ var ResizeObservation = /** @class */ (function () {
78503
+ /**
78504
+ * Creates an instance of ResizeObservation.
78505
+ *
78506
+ * @param {Element} target - Element to be observed.
78507
+ */
78508
+ function ResizeObservation(target) {
78509
+ /**
78510
+ * Broadcasted width of content rectangle.
78511
+ *
78512
+ * @type {number}
78513
+ */
78514
+ this.broadcastWidth = 0;
78515
+ /**
78516
+ * Broadcasted height of content rectangle.
78517
+ *
78518
+ * @type {number}
78519
+ */
78520
+ this.broadcastHeight = 0;
78521
+ /**
78522
+ * Reference to the last observed content rectangle.
78523
+ *
78524
+ * @private {DOMRectInit}
78525
+ */
78526
+ this.contentRect_ = createRectInit(0, 0, 0, 0);
78527
+ this.target = target;
78528
+ }
78529
+ /**
78530
+ * Updates content rectangle and tells whether it's width or height properties
78531
+ * have changed since the last broadcast.
78532
+ *
78533
+ * @returns {boolean}
78534
+ */
78535
+ ResizeObservation.prototype.isActive = function () {
78536
+ var rect = getContentRect(this.target);
78537
+ this.contentRect_ = rect;
78538
+ return (rect.width !== this.broadcastWidth ||
78539
+ rect.height !== this.broadcastHeight);
78540
+ };
78541
+ /**
78542
+ * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
78543
+ * from the corresponding properties of the last observed content rectangle.
78544
+ *
78545
+ * @returns {DOMRectInit} Last observed content rectangle.
78546
+ */
78547
+ ResizeObservation.prototype.broadcastRect = function () {
78548
+ var rect = this.contentRect_;
78549
+ this.broadcastWidth = rect.width;
78550
+ this.broadcastHeight = rect.height;
78551
+ return rect;
78552
+ };
78553
+ return ResizeObservation;
78554
+ }());
78593
78555
 
78594
- ical.TimezoneService.register(key, new ical.Timezone(vtimezone));
78595
- });
78596
- }
78556
+ var ResizeObserverEntry = /** @class */ (function () {
78557
+ /**
78558
+ * Creates an instance of ResizeObserverEntry.
78559
+ *
78560
+ * @param {Element} target - Element that is being observed.
78561
+ * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
78562
+ */
78563
+ function ResizeObserverEntry(target, rectInit) {
78564
+ var contentRect = createReadOnlyRect(rectInit);
78565
+ // According to the specification following properties are not writable
78566
+ // and are also not enumerable in the native implementation.
78567
+ //
78568
+ // Property accessors are not being used as they'd require to define a
78569
+ // private WeakMap storage which may cause memory leaks in browsers that
78570
+ // don't support this type of collections.
78571
+ defineConfigurable(this, { target: target, contentRect: contentRect });
78572
+ }
78573
+ return ResizeObserverEntry;
78574
+ }());
78597
78575
 
78598
- registerTimezones();
78576
+ var ResizeObserverSPI = /** @class */ (function () {
78577
+ /**
78578
+ * Creates a new instance of ResizeObserver.
78579
+ *
78580
+ * @param {ResizeObserverCallback} callback - Callback function that is invoked
78581
+ * when one of the observed elements changes it's content dimensions.
78582
+ * @param {ResizeObserverController} controller - Controller instance which
78583
+ * is responsible for the updates of observer.
78584
+ * @param {ResizeObserver} callbackCtx - Reference to the public
78585
+ * ResizeObserver instance which will be passed to callback function.
78586
+ */
78587
+ function ResizeObserverSPI(callback, controller, callbackCtx) {
78588
+ /**
78589
+ * Collection of resize observations that have detected changes in dimensions
78590
+ * of elements.
78591
+ *
78592
+ * @private {Array<ResizeObservation>}
78593
+ */
78594
+ this.activeObservations_ = [];
78595
+ /**
78596
+ * Registry of the ResizeObservation instances.
78597
+ *
78598
+ * @private {Map<Element, ResizeObservation>}
78599
+ */
78600
+ this.observations_ = new MapShim();
78601
+ if (typeof callback !== 'function') {
78602
+ throw new TypeError('The callback provided as parameter 1 is not a function.');
78603
+ }
78604
+ this.callback_ = callback;
78605
+ this.controller_ = controller;
78606
+ this.callbackCtx_ = callbackCtx;
78607
+ }
78608
+ /**
78609
+ * Starts observing provided element.
78610
+ *
78611
+ * @param {Element} target - Element to be observed.
78612
+ * @returns {void}
78613
+ */
78614
+ ResizeObserverSPI.prototype.observe = function (target) {
78615
+ if (!arguments.length) {
78616
+ throw new TypeError('1 argument required, but only 0 present.');
78617
+ }
78618
+ // Do nothing if current environment doesn't have the Element interface.
78619
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
78620
+ return;
78621
+ }
78622
+ if (!(target instanceof getWindowOf(target).Element)) {
78623
+ throw new TypeError('parameter 1 is not of type "Element".');
78624
+ }
78625
+ var observations = this.observations_;
78626
+ // Do nothing if element is already being observed.
78627
+ if (observations.has(target)) {
78628
+ return;
78629
+ }
78630
+ observations.set(target, new ResizeObservation(target));
78631
+ this.controller_.addObserver(this);
78632
+ // Force the update of observations.
78633
+ this.controller_.refresh();
78634
+ };
78635
+ /**
78636
+ * Stops observing provided element.
78637
+ *
78638
+ * @param {Element} target - Element to stop observing.
78639
+ * @returns {void}
78640
+ */
78641
+ ResizeObserverSPI.prototype.unobserve = function (target) {
78642
+ if (!arguments.length) {
78643
+ throw new TypeError('1 argument required, but only 0 present.');
78644
+ }
78645
+ // Do nothing if current environment doesn't have the Element interface.
78646
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
78647
+ return;
78648
+ }
78649
+ if (!(target instanceof getWindowOf(target).Element)) {
78650
+ throw new TypeError('parameter 1 is not of type "Element".');
78651
+ }
78652
+ var observations = this.observations_;
78653
+ // Do nothing if element is not being observed.
78654
+ if (!observations.has(target)) {
78655
+ return;
78656
+ }
78657
+ observations.delete(target);
78658
+ if (!observations.size) {
78659
+ this.controller_.removeObserver(this);
78660
+ }
78661
+ };
78662
+ /**
78663
+ * Stops observing all elements.
78664
+ *
78665
+ * @returns {void}
78666
+ */
78667
+ ResizeObserverSPI.prototype.disconnect = function () {
78668
+ this.clearActive();
78669
+ this.observations_.clear();
78670
+ this.controller_.removeObserver(this);
78671
+ };
78672
+ /**
78673
+ * Collects observation instances the associated element of which has changed
78674
+ * it's content rectangle.
78675
+ *
78676
+ * @returns {void}
78677
+ */
78678
+ ResizeObserverSPI.prototype.gatherActive = function () {
78679
+ var _this = this;
78680
+ this.clearActive();
78681
+ this.observations_.forEach(function (observation) {
78682
+ if (observation.isActive()) {
78683
+ _this.activeObservations_.push(observation);
78684
+ }
78685
+ });
78686
+ };
78687
+ /**
78688
+ * Invokes initial callback function with a list of ResizeObserverEntry
78689
+ * instances collected from active resize observations.
78690
+ *
78691
+ * @returns {void}
78692
+ */
78693
+ ResizeObserverSPI.prototype.broadcastActive = function () {
78694
+ // Do nothing if observer doesn't have active observations.
78695
+ if (!this.hasActive()) {
78696
+ return;
78697
+ }
78698
+ var ctx = this.callbackCtx_;
78699
+ // Create ResizeObserverEntry instance for every active observation.
78700
+ var entries = this.activeObservations_.map(function (observation) {
78701
+ return new ResizeObserverEntry(observation.target, observation.broadcastRect());
78702
+ });
78703
+ this.callback_.call(ctx, entries, ctx);
78704
+ this.clearActive();
78705
+ };
78706
+ /**
78707
+ * Clears the collection of active observations.
78708
+ *
78709
+ * @returns {void}
78710
+ */
78711
+ ResizeObserverSPI.prototype.clearActive = function () {
78712
+ this.activeObservations_.splice(0);
78713
+ };
78714
+ /**
78715
+ * Tells whether observer has active observations.
78716
+ *
78717
+ * @returns {boolean}
78718
+ */
78719
+ ResizeObserverSPI.prototype.hasActive = function () {
78720
+ return this.activeObservations_.length > 0;
78721
+ };
78722
+ return ResizeObserverSPI;
78723
+ }());
78599
78724
 
78600
- var icalExpander = IcalExpander;
78725
+ // Registry of internal observers. If WeakMap is not available use current shim
78726
+ // for the Map collection as it has all required methods and because WeakMap
78727
+ // can't be fully polyfilled anyway.
78728
+ var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
78729
+ /**
78730
+ * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
78731
+ * exposing only those methods and properties that are defined in the spec.
78732
+ */
78733
+ var ResizeObserver$1 = /** @class */ (function () {
78734
+ /**
78735
+ * Creates a new instance of ResizeObserver.
78736
+ *
78737
+ * @param {ResizeObserverCallback} callback - Callback that is invoked when
78738
+ * dimensions of the observed elements change.
78739
+ */
78740
+ function ResizeObserver(callback) {
78741
+ if (!(this instanceof ResizeObserver)) {
78742
+ throw new TypeError('Cannot call a class as a function.');
78743
+ }
78744
+ if (!arguments.length) {
78745
+ throw new TypeError('1 argument required, but only 0 present.');
78746
+ }
78747
+ var controller = ResizeObserverController.getInstance();
78748
+ var observer = new ResizeObserverSPI(callback, controller, this);
78749
+ observers.set(this, observer);
78750
+ }
78751
+ return ResizeObserver;
78752
+ }());
78753
+ // Expose public methods of ResizeObserver.
78754
+ [
78755
+ 'observe',
78756
+ 'unobserve',
78757
+ 'disconnect'
78758
+ ].forEach(function (method) {
78759
+ ResizeObserver$1.prototype[method] = function () {
78760
+ var _a;
78761
+ return (_a = observers.get(this))[method].apply(_a, arguments);
78762
+ };
78763
+ });
78764
+
78765
+ var index = (function () {
78766
+ // Export existing implementation if available.
78767
+ if (typeof global$1.ResizeObserver !== 'undefined') {
78768
+ return global$1.ResizeObserver;
78769
+ }
78770
+ return ResizeObserver$1;
78771
+ })();
78601
78772
 
78602
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function W(){return (W=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);}return t}).apply(this,arguments)}function A(t,e){if(null==t)return {};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function N(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return F(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (n=t[Symbol.iterator]()).next.bind(n)}function _(t,e){return !(!t||t[0]!==e[0]||t[1]!==e[1])}function V(t,e){return !(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}var G="up",j=system(function(){var t=stream(),e=statefulStream(0),u=stream(),s=statefulStream(0),c=stream(),f=statefulStream(0),d=statefulStream(0),m=stream(),h=stream(),p=statefulStream(!1);connect(t,s);var v=statefulStream("down");return connect(pipe(t,scan(function(t,e){return {direction:e<t.prevScrollTop?G:"down",prevScrollTop:e}},{direction:"down",prevScrollTop:0}),map(function(t){return t.direction})),v),{scrollTop:t,viewportHeight:c,headerHeight:f,footerHeight:d,smoothScrollTargetReached:u,scrollTo:m,scrollBy:h,scrollDirection:v,statefulScrollTop:s,deviation:e,scrollingInProgress:p}},[],{singleton:!0}),D=system(function(){var t=statefulStream(!1);return {propsReady:t,didMount:streamFromEmitter(pipe(t,filter(function(t){return t}),distinctUntilChanged()))}},[],{singleton:!0}),U={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,totalHeight:0}},K=system(function(t){var e=t[0],s=e.scrollTop,C=e.viewportHeight,S=statefulStream(!1),x=statefulStream(!0),T=stream(),w=stream(),y=stream(),H=streamFromEmitter(pipe(merge(pipe(duc(s),skip(1),mapTo(!0)),pipe(duc(s),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()));connect(pipe(duc(s),map(function(t){return 0===t}),distinctUntilChanged()),x),connect(x,w);var b=streamFromEmitter(pipe(combineLatest(y,duc(s),duc(C)),scan(function(t,e){var n=e[0],o=n.bottom,r=n.offsetBottom,i=e[1],l=e[2],a={viewportHeight:l,scrollTop:i,offsetBottom:r,totalHeight:o+r};return 0===r&&i+l-o>-4?{atBottom:!0,state:a}:{atBottom:!1,notAtBottomBecause:a.totalHeight>t.state.totalHeight?"SIZE_INCREASED":0!==r?"NOT_SHOWING_LAST_ITEM":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:a}},U),distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom})));return connect(pipe(b,map(function(t){return t.atBottom})),S),subscribe(S,function(t){setTimeout(function(){return publish(T,t)});}),{isScrolling:H,isAtTop:x,isAtBottom:S,atBottomState:b,atTopStateChange:w,atBottomStateChange:T,listStateListener:y}},tup(j)),Y=system(function(t){var e=t[0].scrollTop,u=t[1].isScrolling,f=statefulStream(0),d=statefulStream(!1),m=stream(),p=statefulStream(!1);return connect(pipe(u,filter(function(t){return !t}),mapTo(0)),f),connect(pipe(e,throttleTime(100),withLatestFrom(u),filter(function(t){return !!t[1]}),scan(function(t,e){return [t[1],e[0]]},[0,0]),map(function(t){return t[1]-t[0]})),f),connect(pipe(f,withLatestFrom(p,d,m),filter(function(t){return !!t[1]}),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0, n.exit)(e,r))return !1}else if(i(e,r))return !0;return o}),distinctUntilChanged()),d),subscribe(pipe(combineLatest(d,f,m),withLatestFrom(p)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:d,scrollSeekConfiguration:p,scrollVelocity:f,scrollSeekRangeChanged:m}},tup(j,K),{singleton:!0}),Z={lvl:0};function q(t,e,n,o,r){return void 0===o&&(o=Z),void 0===r&&(r=Z),{k:t,v:e,lvl:n,l:o,r:r}}function $(t){return t===Z}function J(){return Z}function Q(t,e){if($(t))return Z;var n=t.k,o=t.l,r=t.r;if(e===n){if($(o))return r;if($(r))return o;var i=ot(o);return at(it(t,{k:i[0],v:i[1],l:rt(o)}))}return at(it(t,e<n?{l:Q(o,e)}:{r:Q(r,e)}))}function X(t,e,n){if(void 0===n&&(n="k"),$(t))return [-Infinity,void 0];if(t[n]===e)return [t.k,t.v];if(t[n]<e){var o=X(t.r,e,n);return -Infinity===o[0]?[t.k,t.v]:o}return X(t.l,e,n)}function tt(t,e,n){return $(t)?q(e,n,1):e===t.k?it(t,{k:e,v:n}):function(t){return ct(ft(t))}(it(t,e<t.k?{l:tt(t.l,e,n)}:{r:tt(t.r,e,n)}))}function et(t,e,n){if($(t))return [];var o=t.k,r=t.v,i=t.r,l=[];return o>e&&(l=l.concat(et(t.l,e,n))),o>=e&&o<=n&&l.push({k:o,v:r}),o<=n&&(l=l.concat(et(i,e,n))),l}function nt(t){return $(t)?[]:[].concat(nt(t.l),[{k:t.k,v:t.v}],nt(t.r))}function ot(t){return $(t.r)?[t.k,t.v]:ot(t.r)}function rt(t){return $(t.r)?t.l:at(it(t,{r:rt(t.r)}))}function it(t,e){return q(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function lt(t){return $(t)||t.lvl>t.r.lvl}function at(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(lt(e))return ft(it(t,{lvl:o-1}));if($(e)||$(e.r))throw new Error("Unexpected empty nodes");return it(e.r,{l:it(e,{r:e.r.l}),r:it(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(lt(t))return ct(it(t,{lvl:o-1}));if($(n)||$(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=lt(r)?n.lvl-1:n.lvl;return it(r,{l:it(t,{r:r.l,lvl:o-1}),r:ct(it(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function ut(t,e,n){return $(t)?[]:st(et(t,X(t,e)[0],n),function(t){return {index:t.k,value:t.v}})}function st(t,e){var n=t.length;if(0===n)return [];for(var o=e(t[0]),r=o.index,i=o.value,l=[],a=1;a<n;a++){var u=e(t[a]),s=u.index,c=u.value;l.push({start:r,end:s-1,value:i}),r=s,i=c;}return l.push({start:r,end:Infinity,value:i}),l}function ct(t){var e=t.r,n=t.lvl;return $(e)||$(e.r)||e.lvl!==n||e.r.lvl!==n?t:it(e,{l:it(t,{r:e.l}),lvl:n+1})}function ft(t){var e=t.l;return $(e)||e.lvl!==t.lvl?t:it(e,{r:it(t,{l:e.r})})}function dt(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),l=n(t[i],e);if(0===l)return i;if(-1===l){if(r-o<2)return i-1;r=i-1;}else {if(r===o)return i;o=i+1;}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function mt(t,e,n){return t[dt(t,e,n)]}function ht(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function pt(t,e){var n=t.index;return e===n?0:e<n?-1:1}function vt(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function gt(t){return {index:t.index,value:t}}function It(t,e){var n=e[0],o=e[1],r=t.sizeTree,i=t.offsetTree,l=r,a=0;if(o.length>0&&$(r)&&2===n.length){var u=n[0].size,s=n[1].size;l=o.reduce(function(t,e){return tt(tt(t,e,u),e+1,s)},l);}else {var c=function(t,e){for(var n,o=$(t)?0:Infinity,r=N(e);!(n=r()).done;){var i=n.value,l=i.size,a=i.startIndex,u=i.endIndex;if(o=Math.min(o,a),$(t))t=tt(t,0,l);else {var s=ut(t,a-1,u+1);if(!s.some(ht(i))){for(var c,f=!1,d=!1,m=N(s);!(c=m()).done;){var h=c.value,p=h.start,v=h.end,g=h.value;f?(u>=p||l===g)&&(t=Q(t,p)):(d=g!==l,f=!0),v>u&&u>=p&&g!==l&&(t=tt(t,u+1,g));}d&&(t=tt(t,a,l));}}}return [t,o]}(l,n);l=c[0],a=c[1];}if(l===r)return t;var f=0,d=0,m=0,h=0;if(0!==a){h=dt(i,a-1,pt),m=i[h].offset;var p=X(l,a-1);f=p[0],d=p[1],i.length&&i[h].size===X(l,a)[1]&&(h-=1),i=i.slice(0,h+1);}else i=[];for(var v,g=N(ut(l,a,Infinity));!(v=g()).done;){var I=v.value,C=I.start,S=I.value,x=(C-f)*d+m;i.push({offset:x,size:S,index:C}),f=C,m=x,d=S;}return {sizeTree:l,offsetTree:i,groupOffsetTree:o.reduce(function(t,e){return tt(t,e,Ct(e,i))},J()),lastIndex:f,lastOffset:m,lastSize:d,groupIndices:o}}function Ct(t,e){if(0===e.length)return 0;var n=mt(e,t,pt);return n.size*(t-n.index)+n.offset}function St(t,e){if(!xt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function xt(t){return !$(t.groupOffsetTree)}var Tt=system(function(){var t=stream(),e=stream(),f=stream(),d=statefulStream(0),m=statefulStream([]),h=statefulStream(void 0),p=statefulStream(void 0),v=statefulStream(void 0),g={offsetTree:[],sizeTree:J(),groupOffsetTree:J(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=statefulStreamFromEmitter(pipe(t,withLatestFrom(m),scan(It,g),distinctUntilChanged()),g);connect(pipe(m,filter(function(t){return t.length>0}),withLatestFrom(I),map(function(t){var e=t[0],n=t[1],o=e.reduce(function(t,e,o){return tt(t,e,Ct(e,n.offsetTree)||o)},J());return W({},n,{groupIndices:e,groupOffsetTree:o})})),I),connect(pipe(e,withLatestFrom(I),filter(function(t){return t[0]<t[1].lastIndex}),map(function(t){var e=t[1];return [{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),t),connect(h,p);var C=statefulStreamFromEmitter(pipe(h,map(function(t){return void 0===t})),!0);connect(pipe(p,filter(function(t){return void 0!==t}),map(function(t){return [{startIndex:0,endIndex:0,size:t}]})),t);var S=streamFromEmitter(pipe(t,withLatestFrom(I),scan(function(t,e){var n=e[1];return {changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:g}),map(function(t){return t.changed})));connect(pipe(d,scan(function(t,e){return {diff:t.prev-e,prev:e}},{diff:0,prev:0}),map(function(t){return t.diff}),filter(function(t){return t>0})),f);var w=streamFromEmitter(f);return connect(pipe(f,withLatestFrom(I),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return nt(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return {ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),t),{data:v,totalCount:e,sizeRanges:t,groupIndices:m,defaultItemSize:p,fixedItemSize:h,unshiftWith:f,beforeUnshiftWith:w,firstItemIndex:d,sizes:I,listRefresh:S,trackItemSizes:C}},[],{singleton:!0}),wt="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function yt(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&wt||(e.behavior="auto"),e.offset||(e.offset=0),e}var Ht=system(function(t){var e=t[0],l=e.sizes,u=e.totalCount,s=e.listRefresh,c=t[1],f=c.scrollingInProgress,d=c.viewportHeight,m=c.scrollTo,h=c.smoothScrollTargetReached,p=c.headerHeight,v=c.footerHeight,C=stream(),S=statefulStream(0),T=null,y=null,H=null,b=function(){T&&(T(),T=null),H&&(H(),H=null),y&&(clearTimeout(y),y=null),publish(f,!1);};return connect(pipe(C,withLatestFrom(l,d,u,S,p,v),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=t[4],l=t[5],a=t[6],u=yt(e),c=u.align,d=u.behavior,m=u.offset,p=r-1,v=u.index;v=St(v,n);var S=Ct(v=Math.max(0,v,Math.min(p,v)),n.offsetTree)+l;"end"===c?(S=Math.round(S-o+X(n.sizeTree,v)[1]),v===p&&(S+=a)):"center"===c?S=Math.round(S-o/2+X(n.sizeTree,v)[1]/2):S-=i,m&&(S+=m);var x=function(t){b(),t&&publish(C,e);};if(b(),"smooth"===d){var k=!1;H=subscribe(s,function(t){k=k||t;}),T=handleNext(h,function(){x(k);});}else T=handleNext(s,x);return y=setTimeout(function(){b();},1200),publish(f,!0),{top:S,behavior:d}})),m),{scrollToIndex:C,topListHeight:S}},tup(Tt,j),{singleton:!0}),bt=function(t,e,n){return "number"==typeof t?n===G&&"top"===e||"down"===n&&"bottom"===e?t:0:n===G?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse},kt=system(function(t){var e=t[0],r=e.scrollTop,l=e.viewportHeight,u=e.deviation,f=e.headerHeight,m=stream(),h=statefulStream(0),p=statefulStream(0);return {listBoundary:m,overscan:p,topListHeight:h,visibleRange:statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(l),duc(f),duc(m,_),duc(p),duc(h),duc(u)),map(function(t){var e=t[0],n=t[1],o=t[3],r=o[0],i=o[1],l=t[4],a=t[6],u=e-t[2]-a,s="none";return (r-=a)>e+t[5]&&(s=G),(i-=a)<e+n&&(s="down"),"none"!==s?[Math.max(u-bt(l,"top",s),0),u+n+bt(l,"bottom",s)]:null}),filter(function(t){return null!=t}),distinctUntilChanged(_)),[0,0])}},tup(j),{singleton:!0}),zt=system(function(t){var e=t[0],l=e.scrollTop,u=e.scrollTo,s=stream(),c=stream(),f=stream(),d=statefulStream(!1);return connect(pipe(combineLatest(c,s),map(function(t){return Math.max(0,t[0]-t[1].offsetTop)})),l),connect(pipe(u,withLatestFrom(s),map(function(t){var e=t[0];return W({},e,{top:e.top+t[1].offsetTop})})),f),{useWindowScroll:d,windowScrollTop:c,windowViewportRect:s,windowScrollTo:f}},tup(j)),Rt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Bt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Lt=Math.ceil,Et=Math.floor,Mt=Math.min,Ot=Math.max;function Pt(t){return Lt(t)-t<.03?Lt(t):Et(t)}function Wt(t,e){return Array.from({length:e-t+1}).map(function(e,n){return {index:n+t}})}var At=system(function(t){var e=t[0],l=e.overscan,f=e.visibleRange,m=e.listBoundary,p=t[1],g=p.scrollTop,I=p.viewportHeight,C=p.scrollBy,S=p.scrollTo,w=p.smoothScrollTargetReached,y=t[2],H=t[3],b=t[4],k=b.propsReady,z=b.didMount,R=t[5],B=R.windowViewportRect,L=R.windowScrollTo,E=R.useWindowScroll,M=R.windowScrollTop,O=statefulStream(0),P=statefulStream(0),A=statefulStream(Rt),F=statefulStream({height:0,width:0}),N=statefulStream({height:0,width:0}),G=stream();connect(pipe(z,withLatestFrom(P),filter(function(t){return 0!==t[1]}),map(function(t){return {items:Wt(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),A),connect(pipe(combineLatest(duc(O),f,duc(N,function(t,e){return t&&t.width===e.width&&t.height===e.height})),withLatestFrom(F),map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],l=e[2],a=t[1],u=l.height,s=l.width,c=a.width;if(0===n||0===c)return Rt;if(0===s)return Bt;var f=Pt(c/s),d=f*Et(r/u),m=f*Lt(i/u)-1;m=Mt(n-1,m);var h=Wt(d=Mt(m,Ot(0,d)),m),p=Ft(a,l,h),v=p.top,g=p.bottom;return {items:h,offsetTop:v,offsetBottom:Lt(n/f)*u-g,top:v,bottom:g,itemHeight:u,itemWidth:s}})),A),connect(pipe(F,map(function(t){return t.height})),I),connect(pipe(combineLatest(F,N,A),map(function(t){var e=Ft(t[0],t[1],t[2].items);return [e.top,e.bottom]}),distinctUntilChanged(_)),m),connect(pipe(m,withLatestFrom(A),map(function(t){return {bottom:t[0][1],offsetBottom:t[1].offsetBottom}})),y.listStateListener);var j=streamFromEmitter(pipe(duc(A),filter(function(t){return t.items.length>0}),withLatestFrom(O),filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),map(function(t){return t[1]-1}),distinctUntilChanged())),D=streamFromEmitter(pipe(duc(A),filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),mapTo(0),distinctUntilChanged())),U=streamFromEmitter(pipe(duc(A),filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V)));connect(U,H.scrollSeekRangeChanged),connect(pipe(G,withLatestFrom(F,N,O),map(function(t){var e=t[1],n=t[2],o=t[3],r=yt(t[0]),i=r.align,l=r.behavior,a=r.offset,u=r.index,s=Nt(e,n,u=Math.max(0,u,Math.min(o-1,u)));return "end"===i?s=Math.round(s-e.height+n.height):"center"===i&&(s=Math.round(s-e.height/2+n.height/2)),a&&(s+=a),{top:s,behavior:l}})),S);var K=statefulStreamFromEmitter(pipe(A,map(function(t){return t.offsetBottom+t.bottom})),0);return connect(pipe(B,map(function(t){return {width:t.visibleWidth,height:t.visibleHeight}})),F),W({totalCount:O,viewportDimensions:F,itemDimensions:N,scrollTop:g,overscan:l,scrollBy:C,scrollTo:S,scrollToIndex:G,smoothScrollTargetReached:w,windowViewportRect:B,windowScrollTo:L,useWindowScroll:E,windowScrollTop:M,initialItemCount:P},H,{gridState:A,totalListHeight:K},y,{startReached:D,endReached:j,rangeChanged:U,propsReady:k})},tup(kt,j,K,Y,D,zt));function Ft(t,e,n){var o=e.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:Nt(t,e,n[0].index),bottom:Nt(t,e,n[n.length-1].index)+o}}function Nt(t,e,n){var o=Pt(t.width/e.width);return Et(n/o)*e.height}function _t(t,e){void 0===e&&(e=!0);var n=React.useRef(null),o=new index$1(function(e){var n=e[0].target;null!==n.offsetParent&&t(n);});return {ref:n,callbackRef:function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null);}}}function Vt(t,e){return void 0===e&&(e=!0),_t(t,e).callbackRef}function Gt(t){var e=React.useRef(null),n=React.useCallback(function(n){if(null!==n){var o=n.getBoundingClientRect(),r=window.innerHeight-Math.max(0,o.top),i=o.top+window.pageYOffset;e.current={offsetTop:i,visibleHeight:r,visibleWidth:o.width},t(e.current);}},[t]),o=_t(n),r=o.callbackRef,i=o.ref,l=React.useCallback(function(){n(i.current);},[n,i]);return React.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l);}},[l]),r}var jt="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function Dt(t,e,n,o){void 0===o&&(o=noop);var r=React.useRef(null),i=React.useRef(null),l=React.useRef(null),a=React.useCallback(function(n){var o=n.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop;t(Math.max(r,0)),null!==i.current&&(r===i.current||r<=0||r===o.scrollHeight-o.offsetHeight)&&(i.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null));},[t,e]);return React.useEffect(function(){var t=r.current;return o(r.current),a({target:t}),t.addEventListener("scroll",a,{passive:!0}),function(){o(null),t.removeEventListener("scroll",a);}},[r,a,n,o]),{scrollerRef:r,scrollByCallback:function(t){null===i.current&&r.current.scrollBy(t);},scrollToCallback:function(n){var o=r.current;if(o){var a,u,s,c="smooth"===n.behavior;if(o===window?(u=document.documentElement.offsetHeight,a=window.innerHeight,s=document.documentElement.scrollTop):(u=o.scrollHeight,a=o.offsetHeight,s=o.scrollTop),a===u||n.top===s)return t(s),void(c&&e(!0));n.top=Math.max(Math.min(u-a,n.top),0),c?(i.current=n.top,l.current&&clearTimeout(l.current),l.current=setTimeout(function(){l.current=null,i.current=null,e(!0);},1e3)):i.current=null,o.scrollTo(n);}}}}var Ut=system(function(t){var e=t[0],n=e.sizes,l=e.listRefresh,a=t[1].scrollTop,u=t[2].scrollToIndex,c=t[3].didMount,f=statefulStream(!0),d=statefulStream(0);return connect(pipe(c,withLatestFrom(d),filter(function(t){return 0!==t[1]}),mapTo(!1)),f),subscribe(pipe(l,withLatestFrom(f,n),filter(function(t){var e=t[1];return !$(t[2].sizeTree)&&!e}),withLatestFrom(d)),function(t){var e=t[1];handleNext(a,function(){publish(f,!0);}),publish(u,e);}),{scrolledToInitialItem:f,initialTopMostItemIndex:d}},tup(Tt,j,Ht,D),{singleton:!0});function Kt(t){return !!t&&("smooth"===t?"smooth":"auto")}var Yt=system(function(t){var e=t[0],n=e.totalCount,r=e.listRefresh,u=t[1],c=u.isAtBottom,f=u.atBottomState,m=t[2].scrollToIndex,h=t[3].scrolledToInitialItem,p=t[4],C=p.propsReady,S=p.didMount,T=statefulStream(!1);function y(t,e){publish(m,{index:t-1,align:"end",behavior:e});}return subscribe(pipe(combineLatest(duc(n),S),withLatestFrom(duc(T),c,h),map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return "function"==typeof t?Kt(t(e)):e&&Kt(t)}(t[1],t[2]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),filter(function(t){return t.shouldFollow})),function(t){var e=t.totalCount,n=t.followOutputBehavior;handleNext(r,function(){y(e,n);});}),subscribe(pipe(combineLatest(duc(T),n,C),filter(function(t){return t[0]&&t[2]}),scan(function(t,e){var n=e[1];return {refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),filter(function(t){return t.refreshed}),withLatestFrom(T,n)),function(t){var e=t[1],n=t[2],o=handleNext(f,function(t){e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&y(n,"auto");});setTimeout(o,100);}),subscribe(pipe(combineLatest(duc(T),f),withLatestFrom(n)),function(t){var e=t[0],n=e[1];e[0]&&!n.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===n.notAtBottomBecause&&y(t[1],"auto");}),{followOutput:T}},tup(Tt,K,Ht,Ut,D));function Zt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var qt=system(function(t){var e=t[0],o=e.totalCount,l=e.groupIndices,f=e.sizes,d=t[1],m=d.scrollTop,h=d.headerHeight,p=stream(),g=stream(),I=streamFromEmitter(pipe(p,map(Zt)));return connect(pipe(I,map(prop("totalCount"))),o),connect(pipe(I,map(prop("groupIndices"))),l),connect(pipe(combineLatest(m,f,h),filter(function(t){return xt(t[1])}),map(function(t){return X(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),distinctUntilChanged(),map(function(t){return [t]})),g),{groupCounts:p,topItemsIndexes:g}},tup(Tt,j)),$t={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function Jt(t,e,n){if(0===t.length)return [];if(!xt(e))return t.map(function(t){return W({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=ut(e.groupOffsetTree,t[0].index,t[t.length-1].index),l=void 0,a=0,u=N(t);!(o=u()).done;){var s=o.value;(!l||l.end<s.index)&&(l=i.shift(),a=e.groupIndices.indexOf(l.start)),r.push(W({},s.index===l.start?{type:"group",index:a}:{index:s.index-(a+1)+n,groupIndex:a},{size:s.size,offset:s.offset,originalIndex:s.index,data:s.data}));}return r}function Qt(t,e,n,o,r){var i=0,l=0;if(t.length>0){i=t[0].offset;var a=t[t.length-1];l=a.offset+a.size;}var u=i,s=o.lastOffset+(n-o.lastIndex)*o.lastSize-l;return {items:Jt(t,o,r),topItems:Jt(e,o,r),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:s,top:u,bottom:l,totalCount:n}}var Xt,te,ee,ne=system(function(t){var e=t[0],l=e.statefulScrollTop,f=e.headerHeight,m=t[1],h=m.sizes,p=m.totalCount,g=m.data,I=m.firstItemIndex,C=t[2],w=t[3],y=w.visibleRange,z=w.listBoundary,R=w.topListHeight,B=t[4],L=B.scrolledToInitialItem,E=B.initialTopMostItemIndex,M=t[5].topListHeight,O=t[6],P=t[7].didMount,A=statefulStream([]),F=stream();connect(C.topItemsIndexes,A);var G=statefulStreamFromEmitter(pipe(combineLatest(P,duc(y),duc(p),duc(h),duc(E),L,duc(A),duc(I),g),filter(function(t){return t[0]}),map(function(t){var e=t[1],n=e[0],o=e[1],r=t[2],i=t[4],a=t[5],u=t[6],s=t[7],c=t[8],d=t[3],m=d.sizeTree,h=d.offsetTree;if(0===r||0===n&&0===o)return $t;if($(m))return Qt(function(t,e,n){if(xt(e)){var o=St(t,e);return [{index:X(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return [{index:t,size:0,offset:0,data:n&&n[0]}]}(i,d,c),[],r,d,s);var p=[];if(u.length>0)for(var v,g=u[0],I=u[u.length-1],C=0,S=N(ut(m,g,I));!(v=S()).done;)for(var x=v.value,T=x.value,w=Math.max(x.start,g),y=Math.min(x.end,I),H=w;H<=y;H++)p.push({index:H,size:T,offset:C,data:c&&c[H]}),C+=T;if(!a)return Qt([],p,r,d,s);if(xt(d)){var z=Math.max(getValue(l)-getValue(f),0);u=[X(d.groupOffsetTree,z,"v")[0]];}var R=u.length>0?u[u.length-1]+1:0,B=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,mt(t,o,pt).offset)),st((i=n,a=dt(r=t,e,l=vt),u=dt(r,i,l,a),r.slice(a,u+1)),gt);var r,i,l,a,u;}(h,n,o,R),L=r-1;return Qt(tap([],function(t){for(var e,r=N(B);!(e=r()).done;){var i=e.value,l=i.value,a=l.offset,u=i.start,s=l.size;l.offset<n&&(a+=((u+=Math.floor((n-l.offset)/s))-i.start)*s),u<R&&(a+=(R-u)*s,u=R);for(var f=Math.min(i.end,L),d=u;d<=f&&!(a>=o);d++)t.push({index:d,size:s,offset:a,data:c&&c[d]}),a+=s;}}),p,r,d,s)}),distinctUntilChanged()),$t);return connect(pipe(g,filter(function(t){return void 0!==t}),map(function(t){return t.length})),p),connect(pipe(G,map(prop("topListHeight"))),M),connect(M,R),connect(G,O.listStateListener),connect(pipe(G,map(function(t){return [t.top,t.bottom]})),z),connect(pipe(G,map(function(t){return t.items})),F),W({listState:G,topItemsIndexes:A,endReached:streamFromEmitter(pipe(G,filter(function(t){return t.items.length>0}),withLatestFrom(p,g),filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),map(function(t){return [t[1]-1,t[2]]}),distinctUntilChanged(_),map(function(t){return t[0]}))),startReached:streamFromEmitter(pipe(G,throttleTime(200),filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),map(function(t){return t.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(G,filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V))),itemsRendered:F},O)},tup(j,Tt,qt,kt,Ut,Ht,K,D),{singleton:!0}),oe=system(function(t){var e=t[0],n=e.sizes,l=e.firstItemIndex,u=e.data,c=t[1].listState,f=t[2].didMount,d=statefulStream(0);return connect(pipe(f,withLatestFrom(d),filter(function(t){return 0!==t[1]}),withLatestFrom(n,l,u),map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=void 0===r?[]:r,l=0;if(n.groupIndices.length>0)for(var a,u=N(n.groupIndices);!((a=u()).done||a.value-l>=e);)l++;var s=e+l;return Qt(Array.from({length:s}).map(function(t,e){return {index:e,size:0,offset:0,data:i[e]}}),[],s,n,o)})),c),{initialItemCount:d}},tup(Tt,ne,D),{singleton:!0}),re=system(function(t){var e=t[0].topItemsIndexes,n=statefulStream(0);return connect(pipe(n,filter(function(t){return t>0}),map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),e),{topItemCount:n}},tup(ne)),ie=system(function(t){var e=t[0],o=e.footerHeight,l=e.headerHeight,u=t[1].listState,s=stream(),c=statefulStreamFromEmitter(pipe(combineLatest(o,l,u),map(function(t){var e=t[2];return t[0]+t[1]+e.offsetBottom+e.bottom})),0);return connect(duc(c),s),{totalListHeight:c,totalListHeightChanged:s}},tup(j,ne),{singleton:!0}),le=system(function(t){var e=t[0],n=e.scrollBy,o=e.deviation,c=t[1].isScrolling,f=t[3],d=f.beforeUnshiftWith,m=f.sizes,h=streamFromEmitter(pipe(t[2].listState,withLatestFrom(e.scrollTop,e.scrollDirection,e.scrollingInProgress),filter(function(t){return !t[3]&&0!==t[1]&&t[2]===G}),map(function(t){return t[0]}),scan(function(t,e){var n=t[1],o=e.items,r=0;if(n.length>0&&o.length>0){var i=o[0].originalIndex,l=n[0].originalIndex;if(0!==i||0!==l)if(i===l)r=o[0].size-n[0].size;else for(var a=function(t){var e=o[t],i=n.find(function(t){return t.originalIndex===e.originalIndex});return i?e.offset!==i.offset?(r=e.offset-i.offset,"break"):void 0:"continue"},u=o.length-1;u>=0;u--){var s=a(u);if("continue"!==s&&"break"===s)break}}return [r,o]},[0,[]]),filter(function(t){return 0!==t[0]}),map(function(t){return t[0]})));return connect(pipe(h,withLatestFrom(o),map(function(t){return t[1]-t[0]})),o),subscribe(pipe(combineLatest(statefulStreamFromEmitter(c,!1),o),filter(function(t){return !t[0]&&0!==t[1]}),map(function(t){return t[1]}),throttleTime(1)),function(t){t>0?(publish(n,{top:-t,behavior:"auto"}),publish(o,0)):(publish(o,0),publish(n,{top:-t,behavior:"auto"}));}),connect(pipe(d,withLatestFrom(m),map(function(t){return t[0]*t[1].lastSize})),h),{deviation:o}},tup(j,K,ne,Tt)),ae=system(function(t){var e=t[0].totalListHeight,n=t[1].didMount,r=t[2].scrollTo,l=statefulStream(0);return subscribe(pipe(n,withLatestFrom(l),filter(function(t){return 0!==t[1]}),map(function(t){return {top:t[1]}})),function(t){handleNext(pipe(e,filter(function(t){return 0!==t})),function(){setTimeout(function(){publish(r,t);});});}),{initialScrollTop:l}},tup(ie,D,j),{singleton:!0}),ue=system(function(t){var e=t[0].viewportHeight,n=t[1].totalListHeight,r=statefulStream(!1);return {alignToBottom:r,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(r,e,n),filter(function(t){return t[0]}),map(function(t){return Math.max(0,t[1]-t[2])}),distinctUntilChanged()),0)}},tup(j,ie),{singleton:!0}),se=system(function(t){return W({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])},tup(kt,oe,D,Y,ie,ae,ue,zt)),ce=system(function(t){var e=t[0],n=e.totalCount,o=e.sizeRanges,l=e.fixedItemSize,u=e.defaultItemSize,s=e.trackItemSizes,c=e.data,f=e.firstItemIndex,d=e.groupIndices,m=t[1],h=m.initialTopMostItemIndex,p=m.scrolledToInitialItem,v=t[2],g=t[3],I=t[4],C=I.listState,S=I.topItemsIndexes,x=A(I,["listState","topItemsIndexes"]),T=t[5].scrollToIndex,w=t[7].topItemCount,y=t[8].groupCounts,b=t[9];return connect(x.rangeChanged,b.scrollSeekRangeChanged),connect(pipe(b.windowViewportRect,map(prop("visibleHeight"))),v.viewportHeight),W({totalCount:n,data:c,firstItemIndex:f,sizeRanges:o,initialTopMostItemIndex:h,scrolledToInitialItem:p,topItemsIndexes:S,topItemCount:w,groupCounts:y,fixedItemHeight:l,defaultItemHeight:u},g,{listState:C,scrollToIndex:T,trackItemSizes:s,groupIndices:d},x,b,v)},tup(Tt,Ut,j,Yt,ne,Ht,le,re,qt,se)),fe=(Xt=function(){if("undefined"==typeof document)return "sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"},ee=!1,function(){return ee||(ee=!0,te=Xt()),te});function de(t){return t}var me=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream(function(t){return "Group "+t}),n=statefulStream({}),r=statefulStream(de),l=statefulStream("div"),u=statefulStream(noop),s=function(t,e){return void 0===e&&(e=null),statefulStreamFromEmitter(pipe(n,map(function(e){return e[t]}),distinctUntilChanged()),e)};return {itemContent:t,groupContent:e,components:n,computeItemKey:r,headerFooterTag:l,scrollerRef:u,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function he(t,e){var o=stream();return subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+e,"color: red;","color: inherit;","color: blue;")}),connect(o,t),o}var pe=system(function(t){var e=t[0],o=t[1],l={item:he(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:he(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:he(e.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:he(e.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:he(e.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function u(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),W({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(l.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(l.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(l.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=A(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,W({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),u(l.footer,"Footer","footer"),u(l.header,"Header","header"),u(l.ItemContainer,"Item","ItemContainer"),u(l.ListContainer,"List","ListContainer"),u(l.ScrollContainer,"Scroller","ScrollContainer"),u(l.emptyComponent,"EmptyPlaceholder","emptyComponent"),u(l.GroupContainer,"Group","GroupContainer"),W({},e,o,l)},tup(ce,me)),ve=function(t){return React.createElement("div",{style:{height:t.height}})},ge={position:fe(),zIndex:1},Ie=React.memo(function(t){var e,n=t.showTopList,o=void 0!==n&&n,r=Ee("listState"),i=Ee("deviation"),l=Le("sizeRanges"),a=Ee("itemContent"),u=Ee("groupContent"),s=(e=l,Vt(function(t){var n=function(t,e){var n=t.length;if(0===n)return null;for(var o=[],r=0;r<n;r++){var i=t.item(r);if(i&&void 0!==i.dataset.index){var l=parseInt(i.dataset.index),a=parseInt(i.dataset.knownSize),u=i.offsetHeight;if(0===u)throw new Error("Zero-sized element, this should not happen");if(u!==a){var s=o[o.length-1];0===o.length||s.size!==u||s.endIndex!==l-1?o.push({startIndex:l,endIndex:l,size:u}):o[o.length-1].endIndex++;}}}return o}(t.children);null!==n&&e(n);},Ee("trackItemSizes"))),c=Ee("EmptyPlaceholder"),f=Ee("ScrollSeekPlaceholder")||ve,d=Ee("ListComponent"),m=Ee("ItemComponent"),h=Ee("GroupComponent"),p=Ee("computeItemKey"),v=Ee("isSeeking"),g=Ee("groupIndices").length>0,I=Ee("paddingTopAddition"),C=Ee("scrolledToInitialItem"),S=o?{}:{boxSizing:"border-box",paddingTop:r.offsetTop+I,paddingBottom:r.offsetBottom,marginTop:i};return !o&&0===r.items.length&&c&&C?React.createElement(c):React.createElement(d,{ref:s,style:S},(o?r.topItems:r.items).map(function(t){var e=t.originalIndex,n=p(e);return v?React.createElement(f,{key:n,index:t.index,height:t.size}):"group"===t.type?React.createElement(h,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:ge},u(t.index)):React.createElement(m,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex},g?a(t.index,t.groupIndex,t.data):a(t.index,t.data))}))}),Ce={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Se={width:"100%",height:"100%",position:"absolute",top:0},xe={width:"100%",position:fe(),top:0},Te=React.memo(function(){var t=Ee("HeaderComponent"),e=Le("headerHeight"),n=Ee("headerFooterTag"),o=Vt(function(t){return e(t.offsetHeight)});return t?React.createElement(n,{ref:o},React.createElement(t)):null}),we=React.memo(function(){var t=Ee("FooterComponent"),e=Le("footerHeight"),n=Ee("headerFooterTag"),o=Vt(function(t){return e(t.offsetHeight)});return t?React.createElement(n,{ref:o},React.createElement(t)):null});function ye(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=A(t,["style","children"]),a=e("scrollTop"),u=o("ScrollerComponent"),s=Dt(a,e("smoothScrollTargetReached"),u,o("scrollerRef")),c=s.scrollerRef,f=s.scrollByCallback;return n("scrollTo",s.scrollToCallback),n("scrollBy",f),React.createElement(u,W({ref:c,style:W({},Ce,r),tabIndex:0},l),i)})}function He(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=A(t,["style","children"]),a=e("windowScrollTop"),u=o("ScrollerComponent"),s=e("smoothScrollTargetReached"),c=o("totalListHeight"),f=Dt(a,s,u),d=f.scrollerRef,m=f.scrollByCallback,h=f.scrollToCallback;return jt(function(){return d.current=window,function(){d.current=null;}},[d]),n("windowScrollTo",h),n("scrollBy",m),React.createElement(u,W({style:W({position:"relative"},r,0!==c?{height:c}:{})},l),i)})}var be=function(t){var e=t.children,n=Le("viewportHeight"),o=Vt(compose(n,prop("offsetHeight")));return React.createElement("div",{style:Se,ref:o},e)},ke=function(t){var e=t.children,n=Gt(Le("windowViewportRect"));return React.createElement("div",{ref:n,style:Se},e)},ze=function(t){var e=t.children,n=Ee("TopItemListComponent"),o=Ee("headerHeight"),r=W({},xe,{marginTop:o+"px"});return React.createElement(n||"div",{style:r},e)},Re=systemToComponent(pe,{required:{},optional:{followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React.memo(function(t){var e=Ee("useWindowScroll"),n=Ee("topItemsIndexes").length>0,o=e?ke:be;return React.createElement(e?Pe:Oe,Object.assign({},t),React.createElement(o,null,React.createElement(Te,null),React.createElement(Ie,null),React.createElement(we,null)),n&&React.createElement(ze,null,React.createElement(Ie,{showTopList:!0})))})),Be=Re.Component,Le=Re.usePublisher,Ee=Re.useEmitterValue,Me=Re.useEmitter,Oe=ye({usePublisher:Le,useEmitterValue:Ee,useEmitter:Me}),Pe=He({usePublisher:Le,useEmitterValue:Ee,useEmitter:Me}),We=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream({}),n=statefulStream("virtuoso-grid-item"),r=statefulStream("virtuoso-grid-list"),l=statefulStream(de),u=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(e,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {itemContent:t,components:e,computeItemKey:l,itemClassName:n,listClassName:r,scrollerRef:u,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ae=system(function(t){var e=t[0],o=t[1],l={item:he(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function u(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),W({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=A(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,W({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),u(l.ItemContainer,"Item","ItemContainer"),u(l.ListContainer,"List","ListContainer"),u(l.ScrollContainer,"Scroller","ScrollContainer"),W({},e,o,l)},tup(At,We)),Fe=React.memo(function(){var t=De("gridState"),e=De("listClassName"),n=De("itemClassName"),o=De("itemContent"),r=De("computeItemKey"),i=De("isSeeking"),l=De("ItemComponent"),a=De("ListComponent"),u=De("ScrollSeekPlaceholder"),s=je("itemDimensions"),c=Vt(function(t){var e=t.firstChild;e&&s({width:e.offsetWidth,height:e.offsetHeight});});return React.createElement(a,{ref:c,className:e,style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}},t.items.map(function(e){var a=r(e.index);return i?React.createElement(u,{key:a,style:{height:t.itemHeight,width:t.itemWidth}}):React.createElement(l,{className:n,"data-index":e.index,key:a},o(e.index))}))}),Ne=function(t){var e=t.children,n=je("viewportDimensions"),o=Vt(function(t){n({width:t.offsetWidth,height:t.offsetHeight});});return React.createElement("div",{style:Se,ref:o},e)},_e=function(t){var e=t.children,n=Gt(je("windowViewportRect"));return React.createElement("div",{ref:n,style:Se},e)},Ve=systemToComponent(Ae,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React.memo(function(t){var e=W({},t),n=De("useWindowScroll"),o=n?_e:Ne;return React.createElement(n?Ye:Ke,Object.assign({},e),React.createElement(o,null,React.createElement(Fe,null)))})),je=Ve.usePublisher,De=Ve.useEmitterValue,Ue=Ve.useEmitter,Ke=ye({usePublisher:je,useEmitterValue:De,useEmitter:Ue}),Ye=He({usePublisher:je,useEmitterValue:De,useEmitter:Ue}),Ze=Be;
78773
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function W(){return (W=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);}return t}).apply(this,arguments)}function A(t,e){if(null==t)return {};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function N(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return F(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (n=t[Symbol.iterator]()).next.bind(n)}function _(t,e){return !(!t||t[0]!==e[0]||t[1]!==e[1])}function V(t,e){return !(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}var G="up",j=system(function(){var t=stream(),e=statefulStream(0),u=stream(),s=statefulStream(0),c=stream(),f=statefulStream(0),d=statefulStream(0),m=stream(),h=stream(),p=statefulStream(!1);connect(t,s);var v=statefulStream("down");return connect(pipe(t,scan(function(t,e){return {direction:e<t.prevScrollTop?G:"down",prevScrollTop:e}},{direction:"down",prevScrollTop:0}),map(function(t){return t.direction})),v),{scrollTop:t,viewportHeight:c,headerHeight:f,footerHeight:d,smoothScrollTargetReached:u,scrollTo:m,scrollBy:h,scrollDirection:v,statefulScrollTop:s,deviation:e,scrollingInProgress:p}},[],{singleton:!0}),D=system(function(){var t=statefulStream(!1);return {propsReady:t,didMount:streamFromEmitter(pipe(t,filter(function(t){return t}),distinctUntilChanged()))}},[],{singleton:!0}),U={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,totalHeight:0}},K=system(function(t){var e=t[0],s=e.scrollTop,C=e.viewportHeight,S=statefulStream(!1),x=statefulStream(!0),T=stream(),w=stream(),y=stream(),H=streamFromEmitter(pipe(merge(pipe(duc(s),skip(1),mapTo(!0)),pipe(duc(s),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()));connect(pipe(duc(s),map(function(t){return 0===t}),distinctUntilChanged()),x),connect(x,w);var b=streamFromEmitter(pipe(combineLatest(y,duc(s),duc(C)),scan(function(t,e){var n=e[0],o=n.bottom,r=n.offsetBottom,i=e[1],l=e[2],a={viewportHeight:l,scrollTop:i,offsetBottom:r,totalHeight:o+r};return 0===r&&i+l-o>-4?{atBottom:!0,state:a}:{atBottom:!1,notAtBottomBecause:a.totalHeight>t.state.totalHeight?"SIZE_INCREASED":0!==r?"NOT_SHOWING_LAST_ITEM":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:a}},U),distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom})));return connect(pipe(b,map(function(t){return t.atBottom})),S),subscribe(S,function(t){setTimeout(function(){return publish(T,t)});}),{isScrolling:H,isAtTop:x,isAtBottom:S,atBottomState:b,atTopStateChange:w,atBottomStateChange:T,listStateListener:y}},tup(j)),Y=system(function(t){var e=t[0].scrollTop,u=t[1].isScrolling,f=statefulStream(0),d=statefulStream(!1),m=stream(),p=statefulStream(!1);return connect(pipe(u,filter(function(t){return !t}),mapTo(0)),f),connect(pipe(e,throttleTime(100),withLatestFrom(u),filter(function(t){return !!t[1]}),scan(function(t,e){return [t[1],e[0]]},[0,0]),map(function(t){return t[1]-t[0]})),f),connect(pipe(f,withLatestFrom(p,d,m),filter(function(t){return !!t[1]}),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0, n.exit)(e,r))return !1}else if(i(e,r))return !0;return o}),distinctUntilChanged()),d),subscribe(pipe(combineLatest(d,f,m),withLatestFrom(p)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:d,scrollSeekConfiguration:p,scrollVelocity:f,scrollSeekRangeChanged:m}},tup(j,K),{singleton:!0}),Z={lvl:0};function q(t,e,n,o,r){return void 0===o&&(o=Z),void 0===r&&(r=Z),{k:t,v:e,lvl:n,l:o,r:r}}function $(t){return t===Z}function J(){return Z}function Q(t,e){if($(t))return Z;var n=t.k,o=t.l,r=t.r;if(e===n){if($(o))return r;if($(r))return o;var i=ot(o);return at(it(t,{k:i[0],v:i[1],l:rt(o)}))}return at(it(t,e<n?{l:Q(o,e)}:{r:Q(r,e)}))}function X(t,e,n){if(void 0===n&&(n="k"),$(t))return [-Infinity,void 0];if(t[n]===e)return [t.k,t.v];if(t[n]<e){var o=X(t.r,e,n);return -Infinity===o[0]?[t.k,t.v]:o}return X(t.l,e,n)}function tt(t,e,n){return $(t)?q(e,n,1):e===t.k?it(t,{k:e,v:n}):function(t){return ct(ft(t))}(it(t,e<t.k?{l:tt(t.l,e,n)}:{r:tt(t.r,e,n)}))}function et(t,e,n){if($(t))return [];var o=t.k,r=t.v,i=t.r,l=[];return o>e&&(l=l.concat(et(t.l,e,n))),o>=e&&o<=n&&l.push({k:o,v:r}),o<=n&&(l=l.concat(et(i,e,n))),l}function nt(t){return $(t)?[]:[].concat(nt(t.l),[{k:t.k,v:t.v}],nt(t.r))}function ot(t){return $(t.r)?[t.k,t.v]:ot(t.r)}function rt(t){return $(t.r)?t.l:at(it(t,{r:rt(t.r)}))}function it(t,e){return q(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function lt(t){return $(t)||t.lvl>t.r.lvl}function at(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(lt(e))return ft(it(t,{lvl:o-1}));if($(e)||$(e.r))throw new Error("Unexpected empty nodes");return it(e.r,{l:it(e,{r:e.r.l}),r:it(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(lt(t))return ct(it(t,{lvl:o-1}));if($(n)||$(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=lt(r)?n.lvl-1:n.lvl;return it(r,{l:it(t,{r:r.l,lvl:o-1}),r:ct(it(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function ut(t,e,n){return $(t)?[]:st(et(t,X(t,e)[0],n),function(t){return {index:t.k,value:t.v}})}function st(t,e){var n=t.length;if(0===n)return [];for(var o=e(t[0]),r=o.index,i=o.value,l=[],a=1;a<n;a++){var u=e(t[a]),s=u.index,c=u.value;l.push({start:r,end:s-1,value:i}),r=s,i=c;}return l.push({start:r,end:Infinity,value:i}),l}function ct(t){var e=t.r,n=t.lvl;return $(e)||$(e.r)||e.lvl!==n||e.r.lvl!==n?t:it(e,{l:it(t,{r:e.l}),lvl:n+1})}function ft(t){var e=t.l;return $(e)||e.lvl!==t.lvl?t:it(e,{r:it(t,{l:e.r})})}function dt(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),l=n(t[i],e);if(0===l)return i;if(-1===l){if(r-o<2)return i-1;r=i-1;}else {if(r===o)return i;o=i+1;}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function mt(t,e,n){return t[dt(t,e,n)]}function ht(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function pt(t,e){var n=t.index;return e===n?0:e<n?-1:1}function vt(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function gt(t){return {index:t.index,value:t}}function It(t,e){var n=e[0],o=e[1],r=t.sizeTree,i=t.offsetTree,l=r,a=0;if(o.length>0&&$(r)&&2===n.length){var u=n[0].size,s=n[1].size;l=o.reduce(function(t,e){return tt(tt(t,e,u),e+1,s)},l);}else {var c=function(t,e){for(var n,o=$(t)?0:Infinity,r=N(e);!(n=r()).done;){var i=n.value,l=i.size,a=i.startIndex,u=i.endIndex;if(o=Math.min(o,a),$(t))t=tt(t,0,l);else {var s=ut(t,a-1,u+1);if(!s.some(ht(i))){for(var c,f=!1,d=!1,m=N(s);!(c=m()).done;){var h=c.value,p=h.start,v=h.end,g=h.value;f?(u>=p||l===g)&&(t=Q(t,p)):(d=g!==l,f=!0),v>u&&u>=p&&g!==l&&(t=tt(t,u+1,g));}d&&(t=tt(t,a,l));}}}return [t,o]}(l,n);l=c[0],a=c[1];}if(l===r)return t;var f=0,d=0,m=0,h=0;if(0!==a){h=dt(i,a-1,pt),m=i[h].offset;var p=X(l,a-1);f=p[0],d=p[1],i.length&&i[h].size===X(l,a)[1]&&(h-=1),i=i.slice(0,h+1);}else i=[];for(var v,g=N(ut(l,a,Infinity));!(v=g()).done;){var I=v.value,C=I.start,S=I.value,x=(C-f)*d+m;i.push({offset:x,size:S,index:C}),f=C,m=x,d=S;}return {sizeTree:l,offsetTree:i,groupOffsetTree:o.reduce(function(t,e){return tt(t,e,Ct(e,i))},J()),lastIndex:f,lastOffset:m,lastSize:d,groupIndices:o}}function Ct(t,e){if(0===e.length)return 0;var n=mt(e,t,pt);return n.size*(t-n.index)+n.offset}function St(t,e){if(!xt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function xt(t){return !$(t.groupOffsetTree)}var Tt=system(function(){var t=stream(),e=stream(),f=stream(),d=statefulStream(0),m=statefulStream([]),h=statefulStream(void 0),p=statefulStream(void 0),v=statefulStream(void 0),g={offsetTree:[],sizeTree:J(),groupOffsetTree:J(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=statefulStreamFromEmitter(pipe(t,withLatestFrom(m),scan(It,g),distinctUntilChanged()),g);connect(pipe(m,filter(function(t){return t.length>0}),withLatestFrom(I),map(function(t){var e=t[0],n=t[1],o=e.reduce(function(t,e,o){return tt(t,e,Ct(e,n.offsetTree)||o)},J());return W({},n,{groupIndices:e,groupOffsetTree:o})})),I),connect(pipe(e,withLatestFrom(I),filter(function(t){return t[0]<t[1].lastIndex}),map(function(t){var e=t[1];return [{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),t),connect(h,p);var C=statefulStreamFromEmitter(pipe(h,map(function(t){return void 0===t})),!0);connect(pipe(p,filter(function(t){return void 0!==t}),map(function(t){return [{startIndex:0,endIndex:0,size:t}]})),t);var S=streamFromEmitter(pipe(t,withLatestFrom(I),scan(function(t,e){var n=e[1];return {changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:g}),map(function(t){return t.changed})));connect(pipe(d,scan(function(t,e){return {diff:t.prev-e,prev:e}},{diff:0,prev:0}),map(function(t){return t.diff}),filter(function(t){return t>0})),f);var w=streamFromEmitter(f);return connect(pipe(f,withLatestFrom(I),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return nt(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return {ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),t),{data:v,totalCount:e,sizeRanges:t,groupIndices:m,defaultItemSize:p,fixedItemSize:h,unshiftWith:f,beforeUnshiftWith:w,firstItemIndex:d,sizes:I,listRefresh:S,trackItemSizes:C}},[],{singleton:!0}),wt="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function yt(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&wt||(e.behavior="auto"),e.offset||(e.offset=0),e}var Ht=system(function(t){var e=t[0],l=e.sizes,u=e.totalCount,s=e.listRefresh,c=t[1],f=c.scrollingInProgress,d=c.viewportHeight,m=c.scrollTo,h=c.smoothScrollTargetReached,p=c.headerHeight,v=c.footerHeight,C=stream(),S=statefulStream(0),T=null,y=null,H=null,b=function(){T&&(T(),T=null),H&&(H(),H=null),y&&(clearTimeout(y),y=null),publish(f,!1);};return connect(pipe(C,withLatestFrom(l,d,u,S,p,v),map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=t[4],l=t[5],a=t[6],u=yt(e),c=u.align,d=u.behavior,m=u.offset,p=r-1,v=u.index;v=St(v,n);var S=Ct(v=Math.max(0,v,Math.min(p,v)),n.offsetTree)+l;"end"===c?(S=Math.round(S-o+X(n.sizeTree,v)[1]),v===p&&(S+=a)):"center"===c?S=Math.round(S-o/2+X(n.sizeTree,v)[1]/2):S-=i,m&&(S+=m);var x=function(t){b(),t&&publish(C,e);};if(b(),"smooth"===d){var k=!1;H=subscribe(s,function(t){k=k||t;}),T=handleNext(h,function(){x(k);});}else T=handleNext(s,x);return y=setTimeout(function(){b();},1200),publish(f,!0),{top:S,behavior:d}})),m),{scrollToIndex:C,topListHeight:S}},tup(Tt,j),{singleton:!0}),bt=function(t,e,n){return "number"==typeof t?n===G&&"top"===e||"down"===n&&"bottom"===e?t:0:n===G?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse},kt=system(function(t){var e=t[0],r=e.scrollTop,l=e.viewportHeight,u=e.deviation,f=e.headerHeight,m=stream(),h=statefulStream(0),p=statefulStream(0);return {listBoundary:m,overscan:p,topListHeight:h,visibleRange:statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(l),duc(f),duc(m,_),duc(p),duc(h),duc(u)),map(function(t){var e=t[0],n=t[1],o=t[3],r=o[0],i=o[1],l=t[4],a=t[6],u=e-t[2]-a,s="none";return (r-=a)>e+t[5]&&(s=G),(i-=a)<e+n&&(s="down"),"none"!==s?[Math.max(u-bt(l,"top",s),0),u+n+bt(l,"bottom",s)]:null}),filter(function(t){return null!=t}),distinctUntilChanged(_)),[0,0])}},tup(j),{singleton:!0}),zt=system(function(t){var e=t[0],l=e.scrollTop,u=e.scrollTo,s=stream(),c=stream(),f=stream(),d=statefulStream(!1);return connect(pipe(combineLatest(c,s),map(function(t){return Math.max(0,t[0]-t[1].offsetTop)})),l),connect(pipe(u,withLatestFrom(s),map(function(t){var e=t[0];return W({},e,{top:e.top+t[1].offsetTop})})),f),{useWindowScroll:d,windowScrollTop:c,windowViewportRect:s,windowScrollTo:f}},tup(j)),Rt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Bt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Lt=Math.ceil,Et=Math.floor,Mt=Math.min,Ot=Math.max;function Pt(t){return Lt(t)-t<.03?Lt(t):Et(t)}function Wt(t,e){return Array.from({length:e-t+1}).map(function(e,n){return {index:n+t}})}var At=system(function(t){var e=t[0],l=e.overscan,f=e.visibleRange,m=e.listBoundary,p=t[1],g=p.scrollTop,I=p.viewportHeight,C=p.scrollBy,S=p.scrollTo,w=p.smoothScrollTargetReached,y=t[2],H=t[3],b=t[4],k=b.propsReady,z=b.didMount,R=t[5],B=R.windowViewportRect,L=R.windowScrollTo,E=R.useWindowScroll,M=R.windowScrollTop,O=statefulStream(0),P=statefulStream(0),A=statefulStream(Rt),F=statefulStream({height:0,width:0}),N=statefulStream({height:0,width:0}),G=stream();connect(pipe(z,withLatestFrom(P),filter(function(t){return 0!==t[1]}),map(function(t){return {items:Wt(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),A),connect(pipe(combineLatest(duc(O),f,duc(N,function(t,e){return t&&t.width===e.width&&t.height===e.height})),withLatestFrom(F),map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],l=e[2],a=t[1],u=l.height,s=l.width,c=a.width;if(0===n||0===c)return Rt;if(0===s)return Bt;var f=Pt(c/s),d=f*Et(r/u),m=f*Lt(i/u)-1;m=Mt(n-1,m);var h=Wt(d=Mt(m,Ot(0,d)),m),p=Ft(a,l,h),v=p.top,g=p.bottom;return {items:h,offsetTop:v,offsetBottom:Lt(n/f)*u-g,top:v,bottom:g,itemHeight:u,itemWidth:s}})),A),connect(pipe(F,map(function(t){return t.height})),I),connect(pipe(combineLatest(F,N,A),map(function(t){var e=Ft(t[0],t[1],t[2].items);return [e.top,e.bottom]}),distinctUntilChanged(_)),m),connect(pipe(m,withLatestFrom(A),map(function(t){return {bottom:t[0][1],offsetBottom:t[1].offsetBottom}})),y.listStateListener);var j=streamFromEmitter(pipe(duc(A),filter(function(t){return t.items.length>0}),withLatestFrom(O),filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),map(function(t){return t[1]-1}),distinctUntilChanged())),D=streamFromEmitter(pipe(duc(A),filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),mapTo(0),distinctUntilChanged())),U=streamFromEmitter(pipe(duc(A),filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V)));connect(U,H.scrollSeekRangeChanged),connect(pipe(G,withLatestFrom(F,N,O),map(function(t){var e=t[1],n=t[2],o=t[3],r=yt(t[0]),i=r.align,l=r.behavior,a=r.offset,u=r.index,s=Nt(e,n,u=Math.max(0,u,Math.min(o-1,u)));return "end"===i?s=Math.round(s-e.height+n.height):"center"===i&&(s=Math.round(s-e.height/2+n.height/2)),a&&(s+=a),{top:s,behavior:l}})),S);var K=statefulStreamFromEmitter(pipe(A,map(function(t){return t.offsetBottom+t.bottom})),0);return connect(pipe(B,map(function(t){return {width:t.visibleWidth,height:t.visibleHeight}})),F),W({totalCount:O,viewportDimensions:F,itemDimensions:N,scrollTop:g,overscan:l,scrollBy:C,scrollTo:S,scrollToIndex:G,smoothScrollTargetReached:w,windowViewportRect:B,windowScrollTo:L,useWindowScroll:E,windowScrollTop:M,initialItemCount:P},H,{gridState:A,totalListHeight:K},y,{startReached:D,endReached:j,rangeChanged:U,propsReady:k})},tup(kt,j,K,Y,D,zt));function Ft(t,e,n){var o=e.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:Nt(t,e,n[0].index),bottom:Nt(t,e,n[n.length-1].index)+o}}function Nt(t,e,n){var o=Pt(t.width/e.width);return Et(n/o)*e.height}function _t(t,e){void 0===e&&(e=!0);var n=React.useRef(null),o=new index(function(e){var n=e[0].target;null!==n.offsetParent&&t(n);});return {ref:n,callbackRef:function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null);}}}function Vt(t,e){return void 0===e&&(e=!0),_t(t,e).callbackRef}function Gt(t){var e=React.useRef(null),n=React.useCallback(function(n){if(null!==n){var o=n.getBoundingClientRect(),r=window.innerHeight-Math.max(0,o.top),i=o.top+window.pageYOffset;e.current={offsetTop:i,visibleHeight:r,visibleWidth:o.width},t(e.current);}},[t]),o=_t(n),r=o.callbackRef,i=o.ref,l=React.useCallback(function(){n(i.current);},[n,i]);return React.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l);}},[l]),r}var jt="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;function Dt(t,e,n,o){void 0===o&&(o=noop);var r=React.useRef(null),i=React.useRef(null),l=React.useRef(null),a=React.useCallback(function(n){var o=n.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop;t(Math.max(r,0)),null!==i.current&&(r===i.current||r<=0||r===o.scrollHeight-o.offsetHeight)&&(i.current=null,e(!0),l.current&&(clearTimeout(l.current),l.current=null));},[t,e]);return React.useEffect(function(){var t=r.current;return o(r.current),a({target:t}),t.addEventListener("scroll",a,{passive:!0}),function(){o(null),t.removeEventListener("scroll",a);}},[r,a,n,o]),{scrollerRef:r,scrollByCallback:function(t){null===i.current&&r.current.scrollBy(t);},scrollToCallback:function(n){var o=r.current;if(o){var a,u,s,c="smooth"===n.behavior;if(o===window?(u=document.documentElement.offsetHeight,a=window.innerHeight,s=document.documentElement.scrollTop):(u=o.scrollHeight,a=o.offsetHeight,s=o.scrollTop),a===u||n.top===s)return t(s),void(c&&e(!0));n.top=Math.max(Math.min(u-a,n.top),0),c?(i.current=n.top,l.current&&clearTimeout(l.current),l.current=setTimeout(function(){l.current=null,i.current=null,e(!0);},1e3)):i.current=null,o.scrollTo(n);}}}}var Ut=system(function(t){var e=t[0],n=e.sizes,l=e.listRefresh,a=t[1].scrollTop,u=t[2].scrollToIndex,c=t[3].didMount,f=statefulStream(!0),d=statefulStream(0);return connect(pipe(c,withLatestFrom(d),filter(function(t){return 0!==t[1]}),mapTo(!1)),f),subscribe(pipe(l,withLatestFrom(f,n),filter(function(t){var e=t[1];return !$(t[2].sizeTree)&&!e}),withLatestFrom(d)),function(t){var e=t[1];handleNext(a,function(){publish(f,!0);}),publish(u,e);}),{scrolledToInitialItem:f,initialTopMostItemIndex:d}},tup(Tt,j,Ht,D),{singleton:!0});function Kt(t){return !!t&&("smooth"===t?"smooth":"auto")}var Yt=system(function(t){var e=t[0],n=e.totalCount,r=e.listRefresh,u=t[1],c=u.isAtBottom,f=u.atBottomState,m=t[2].scrollToIndex,h=t[3].scrolledToInitialItem,p=t[4],C=p.propsReady,S=p.didMount,T=statefulStream(!1);function y(t,e){publish(m,{index:t-1,align:"end",behavior:e});}return subscribe(pipe(combineLatest(duc(n),S),withLatestFrom(duc(T),c,h),map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return "function"==typeof t?Kt(t(e)):e&&Kt(t)}(t[1],t[2]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),filter(function(t){return t.shouldFollow})),function(t){var e=t.totalCount,n=t.followOutputBehavior;handleNext(r,function(){y(e,n);});}),subscribe(pipe(combineLatest(duc(T),n,C),filter(function(t){return t[0]&&t[2]}),scan(function(t,e){var n=e[1];return {refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),filter(function(t){return t.refreshed}),withLatestFrom(T,n)),function(t){var e=t[1],n=t[2],o=handleNext(f,function(t){e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&y(n,"auto");});setTimeout(o,100);}),subscribe(pipe(combineLatest(duc(T),f),withLatestFrom(n)),function(t){var e=t[0],n=e[1];e[0]&&!n.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===n.notAtBottomBecause&&y(t[1],"auto");}),{followOutput:T}},tup(Tt,K,Ht,Ut,D));function Zt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var qt=system(function(t){var e=t[0],o=e.totalCount,l=e.groupIndices,f=e.sizes,d=t[1],m=d.scrollTop,h=d.headerHeight,p=stream(),g=stream(),I=streamFromEmitter(pipe(p,map(Zt)));return connect(pipe(I,map(prop("totalCount"))),o),connect(pipe(I,map(prop("groupIndices"))),l),connect(pipe(combineLatest(m,f,h),filter(function(t){return xt(t[1])}),map(function(t){return X(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),distinctUntilChanged(),map(function(t){return [t]})),g),{groupCounts:p,topItemsIndexes:g}},tup(Tt,j)),$t={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function Jt(t,e,n){if(0===t.length)return [];if(!xt(e))return t.map(function(t){return W({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=ut(e.groupOffsetTree,t[0].index,t[t.length-1].index),l=void 0,a=0,u=N(t);!(o=u()).done;){var s=o.value;(!l||l.end<s.index)&&(l=i.shift(),a=e.groupIndices.indexOf(l.start)),r.push(W({},s.index===l.start?{type:"group",index:a}:{index:s.index-(a+1)+n,groupIndex:a},{size:s.size,offset:s.offset,originalIndex:s.index,data:s.data}));}return r}function Qt(t,e,n,o,r){var i=0,l=0;if(t.length>0){i=t[0].offset;var a=t[t.length-1];l=a.offset+a.size;}var u=i,s=o.lastOffset+(n-o.lastIndex)*o.lastSize-l;return {items:Jt(t,o,r),topItems:Jt(e,o,r),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:s,top:u,bottom:l,totalCount:n}}var Xt,te,ee,ne=system(function(t){var e=t[0],l=e.statefulScrollTop,f=e.headerHeight,m=t[1],h=m.sizes,p=m.totalCount,g=m.data,I=m.firstItemIndex,C=t[2],w=t[3],y=w.visibleRange,z=w.listBoundary,R=w.topListHeight,B=t[4],L=B.scrolledToInitialItem,E=B.initialTopMostItemIndex,M=t[5].topListHeight,O=t[6],P=t[7].didMount,A=statefulStream([]),F=stream();connect(C.topItemsIndexes,A);var G=statefulStreamFromEmitter(pipe(combineLatest(P,duc(y),duc(p),duc(h),duc(E),L,duc(A),duc(I),g),filter(function(t){return t[0]}),map(function(t){var e=t[1],n=e[0],o=e[1],r=t[2],i=t[4],a=t[5],u=t[6],s=t[7],c=t[8],d=t[3],m=d.sizeTree,h=d.offsetTree;if(0===r||0===n&&0===o)return $t;if($(m))return Qt(function(t,e,n){if(xt(e)){var o=St(t,e);return [{index:X(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return [{index:t,size:0,offset:0,data:n&&n[0]}]}(i,d,c),[],r,d,s);var p=[];if(u.length>0)for(var v,g=u[0],I=u[u.length-1],C=0,S=N(ut(m,g,I));!(v=S()).done;)for(var x=v.value,T=x.value,w=Math.max(x.start,g),y=Math.min(x.end,I),H=w;H<=y;H++)p.push({index:H,size:T,offset:C,data:c&&c[H]}),C+=T;if(!a)return Qt([],p,r,d,s);if(xt(d)){var z=Math.max(getValue(l)-getValue(f),0);u=[X(d.groupOffsetTree,z,"v")[0]];}var R=u.length>0?u[u.length-1]+1:0,B=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,mt(t,o,pt).offset)),st((i=n,a=dt(r=t,e,l=vt),u=dt(r,i,l,a),r.slice(a,u+1)),gt);var r,i,l,a,u;}(h,n,o,R),L=r-1;return Qt(tap([],function(t){for(var e,r=N(B);!(e=r()).done;){var i=e.value,l=i.value,a=l.offset,u=i.start,s=l.size;l.offset<n&&(a+=((u+=Math.floor((n-l.offset)/s))-i.start)*s),u<R&&(a+=(R-u)*s,u=R);for(var f=Math.min(i.end,L),d=u;d<=f&&!(a>=o);d++)t.push({index:d,size:s,offset:a,data:c&&c[d]}),a+=s;}}),p,r,d,s)}),distinctUntilChanged()),$t);return connect(pipe(g,filter(function(t){return void 0!==t}),map(function(t){return t.length})),p),connect(pipe(G,map(prop("topListHeight"))),M),connect(M,R),connect(G,O.listStateListener),connect(pipe(G,map(function(t){return [t.top,t.bottom]})),z),connect(pipe(G,map(function(t){return t.items})),F),W({listState:G,topItemsIndexes:A,endReached:streamFromEmitter(pipe(G,filter(function(t){return t.items.length>0}),withLatestFrom(p,g),filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),map(function(t){return [t[1]-1,t[2]]}),distinctUntilChanged(_),map(function(t){return t[0]}))),startReached:streamFromEmitter(pipe(G,throttleTime(200),filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),map(function(t){return t.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(G,filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(V))),itemsRendered:F},O)},tup(j,Tt,qt,kt,Ut,Ht,K,D),{singleton:!0}),oe=system(function(t){var e=t[0],n=e.sizes,l=e.firstItemIndex,u=e.data,c=t[1].listState,f=t[2].didMount,d=statefulStream(0);return connect(pipe(f,withLatestFrom(d),filter(function(t){return 0!==t[1]}),withLatestFrom(n,l,u),map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=void 0===r?[]:r,l=0;if(n.groupIndices.length>0)for(var a,u=N(n.groupIndices);!((a=u()).done||a.value-l>=e);)l++;var s=e+l;return Qt(Array.from({length:s}).map(function(t,e){return {index:e,size:0,offset:0,data:i[e]}}),[],s,n,o)})),c),{initialItemCount:d}},tup(Tt,ne,D),{singleton:!0}),re=system(function(t){var e=t[0].topItemsIndexes,n=statefulStream(0);return connect(pipe(n,filter(function(t){return t>0}),map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),e),{topItemCount:n}},tup(ne)),ie=system(function(t){var e=t[0],o=e.footerHeight,l=e.headerHeight,u=t[1].listState,s=stream(),c=statefulStreamFromEmitter(pipe(combineLatest(o,l,u),map(function(t){var e=t[2];return t[0]+t[1]+e.offsetBottom+e.bottom})),0);return connect(duc(c),s),{totalListHeight:c,totalListHeightChanged:s}},tup(j,ne),{singleton:!0}),le=system(function(t){var e=t[0],n=e.scrollBy,o=e.deviation,c=t[1].isScrolling,f=t[3],d=f.beforeUnshiftWith,m=f.sizes,h=streamFromEmitter(pipe(t[2].listState,withLatestFrom(e.scrollTop,e.scrollDirection,e.scrollingInProgress),filter(function(t){return !t[3]&&0!==t[1]&&t[2]===G}),map(function(t){return t[0]}),scan(function(t,e){var n=t[1],o=e.items,r=0;if(n.length>0&&o.length>0){var i=o[0].originalIndex,l=n[0].originalIndex;if(0!==i||0!==l)if(i===l)r=o[0].size-n[0].size;else for(var a=function(t){var e=o[t],i=n.find(function(t){return t.originalIndex===e.originalIndex});return i?e.offset!==i.offset?(r=e.offset-i.offset,"break"):void 0:"continue"},u=o.length-1;u>=0;u--){var s=a(u);if("continue"!==s&&"break"===s)break}}return [r,o]},[0,[]]),filter(function(t){return 0!==t[0]}),map(function(t){return t[0]})));return connect(pipe(h,withLatestFrom(o),map(function(t){return t[1]-t[0]})),o),subscribe(pipe(combineLatest(statefulStreamFromEmitter(c,!1),o),filter(function(t){return !t[0]&&0!==t[1]}),map(function(t){return t[1]}),throttleTime(1)),function(t){t>0?(publish(n,{top:-t,behavior:"auto"}),publish(o,0)):(publish(o,0),publish(n,{top:-t,behavior:"auto"}));}),connect(pipe(d,withLatestFrom(m),map(function(t){return t[0]*t[1].lastSize})),h),{deviation:o}},tup(j,K,ne,Tt)),ae=system(function(t){var e=t[0].totalListHeight,n=t[1].didMount,r=t[2].scrollTo,l=statefulStream(0);return subscribe(pipe(n,withLatestFrom(l),filter(function(t){return 0!==t[1]}),map(function(t){return {top:t[1]}})),function(t){handleNext(pipe(e,filter(function(t){return 0!==t})),function(){setTimeout(function(){publish(r,t);});});}),{initialScrollTop:l}},tup(ie,D,j),{singleton:!0}),ue=system(function(t){var e=t[0].viewportHeight,n=t[1].totalListHeight,r=statefulStream(!1);return {alignToBottom:r,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(r,e,n),filter(function(t){return t[0]}),map(function(t){return Math.max(0,t[1]-t[2])}),distinctUntilChanged()),0)}},tup(j,ie),{singleton:!0}),se=system(function(t){return W({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7])},tup(kt,oe,D,Y,ie,ae,ue,zt)),ce=system(function(t){var e=t[0],n=e.totalCount,o=e.sizeRanges,l=e.fixedItemSize,u=e.defaultItemSize,s=e.trackItemSizes,c=e.data,f=e.firstItemIndex,d=e.groupIndices,m=t[1],h=m.initialTopMostItemIndex,p=m.scrolledToInitialItem,v=t[2],g=t[3],I=t[4],C=I.listState,S=I.topItemsIndexes,x=A(I,["listState","topItemsIndexes"]),T=t[5].scrollToIndex,w=t[7].topItemCount,y=t[8].groupCounts,b=t[9];return connect(x.rangeChanged,b.scrollSeekRangeChanged),connect(pipe(b.windowViewportRect,map(prop("visibleHeight"))),v.viewportHeight),W({totalCount:n,data:c,firstItemIndex:f,sizeRanges:o,initialTopMostItemIndex:h,scrolledToInitialItem:p,topItemsIndexes:S,topItemCount:w,groupCounts:y,fixedItemHeight:l,defaultItemHeight:u},g,{listState:C,scrollToIndex:T,trackItemSizes:s,groupIndices:d},x,b,v)},tup(Tt,Ut,j,Yt,ne,Ht,le,re,qt,se)),fe=(Xt=function(){if("undefined"==typeof document)return "sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"},ee=!1,function(){return ee||(ee=!0,te=Xt()),te});function de(t){return t}var me=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream(function(t){return "Group "+t}),n=statefulStream({}),r=statefulStream(de),l=statefulStream("div"),u=statefulStream(noop),s=function(t,e){return void 0===e&&(e=null),statefulStreamFromEmitter(pipe(n,map(function(e){return e[t]}),distinctUntilChanged()),e)};return {itemContent:t,groupContent:e,components:n,computeItemKey:r,headerFooterTag:l,scrollerRef:u,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function he(t,e){var o=stream();return subscribe(o,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+e,"color: red;","color: inherit;","color: blue;")}),connect(o,t),o}var pe=system(function(t){var e=t[0],o=t[1],l={item:he(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:he(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:he(e.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:he(e.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:he(e.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function u(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),W({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(l.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(l.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(l.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=A(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,W({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),u(l.footer,"Footer","footer"),u(l.header,"Header","header"),u(l.ItemContainer,"Item","ItemContainer"),u(l.ListContainer,"List","ListContainer"),u(l.ScrollContainer,"Scroller","ScrollContainer"),u(l.emptyComponent,"EmptyPlaceholder","emptyComponent"),u(l.GroupContainer,"Group","GroupContainer"),W({},e,o,l)},tup(ce,me)),ve=function(t){return React.createElement("div",{style:{height:t.height}})},ge={position:fe(),zIndex:1},Ie=React.memo(function(t){var e,n=t.showTopList,o=void 0!==n&&n,r=Ee("listState"),i=Ee("deviation"),l=Le("sizeRanges"),a=Ee("itemContent"),u=Ee("groupContent"),s=(e=l,Vt(function(t){var n=function(t,e){var n=t.length;if(0===n)return null;for(var o=[],r=0;r<n;r++){var i=t.item(r);if(i&&void 0!==i.dataset.index){var l=parseInt(i.dataset.index),a=parseInt(i.dataset.knownSize),u=i.offsetHeight;if(0===u)throw new Error("Zero-sized element, this should not happen");if(u!==a){var s=o[o.length-1];0===o.length||s.size!==u||s.endIndex!==l-1?o.push({startIndex:l,endIndex:l,size:u}):o[o.length-1].endIndex++;}}}return o}(t.children);null!==n&&e(n);},Ee("trackItemSizes"))),c=Ee("EmptyPlaceholder"),f=Ee("ScrollSeekPlaceholder")||ve,d=Ee("ListComponent"),m=Ee("ItemComponent"),h=Ee("GroupComponent"),p=Ee("computeItemKey"),v=Ee("isSeeking"),g=Ee("groupIndices").length>0,I=Ee("paddingTopAddition"),C=Ee("scrolledToInitialItem"),S=o?{}:{boxSizing:"border-box",paddingTop:r.offsetTop+I,paddingBottom:r.offsetBottom,marginTop:i};return !o&&0===r.items.length&&c&&C?React.createElement(c):React.createElement(d,{ref:s,style:S},(o?r.topItems:r.items).map(function(t){var e=t.originalIndex,n=p(e);return v?React.createElement(f,{key:n,index:t.index,height:t.size}):"group"===t.type?React.createElement(h,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:ge},u(t.index)):React.createElement(m,{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex},g?a(t.index,t.groupIndex,t.data):a(t.index,t.data))}))}),Ce={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Se={width:"100%",height:"100%",position:"absolute",top:0},xe={width:"100%",position:fe(),top:0},Te=React.memo(function(){var t=Ee("HeaderComponent"),e=Le("headerHeight"),n=Ee("headerFooterTag"),o=Vt(function(t){return e(t.offsetHeight)});return t?React.createElement(n,{ref:o},React.createElement(t)):null}),we=React.memo(function(){var t=Ee("FooterComponent"),e=Le("footerHeight"),n=Ee("headerFooterTag"),o=Vt(function(t){return e(t.offsetHeight)});return t?React.createElement(n,{ref:o},React.createElement(t)):null});function ye(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=A(t,["style","children"]),a=e("scrollTop"),u=o("ScrollerComponent"),s=Dt(a,e("smoothScrollTargetReached"),u,o("scrollerRef")),c=s.scrollerRef,f=s.scrollByCallback;return n("scrollTo",s.scrollToCallback),n("scrollBy",f),React.createElement(u,W({ref:c,style:W({},Ce,r),tabIndex:0},l),i)})}function He(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return React.memo(function(t){var r=t.style,i=t.children,l=A(t,["style","children"]),a=e("windowScrollTop"),u=o("ScrollerComponent"),s=e("smoothScrollTargetReached"),c=o("totalListHeight"),f=Dt(a,s,u),d=f.scrollerRef,m=f.scrollByCallback,h=f.scrollToCallback;return jt(function(){return d.current=window,function(){d.current=null;}},[d]),n("windowScrollTo",h),n("scrollBy",m),React.createElement(u,W({style:W({position:"relative"},r,0!==c?{height:c}:{})},l),i)})}var be=function(t){var e=t.children,n=Le("viewportHeight"),o=Vt(compose(n,prop("offsetHeight")));return React.createElement("div",{style:Se,ref:o},e)},ke=function(t){var e=t.children,n=Gt(Le("windowViewportRect"));return React.createElement("div",{ref:n,style:Se},e)},ze=function(t){var e=t.children,n=Ee("TopItemListComponent"),o=Ee("headerHeight"),r=W({},xe,{marginTop:o+"px"});return React.createElement(n||"div",{style:r},e)},Re=systemToComponent(pe,{required:{},optional:{followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React.memo(function(t){var e=Ee("useWindowScroll"),n=Ee("topItemsIndexes").length>0,o=e?ke:be;return React.createElement(e?Pe:Oe,Object.assign({},t),React.createElement(o,null,React.createElement(Te,null),React.createElement(Ie,null),React.createElement(we,null)),n&&React.createElement(ze,null,React.createElement(Ie,{showTopList:!0})))})),Be=Re.Component,Le=Re.usePublisher,Ee=Re.useEmitterValue,Me=Re.useEmitter,Oe=ye({usePublisher:Le,useEmitterValue:Ee,useEmitter:Me}),Pe=He({usePublisher:Le,useEmitterValue:Ee,useEmitter:Me}),We=system(function(){var t=statefulStream(function(t){return "Item "+t}),e=statefulStream({}),n=statefulStream("virtuoso-grid-item"),r=statefulStream("virtuoso-grid-list"),l=statefulStream(de),u=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(e,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {itemContent:t,components:e,computeItemKey:l,itemClassName:n,listClassName:r,scrollerRef:u,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ae=system(function(t){var e=t[0],o=t[1],l={item:he(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function u(t,e,n){connect(pipe(t,withLatestFrom(o.components),map(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),W({},i,((o={})[e]=r,o))})),o.components);}return subscribe(l.scrollSeek,function(t){var n=t.placeholder,r=A(t,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(o.components,W({},getValue(o.components),{ScrollSeekPlaceholder:n})),publish(e.scrollSeekConfiguration,r);}),u(l.ItemContainer,"Item","ItemContainer"),u(l.ListContainer,"List","ListContainer"),u(l.ScrollContainer,"Scroller","ScrollContainer"),W({},e,o,l)},tup(At,We)),Fe=React.memo(function(){var t=De("gridState"),e=De("listClassName"),n=De("itemClassName"),o=De("itemContent"),r=De("computeItemKey"),i=De("isSeeking"),l=De("ItemComponent"),a=De("ListComponent"),u=De("ScrollSeekPlaceholder"),s=je("itemDimensions"),c=Vt(function(t){var e=t.firstChild;e&&s({width:e.offsetWidth,height:e.offsetHeight});});return React.createElement(a,{ref:c,className:e,style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}},t.items.map(function(e){var a=r(e.index);return i?React.createElement(u,{key:a,style:{height:t.itemHeight,width:t.itemWidth}}):React.createElement(l,{className:n,"data-index":e.index,key:a},o(e.index))}))}),Ne=function(t){var e=t.children,n=je("viewportDimensions"),o=Vt(function(t){n({width:t.offsetWidth,height:t.offsetHeight});});return React.createElement("div",{style:Se,ref:o},e)},_e=function(t){var e=t.children,n=Gt(je("windowViewportRect"));return React.createElement("div",{ref:n,style:Se},e)},Ve=systemToComponent(Ae,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React.memo(function(t){var e=W({},t),n=De("useWindowScroll"),o=n?_e:Ne;return React.createElement(n?Ye:Ke,Object.assign({},e),React.createElement(o,null,React.createElement(Fe,null)))})),je=Ve.usePublisher,De=Ve.useEmitterValue,Ue=Ve.useEmitter,Ke=ye({usePublisher:je,useEmitterValue:De,useEmitter:Ue}),Ye=He({usePublisher:je,useEmitterValue:De,useEmitter:Ue}),Ze=Be;
78603
78774
 
78604
78775
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
78605
78776
  var isBetween = createCommonjsModule$1(function (module, exports) {
@@ -80929,6 +81100,7 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
80929
81100
  exports.getMessageActions = getMessageActions;
80930
81101
  exports.getNonImageAttachments = getNonImageAttachments;
80931
81102
  exports.getReadByTooltipText = getReadByTooltipText;
81103
+ exports.getWholeChar = getWholeChar;
80932
81104
  exports.handleActionWarning = handleActionWarning;
80933
81105
  exports.hiTranslations = hiTranslations;
80934
81106
  exports.isAudioAttachment = isAudioAttachment;
@@ -80969,7 +81141,6 @@ var StreamChatReact = (function (exports, React, reactDom, streamChat) {
80969
81141
  exports.renderText = renderText;
80970
81142
  exports.ruTranslations = ruTranslations;
80971
81143
  exports.showMessageActionsBox = showMessageActionsBox;
80972
- exports.smartRender = smartRender;
80973
81144
  exports.trTranslations = trTranslations;
80974
81145
  exports.useActionHandler = useActionHandler;
80975
81146
  exports.useBreakpoint = useBreakpoint;