stream-chat-react 12.14.0 → 13.0.0-rc.1
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.
- package/dist/components/AIStateIndicator/AIStateIndicator.d.ts +4 -5
- package/dist/components/AIStateIndicator/hooks/useAIState.d.ts +2 -3
- package/dist/components/Attachment/Attachment.d.ts +8 -9
- package/dist/components/Attachment/Attachment.js +6 -5
- package/dist/components/Attachment/AttachmentActions.d.ts +2 -3
- package/dist/components/Attachment/AttachmentContainer.d.ts +15 -15
- package/dist/components/Attachment/AttachmentContainer.js +2 -2
- package/dist/components/Attachment/Audio.d.ts +3 -4
- package/dist/components/Attachment/Card.d.ts +1 -1
- package/dist/components/Attachment/FileAttachment.d.ts +3 -4
- package/dist/components/Attachment/FileAttachment.js +1 -1
- package/dist/components/Attachment/UnsupportedAttachment.d.ts +3 -4
- package/dist/components/Attachment/UnsupportedAttachment.js +1 -1
- package/dist/components/Attachment/VoiceRecording.d.ts +4 -5
- package/dist/components/Attachment/components/FileSizeIndicator.d.ts +1 -1
- package/dist/components/Attachment/components/FileSizeIndicator.js +4 -2
- package/dist/components/Attachment/utils.d.ts +8 -22
- package/dist/components/Attachment/utils.js +3 -18
- package/dist/components/Avatar/Avatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.js +1 -1
- package/dist/components/Avatar/GroupAvatar.d.ts +2 -2
- package/dist/components/Channel/Channel.d.ts +18 -37
- package/dist/components/Channel/Channel.js +25 -88
- package/dist/components/Channel/channelState.d.ts +17 -18
- package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.js +1 -15
- package/dist/components/Channel/hooks/useCreateTypingContext.d.ts +1 -2
- package/dist/components/Channel/hooks/useEditMessageHandler.d.ts +3 -4
- package/dist/components/Channel/hooks/useMentionsHandlers.d.ts +3 -4
- package/dist/components/Channel/utils.d.ts +8 -6
- package/dist/components/Channel/utils.js +1 -0
- package/dist/components/ChannelHeader/ChannelHeader.d.ts +2 -3
- package/dist/components/ChannelList/ChannelList.d.ts +31 -30
- package/dist/components/ChannelList/ChannelList.js +8 -10
- package/dist/components/ChannelList/ChannelListMessenger.d.ts +6 -6
- package/dist/components/ChannelList/hooks/useChannelDeletedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelHiddenListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelListShape.d.ts +44 -44
- package/dist/components/ChannelList/hooks/useChannelListShape.js +0 -2
- package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -3
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelVisibleListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +7 -8
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +3 -3
- package/dist/components/ChannelList/hooks/useSelectedChannelState.d.ts +7 -7
- package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.d.ts +1 -2
- package/dist/components/ChannelList/utils.d.ts +20 -21
- package/dist/components/ChannelList/utils.js +2 -2
- package/dist/components/ChannelPreview/ChannelPreview.d.ts +15 -16
- package/dist/components/ChannelPreview/ChannelPreview.js +1 -1
- package/dist/components/ChannelPreview/ChannelPreviewActionButtons.d.ts +4 -4
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts +3 -4
- package/dist/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useMessageDeliveryStatus.d.ts +5 -7
- package/dist/components/ChannelPreview/icons.d.ts +1 -1
- package/dist/components/ChannelPreview/utils.d.ts +7 -7
- package/dist/components/ChannelSearch/ChannelSearch.d.ts +5 -6
- package/dist/components/ChannelSearch/ChannelSearch.js +2 -2
- package/dist/components/ChannelSearch/SearchBar.d.ts +1 -1
- package/dist/components/ChannelSearch/SearchBar.js +1 -1
- package/dist/components/ChannelSearch/SearchResults.d.ts +13 -14
- package/dist/components/ChannelSearch/SearchResults.js +1 -1
- package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts +17 -18
- package/dist/components/ChannelSearch/hooks/useChannelSearch.js +2 -6
- package/dist/components/ChannelSearch/utils.d.ts +2 -3
- package/dist/components/Chat/Chat.d.ts +9 -9
- package/dist/components/Chat/hooks/useChannelsQueryState.d.ts +1 -1
- package/dist/components/Chat/hooks/useChat.d.ts +10 -10
- package/dist/components/Chat/hooks/useChat.js +3 -3
- package/dist/components/Chat/hooks/useCreateChatClient.d.ts +4 -4
- package/dist/components/Chat/hooks/useCreateChatContext.d.ts +1 -2
- package/dist/components/Dialog/DialogAnchor.d.ts +4 -3
- package/dist/components/Dialog/DialogAnchor.js +2 -2
- package/dist/components/Dialog/DialogMenu.d.ts +2 -1
- package/dist/components/Dialog/DialogPortal.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.js +1 -1
- package/dist/components/Dialog/PromptDialog.d.ts +2 -1
- package/dist/components/DragAndDrop/DragAndDropContainer.d.ts +2 -1
- package/dist/components/EventComponent/EventComponent.d.ts +7 -6
- package/dist/components/Form/FieldError.d.ts +2 -1
- package/dist/components/Form/SwitchField.d.ts +2 -1
- package/dist/components/Form/SwitchField.js +1 -1
- package/dist/components/Gallery/Gallery.d.ts +5 -5
- package/dist/components/Gallery/Image.d.ts +6 -5
- package/dist/components/Gallery/ModalGallery.d.ts +3 -4
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +2 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScrollPaginator.d.ts +2 -1
- package/dist/components/LoadMore/LoadMoreButton.d.ts +2 -1
- package/dist/components/LoadMore/LoadMorePaginator.d.ts +3 -2
- package/dist/components/LoadMore/LoadMorePaginator.js +1 -1
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecorder.js +3 -2
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecordingInProgress.js +1 -1
- package/dist/components/MediaRecorder/RecordingPermissionDeniedNotification.d.ts +1 -1
- package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts +11 -23
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts +8 -8
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.js +6 -4
- package/dist/components/MediaRecorder/observable/BehaviorSubject.d.ts +2 -2
- package/dist/components/MediaRecorder/observable/Observable.d.ts +1 -1
- package/dist/components/MediaRecorder/observable/Subject.d.ts +3 -2
- package/dist/components/Message/FixedHeightMessage.d.ts +4 -5
- package/dist/components/Message/Message.d.ts +1 -2
- package/dist/components/Message/MessageDeleted.d.ts +4 -5
- package/dist/components/Message/MessageEditedTimestamp.d.ts +2 -3
- package/dist/components/Message/MessageErrorText.d.ts +4 -5
- package/dist/components/Message/MessageErrorText.js +2 -2
- package/dist/components/Message/MessageOptions.d.ts +3 -3
- package/dist/components/Message/MessageRepliesCountButton.d.ts +2 -1
- package/dist/components/Message/MessageSimple.d.ts +1 -2
- package/dist/components/Message/MessageSimple.js +8 -10
- package/dist/components/Message/MessageStatus.d.ts +3 -4
- package/dist/components/Message/MessageText.d.ts +6 -6
- package/dist/components/Message/MessageTimestamp.d.ts +4 -5
- package/dist/components/Message/QuotedMessage.d.ts +2 -3
- package/dist/components/Message/QuotedMessage.js +1 -1
- package/dist/components/Message/StreamedMessageText.d.ts +3 -4
- package/dist/components/Message/hooks/useActionHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useActionHandler.js +1 -1
- package/dist/components/Message/hooks/useDeleteHandler.d.ts +4 -5
- package/dist/components/Message/hooks/useFlagHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMarkUnreadHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMentionsHandler.d.ts +6 -8
- package/dist/components/Message/hooks/useMessageTextStreaming.d.ts +2 -3
- package/dist/components/Message/hooks/useMuteHandler.d.ts +5 -7
- package/dist/components/Message/hooks/useMuteHandler.js +1 -1
- package/dist/components/Message/hooks/useOpenThreadHandler.d.ts +2 -3
- package/dist/components/Message/hooks/usePinHandler.d.ts +4 -5
- package/dist/components/Message/hooks/usePinHandler.js +1 -1
- package/dist/components/Message/hooks/useReactionHandler.d.ts +3 -4
- package/dist/components/Message/hooks/useReactionHandler.js +2 -4
- package/dist/components/Message/hooks/useReactionsFetcher.d.ts +5 -7
- package/dist/components/Message/hooks/useRetryHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useRetryHandler.js +1 -1
- package/dist/components/Message/hooks/useUserHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useUserRole.d.ts +2 -3
- package/dist/components/Message/hooks/useUserRole.js +1 -1
- package/dist/components/Message/icons.d.ts +2 -2
- package/dist/components/Message/icons.js +1 -1
- package/dist/components/Message/renderText/componentRenderers/Anchor.d.ts +2 -1
- package/dist/components/Message/renderText/componentRenderers/Emoji.d.ts +1 -1
- package/dist/components/Message/renderText/componentRenderers/Mention.d.ts +5 -5
- package/dist/components/Message/renderText/componentRenderers/Mention.js +1 -1
- package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +1 -2
- package/dist/components/Message/renderText/renderText.d.ts +6 -6
- package/dist/components/Message/renderText/types.d.ts +1 -1
- package/dist/components/Message/types.d.ts +27 -28
- package/dist/components/Message/utils.d.ts +21 -22
- package/dist/components/Message/utils.js +5 -4
- package/dist/components/MessageActions/CustomMessageActionsList.d.ts +6 -7
- package/dist/components/MessageActions/MessageActions.d.ts +6 -5
- package/dist/components/MessageActions/MessageActions.js +1 -1
- package/dist/components/MessageActions/MessageActionsBox.d.ts +5 -5
- package/dist/components/MessageActions/MessageActionsBox.js +4 -3
- package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +1 -1
- package/dist/components/MessageBounce/MessageBounceModal.d.ts +4 -3
- package/dist/components/MessageBounce/MessageBouncePrompt.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts +11 -11
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.js +17 -14
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts +4 -12
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.js +8 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.js +2 -2
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts +7 -5
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts +1 -1
- package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts +3 -4
- package/dist/components/MessageInput/AttachmentSelector.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentSelector.js +5 -3
- package/dist/components/MessageInput/EditMessageForm.d.ts +3 -2
- package/dist/components/MessageInput/EditMessageForm.js +30 -6
- package/dist/components/MessageInput/LinkPreviewList.d.ts +6 -4
- package/dist/components/MessageInput/LinkPreviewList.js +24 -10
- package/dist/components/MessageInput/MessageInput.d.ts +23 -45
- package/dist/components/MessageInput/MessageInput.js +25 -15
- package/dist/components/MessageInput/MessageInputFlat.d.ts +1 -2
- package/dist/components/MessageInput/MessageInputFlat.js +31 -76
- package/dist/components/MessageInput/QuotedMessagePreview.d.ts +4 -7
- package/dist/components/MessageInput/QuotedMessagePreview.js +22 -16
- package/dist/components/MessageInput/SendButton.d.ts +4 -5
- package/dist/components/MessageInput/SendButton.js +6 -2
- package/dist/components/MessageInput/WithDragAndDropUpload.d.ts +38 -0
- package/dist/components/MessageInput/WithDragAndDropUpload.js +96 -0
- package/dist/components/MessageInput/hooks/index.d.ts +5 -1
- package/dist/components/MessageInput/hooks/index.js +5 -1
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.d.ts +10 -0
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.js +19 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.js +10 -0
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts +2 -3
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts +1 -2
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +1 -55
- package/dist/components/MessageInput/hooks/useMessageComposer.d.ts +2 -0
- package/dist/components/MessageInput/hooks/useMessageComposer.js +80 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.js +8 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +12 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.js +23 -0
- package/dist/components/MessageInput/hooks/useMessageInputText.d.ts +1 -5
- package/dist/components/MessageInput/hooks/useMessageInputText.js +19 -53
- package/dist/components/MessageInput/hooks/usePasteHandler.d.ts +1 -3
- package/dist/components/MessageInput/hooks/usePasteHandler.js +6 -8
- package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts +2 -6
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +30 -98
- package/dist/components/MessageInput/hooks/utils.d.ts +0 -27
- package/dist/components/MessageInput/hooks/utils.js +0 -124
- package/dist/components/MessageInput/index.d.ts +1 -2
- package/dist/components/MessageInput/index.js +1 -2
- package/dist/components/MessageList/ConnectionStatus.d.ts +1 -2
- package/dist/components/MessageList/ConnectionStatus.js +1 -1
- package/dist/components/MessageList/CustomNotification.d.ts +2 -1
- package/dist/components/MessageList/GiphyPreviewMessage.d.ts +4 -5
- package/dist/components/MessageList/MessageList.d.ts +11 -12
- package/dist/components/MessageList/MessageList.js +4 -4
- package/dist/components/MessageList/MessageNotification.d.ts +2 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +22 -21
- package/dist/components/MessageList/VirtualizedMessageList.js +6 -6
- package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +10 -10
- package/dist/components/MessageList/VirtualizedMessageListComponents.js +7 -7
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +8 -10
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +1 -1
- package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts +11 -12
- package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts +4 -5
- package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts +5 -6
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.js +3 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +6 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.d.ts +3 -4
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.js +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.d.ts +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.js +5 -1
- package/dist/components/MessageList/hooks/useMarkRead.d.ts +1 -2
- package/dist/components/MessageList/renderMessages.d.ts +14 -14
- package/dist/components/MessageList/renderMessages.js +8 -7
- package/dist/components/MessageList/utils.d.ts +34 -28
- package/dist/components/MessageList/utils.js +26 -21
- package/dist/components/Modal/Modal.d.ts +2 -1
- package/dist/components/Poll/Poll.d.ts +2 -3
- package/dist/components/Poll/Poll.js +1 -1
- package/dist/components/Poll/PollActions/AddCommentForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/AddCommentForm.js +4 -2
- package/dist/components/Poll/PollActions/EndPollDialog.d.ts +1 -2
- package/dist/components/Poll/PollActions/EndPollDialog.js +1 -1
- package/dist/components/Poll/PollActions/PollAction.d.ts +2 -1
- package/dist/components/Poll/PollActions/PollActions.d.ts +7 -8
- package/dist/components/Poll/PollActions/PollActions.js +5 -5
- package/dist/components/Poll/PollActions/PollAnswerList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.js +4 -2
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithLatestVotes.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.d.ts +4 -5
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollResults.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollResults/PollResults.js +1 -1
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.js +3 -1
- package/dist/components/Poll/PollContent.d.ts +1 -2
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.js +35 -0
- package/dist/components/Poll/PollCreationDialog/NameField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/NameField.js +26 -0
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.d.ts +1 -8
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.js +33 -65
- package/dist/components/Poll/PollCreationDialog/PollCreationDialog.js +31 -85
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.d.ts +1 -4
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.js +15 -41
- package/dist/components/Poll/PollCreationDialog/types.d.ts +0 -14
- package/dist/components/Poll/PollHeader.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.js +4 -2
- package/dist/components/Poll/PollOptionSelector.d.ts +3 -4
- package/dist/components/Poll/PollVote.d.ts +6 -7
- package/dist/components/Poll/PollVote.js +3 -3
- package/dist/components/Poll/QuotedPoll.d.ts +1 -2
- package/dist/components/Poll/constants.d.ts +0 -1
- package/dist/components/Poll/constants.js +0 -1
- package/dist/components/Poll/hooks/useManagePollVotesRealtime.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.js +2 -2
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.js +1 -1
- package/dist/components/Portal/Portal.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIcon.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIconSet.d.ts +2 -1
- package/dist/components/ReactFileUtilities/FileIcon/iconMap.d.ts +1 -1
- package/dist/components/ReactFileUtilities/UploadButton.d.ts +3 -2
- package/dist/components/ReactFileUtilities/UploadButton.js +16 -6
- package/dist/components/ReactFileUtilities/index.d.ts +0 -1
- package/dist/components/ReactFileUtilities/index.js +0 -1
- package/dist/components/ReactFileUtilities/utils.d.ts +2 -2
- package/dist/components/Reactions/ReactionSelector.d.ts +4 -5
- package/dist/components/Reactions/ReactionSelectorWithButton.d.ts +1 -2
- package/dist/components/Reactions/ReactionsList.d.ts +6 -7
- package/dist/components/Reactions/ReactionsList.js +2 -2
- package/dist/components/Reactions/ReactionsListModal.d.ts +9 -10
- package/dist/components/Reactions/SimpleReactionsList.d.ts +5 -6
- package/dist/components/Reactions/StreamEmoji.d.ts +1 -1
- package/dist/components/Reactions/hooks/useFetchReactions.d.ts +9 -10
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts +1 -2
- package/dist/components/Reactions/types.d.ts +3 -4
- package/dist/components/Reactions/utils/utils.d.ts +1 -1
- package/dist/components/SafeAnchor/SafeAnchor.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.js +1 -2
- package/dist/components/{EmoticonItem → TextareaComposer/SuggestionList}/EmoticonItem.d.ts +7 -7
- package/dist/components/TextareaComposer/SuggestionList/EmoticonItem.js +12 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.d.ts +16 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.js +49 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts +18 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.js +25 -0
- package/dist/components/{UserItem → TextareaComposer/SuggestionList}/UserItem.d.ts +7 -4
- package/dist/components/TextareaComposer/SuggestionList/UserItem.js +24 -0
- package/dist/components/TextareaComposer/SuggestionList/index.d.ts +5 -0
- package/dist/components/TextareaComposer/SuggestionList/index.js +5 -0
- package/dist/components/TextareaComposer/TextareaComposer.d.ts +13 -0
- package/dist/components/TextareaComposer/TextareaComposer.js +155 -0
- package/dist/components/TextareaComposer/index.d.ts +2 -0
- package/dist/components/TextareaComposer/index.js +2 -0
- package/dist/components/Thread/Thread.d.ts +13 -10
- package/dist/components/Thread/Thread.js +23 -12
- package/dist/components/Thread/ThreadHead.d.ts +2 -3
- package/dist/components/Thread/ThreadHeader.d.ts +5 -6
- package/dist/components/Thread/ThreadHeader.js +1 -1
- package/dist/components/Threads/ThreadContext.d.ts +2 -2
- package/dist/components/Threads/ThreadContext.js +1 -4
- package/dist/components/Threads/ThreadList/ThreadList.d.ts +1 -1
- package/dist/components/Threads/ThreadList/ThreadListItem.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadManagerState.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadState.d.ts +1 -1
- package/dist/components/Threads/icons.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +1 -1
- package/dist/components/TypingIndicator/TypingIndicator.d.ts +1 -2
- package/dist/components/Window/Window.d.ts +6 -6
- package/dist/components/index.d.ts +1 -5
- package/dist/components/index.js +1 -5
- package/dist/context/AttachmentSelectorContext.d.ts +2 -1
- package/dist/context/ChannelActionContext.d.ts +26 -35
- package/dist/context/ChannelListContext.d.ts +9 -9
- package/dist/context/ChannelListContext.js +1 -1
- package/dist/context/ChannelStateContext.d.ts +24 -34
- package/dist/context/ChatContext.d.ts +18 -17
- package/dist/context/ComponentContext.d.ts +39 -37
- package/dist/context/DialogManagerContext.d.ts +2 -1
- package/dist/context/MessageBounceContext.d.ts +8 -7
- package/dist/context/MessageBounceContext.js +1 -1
- package/dist/context/MessageContext.d.ts +23 -23
- package/dist/context/MessageInputContext.d.ts +8 -26
- package/dist/context/MessageInputContext.js +3 -2
- package/dist/context/MessageListContext.d.ts +2 -1
- package/dist/context/PollContext.d.ts +8 -8
- package/dist/context/TranslationContext.d.ts +2 -1
- package/dist/context/TypingContext.d.ts +11 -10
- package/dist/context/VirtualizedMessageListContext.d.ts +2 -1
- package/dist/context/WithComponents.d.ts +3 -2
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/experimental/MessageActions/MessageActions.d.ts +1 -1
- package/dist/experimental/MessageActions/MessageActions.js +1 -1
- package/dist/experimental/MessageActions/defaults.js +4 -3
- package/dist/experimental/Search/Search.d.ts +1 -2
- package/dist/experimental/Search/SearchContext.d.ts +8 -8
- package/dist/experimental/Search/SearchResults/SearchResultItem.d.ts +11 -11
- package/dist/experimental/Search/SearchResults/SearchResultItem.js +3 -3
- package/dist/experimental/Search/SearchResults/SearchResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.js +1 -1
- package/dist/experimental/Search/SearchResults/SearchSourceResultList.d.ts +2 -3
- package/dist/experimental/Search/SearchResults/SearchSourceResultListFooter.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.js +1 -1
- package/dist/experimental/Search/SearchSourceResultsContext.d.ts +2 -1
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.d.ts +1 -2
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.js +3 -1
- package/dist/experimental/Search/hooks/useSearchQueriesInProgress.d.ts +3 -4
- package/dist/experimental/index.browser.cjs +1139 -1075
- package/dist/experimental/index.browser.cjs.map +4 -4
- package/dist/experimental/index.node.cjs +1139 -1075
- package/dist/experimental/index.node.cjs.map +4 -4
- package/dist/i18n/Streami18n.d.ts +1 -1
- package/dist/i18n/types.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/i18n/utils.js +3 -1
- package/dist/index.browser.cjs +28545 -30631
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +30774 -32868
- package/dist/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/index.browser.cjs +133 -5
- package/dist/plugins/Emojis/index.browser.cjs.map +4 -4
- package/dist/plugins/Emojis/index.d.ts +1 -0
- package/dist/plugins/Emojis/index.js +1 -0
- package/dist/plugins/Emojis/index.node.cjs +135 -6
- package/dist/plugins/Emojis/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/middleware/index.d.ts +1 -0
- package/dist/plugins/Emojis/middleware/index.js +1 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts +66 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.js +143 -0
- package/dist/plugins/encoders/mp3.browser.cjs.map +2 -2
- package/dist/plugins/encoders/mp3.node.cjs.map +2 -2
- package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +14 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +11 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-layout.scss +14 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-theme.scss +17 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-layout.scss +18 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-theme.scss +15 -0
- package/dist/scss/v2/MessageInput/MessageInput-layout.scss +0 -13
- package/dist/scss/v2/MessageInput/MessageInput-theme.scss +8 -19
- package/dist/scss/v2/index.layout.scss +2 -1
- package/dist/scss/v2/index.scss +1 -0
- package/dist/types/defaultDataInterfaces.d.ts +25 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types.d.ts +2 -62
- package/dist/utils/getChannel.d.ts +5 -6
- package/dist/utils/mergeDeep.d.ts +2 -3
- package/package.json +5 -5
- package/dist/components/AutoCompleteTextarea/Item.d.ts +0 -2
- package/dist/components/AutoCompleteTextarea/Item.js +0 -10
- package/dist/components/AutoCompleteTextarea/List.d.ts +0 -17
- package/dist/components/AutoCompleteTextarea/List.js +0 -89
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts +0 -114
- package/dist/components/AutoCompleteTextarea/Textarea.js +0 -593
- package/dist/components/AutoCompleteTextarea/index.d.ts +0 -4
- package/dist/components/AutoCompleteTextarea/index.js +0 -4
- package/dist/components/AutoCompleteTextarea/types.d.ts +0 -15
- package/dist/components/AutoCompleteTextarea/utils.d.ts +0 -6
- package/dist/components/AutoCompleteTextarea/utils.js +0 -40
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +0 -78
- package/dist/components/ChatAutoComplete/ChatAutoComplete.js +0 -33
- package/dist/components/ChatAutoComplete/index.d.ts +0 -1
- package/dist/components/ChatAutoComplete/index.js +0 -1
- package/dist/components/CommandItem/index.d.ts +0 -1
- package/dist/components/CommandItem/index.js +0 -1
- package/dist/components/EmoticonItem/EmoticonItem.js +0 -16
- package/dist/components/EmoticonItem/index.d.ts +0 -1
- package/dist/components/EmoticonItem/index.js +0 -1
- package/dist/components/MessageInput/DefaultTriggerProvider.d.ts +0 -35
- package/dist/components/MessageInput/DefaultTriggerProvider.js +0 -24
- package/dist/components/MessageInput/DropzoneProvider.d.ts +0 -4
- package/dist/components/MessageInput/DropzoneProvider.js +0 -23
- package/dist/components/MessageInput/hooks/useAttachments.d.ts +0 -14
- package/dist/components/MessageInput/hooks/useAttachments.js +0 -209
- package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useCommandTrigger.js +0 -62
- package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useEmojiTrigger.js +0 -29
- package/dist/components/MessageInput/hooks/useLinkPreviews.d.ts +0 -30
- package/dist/components/MessageInput/hooks/useLinkPreviews.js +0 -109
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +0 -71
- package/dist/components/MessageInput/hooks/useMessageInputState.js +0 -200
- package/dist/components/MessageInput/hooks/useUserTrigger.d.ts +0 -12
- package/dist/components/MessageInput/hooks/useUserTrigger.js +0 -130
- package/dist/components/MessageInput/types.d.ts +0 -87
- package/dist/components/MessageInput/types.js +0 -19
- package/dist/components/ReactFileUtilities/ImageDropzone.d.ts +0 -16
- package/dist/components/ReactFileUtilities/ImageDropzone.js +0 -42
- package/dist/components/UserItem/UserItem.js +0 -26
- package/dist/components/UserItem/index.d.ts +0 -1
- package/dist/components/UserItem/index.js +0 -1
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.d.ts +0 -0
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.js +0 -0
- /package/dist/scss/v2/DragAndDropContainer/{DragAmdDropContainer-layout.scss → DragAndDropContainer-layout.scss} +0 -0
- /package/dist/{components/AutoCompleteTextarea/types.js → types/defaultDataInterfaces.js} +0 -0
|
@@ -326,30 +326,16 @@ __export(experimental_exports, {
|
|
|
326
326
|
module.exports = __toCommonJS(experimental_exports);
|
|
327
327
|
|
|
328
328
|
// src/experimental/MessageActions/MessageActions.tsx
|
|
329
|
-
var
|
|
330
|
-
var
|
|
331
|
-
|
|
332
|
-
// src/context/ChannelActionContext.tsx
|
|
333
|
-
var import_react = __toESM(require("react"));
|
|
334
|
-
var ChannelActionContext = import_react.default.createContext(void 0);
|
|
335
|
-
var useChannelActionContext = (componentName) => {
|
|
336
|
-
const contextValue = (0, import_react.useContext)(ChannelActionContext);
|
|
337
|
-
if (!contextValue) {
|
|
338
|
-
console.warn(
|
|
339
|
-
`The useChannelActionContext hook was called outside of the ChannelActionContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`
|
|
340
|
-
);
|
|
341
|
-
return {};
|
|
342
|
-
}
|
|
343
|
-
return contextValue;
|
|
344
|
-
};
|
|
329
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
330
|
+
var import_react39 = __toESM(require("react"));
|
|
345
331
|
|
|
346
332
|
// src/context/ChannelListContext.tsx
|
|
347
|
-
var
|
|
348
|
-
var ChannelListContext = (0,
|
|
333
|
+
var import_react = __toESM(require("react"));
|
|
334
|
+
var ChannelListContext = (0, import_react.createContext)(
|
|
349
335
|
void 0
|
|
350
336
|
);
|
|
351
337
|
var useChannelListContext = (componentName) => {
|
|
352
|
-
const contextValue = (0,
|
|
338
|
+
const contextValue = (0, import_react.useContext)(ChannelListContext);
|
|
353
339
|
if (!contextValue) {
|
|
354
340
|
console.warn(
|
|
355
341
|
`The useChannelListContext hook was called outside of the ChannelListContext provider. Make sure this hook is called within the ChannelList component. The errored call is located in the ${componentName} component.`
|
|
@@ -360,10 +346,10 @@ var useChannelListContext = (componentName) => {
|
|
|
360
346
|
};
|
|
361
347
|
|
|
362
348
|
// src/context/ChannelStateContext.tsx
|
|
363
|
-
var
|
|
364
|
-
var ChannelStateContext =
|
|
349
|
+
var import_react2 = __toESM(require("react"));
|
|
350
|
+
var ChannelStateContext = import_react2.default.createContext(void 0);
|
|
365
351
|
var useChannelStateContext = (componentName) => {
|
|
366
|
-
const contextValue = (0,
|
|
352
|
+
const contextValue = (0, import_react2.useContext)(ChannelStateContext);
|
|
367
353
|
if (!contextValue) {
|
|
368
354
|
console.warn(
|
|
369
355
|
`The useChannelStateContext hook was called outside of the ChannelStateContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`
|
|
@@ -374,10 +360,10 @@ var useChannelStateContext = (componentName) => {
|
|
|
374
360
|
};
|
|
375
361
|
|
|
376
362
|
// src/context/ChatContext.tsx
|
|
377
|
-
var
|
|
378
|
-
var ChatContext =
|
|
363
|
+
var import_react3 = __toESM(require("react"));
|
|
364
|
+
var ChatContext = import_react3.default.createContext(void 0);
|
|
379
365
|
var useChatContext = (componentName) => {
|
|
380
|
-
const contextValue = (0,
|
|
366
|
+
const contextValue = (0, import_react3.useContext)(ChatContext);
|
|
381
367
|
if (!contextValue) {
|
|
382
368
|
console.warn(
|
|
383
369
|
`The useChatContext hook was called outside of the ChatContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`
|
|
@@ -388,33 +374,33 @@ var useChatContext = (componentName) => {
|
|
|
388
374
|
};
|
|
389
375
|
|
|
390
376
|
// src/context/ComponentContext.tsx
|
|
391
|
-
var
|
|
392
|
-
var ComponentContext =
|
|
393
|
-
var useComponentContext = (_componentName) => (0,
|
|
377
|
+
var import_react4 = __toESM(require("react"));
|
|
378
|
+
var ComponentContext = import_react4.default.createContext({});
|
|
379
|
+
var useComponentContext = (_componentName) => (0, import_react4.useContext)(ComponentContext);
|
|
394
380
|
|
|
395
381
|
// src/context/DialogManagerContext.tsx
|
|
396
|
-
var
|
|
382
|
+
var import_react9 = __toESM(require("react"));
|
|
397
383
|
|
|
398
384
|
// src/components/Dialog/DialogPortal.tsx
|
|
399
|
-
var
|
|
385
|
+
var import_react8 = __toESM(require("react"));
|
|
400
386
|
|
|
401
387
|
// src/components/Dialog/hooks/useDialog.ts
|
|
402
|
-
var
|
|
388
|
+
var import_react6 = require("react");
|
|
403
389
|
|
|
404
390
|
// src/store/hooks/useStateStore.ts
|
|
405
|
-
var
|
|
391
|
+
var import_react5 = require("react");
|
|
406
392
|
var import_shim = require("use-sync-external-store/shim");
|
|
407
393
|
var noop = () => {
|
|
408
394
|
};
|
|
409
395
|
function useStateStore(store, selector2) {
|
|
410
|
-
const wrappedSubscription = (0,
|
|
396
|
+
const wrappedSubscription = (0, import_react5.useCallback)(
|
|
411
397
|
(onStoreChange) => {
|
|
412
398
|
const unsubscribe = store?.subscribeWithSelector(selector2, onStoreChange);
|
|
413
399
|
return unsubscribe ?? noop;
|
|
414
400
|
},
|
|
415
401
|
[store, selector2]
|
|
416
402
|
);
|
|
417
|
-
const wrappedSnapshot = (0,
|
|
403
|
+
const wrappedSnapshot = (0, import_react5.useMemo)(() => {
|
|
418
404
|
let cachedTuple;
|
|
419
405
|
return () => {
|
|
420
406
|
const currentValue = store?.getLatestValue();
|
|
@@ -443,7 +429,7 @@ function useStateStore(store, selector2) {
|
|
|
443
429
|
// src/components/Dialog/hooks/useDialog.ts
|
|
444
430
|
var useDialog = ({ id }) => {
|
|
445
431
|
const { dialogManager } = useDialogManager();
|
|
446
|
-
(0,
|
|
432
|
+
(0, import_react6.useEffect)(
|
|
447
433
|
() => () => {
|
|
448
434
|
dialogManager.markForRemoval(id);
|
|
449
435
|
},
|
|
@@ -453,7 +439,7 @@ var useDialog = ({ id }) => {
|
|
|
453
439
|
};
|
|
454
440
|
var useDialogIsOpen = (id) => {
|
|
455
441
|
const { dialogManager } = useDialogManager();
|
|
456
|
-
const dialogIsOpenSelector = (0,
|
|
442
|
+
const dialogIsOpenSelector = (0, import_react6.useCallback)(
|
|
457
443
|
({ dialogsById }) => ({ isOpen: !!dialogsById[id]?.isOpen }),
|
|
458
444
|
[id]
|
|
459
445
|
);
|
|
@@ -461,15 +447,15 @@ var useDialogIsOpen = (id) => {
|
|
|
461
447
|
};
|
|
462
448
|
|
|
463
449
|
// src/components/Portal/Portal.ts
|
|
464
|
-
var
|
|
450
|
+
var import_react7 = require("react");
|
|
465
451
|
var import_react_dom = require("react-dom");
|
|
466
452
|
var Portal = ({
|
|
467
453
|
children,
|
|
468
454
|
getPortalDestination,
|
|
469
455
|
isOpen
|
|
470
456
|
}) => {
|
|
471
|
-
const [portalDestination, setPortalDestination] = (0,
|
|
472
|
-
(0,
|
|
457
|
+
const [portalDestination, setPortalDestination] = (0, import_react7.useState)(null);
|
|
458
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
473
459
|
const destination = getPortalDestination();
|
|
474
460
|
if (!destination || !isOpen) return;
|
|
475
461
|
setPortalDestination(destination);
|
|
@@ -485,40 +471,35 @@ var DialogPortalEntry = ({
|
|
|
485
471
|
}) => {
|
|
486
472
|
const { dialogManager } = useDialogManager();
|
|
487
473
|
const dialogIsOpen = useDialogIsOpen(dialogId);
|
|
488
|
-
const getPortalDestination = (0,
|
|
474
|
+
const getPortalDestination = (0, import_react8.useCallback)(
|
|
489
475
|
() => document.querySelector(`div[data-str-chat__portal-id="${dialogManager.id}"]`),
|
|
490
476
|
[dialogManager.id]
|
|
491
477
|
);
|
|
492
|
-
return /* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ import_react8.default.createElement(Portal, { getPortalDestination, isOpen: dialogIsOpen }, children);
|
|
493
479
|
};
|
|
494
480
|
|
|
495
481
|
// src/context/DialogManagerContext.tsx
|
|
496
|
-
var DialogManagerProviderContext =
|
|
482
|
+
var DialogManagerProviderContext = import_react9.default.createContext(void 0);
|
|
497
483
|
var useDialogManager = () => {
|
|
498
|
-
const value = (0,
|
|
484
|
+
const value = (0, import_react9.useContext)(DialogManagerProviderContext);
|
|
499
485
|
return value;
|
|
500
486
|
};
|
|
501
487
|
|
|
502
488
|
// src/context/MessageContext.tsx
|
|
503
|
-
var
|
|
504
|
-
var MessageContext =
|
|
489
|
+
var import_react10 = __toESM(require("react"));
|
|
490
|
+
var MessageContext = import_react10.default.createContext(
|
|
505
491
|
void 0
|
|
506
492
|
);
|
|
507
493
|
var useMessageContext = (_componentName) => {
|
|
508
|
-
const contextValue = (0,
|
|
494
|
+
const contextValue = (0, import_react10.useContext)(MessageContext);
|
|
509
495
|
if (!contextValue) {
|
|
510
496
|
return {};
|
|
511
497
|
}
|
|
512
498
|
return contextValue;
|
|
513
499
|
};
|
|
514
500
|
|
|
515
|
-
// src/constants/limits.ts
|
|
516
|
-
var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
|
|
517
|
-
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
518
|
-
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
519
|
-
|
|
520
501
|
// src/context/TranslationContext.tsx
|
|
521
|
-
var
|
|
502
|
+
var import_react11 = __toESM(require("react"));
|
|
522
503
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
523
504
|
var import_calendar = __toESM(require("dayjs/plugin/calendar"));
|
|
524
505
|
var import_localizedFormat = __toESM(require("dayjs/plugin/localizedFormat"));
|
|
@@ -531,13 +512,13 @@ var defaultDateTimeParser = (input) => (0, import_dayjs.default)(input);
|
|
|
531
512
|
// src/context/TranslationContext.tsx
|
|
532
513
|
import_dayjs2.default.extend(import_calendar.default);
|
|
533
514
|
import_dayjs2.default.extend(import_localizedFormat.default);
|
|
534
|
-
var TranslationContext =
|
|
515
|
+
var TranslationContext = import_react11.default.createContext({
|
|
535
516
|
t: defaultTranslatorFunction,
|
|
536
517
|
tDateTimeParser: defaultDateTimeParser,
|
|
537
518
|
userLanguage: "en"
|
|
538
519
|
});
|
|
539
520
|
var useTranslationContext = (componentName) => {
|
|
540
|
-
const contextValue = (0,
|
|
521
|
+
const contextValue = (0, import_react11.useContext)(TranslationContext);
|
|
541
522
|
if (!contextValue) {
|
|
542
523
|
console.warn(
|
|
543
524
|
`The useTranslationContext hook was called outside of the TranslationContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`
|
|
@@ -547,408 +528,597 @@ var useTranslationContext = (componentName) => {
|
|
|
547
528
|
return contextValue;
|
|
548
529
|
};
|
|
549
530
|
|
|
550
|
-
//
|
|
551
|
-
var
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
531
|
+
// src/components/MessageInput/hooks/useMessageComposer.ts
|
|
532
|
+
var import_react34 = require("react");
|
|
533
|
+
var import_stream_chat = require("stream-chat");
|
|
534
|
+
|
|
535
|
+
// src/components/Threads/ThreadContext.tsx
|
|
536
|
+
var import_react12 = __toESM(require("react"));
|
|
537
|
+
var ThreadContext = (0, import_react12.createContext)(void 0);
|
|
538
|
+
var useThreadContext = () => (0, import_react12.useContext)(ThreadContext);
|
|
539
|
+
|
|
540
|
+
// src/components/Avatar/Avatar.tsx
|
|
541
|
+
var import_clsx = __toESM(require("clsx"));
|
|
542
|
+
var import_react14 = __toESM(require("react"));
|
|
543
|
+
|
|
544
|
+
// src/components/Threads/icons.tsx
|
|
545
|
+
var import_react13 = __toESM(require("react"));
|
|
546
|
+
var Icon = {
|
|
547
|
+
MessageBubble: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
548
|
+
"svg",
|
|
549
|
+
{
|
|
550
|
+
className: "str-chat__icon str-chat__icon--message-bubble",
|
|
551
|
+
fill: "none",
|
|
552
|
+
height: "14",
|
|
553
|
+
viewBox: "0 0 14 14",
|
|
554
|
+
width: "14",
|
|
555
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
556
|
+
...props
|
|
557
|
+
},
|
|
558
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
559
|
+
"path",
|
|
560
|
+
{
|
|
561
|
+
d: "M1.66659 1.66665H12.3333V9.66665H2.44659L1.66659 10.4466V1.66665ZM1.66659 0.333313C0.933252 0.333313 0.339919 0.933313 0.339919 1.66665L0.333252 13.6666L2.99992 11H12.3333C13.0666 11 13.6666 10.4 13.6666 9.66665V1.66665C13.6666 0.933313 13.0666 0.333313 12.3333 0.333313H1.66659ZM2.99992 6.99998H10.9999V8.33331H2.99992V6.99998ZM2.99992 4.99998H10.9999V6.33331H2.99992V4.99998ZM2.99992 2.99998H10.9999V4.33331H2.99992V2.99998Z",
|
|
562
|
+
fill: "currentColor"
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
),
|
|
566
|
+
MessageBubbleEmpty: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
567
|
+
"svg",
|
|
568
|
+
{
|
|
569
|
+
className: "str-chat__icon str-chat__icon--message-bubble-empty",
|
|
570
|
+
fill: "none",
|
|
571
|
+
height: "20",
|
|
572
|
+
viewBox: "0 0 20 20",
|
|
573
|
+
width: "20",
|
|
574
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
575
|
+
...props
|
|
576
|
+
},
|
|
577
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
578
|
+
"path",
|
|
579
|
+
{
|
|
580
|
+
d: "M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0ZM18 14H4L2 16V2H18V14Z",
|
|
581
|
+
fill: "currentColor"
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
),
|
|
585
|
+
Reload: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
586
|
+
"svg",
|
|
587
|
+
{
|
|
588
|
+
className: "str-chat__icon str-chat__icon--reload",
|
|
589
|
+
fill: "none",
|
|
590
|
+
height: "22",
|
|
591
|
+
viewBox: "0 0 16 22",
|
|
592
|
+
width: "16",
|
|
593
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
594
|
+
...props
|
|
595
|
+
},
|
|
596
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
597
|
+
"path",
|
|
598
|
+
{
|
|
599
|
+
d: "M8 3V0L4 4L8 8V5C11.31 5 14 7.69 14 11C14 12.01 13.75 12.97 13.3 13.8L14.76 15.26C15.54 14.03 16 12.57 16 11C16 6.58 12.42 3 8 3ZM8 17C4.69 17 2 14.31 2 11C2 9.99 2.25 9.03 2.7 8.2L1.24 6.74C0.46 7.97 0 9.43 0 11C0 15.42 3.58 19 8 19V22L12 18L8 14V17Z",
|
|
600
|
+
fill: "currentColor"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
),
|
|
604
|
+
User: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
605
|
+
"svg",
|
|
606
|
+
{
|
|
607
|
+
className: "str-chat__icon str-chat__icon--user",
|
|
608
|
+
fill: "none",
|
|
609
|
+
height: "16",
|
|
610
|
+
viewBox: "0 0 16 16",
|
|
611
|
+
width: "16",
|
|
612
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
613
|
+
...props
|
|
614
|
+
},
|
|
615
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
616
|
+
"path",
|
|
617
|
+
{
|
|
618
|
+
d: "M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z",
|
|
619
|
+
fill: "currentColor"
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
)
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
// src/utils/getWholeChar.ts
|
|
626
|
+
var getWholeChar = (str, i) => {
|
|
627
|
+
const code2 = str.charCodeAt(i);
|
|
628
|
+
if (Number.isNaN(code2)) return "";
|
|
629
|
+
if (code2 < 55296 || code2 > 57343) return str.charAt(i);
|
|
630
|
+
if (55296 <= code2 && code2 <= 56319) {
|
|
631
|
+
if (str.length <= i + 1) {
|
|
632
|
+
throw "High surrogate without following low surrogate";
|
|
593
633
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
function propsFactory(check) {
|
|
598
|
-
const checkAsRecord = (
|
|
599
|
-
/** @type {Record<string, unknown>} */
|
|
600
|
-
check
|
|
601
|
-
);
|
|
602
|
-
return castFactory(all2);
|
|
603
|
-
function all2(node2) {
|
|
604
|
-
const nodeAsRecord = (
|
|
605
|
-
/** @type {Record<string, unknown>} */
|
|
606
|
-
/** @type {unknown} */
|
|
607
|
-
node2
|
|
608
|
-
);
|
|
609
|
-
let key;
|
|
610
|
-
for (key in check) {
|
|
611
|
-
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
634
|
+
const next = str.charCodeAt(i + 1);
|
|
635
|
+
if (56320 > next || next > 57343) {
|
|
636
|
+
throw "High surrogate without following low surrogate";
|
|
612
637
|
}
|
|
613
|
-
return
|
|
638
|
+
return str.charAt(i) + str.charAt(i + 1);
|
|
614
639
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return castFactory(type);
|
|
618
|
-
function type(node2) {
|
|
619
|
-
return node2 && node2.type === check;
|
|
640
|
+
if (i === 0) {
|
|
641
|
+
throw "Low surrogate without preceding high surrogate";
|
|
620
642
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
function check(value, index3, parent) {
|
|
625
|
-
return Boolean(
|
|
626
|
-
looksLikeANode(value) && testFunction.call(
|
|
627
|
-
this,
|
|
628
|
-
value,
|
|
629
|
-
typeof index3 === "number" ? index3 : void 0,
|
|
630
|
-
parent || void 0
|
|
631
|
-
)
|
|
632
|
-
);
|
|
643
|
+
const prev = str.charCodeAt(i - 1);
|
|
644
|
+
if (55296 > prev || prev > 56319) {
|
|
645
|
+
throw "Low surrogate without preceding high surrogate";
|
|
633
646
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
function looksLikeANode(value) {
|
|
639
|
-
return value !== null && typeof value === "object" && "type" in value;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// node_modules/unist-util-visit-parents/lib/color.node.js
|
|
643
|
-
function color(d) {
|
|
644
|
-
return "\x1B[33m" + d + "\x1B[39m";
|
|
645
|
-
}
|
|
647
|
+
return "";
|
|
648
|
+
};
|
|
646
649
|
|
|
647
|
-
//
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
let grandparents;
|
|
686
|
-
if (!test || is2(node2, index3, parents[parents.length - 1] || void 0)) {
|
|
687
|
-
result = toResult(visitor(node2, parents));
|
|
688
|
-
if (result[0] === EXIT) {
|
|
689
|
-
return result;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
if ("children" in node2 && node2.children) {
|
|
693
|
-
const nodeAsParent = (
|
|
694
|
-
/** @type {UnistParent} */
|
|
695
|
-
node2
|
|
696
|
-
);
|
|
697
|
-
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
698
|
-
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
699
|
-
grandparents = parents.concat(nodeAsParent);
|
|
700
|
-
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
701
|
-
const child = nodeAsParent.children[offset];
|
|
702
|
-
subresult = factory(child, offset, grandparents)();
|
|
703
|
-
if (subresult[0] === EXIT) {
|
|
704
|
-
return subresult;
|
|
705
|
-
}
|
|
706
|
-
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
650
|
+
// src/components/Avatar/Avatar.tsx
|
|
651
|
+
var Avatar = (props) => {
|
|
652
|
+
const {
|
|
653
|
+
className,
|
|
654
|
+
image: image2,
|
|
655
|
+
name: name2,
|
|
656
|
+
onClick = () => void 0,
|
|
657
|
+
onMouseOver = () => void 0
|
|
658
|
+
} = props;
|
|
659
|
+
const [error, setError] = (0, import_react14.useState)(false);
|
|
660
|
+
(0, import_react14.useEffect)(() => {
|
|
661
|
+
setError(false);
|
|
662
|
+
}, [image2]);
|
|
663
|
+
const nameStr = name2?.toString() || "";
|
|
664
|
+
const initials = getWholeChar(nameStr, 0);
|
|
665
|
+
const showImage = image2 && !error;
|
|
666
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
667
|
+
"div",
|
|
668
|
+
{
|
|
669
|
+
className: (0, import_clsx.default)(`str-chat__avatar str-chat__message-sender-avatar`, className, {
|
|
670
|
+
["str-chat__avatar--multiple-letters"]: initials.length > 1,
|
|
671
|
+
["str-chat__avatar--no-letters"]: !initials.length,
|
|
672
|
+
["str-chat__avatar--one-letter"]: initials.length === 1
|
|
673
|
+
}),
|
|
674
|
+
"data-testid": "avatar",
|
|
675
|
+
onClick,
|
|
676
|
+
onMouseOver,
|
|
677
|
+
role: "button",
|
|
678
|
+
title: name2
|
|
679
|
+
},
|
|
680
|
+
showImage ? /* @__PURE__ */ import_react14.default.createElement(
|
|
681
|
+
"img",
|
|
682
|
+
{
|
|
683
|
+
alt: initials,
|
|
684
|
+
className: "str-chat__avatar-image",
|
|
685
|
+
"data-testid": "avatar-img",
|
|
686
|
+
onError: () => setError(true),
|
|
687
|
+
src: image2
|
|
709
688
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
return value === null || value === void 0 ? empty : [value];
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// node_modules/unist-util-visit/lib/index.js
|
|
725
|
-
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
726
|
-
let reverse;
|
|
727
|
-
let test;
|
|
728
|
-
let visitor;
|
|
729
|
-
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
730
|
-
test = void 0;
|
|
731
|
-
visitor = testOrVisitor;
|
|
732
|
-
reverse = visitorOrReverse;
|
|
733
|
-
} else {
|
|
734
|
-
test = testOrVisitor;
|
|
735
|
-
visitor = visitorOrReverse;
|
|
736
|
-
reverse = maybeReverse;
|
|
737
|
-
}
|
|
738
|
-
visitParents(tree, test, overload, reverse);
|
|
739
|
-
function overload(node2, parents) {
|
|
740
|
-
const parent = parents[parents.length - 1];
|
|
741
|
-
const index3 = parent ? parent.children.indexOf(node2) : void 0;
|
|
742
|
-
return visitor(node2, index3, parent);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
689
|
+
) : /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, !!initials.length && /* @__PURE__ */ import_react14.default.createElement(
|
|
690
|
+
"div",
|
|
691
|
+
{
|
|
692
|
+
className: (0, import_clsx.default)("str-chat__avatar-fallback"),
|
|
693
|
+
"data-testid": "avatar-fallback"
|
|
694
|
+
},
|
|
695
|
+
initials
|
|
696
|
+
), !initials.length && /* @__PURE__ */ import_react14.default.createElement(Icon.User, null))
|
|
697
|
+
);
|
|
698
|
+
};
|
|
745
699
|
|
|
746
|
-
//
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
function unreachable() {
|
|
750
|
-
}
|
|
700
|
+
// src/components/ChannelPreview/ChannelPreview.tsx
|
|
701
|
+
var import_lodash = __toESM(require("lodash.throttle"));
|
|
702
|
+
var import_react23 = __toESM(require("react"));
|
|
751
703
|
|
|
752
|
-
//
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
756
|
-
return input.join(
|
|
757
|
-
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
758
|
-
).trim();
|
|
759
|
-
}
|
|
704
|
+
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
705
|
+
var import_react18 = __toESM(require("react"));
|
|
706
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
760
707
|
|
|
761
|
-
//
|
|
762
|
-
var
|
|
763
|
-
var
|
|
764
|
-
var emptyOptions = {};
|
|
765
|
-
function name(name2, options) {
|
|
766
|
-
const settings = options || emptyOptions;
|
|
767
|
-
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
768
|
-
return re2.test(name2);
|
|
769
|
-
}
|
|
708
|
+
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
709
|
+
var import_react17 = __toESM(require("react"));
|
|
710
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
770
711
|
|
|
771
|
-
//
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
function empty2(value) {
|
|
777
|
-
return value.replace(re, "") === "";
|
|
778
|
-
}
|
|
712
|
+
// src/constants/limits.ts
|
|
713
|
+
var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
|
|
714
|
+
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
715
|
+
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
779
716
|
|
|
780
|
-
//
|
|
781
|
-
var
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
* @param {Properties} property
|
|
785
|
-
* @param {Normal} normal
|
|
786
|
-
* @param {string} [space]
|
|
787
|
-
*/
|
|
788
|
-
constructor(property, normal, space2) {
|
|
789
|
-
this.property = property;
|
|
790
|
-
this.normal = normal;
|
|
791
|
-
if (space2) {
|
|
792
|
-
this.space = space2;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
717
|
+
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
718
|
+
var import_react15 = require("react");
|
|
719
|
+
var import_shim2 = require("use-sync-external-store/shim");
|
|
720
|
+
var noop2 = () => {
|
|
795
721
|
};
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
722
|
+
function useSelectedChannelState({
|
|
723
|
+
channel,
|
|
724
|
+
selector: selector2,
|
|
725
|
+
stateChangeEventKeys = ["all"]
|
|
726
|
+
}) {
|
|
727
|
+
const subscribe = (0, import_react15.useCallback)(
|
|
728
|
+
(onStoreChange) => {
|
|
729
|
+
if (!channel) return noop2;
|
|
730
|
+
const subscriptions = stateChangeEventKeys.map(
|
|
731
|
+
(et) => channel.on(et, () => {
|
|
732
|
+
onStoreChange(selector2(channel));
|
|
733
|
+
})
|
|
734
|
+
);
|
|
735
|
+
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
736
|
+
},
|
|
737
|
+
[channel, selector2, stateChangeEventKeys]
|
|
738
|
+
);
|
|
739
|
+
const getSnapshot = (0, import_react15.useCallback)(() => {
|
|
740
|
+
if (!channel) return void 0;
|
|
741
|
+
return selector2(channel);
|
|
742
|
+
}, [channel, selector2]);
|
|
743
|
+
return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot);
|
|
810
744
|
}
|
|
811
745
|
|
|
812
|
-
//
|
|
813
|
-
|
|
814
|
-
|
|
746
|
+
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
747
|
+
var selector = (c) => c.state.membership;
|
|
748
|
+
var keys = ["member.updated"];
|
|
749
|
+
function useChannelMembershipState(channel) {
|
|
750
|
+
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys });
|
|
815
751
|
}
|
|
816
752
|
|
|
817
|
-
//
|
|
818
|
-
var
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
753
|
+
// src/components/ChannelPreview/icons.tsx
|
|
754
|
+
var import_react16 = __toESM(require("react"));
|
|
755
|
+
var Icon2 = {
|
|
756
|
+
ArchiveBox: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
757
|
+
"svg",
|
|
758
|
+
{
|
|
759
|
+
className: "str-chat__icon str-chat__icon--archive-box",
|
|
760
|
+
fill: "currentColor",
|
|
761
|
+
viewBox: "0 0 512 512",
|
|
762
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
763
|
+
...props
|
|
764
|
+
},
|
|
765
|
+
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64C0 46.3 14.3 32 32 32zm0 128l448 0 0 256c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-256zm128 80c0 8.8 7.2 16 16 16l160 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-160 0c-8.8 0-16 7.2-16 16z" })
|
|
766
|
+
),
|
|
767
|
+
Pin: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
768
|
+
"svg",
|
|
769
|
+
{
|
|
770
|
+
className: "str-chat__icon str-chat__icon--pin",
|
|
771
|
+
fill: "currentColor",
|
|
772
|
+
viewBox: "0 0 384 512",
|
|
773
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
774
|
+
...props
|
|
775
|
+
},
|
|
776
|
+
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32C32 14.3 46.3 0 64 0L320 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-29.5 0 11.4 148.2c36.7 19.9 65.7 53.2 79.5 94.7l1 3c3.3 9.8 1.6 20.5-4.4 28.8s-15.7 13.3-26 13.3L32 352c-10.3 0-19.9-4.9-26-13.3s-7.7-19.1-4.4-28.8l1-3c13.8-41.5 42.8-74.8 79.5-94.7L93.5 64 64 64C46.3 64 32 49.7 32 32zM160 384l64 0 0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-96z" })
|
|
777
|
+
)
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
781
|
+
function ChannelPreviewActionButtons({
|
|
782
|
+
channel
|
|
783
|
+
}) {
|
|
784
|
+
const membership = useChannelMembershipState(channel);
|
|
785
|
+
const { t } = useTranslationContext();
|
|
786
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "str-chat__channel-preview__action-buttons" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
787
|
+
"button",
|
|
788
|
+
{
|
|
789
|
+
"aria-label": membership.pinned_at ? t("Unpin") : t("Pin"),
|
|
790
|
+
className: (0, import_clsx2.default)(
|
|
791
|
+
"str-chat__channel-preview__action-button",
|
|
792
|
+
"str-chat__channel-preview__action-button--pin",
|
|
793
|
+
membership.pinned_at && "str-chat__channel-preview__action-button--active"
|
|
794
|
+
),
|
|
795
|
+
onClick: (e) => {
|
|
796
|
+
e.stopPropagation();
|
|
797
|
+
if (membership.pinned_at) {
|
|
798
|
+
channel.unpin();
|
|
799
|
+
} else {
|
|
800
|
+
channel.pin();
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
title: membership.pinned_at ? t("Unpin") : t("Pin")
|
|
804
|
+
},
|
|
805
|
+
/* @__PURE__ */ import_react17.default.createElement(Icon2.Pin, null)
|
|
806
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
807
|
+
"button",
|
|
808
|
+
{
|
|
809
|
+
"aria-label": membership.archived_at ? t("Unarchive") : t("Archive"),
|
|
810
|
+
className: (0, import_clsx2.default)(
|
|
811
|
+
"str-chat__channel-preview__action-button",
|
|
812
|
+
"str-chat__channel-preview__action-button--archive",
|
|
813
|
+
membership.archived_at && "str-chat__channel-preview__action-button--active"
|
|
814
|
+
),
|
|
815
|
+
onClick: (e) => {
|
|
816
|
+
e.stopPropagation();
|
|
817
|
+
if (membership.archived_at) {
|
|
818
|
+
channel.unarchive();
|
|
819
|
+
} else {
|
|
820
|
+
channel.archive();
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
title: membership.archived_at ? t("Unarchive") : t("Archive")
|
|
824
|
+
},
|
|
825
|
+
/* @__PURE__ */ import_react17.default.createElement(Icon2.ArchiveBox, null)
|
|
826
|
+
));
|
|
861
827
|
}
|
|
862
828
|
|
|
863
|
-
//
|
|
864
|
-
var
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
829
|
+
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
830
|
+
var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
831
|
+
const {
|
|
832
|
+
active,
|
|
833
|
+
Avatar: Avatar2 = Avatar,
|
|
834
|
+
channel,
|
|
835
|
+
className: customClassName = "",
|
|
836
|
+
displayImage,
|
|
837
|
+
displayTitle,
|
|
838
|
+
groupChannelDisplayInfo,
|
|
839
|
+
latestMessagePreview,
|
|
840
|
+
onSelect: customOnSelectChannel,
|
|
841
|
+
setActiveChannel,
|
|
842
|
+
unread,
|
|
843
|
+
watchers
|
|
844
|
+
} = props;
|
|
845
|
+
const { ChannelPreviewActionButtons: ChannelPreviewActionButtons2 = ChannelPreviewActionButtons } = useComponentContext();
|
|
846
|
+
const channelPreviewButton = (0, import_react18.useRef)(null);
|
|
847
|
+
const avatarName = displayTitle || channel.state.messages[channel.state.messages.length - 1]?.user?.id;
|
|
848
|
+
const onSelectChannel = (e) => {
|
|
849
|
+
if (customOnSelectChannel) {
|
|
850
|
+
customOnSelectChannel(e);
|
|
851
|
+
} else if (setActiveChannel) {
|
|
852
|
+
setActiveChannel(channel, watchers);
|
|
882
853
|
}
|
|
883
|
-
|
|
854
|
+
if (channelPreviewButton?.current) {
|
|
855
|
+
channelPreviewButton.current.blur();
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-container" }, /* @__PURE__ */ import_react18.default.createElement(ChannelPreviewActionButtons2, { channel }), /* @__PURE__ */ import_react18.default.createElement(
|
|
859
|
+
"button",
|
|
860
|
+
{
|
|
861
|
+
"aria-label": `Select Channel: ${displayTitle || ""}`,
|
|
862
|
+
"aria-selected": active,
|
|
863
|
+
className: (0, import_clsx3.default)(
|
|
864
|
+
`str-chat__channel-preview-messenger str-chat__channel-preview`,
|
|
865
|
+
active && "str-chat__channel-preview-messenger--active",
|
|
866
|
+
unread && unread >= 1 && "str-chat__channel-preview-messenger--unread",
|
|
867
|
+
customClassName
|
|
868
|
+
),
|
|
869
|
+
"data-testid": "channel-preview-button",
|
|
870
|
+
onClick: onSelectChannel,
|
|
871
|
+
ref: channelPreviewButton,
|
|
872
|
+
role: "option"
|
|
873
|
+
},
|
|
874
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--left" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
875
|
+
Avatar2,
|
|
876
|
+
{
|
|
877
|
+
className: "str-chat__avatar--channel-preview",
|
|
878
|
+
groupChannelDisplayInfo,
|
|
879
|
+
image: displayImage,
|
|
880
|
+
name: avatarName
|
|
881
|
+
}
|
|
882
|
+
)),
|
|
883
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-end" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-end-first-row" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--name" }, /* @__PURE__ */ import_react18.default.createElement("span", null, displayTitle)), !!unread && /* @__PURE__ */ import_react18.default.createElement(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
className: "str-chat__channel-preview-unread-badge",
|
|
887
|
+
"data-testid": "unread-badge"
|
|
888
|
+
},
|
|
889
|
+
unread
|
|
890
|
+
)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--last-message" }, latestMessagePreview))
|
|
891
|
+
));
|
|
884
892
|
};
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
values[key] = value;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
893
|
+
var ChannelPreviewMessenger = import_react18.default.memo(
|
|
894
|
+
UnMemoizedChannelPreviewMessenger
|
|
895
|
+
);
|
|
891
896
|
|
|
892
|
-
//
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
value,
|
|
905
|
-
definition2.space
|
|
906
|
-
);
|
|
907
|
-
if (definition2.mustUseProperty && definition2.mustUseProperty.includes(prop)) {
|
|
908
|
-
info.mustUseProperty = true;
|
|
909
|
-
}
|
|
910
|
-
property[prop] = info;
|
|
911
|
-
normal[normalize(prop)] = prop;
|
|
912
|
-
normal[normalize(info.attribute)] = prop;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return new Schema(property, normal, definition2.space);
|
|
916
|
-
}
|
|
897
|
+
// src/components/ChannelPreview/hooks/useIsChannelMuted.ts
|
|
898
|
+
var import_react19 = require("react");
|
|
899
|
+
var useIsChannelMuted = (channel) => {
|
|
900
|
+
const { client } = useChatContext("useIsChannelMuted");
|
|
901
|
+
const [muted, setMuted] = (0, import_react19.useState)(channel.muteStatus());
|
|
902
|
+
(0, import_react19.useEffect)(() => {
|
|
903
|
+
const handleEvent = () => setMuted(channel.muteStatus());
|
|
904
|
+
client.on("notification.channel_mutes_updated", handleEvent);
|
|
905
|
+
return () => client.off("notification.channel_mutes_updated", handleEvent);
|
|
906
|
+
}, [muted]);
|
|
907
|
+
return muted;
|
|
908
|
+
};
|
|
917
909
|
|
|
918
|
-
//
|
|
919
|
-
var
|
|
920
|
-
space: "xlink",
|
|
921
|
-
transform(_, prop) {
|
|
922
|
-
return "xlink:" + prop.slice(5).toLowerCase();
|
|
923
|
-
},
|
|
924
|
-
properties: {
|
|
925
|
-
xLinkActuate: null,
|
|
926
|
-
xLinkArcRole: null,
|
|
927
|
-
xLinkHref: null,
|
|
928
|
-
xLinkRole: null,
|
|
929
|
-
xLinkShow: null,
|
|
930
|
-
xLinkTitle: null,
|
|
931
|
-
xLinkType: null
|
|
932
|
-
}
|
|
933
|
-
});
|
|
910
|
+
// src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts
|
|
911
|
+
var import_react21 = require("react");
|
|
934
912
|
|
|
935
|
-
//
|
|
936
|
-
var
|
|
937
|
-
space: "xml",
|
|
938
|
-
transform(_, prop) {
|
|
939
|
-
return "xml:" + prop.slice(3).toLowerCase();
|
|
940
|
-
},
|
|
941
|
-
properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
|
|
942
|
-
});
|
|
913
|
+
// src/components/ChannelPreview/utils.tsx
|
|
914
|
+
var import_react20 = __toESM(require("react"));
|
|
943
915
|
|
|
944
|
-
// node_modules/
|
|
945
|
-
function
|
|
946
|
-
|
|
916
|
+
// node_modules/devlop/lib/default.js
|
|
917
|
+
function ok() {
|
|
918
|
+
}
|
|
919
|
+
function unreachable() {
|
|
947
920
|
}
|
|
948
921
|
|
|
949
|
-
// node_modules/
|
|
950
|
-
function
|
|
951
|
-
|
|
922
|
+
// node_modules/comma-separated-tokens/index.js
|
|
923
|
+
function stringify(values, options) {
|
|
924
|
+
const settings = options || {};
|
|
925
|
+
const input = values[values.length - 1] === "" ? [...values, ""] : values;
|
|
926
|
+
return input.join(
|
|
927
|
+
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
928
|
+
).trim();
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// node_modules/estree-util-is-identifier-name/lib/index.js
|
|
932
|
+
var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
933
|
+
var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
934
|
+
var emptyOptions = {};
|
|
935
|
+
function name(name2, options) {
|
|
936
|
+
const settings = options || emptyOptions;
|
|
937
|
+
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
938
|
+
return re2.test(name2);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// node_modules/hast-util-whitespace/lib/index.js
|
|
942
|
+
var re = /[ \t\n\f\r]/g;
|
|
943
|
+
function whitespace(thing) {
|
|
944
|
+
return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
|
|
945
|
+
}
|
|
946
|
+
function empty(value) {
|
|
947
|
+
return value.replace(re, "") === "";
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// node_modules/property-information/lib/util/schema.js
|
|
951
|
+
var Schema = class {
|
|
952
|
+
/**
|
|
953
|
+
* @constructor
|
|
954
|
+
* @param {Properties} property
|
|
955
|
+
* @param {Normal} normal
|
|
956
|
+
* @param {string} [space]
|
|
957
|
+
*/
|
|
958
|
+
constructor(property, normal, space2) {
|
|
959
|
+
this.property = property;
|
|
960
|
+
this.normal = normal;
|
|
961
|
+
if (space2) {
|
|
962
|
+
this.space = space2;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
Schema.prototype.property = {};
|
|
967
|
+
Schema.prototype.normal = {};
|
|
968
|
+
Schema.prototype.space = null;
|
|
969
|
+
|
|
970
|
+
// node_modules/property-information/lib/util/merge.js
|
|
971
|
+
function merge(definitions, space2) {
|
|
972
|
+
const property = {};
|
|
973
|
+
const normal = {};
|
|
974
|
+
let index3 = -1;
|
|
975
|
+
while (++index3 < definitions.length) {
|
|
976
|
+
Object.assign(property, definitions[index3].property);
|
|
977
|
+
Object.assign(normal, definitions[index3].normal);
|
|
978
|
+
}
|
|
979
|
+
return new Schema(property, normal, space2);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// node_modules/property-information/lib/normalize.js
|
|
983
|
+
function normalize(value) {
|
|
984
|
+
return value.toLowerCase();
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// node_modules/property-information/lib/util/info.js
|
|
988
|
+
var Info = class {
|
|
989
|
+
/**
|
|
990
|
+
* @constructor
|
|
991
|
+
* @param {string} property
|
|
992
|
+
* @param {string} attribute
|
|
993
|
+
*/
|
|
994
|
+
constructor(property, attribute) {
|
|
995
|
+
this.property = property;
|
|
996
|
+
this.attribute = attribute;
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
Info.prototype.space = null;
|
|
1000
|
+
Info.prototype.boolean = false;
|
|
1001
|
+
Info.prototype.booleanish = false;
|
|
1002
|
+
Info.prototype.overloadedBoolean = false;
|
|
1003
|
+
Info.prototype.number = false;
|
|
1004
|
+
Info.prototype.commaSeparated = false;
|
|
1005
|
+
Info.prototype.spaceSeparated = false;
|
|
1006
|
+
Info.prototype.commaOrSpaceSeparated = false;
|
|
1007
|
+
Info.prototype.mustUseProperty = false;
|
|
1008
|
+
Info.prototype.defined = false;
|
|
1009
|
+
|
|
1010
|
+
// node_modules/property-information/lib/util/types.js
|
|
1011
|
+
var types_exports = {};
|
|
1012
|
+
__export(types_exports, {
|
|
1013
|
+
boolean: () => boolean,
|
|
1014
|
+
booleanish: () => booleanish,
|
|
1015
|
+
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
1016
|
+
commaSeparated: () => commaSeparated,
|
|
1017
|
+
number: () => number,
|
|
1018
|
+
overloadedBoolean: () => overloadedBoolean,
|
|
1019
|
+
spaceSeparated: () => spaceSeparated
|
|
1020
|
+
});
|
|
1021
|
+
var powers = 0;
|
|
1022
|
+
var boolean = increment();
|
|
1023
|
+
var booleanish = increment();
|
|
1024
|
+
var overloadedBoolean = increment();
|
|
1025
|
+
var number = increment();
|
|
1026
|
+
var spaceSeparated = increment();
|
|
1027
|
+
var commaSeparated = increment();
|
|
1028
|
+
var commaOrSpaceSeparated = increment();
|
|
1029
|
+
function increment() {
|
|
1030
|
+
return 2 ** ++powers;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// node_modules/property-information/lib/util/defined-info.js
|
|
1034
|
+
var checks = Object.keys(types_exports);
|
|
1035
|
+
var DefinedInfo = class extends Info {
|
|
1036
|
+
/**
|
|
1037
|
+
* @constructor
|
|
1038
|
+
* @param {string} property
|
|
1039
|
+
* @param {string} attribute
|
|
1040
|
+
* @param {number|null} [mask]
|
|
1041
|
+
* @param {string} [space]
|
|
1042
|
+
*/
|
|
1043
|
+
constructor(property, attribute, mask, space2) {
|
|
1044
|
+
let index3 = -1;
|
|
1045
|
+
super(property, attribute);
|
|
1046
|
+
mark(this, "space", space2);
|
|
1047
|
+
if (typeof mask === "number") {
|
|
1048
|
+
while (++index3 < checks.length) {
|
|
1049
|
+
const check = checks[index3];
|
|
1050
|
+
mark(this, checks[index3], (mask & types_exports[check]) === types_exports[check]);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
DefinedInfo.prototype.defined = true;
|
|
1056
|
+
function mark(values, key, value) {
|
|
1057
|
+
if (value) {
|
|
1058
|
+
values[key] = value;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// node_modules/property-information/lib/util/create.js
|
|
1063
|
+
var own = {}.hasOwnProperty;
|
|
1064
|
+
function create(definition2) {
|
|
1065
|
+
const property = {};
|
|
1066
|
+
const normal = {};
|
|
1067
|
+
let prop;
|
|
1068
|
+
for (prop in definition2.properties) {
|
|
1069
|
+
if (own.call(definition2.properties, prop)) {
|
|
1070
|
+
const value = definition2.properties[prop];
|
|
1071
|
+
const info = new DefinedInfo(
|
|
1072
|
+
prop,
|
|
1073
|
+
definition2.transform(definition2.attributes || {}, prop),
|
|
1074
|
+
value,
|
|
1075
|
+
definition2.space
|
|
1076
|
+
);
|
|
1077
|
+
if (definition2.mustUseProperty && definition2.mustUseProperty.includes(prop)) {
|
|
1078
|
+
info.mustUseProperty = true;
|
|
1079
|
+
}
|
|
1080
|
+
property[prop] = info;
|
|
1081
|
+
normal[normalize(prop)] = prop;
|
|
1082
|
+
normal[normalize(info.attribute)] = prop;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return new Schema(property, normal, definition2.space);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
// node_modules/property-information/lib/xlink.js
|
|
1089
|
+
var xlink = create({
|
|
1090
|
+
space: "xlink",
|
|
1091
|
+
transform(_, prop) {
|
|
1092
|
+
return "xlink:" + prop.slice(5).toLowerCase();
|
|
1093
|
+
},
|
|
1094
|
+
properties: {
|
|
1095
|
+
xLinkActuate: null,
|
|
1096
|
+
xLinkArcRole: null,
|
|
1097
|
+
xLinkHref: null,
|
|
1098
|
+
xLinkRole: null,
|
|
1099
|
+
xLinkShow: null,
|
|
1100
|
+
xLinkTitle: null,
|
|
1101
|
+
xLinkType: null
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
// node_modules/property-information/lib/xml.js
|
|
1106
|
+
var xml = create({
|
|
1107
|
+
space: "xml",
|
|
1108
|
+
transform(_, prop) {
|
|
1109
|
+
return "xml:" + prop.slice(3).toLowerCase();
|
|
1110
|
+
},
|
|
1111
|
+
properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
// node_modules/property-information/lib/util/case-sensitive-transform.js
|
|
1115
|
+
function caseSensitiveTransform(attributes, attribute) {
|
|
1116
|
+
return attribute in attributes ? attributes[attribute] : attribute;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// node_modules/property-information/lib/util/case-insensitive-transform.js
|
|
1120
|
+
function caseInsensitiveTransform(attributes, property) {
|
|
1121
|
+
return caseSensitiveTransform(attributes, property.toLowerCase());
|
|
952
1122
|
}
|
|
953
1123
|
|
|
954
1124
|
// node_modules/property-information/lib/xmlns.js
|
|
@@ -2299,7 +2469,7 @@ function mdxExpression(state, node2) {
|
|
|
2299
2469
|
if (node2.data && node2.data.estree && state.evaluater) {
|
|
2300
2470
|
const program = node2.data.estree;
|
|
2301
2471
|
const expression = program.body[0];
|
|
2302
|
-
|
|
2472
|
+
ok(expression.type === "ExpressionStatement");
|
|
2303
2473
|
return (
|
|
2304
2474
|
/** @type {Child | undefined} */
|
|
2305
2475
|
state.evaluater.evaluateExpression(expression.expression)
|
|
@@ -2414,11 +2584,11 @@ function createJsxElementProps(state, node2) {
|
|
|
2414
2584
|
if (attribute.data && attribute.data.estree && state.evaluater) {
|
|
2415
2585
|
const program = attribute.data.estree;
|
|
2416
2586
|
const expression = program.body[0];
|
|
2417
|
-
|
|
2587
|
+
ok(expression.type === "ExpressionStatement");
|
|
2418
2588
|
const objectExpression = expression.expression;
|
|
2419
|
-
|
|
2589
|
+
ok(objectExpression.type === "ObjectExpression");
|
|
2420
2590
|
const property = objectExpression.properties[0];
|
|
2421
|
-
|
|
2591
|
+
ok(property.type === "SpreadElement");
|
|
2422
2592
|
Object.assign(
|
|
2423
2593
|
props,
|
|
2424
2594
|
state.evaluater.evaluateExpression(property.argument)
|
|
@@ -2433,7 +2603,7 @@ function createJsxElementProps(state, node2) {
|
|
|
2433
2603
|
if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
|
|
2434
2604
|
const program = attribute.value.data.estree;
|
|
2435
2605
|
const expression = program.body[0];
|
|
2436
|
-
|
|
2606
|
+
ok(expression.type === "ExpressionStatement");
|
|
2437
2607
|
value = state.evaluater.evaluateExpression(expression.expression);
|
|
2438
2608
|
} else {
|
|
2439
2609
|
crashEstree(state, node2.position);
|
|
@@ -2536,7 +2706,7 @@ function findComponentFromName(state, name2, allowExpression) {
|
|
|
2536
2706
|
optional: false
|
|
2537
2707
|
} : prop;
|
|
2538
2708
|
}
|
|
2539
|
-
|
|
2709
|
+
ok(node2, "always a result");
|
|
2540
2710
|
result = node2;
|
|
2541
2711
|
} else {
|
|
2542
2712
|
result = name(name2) && !/^[a-z]/.test(name2) ? { type: "Identifier", name: name2 } : { type: "Literal", value: name2 };
|
|
@@ -10211,7 +10381,7 @@ var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serial
|
|
|
10211
10381
|
// node_modules/@ungap/structured-clone/esm/serialize.js
|
|
10212
10382
|
var EMPTY = "";
|
|
10213
10383
|
var { toString: toString2 } = {};
|
|
10214
|
-
var { keys } = Object;
|
|
10384
|
+
var { keys: keys2 } = Object;
|
|
10215
10385
|
var typeOf = (value) => {
|
|
10216
10386
|
const type = typeof value;
|
|
10217
10387
|
if (type !== "object" || !value)
|
|
@@ -10300,7 +10470,7 @@ var serializer = (strict, json, $, _) => {
|
|
|
10300
10470
|
return pair(value.toJSON());
|
|
10301
10471
|
const entries = [];
|
|
10302
10472
|
const index3 = as([TYPE, entries], value);
|
|
10303
|
-
for (const key of
|
|
10473
|
+
for (const key of keys2(value)) {
|
|
10304
10474
|
if (strict || !shouldSkip(typeOf(value[key])))
|
|
10305
10475
|
entries.push([pair(key), pair(value[key])]);
|
|
10306
10476
|
}
|
|
@@ -10457,52 +10627,248 @@ function footer(state) {
|
|
|
10457
10627
|
};
|
|
10458
10628
|
}
|
|
10459
10629
|
|
|
10460
|
-
// node_modules/
|
|
10461
|
-
var
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
patch,
|
|
10480
|
-
wrap
|
|
10481
|
-
};
|
|
10482
|
-
visit(tree, function(node2) {
|
|
10483
|
-
if (node2.type === "definition" || node2.type === "footnoteDefinition") {
|
|
10484
|
-
const map = node2.type === "definition" ? definitionById : footnoteById;
|
|
10485
|
-
const id = String(node2.identifier).toUpperCase();
|
|
10486
|
-
if (!map.has(id)) {
|
|
10487
|
-
map.set(id, node2);
|
|
10488
|
-
}
|
|
10489
|
-
}
|
|
10490
|
-
});
|
|
10491
|
-
return state;
|
|
10492
|
-
function one3(node2, parent) {
|
|
10493
|
-
const type = node2.type;
|
|
10494
|
-
const handle = state.handlers[type];
|
|
10495
|
-
if (own5.call(state.handlers, type) && handle) {
|
|
10496
|
-
return handle(state, node2, parent);
|
|
10630
|
+
// node_modules/unist-util-is/lib/index.js
|
|
10631
|
+
var convert = (
|
|
10632
|
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
10633
|
+
/**
|
|
10634
|
+
* @type {(
|
|
10635
|
+
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
|
10636
|
+
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
|
10637
|
+
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
|
10638
|
+
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
|
10639
|
+
* ((test?: Test) => Check)
|
|
10640
|
+
* )}
|
|
10641
|
+
*/
|
|
10642
|
+
/**
|
|
10643
|
+
* @param {Test} [test]
|
|
10644
|
+
* @returns {Check}
|
|
10645
|
+
*/
|
|
10646
|
+
function(test) {
|
|
10647
|
+
if (test === null || test === void 0) {
|
|
10648
|
+
return ok2;
|
|
10497
10649
|
}
|
|
10498
|
-
if (
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
return
|
|
10650
|
+
if (typeof test === "function") {
|
|
10651
|
+
return castFactory(test);
|
|
10652
|
+
}
|
|
10653
|
+
if (typeof test === "object") {
|
|
10654
|
+
return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
10655
|
+
}
|
|
10656
|
+
if (typeof test === "string") {
|
|
10657
|
+
return typeFactory(test);
|
|
10658
|
+
}
|
|
10659
|
+
throw new Error("Expected function, string, or object as test");
|
|
10660
|
+
}
|
|
10661
|
+
);
|
|
10662
|
+
function anyFactory(tests) {
|
|
10663
|
+
const checks2 = [];
|
|
10664
|
+
let index3 = -1;
|
|
10665
|
+
while (++index3 < tests.length) {
|
|
10666
|
+
checks2[index3] = convert(tests[index3]);
|
|
10667
|
+
}
|
|
10668
|
+
return castFactory(any);
|
|
10669
|
+
function any(...parameters) {
|
|
10670
|
+
let index4 = -1;
|
|
10671
|
+
while (++index4 < checks2.length) {
|
|
10672
|
+
if (checks2[index4].apply(this, parameters)) return true;
|
|
10673
|
+
}
|
|
10674
|
+
return false;
|
|
10675
|
+
}
|
|
10676
|
+
}
|
|
10677
|
+
function propsFactory(check) {
|
|
10678
|
+
const checkAsRecord = (
|
|
10679
|
+
/** @type {Record<string, unknown>} */
|
|
10680
|
+
check
|
|
10681
|
+
);
|
|
10682
|
+
return castFactory(all2);
|
|
10683
|
+
function all2(node2) {
|
|
10684
|
+
const nodeAsRecord = (
|
|
10685
|
+
/** @type {Record<string, unknown>} */
|
|
10686
|
+
/** @type {unknown} */
|
|
10687
|
+
node2
|
|
10688
|
+
);
|
|
10689
|
+
let key;
|
|
10690
|
+
for (key in check) {
|
|
10691
|
+
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
10692
|
+
}
|
|
10693
|
+
return true;
|
|
10694
|
+
}
|
|
10695
|
+
}
|
|
10696
|
+
function typeFactory(check) {
|
|
10697
|
+
return castFactory(type);
|
|
10698
|
+
function type(node2) {
|
|
10699
|
+
return node2 && node2.type === check;
|
|
10700
|
+
}
|
|
10701
|
+
}
|
|
10702
|
+
function castFactory(testFunction) {
|
|
10703
|
+
return check;
|
|
10704
|
+
function check(value, index3, parent) {
|
|
10705
|
+
return Boolean(
|
|
10706
|
+
looksLikeANode(value) && testFunction.call(
|
|
10707
|
+
this,
|
|
10708
|
+
value,
|
|
10709
|
+
typeof index3 === "number" ? index3 : void 0,
|
|
10710
|
+
parent || void 0
|
|
10711
|
+
)
|
|
10712
|
+
);
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
function ok2() {
|
|
10716
|
+
return true;
|
|
10717
|
+
}
|
|
10718
|
+
function looksLikeANode(value) {
|
|
10719
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
10720
|
+
}
|
|
10721
|
+
|
|
10722
|
+
// node_modules/unist-util-visit-parents/lib/color.node.js
|
|
10723
|
+
function color(d) {
|
|
10724
|
+
return "\x1B[33m" + d + "\x1B[39m";
|
|
10725
|
+
}
|
|
10726
|
+
|
|
10727
|
+
// node_modules/unist-util-visit-parents/lib/index.js
|
|
10728
|
+
var empty2 = [];
|
|
10729
|
+
var CONTINUE = true;
|
|
10730
|
+
var EXIT = false;
|
|
10731
|
+
var SKIP = "skip";
|
|
10732
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
10733
|
+
let check;
|
|
10734
|
+
if (typeof test === "function" && typeof visitor !== "function") {
|
|
10735
|
+
reverse = visitor;
|
|
10736
|
+
visitor = test;
|
|
10737
|
+
} else {
|
|
10738
|
+
check = test;
|
|
10739
|
+
}
|
|
10740
|
+
const is2 = convert(check);
|
|
10741
|
+
const step = reverse ? -1 : 1;
|
|
10742
|
+
factory(tree, void 0, [])();
|
|
10743
|
+
function factory(node2, index3, parents) {
|
|
10744
|
+
const value = (
|
|
10745
|
+
/** @type {Record<string, unknown>} */
|
|
10746
|
+
node2 && typeof node2 === "object" ? node2 : {}
|
|
10747
|
+
);
|
|
10748
|
+
if (typeof value.type === "string") {
|
|
10749
|
+
const name2 = (
|
|
10750
|
+
// `hast`
|
|
10751
|
+
typeof value.tagName === "string" ? value.tagName : (
|
|
10752
|
+
// `xast`
|
|
10753
|
+
typeof value.name === "string" ? value.name : void 0
|
|
10754
|
+
)
|
|
10755
|
+
);
|
|
10756
|
+
Object.defineProperty(visit2, "name", {
|
|
10757
|
+
value: "node (" + color(node2.type + (name2 ? "<" + name2 + ">" : "")) + ")"
|
|
10758
|
+
});
|
|
10759
|
+
}
|
|
10760
|
+
return visit2;
|
|
10761
|
+
function visit2() {
|
|
10762
|
+
let result = empty2;
|
|
10763
|
+
let subresult;
|
|
10764
|
+
let offset;
|
|
10765
|
+
let grandparents;
|
|
10766
|
+
if (!test || is2(node2, index3, parents[parents.length - 1] || void 0)) {
|
|
10767
|
+
result = toResult(visitor(node2, parents));
|
|
10768
|
+
if (result[0] === EXIT) {
|
|
10769
|
+
return result;
|
|
10770
|
+
}
|
|
10771
|
+
}
|
|
10772
|
+
if ("children" in node2 && node2.children) {
|
|
10773
|
+
const nodeAsParent = (
|
|
10774
|
+
/** @type {UnistParent} */
|
|
10775
|
+
node2
|
|
10776
|
+
);
|
|
10777
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
10778
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
10779
|
+
grandparents = parents.concat(nodeAsParent);
|
|
10780
|
+
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
10781
|
+
const child = nodeAsParent.children[offset];
|
|
10782
|
+
subresult = factory(child, offset, grandparents)();
|
|
10783
|
+
if (subresult[0] === EXIT) {
|
|
10784
|
+
return subresult;
|
|
10785
|
+
}
|
|
10786
|
+
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
10787
|
+
}
|
|
10788
|
+
}
|
|
10789
|
+
}
|
|
10790
|
+
return result;
|
|
10791
|
+
}
|
|
10792
|
+
}
|
|
10793
|
+
}
|
|
10794
|
+
function toResult(value) {
|
|
10795
|
+
if (Array.isArray(value)) {
|
|
10796
|
+
return value;
|
|
10797
|
+
}
|
|
10798
|
+
if (typeof value === "number") {
|
|
10799
|
+
return [CONTINUE, value];
|
|
10800
|
+
}
|
|
10801
|
+
return value === null || value === void 0 ? empty2 : [value];
|
|
10802
|
+
}
|
|
10803
|
+
|
|
10804
|
+
// node_modules/unist-util-visit/lib/index.js
|
|
10805
|
+
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
10806
|
+
let reverse;
|
|
10807
|
+
let test;
|
|
10808
|
+
let visitor;
|
|
10809
|
+
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
10810
|
+
test = void 0;
|
|
10811
|
+
visitor = testOrVisitor;
|
|
10812
|
+
reverse = visitorOrReverse;
|
|
10813
|
+
} else {
|
|
10814
|
+
test = testOrVisitor;
|
|
10815
|
+
visitor = visitorOrReverse;
|
|
10816
|
+
reverse = maybeReverse;
|
|
10817
|
+
}
|
|
10818
|
+
visitParents(tree, test, overload, reverse);
|
|
10819
|
+
function overload(node2, parents) {
|
|
10820
|
+
const parent = parents[parents.length - 1];
|
|
10821
|
+
const index3 = parent ? parent.children.indexOf(node2) : void 0;
|
|
10822
|
+
return visitor(node2, index3, parent);
|
|
10823
|
+
}
|
|
10824
|
+
}
|
|
10825
|
+
|
|
10826
|
+
// node_modules/mdast-util-to-hast/lib/state.js
|
|
10827
|
+
var own5 = {}.hasOwnProperty;
|
|
10828
|
+
var emptyOptions3 = {};
|
|
10829
|
+
function createState(tree, options) {
|
|
10830
|
+
const settings = options || emptyOptions3;
|
|
10831
|
+
const definitionById = /* @__PURE__ */ new Map();
|
|
10832
|
+
const footnoteById = /* @__PURE__ */ new Map();
|
|
10833
|
+
const footnoteCounts = /* @__PURE__ */ new Map();
|
|
10834
|
+
const handlers2 = { ...handlers, ...settings.handlers };
|
|
10835
|
+
const state = {
|
|
10836
|
+
all: all2,
|
|
10837
|
+
applyData,
|
|
10838
|
+
definitionById,
|
|
10839
|
+
footnoteById,
|
|
10840
|
+
footnoteCounts,
|
|
10841
|
+
footnoteOrder: [],
|
|
10842
|
+
handlers: handlers2,
|
|
10843
|
+
one: one3,
|
|
10844
|
+
options: settings,
|
|
10845
|
+
patch,
|
|
10846
|
+
wrap
|
|
10847
|
+
};
|
|
10848
|
+
visit(tree, function(node2) {
|
|
10849
|
+
if (node2.type === "definition" || node2.type === "footnoteDefinition") {
|
|
10850
|
+
const map = node2.type === "definition" ? definitionById : footnoteById;
|
|
10851
|
+
const id = String(node2.identifier).toUpperCase();
|
|
10852
|
+
if (!map.has(id)) {
|
|
10853
|
+
map.set(id, node2);
|
|
10854
|
+
}
|
|
10855
|
+
}
|
|
10856
|
+
});
|
|
10857
|
+
return state;
|
|
10858
|
+
function one3(node2, parent) {
|
|
10859
|
+
const type = node2.type;
|
|
10860
|
+
const handle = state.handlers[type];
|
|
10861
|
+
if (own5.call(state.handlers, type) && handle) {
|
|
10862
|
+
return handle(state, node2, parent);
|
|
10863
|
+
}
|
|
10864
|
+
if (state.options.passThrough && state.options.passThrough.includes(type)) {
|
|
10865
|
+
if ("children" in node2) {
|
|
10866
|
+
const { children, ...shallow } = node2;
|
|
10867
|
+
const result = esm_default2(shallow);
|
|
10868
|
+
result.children = state.all(node2);
|
|
10869
|
+
return result;
|
|
10870
|
+
}
|
|
10871
|
+
return esm_default2(node2);
|
|
10506
10872
|
}
|
|
10507
10873
|
const unknown = state.options.unknownHandler || defaultUnknownHandler;
|
|
10508
10874
|
return unknown(state, node2, parent);
|
|
@@ -10606,7 +10972,7 @@ function toHast(tree, options) {
|
|
|
10606
10972
|
const foot = footer(state);
|
|
10607
10973
|
const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
|
|
10608
10974
|
if (foot) {
|
|
10609
|
-
|
|
10975
|
+
ok("children" in result);
|
|
10610
10976
|
result.children.push({ type: "text", value: "\n" }, foot);
|
|
10611
10977
|
}
|
|
10612
10978
|
return result;
|
|
@@ -11499,7 +11865,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
11499
11865
|
} else if (resolve) {
|
|
11500
11866
|
resolve(file2);
|
|
11501
11867
|
} else {
|
|
11502
|
-
|
|
11868
|
+
ok(done, "`done` is defined if `resolve` is not");
|
|
11503
11869
|
done(void 0, file2);
|
|
11504
11870
|
}
|
|
11505
11871
|
}
|
|
@@ -11544,7 +11910,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
11544
11910
|
assertCompiler("processSync", this.compiler || this.Compiler);
|
|
11545
11911
|
this.process(file, realDone);
|
|
11546
11912
|
assertDone("processSync", "process", complete);
|
|
11547
|
-
|
|
11913
|
+
ok(result, "we either bailed on an error or have a tree");
|
|
11548
11914
|
return result;
|
|
11549
11915
|
function realDone(error, file2) {
|
|
11550
11916
|
complete = true;
|
|
@@ -11600,7 +11966,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
11600
11966
|
}
|
|
11601
11967
|
return done ? executor(void 0, done) : new Promise(executor);
|
|
11602
11968
|
function executor(resolve, reject) {
|
|
11603
|
-
|
|
11969
|
+
ok(
|
|
11604
11970
|
typeof file !== "function",
|
|
11605
11971
|
"`file` can\u2019t be a `done` anymore, we checked"
|
|
11606
11972
|
);
|
|
@@ -11616,7 +11982,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
11616
11982
|
} else if (resolve) {
|
|
11617
11983
|
resolve(resultingTree);
|
|
11618
11984
|
} else {
|
|
11619
|
-
|
|
11985
|
+
ok(done, "`done` is defined if `resolve` is not");
|
|
11620
11986
|
done(void 0, resultingTree, file2);
|
|
11621
11987
|
}
|
|
11622
11988
|
}
|
|
@@ -11644,7 +12010,7 @@ var Processor = class _Processor extends CallableInstance {
|
|
|
11644
12010
|
let result;
|
|
11645
12011
|
this.run(tree, file, realDone);
|
|
11646
12012
|
assertDone("runSync", "run", complete);
|
|
11647
|
-
|
|
12013
|
+
ok(result, "we either bailed on an error or have a tree");
|
|
11648
12014
|
return result;
|
|
11649
12015
|
function realDone(error, tree2) {
|
|
11650
12016
|
bail(error);
|
|
@@ -11980,445 +12346,51 @@ function Markdown(options) {
|
|
|
11980
12346
|
}
|
|
11981
12347
|
return index3;
|
|
11982
12348
|
}
|
|
11983
|
-
if (node2.type === "element") {
|
|
11984
|
-
let key;
|
|
11985
|
-
for (key in urlAttributes) {
|
|
11986
|
-
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
|
|
11987
|
-
const value = node2.properties[key];
|
|
11988
|
-
const test = urlAttributes[key];
|
|
11989
|
-
if (test === null || test.includes(node2.tagName)) {
|
|
11990
|
-
node2.properties[key] = urlTransform(String(value || ""), key, node2);
|
|
11991
|
-
}
|
|
11992
|
-
}
|
|
11993
|
-
}
|
|
11994
|
-
}
|
|
11995
|
-
if (node2.type === "element") {
|
|
11996
|
-
let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
|
|
11997
|
-
if (!remove && allowElement && typeof index3 === "number") {
|
|
11998
|
-
remove = !allowElement(node2, index3, parent);
|
|
11999
|
-
}
|
|
12000
|
-
if (remove && parent && typeof index3 === "number") {
|
|
12001
|
-
if (unwrapDisallowed && node2.children) {
|
|
12002
|
-
parent.children.splice(index3, 1, ...node2.children);
|
|
12003
|
-
} else {
|
|
12004
|
-
parent.children.splice(index3, 1);
|
|
12005
|
-
}
|
|
12006
|
-
return index3;
|
|
12007
|
-
}
|
|
12008
|
-
}
|
|
12009
|
-
}
|
|
12010
|
-
}
|
|
12011
|
-
function defaultUrlTransform(value) {
|
|
12012
|
-
const colon = value.indexOf(":");
|
|
12013
|
-
const questionMark = value.indexOf("?");
|
|
12014
|
-
const numberSign = value.indexOf("#");
|
|
12015
|
-
const slash = value.indexOf("/");
|
|
12016
|
-
if (
|
|
12017
|
-
// If there is no protocol, it’s relative.
|
|
12018
|
-
colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
12019
|
-
slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
|
|
12020
|
-
safeProtocol.test(value.slice(0, colon))
|
|
12021
|
-
) {
|
|
12022
|
-
return value;
|
|
12023
|
-
}
|
|
12024
|
-
return "";
|
|
12025
|
-
}
|
|
12026
|
-
|
|
12027
|
-
// src/components/Avatar/Avatar.tsx
|
|
12028
|
-
var import_clsx = __toESM(require("clsx"));
|
|
12029
|
-
var import_react14 = __toESM(require("react"));
|
|
12030
|
-
|
|
12031
|
-
// src/components/Threads/icons.tsx
|
|
12032
|
-
var import_react13 = __toESM(require("react"));
|
|
12033
|
-
var Icon = {
|
|
12034
|
-
MessageBubble: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
12035
|
-
"svg",
|
|
12036
|
-
{
|
|
12037
|
-
className: "str-chat__icon str-chat__icon--message-bubble",
|
|
12038
|
-
fill: "none",
|
|
12039
|
-
height: "14",
|
|
12040
|
-
viewBox: "0 0 14 14",
|
|
12041
|
-
width: "14",
|
|
12042
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12043
|
-
...props
|
|
12044
|
-
},
|
|
12045
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
12046
|
-
"path",
|
|
12047
|
-
{
|
|
12048
|
-
d: "M1.66659 1.66665H12.3333V9.66665H2.44659L1.66659 10.4466V1.66665ZM1.66659 0.333313C0.933252 0.333313 0.339919 0.933313 0.339919 1.66665L0.333252 13.6666L2.99992 11H12.3333C13.0666 11 13.6666 10.4 13.6666 9.66665V1.66665C13.6666 0.933313 13.0666 0.333313 12.3333 0.333313H1.66659ZM2.99992 6.99998H10.9999V8.33331H2.99992V6.99998ZM2.99992 4.99998H10.9999V6.33331H2.99992V4.99998ZM2.99992 2.99998H10.9999V4.33331H2.99992V2.99998Z",
|
|
12049
|
-
fill: "currentColor"
|
|
12050
|
-
}
|
|
12051
|
-
)
|
|
12052
|
-
),
|
|
12053
|
-
MessageBubbleEmpty: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
12054
|
-
"svg",
|
|
12055
|
-
{
|
|
12056
|
-
className: "str-chat__icon str-chat__icon--message-bubble-empty",
|
|
12057
|
-
fill: "none",
|
|
12058
|
-
height: "20",
|
|
12059
|
-
viewBox: "0 0 20 20",
|
|
12060
|
-
width: "20",
|
|
12061
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12062
|
-
...props
|
|
12063
|
-
},
|
|
12064
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
12065
|
-
"path",
|
|
12066
|
-
{
|
|
12067
|
-
d: "M18 0H2C0.9 0 0 0.9 0 2V20L4 16H18C19.1 16 20 15.1 20 14V2C20 0.9 19.1 0 18 0ZM18 14H4L2 16V2H18V14Z",
|
|
12068
|
-
fill: "currentColor"
|
|
12069
|
-
}
|
|
12070
|
-
)
|
|
12071
|
-
),
|
|
12072
|
-
Reload: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
12073
|
-
"svg",
|
|
12074
|
-
{
|
|
12075
|
-
className: "str-chat__icon str-chat__icon--reload",
|
|
12076
|
-
fill: "none",
|
|
12077
|
-
height: "22",
|
|
12078
|
-
viewBox: "0 0 16 22",
|
|
12079
|
-
width: "16",
|
|
12080
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12081
|
-
...props
|
|
12082
|
-
},
|
|
12083
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
12084
|
-
"path",
|
|
12085
|
-
{
|
|
12086
|
-
d: "M8 3V0L4 4L8 8V5C11.31 5 14 7.69 14 11C14 12.01 13.75 12.97 13.3 13.8L14.76 15.26C15.54 14.03 16 12.57 16 11C16 6.58 12.42 3 8 3ZM8 17C4.69 17 2 14.31 2 11C2 9.99 2.25 9.03 2.7 8.2L1.24 6.74C0.46 7.97 0 9.43 0 11C0 15.42 3.58 19 8 19V22L12 18L8 14V17Z",
|
|
12087
|
-
fill: "currentColor"
|
|
12088
|
-
}
|
|
12089
|
-
)
|
|
12090
|
-
),
|
|
12091
|
-
User: (props) => /* @__PURE__ */ import_react13.default.createElement(
|
|
12092
|
-
"svg",
|
|
12093
|
-
{
|
|
12094
|
-
className: "str-chat__icon str-chat__icon--user",
|
|
12095
|
-
fill: "none",
|
|
12096
|
-
height: "16",
|
|
12097
|
-
viewBox: "0 0 16 16",
|
|
12098
|
-
width: "16",
|
|
12099
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12100
|
-
...props
|
|
12101
|
-
},
|
|
12102
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
12103
|
-
"path",
|
|
12104
|
-
{
|
|
12105
|
-
d: "M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z",
|
|
12106
|
-
fill: "currentColor"
|
|
12107
|
-
}
|
|
12108
|
-
)
|
|
12109
|
-
)
|
|
12110
|
-
};
|
|
12111
|
-
|
|
12112
|
-
// src/utils/getWholeChar.ts
|
|
12113
|
-
var getWholeChar = (str, i) => {
|
|
12114
|
-
const code2 = str.charCodeAt(i);
|
|
12115
|
-
if (Number.isNaN(code2)) return "";
|
|
12116
|
-
if (code2 < 55296 || code2 > 57343) return str.charAt(i);
|
|
12117
|
-
if (55296 <= code2 && code2 <= 56319) {
|
|
12118
|
-
if (str.length <= i + 1) {
|
|
12119
|
-
throw "High surrogate without following low surrogate";
|
|
12120
|
-
}
|
|
12121
|
-
const next = str.charCodeAt(i + 1);
|
|
12122
|
-
if (56320 > next || next > 57343) {
|
|
12123
|
-
throw "High surrogate without following low surrogate";
|
|
12124
|
-
}
|
|
12125
|
-
return str.charAt(i) + str.charAt(i + 1);
|
|
12126
|
-
}
|
|
12127
|
-
if (i === 0) {
|
|
12128
|
-
throw "Low surrogate without preceding high surrogate";
|
|
12129
|
-
}
|
|
12130
|
-
const prev = str.charCodeAt(i - 1);
|
|
12131
|
-
if (55296 > prev || prev > 56319) {
|
|
12132
|
-
throw "Low surrogate without preceding high surrogate";
|
|
12133
|
-
}
|
|
12134
|
-
return "";
|
|
12135
|
-
};
|
|
12136
|
-
|
|
12137
|
-
// src/components/Avatar/Avatar.tsx
|
|
12138
|
-
var Avatar = (props) => {
|
|
12139
|
-
const {
|
|
12140
|
-
className,
|
|
12141
|
-
image: image2,
|
|
12142
|
-
name: name2,
|
|
12143
|
-
onClick = () => void 0,
|
|
12144
|
-
onMouseOver = () => void 0
|
|
12145
|
-
} = props;
|
|
12146
|
-
const [error, setError] = (0, import_react14.useState)(false);
|
|
12147
|
-
(0, import_react14.useEffect)(() => {
|
|
12148
|
-
setError(false);
|
|
12149
|
-
}, [image2]);
|
|
12150
|
-
const nameStr = name2?.toString() || "";
|
|
12151
|
-
const initials = getWholeChar(nameStr, 0);
|
|
12152
|
-
const showImage = image2 && !error;
|
|
12153
|
-
return /* @__PURE__ */ import_react14.default.createElement(
|
|
12154
|
-
"div",
|
|
12155
|
-
{
|
|
12156
|
-
className: (0, import_clsx.default)(`str-chat__avatar str-chat__message-sender-avatar`, className, {
|
|
12157
|
-
["str-chat__avatar--multiple-letters"]: initials.length > 1,
|
|
12158
|
-
["str-chat__avatar--no-letters"]: !initials.length,
|
|
12159
|
-
["str-chat__avatar--one-letter"]: initials.length === 1
|
|
12160
|
-
}),
|
|
12161
|
-
"data-testid": "avatar",
|
|
12162
|
-
onClick,
|
|
12163
|
-
onMouseOver,
|
|
12164
|
-
role: "button",
|
|
12165
|
-
title: name2
|
|
12166
|
-
},
|
|
12167
|
-
showImage ? /* @__PURE__ */ import_react14.default.createElement(
|
|
12168
|
-
"img",
|
|
12169
|
-
{
|
|
12170
|
-
alt: initials,
|
|
12171
|
-
className: "str-chat__avatar-image",
|
|
12172
|
-
"data-testid": "avatar-img",
|
|
12173
|
-
onError: () => setError(true),
|
|
12174
|
-
src: image2
|
|
12175
|
-
}
|
|
12176
|
-
) : /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, !!initials.length && /* @__PURE__ */ import_react14.default.createElement(
|
|
12177
|
-
"div",
|
|
12178
|
-
{
|
|
12179
|
-
className: (0, import_clsx.default)("str-chat__avatar-fallback"),
|
|
12180
|
-
"data-testid": "avatar-fallback"
|
|
12181
|
-
},
|
|
12182
|
-
initials
|
|
12183
|
-
), !initials.length && /* @__PURE__ */ import_react14.default.createElement(Icon.User, null))
|
|
12184
|
-
);
|
|
12185
|
-
};
|
|
12186
|
-
|
|
12187
|
-
// src/components/Message/utils.tsx
|
|
12188
|
-
var import_react_fast_compare = __toESM(require("react-fast-compare"));
|
|
12189
|
-
var import_emoji_regex = __toESM(require("emoji-regex"));
|
|
12190
|
-
var isUserMuted = (message, mutes) => {
|
|
12191
|
-
if (!mutes || !message) return false;
|
|
12192
|
-
const userMuted = mutes.filter((el) => el.target.id === message.user?.id);
|
|
12193
|
-
return !!userMuted.length;
|
|
12194
|
-
};
|
|
12195
|
-
var MESSAGE_ACTIONS = {
|
|
12196
|
-
delete: "delete",
|
|
12197
|
-
edit: "edit",
|
|
12198
|
-
flag: "flag",
|
|
12199
|
-
markUnread: "markUnread",
|
|
12200
|
-
mute: "mute",
|
|
12201
|
-
pin: "pin",
|
|
12202
|
-
quote: "quote",
|
|
12203
|
-
react: "react",
|
|
12204
|
-
reply: "reply"
|
|
12205
|
-
};
|
|
12206
|
-
var ACTIONS_NOT_WORKING_IN_THREAD = [
|
|
12207
|
-
MESSAGE_ACTIONS.pin,
|
|
12208
|
-
MESSAGE_ACTIONS.reply,
|
|
12209
|
-
MESSAGE_ACTIONS.markUnread
|
|
12210
|
-
];
|
|
12211
|
-
|
|
12212
|
-
// src/components/ChannelPreview/ChannelPreview.tsx
|
|
12213
|
-
var import_lodash = __toESM(require("lodash.throttle"));
|
|
12214
|
-
var import_react23 = __toESM(require("react"));
|
|
12215
|
-
|
|
12216
|
-
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
12217
|
-
var import_react18 = __toESM(require("react"));
|
|
12218
|
-
var import_clsx3 = __toESM(require("clsx"));
|
|
12219
|
-
|
|
12220
|
-
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
12221
|
-
var import_react17 = __toESM(require("react"));
|
|
12222
|
-
var import_clsx2 = __toESM(require("clsx"));
|
|
12223
|
-
|
|
12224
|
-
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
12225
|
-
var import_react15 = require("react");
|
|
12226
|
-
var import_shim2 = require("use-sync-external-store/shim");
|
|
12227
|
-
var noop2 = () => {
|
|
12228
|
-
};
|
|
12229
|
-
function useSelectedChannelState({
|
|
12230
|
-
channel,
|
|
12231
|
-
selector: selector2,
|
|
12232
|
-
stateChangeEventKeys = ["all"]
|
|
12233
|
-
}) {
|
|
12234
|
-
const subscribe = (0, import_react15.useCallback)(
|
|
12235
|
-
(onStoreChange) => {
|
|
12236
|
-
if (!channel) return noop2;
|
|
12237
|
-
const subscriptions = stateChangeEventKeys.map(
|
|
12238
|
-
(et) => channel.on(et, () => {
|
|
12239
|
-
onStoreChange(selector2(channel));
|
|
12240
|
-
})
|
|
12241
|
-
);
|
|
12242
|
-
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
12243
|
-
},
|
|
12244
|
-
[channel, selector2, stateChangeEventKeys]
|
|
12245
|
-
);
|
|
12246
|
-
const getSnapshot = (0, import_react15.useCallback)(() => {
|
|
12247
|
-
if (!channel) return void 0;
|
|
12248
|
-
return selector2(channel);
|
|
12249
|
-
}, [channel, selector2]);
|
|
12250
|
-
return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot);
|
|
12251
|
-
}
|
|
12252
|
-
|
|
12253
|
-
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
12254
|
-
var selector = (c) => c.state.membership;
|
|
12255
|
-
var keys2 = ["member.updated"];
|
|
12256
|
-
function useChannelMembershipState(channel) {
|
|
12257
|
-
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys2 });
|
|
12258
|
-
}
|
|
12259
|
-
|
|
12260
|
-
// src/components/ChannelPreview/icons.tsx
|
|
12261
|
-
var import_react16 = __toESM(require("react"));
|
|
12262
|
-
var Icon2 = {
|
|
12263
|
-
ArchiveBox: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
12264
|
-
"svg",
|
|
12265
|
-
{
|
|
12266
|
-
className: "str-chat__icon str-chat__icon--archive-box",
|
|
12267
|
-
fill: "currentColor",
|
|
12268
|
-
viewBox: "0 0 512 512",
|
|
12269
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12270
|
-
...props
|
|
12271
|
-
},
|
|
12272
|
-
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64C0 46.3 14.3 32 32 32zm0 128l448 0 0 256c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-256zm128 80c0 8.8 7.2 16 16 16l160 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-160 0c-8.8 0-16 7.2-16 16z" })
|
|
12273
|
-
),
|
|
12274
|
-
Pin: (props) => /* @__PURE__ */ import_react16.default.createElement(
|
|
12275
|
-
"svg",
|
|
12276
|
-
{
|
|
12277
|
-
className: "str-chat__icon str-chat__icon--pin",
|
|
12278
|
-
fill: "currentColor",
|
|
12279
|
-
viewBox: "0 0 384 512",
|
|
12280
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12281
|
-
...props
|
|
12282
|
-
},
|
|
12283
|
-
/* @__PURE__ */ import_react16.default.createElement("path", { d: "M32 32C32 14.3 46.3 0 64 0L320 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-29.5 0 11.4 148.2c36.7 19.9 65.7 53.2 79.5 94.7l1 3c3.3 9.8 1.6 20.5-4.4 28.8s-15.7 13.3-26 13.3L32 352c-10.3 0-19.9-4.9-26-13.3s-7.7-19.1-4.4-28.8l1-3c13.8-41.5 42.8-74.8 79.5-94.7L93.5 64 64 64C46.3 64 32 49.7 32 32zM160 384l64 0 0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-96z" })
|
|
12284
|
-
)
|
|
12285
|
-
};
|
|
12286
|
-
|
|
12287
|
-
// src/components/ChannelPreview/ChannelPreviewActionButtons.tsx
|
|
12288
|
-
function ChannelPreviewActionButtons({
|
|
12289
|
-
channel
|
|
12290
|
-
}) {
|
|
12291
|
-
const membership = useChannelMembershipState(channel);
|
|
12292
|
-
const { t } = useTranslationContext();
|
|
12293
|
-
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "str-chat__channel-preview__action-buttons" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
12294
|
-
"button",
|
|
12295
|
-
{
|
|
12296
|
-
"aria-label": membership.pinned_at ? t("Unpin") : t("Pin"),
|
|
12297
|
-
className: (0, import_clsx2.default)(
|
|
12298
|
-
"str-chat__channel-preview__action-button",
|
|
12299
|
-
"str-chat__channel-preview__action-button--pin",
|
|
12300
|
-
membership.pinned_at && "str-chat__channel-preview__action-button--active"
|
|
12301
|
-
),
|
|
12302
|
-
onClick: (e) => {
|
|
12303
|
-
e.stopPropagation();
|
|
12304
|
-
if (membership.pinned_at) {
|
|
12305
|
-
channel.unpin();
|
|
12306
|
-
} else {
|
|
12307
|
-
channel.pin();
|
|
12308
|
-
}
|
|
12309
|
-
},
|
|
12310
|
-
title: membership.pinned_at ? t("Unpin") : t("Pin")
|
|
12311
|
-
},
|
|
12312
|
-
/* @__PURE__ */ import_react17.default.createElement(Icon2.Pin, null)
|
|
12313
|
-
), /* @__PURE__ */ import_react17.default.createElement(
|
|
12314
|
-
"button",
|
|
12315
|
-
{
|
|
12316
|
-
"aria-label": membership.archived_at ? t("Unarchive") : t("Archive"),
|
|
12317
|
-
className: (0, import_clsx2.default)(
|
|
12318
|
-
"str-chat__channel-preview__action-button",
|
|
12319
|
-
"str-chat__channel-preview__action-button--archive",
|
|
12320
|
-
membership.archived_at && "str-chat__channel-preview__action-button--active"
|
|
12321
|
-
),
|
|
12322
|
-
onClick: (e) => {
|
|
12323
|
-
e.stopPropagation();
|
|
12324
|
-
if (membership.archived_at) {
|
|
12325
|
-
channel.unarchive();
|
|
12326
|
-
} else {
|
|
12327
|
-
channel.archive();
|
|
12328
|
-
}
|
|
12329
|
-
},
|
|
12330
|
-
title: membership.archived_at ? t("Unarchive") : t("Archive")
|
|
12331
|
-
},
|
|
12332
|
-
/* @__PURE__ */ import_react17.default.createElement(Icon2.ArchiveBox, null)
|
|
12333
|
-
));
|
|
12334
|
-
}
|
|
12335
|
-
|
|
12336
|
-
// src/components/ChannelPreview/ChannelPreviewMessenger.tsx
|
|
12337
|
-
var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
12338
|
-
const {
|
|
12339
|
-
active,
|
|
12340
|
-
Avatar: Avatar2 = Avatar,
|
|
12341
|
-
channel,
|
|
12342
|
-
className: customClassName = "",
|
|
12343
|
-
displayImage,
|
|
12344
|
-
displayTitle,
|
|
12345
|
-
groupChannelDisplayInfo,
|
|
12346
|
-
latestMessagePreview,
|
|
12347
|
-
onSelect: customOnSelectChannel,
|
|
12348
|
-
setActiveChannel,
|
|
12349
|
-
unread,
|
|
12350
|
-
watchers
|
|
12351
|
-
} = props;
|
|
12352
|
-
const { ChannelPreviewActionButtons: ChannelPreviewActionButtons2 = ChannelPreviewActionButtons } = useComponentContext();
|
|
12353
|
-
const channelPreviewButton = (0, import_react18.useRef)(null);
|
|
12354
|
-
const avatarName = displayTitle || channel.state.messages[channel.state.messages.length - 1]?.user?.id;
|
|
12355
|
-
const onSelectChannel = (e) => {
|
|
12356
|
-
if (customOnSelectChannel) {
|
|
12357
|
-
customOnSelectChannel(e);
|
|
12358
|
-
} else if (setActiveChannel) {
|
|
12359
|
-
setActiveChannel(channel, watchers);
|
|
12360
|
-
}
|
|
12361
|
-
if (channelPreviewButton?.current) {
|
|
12362
|
-
channelPreviewButton.current.blur();
|
|
12349
|
+
if (node2.type === "element") {
|
|
12350
|
+
let key;
|
|
12351
|
+
for (key in urlAttributes) {
|
|
12352
|
+
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
|
|
12353
|
+
const value = node2.properties[key];
|
|
12354
|
+
const test = urlAttributes[key];
|
|
12355
|
+
if (test === null || test.includes(node2.tagName)) {
|
|
12356
|
+
node2.properties[key] = urlTransform(String(value || ""), key, node2);
|
|
12357
|
+
}
|
|
12358
|
+
}
|
|
12359
|
+
}
|
|
12363
12360
|
}
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
"aria-label": `Select Channel: ${displayTitle || ""}`,
|
|
12369
|
-
"aria-selected": active,
|
|
12370
|
-
className: (0, import_clsx3.default)(
|
|
12371
|
-
`str-chat__channel-preview-messenger str-chat__channel-preview`,
|
|
12372
|
-
active && "str-chat__channel-preview-messenger--active",
|
|
12373
|
-
unread && unread >= 1 && "str-chat__channel-preview-messenger--unread",
|
|
12374
|
-
customClassName
|
|
12375
|
-
),
|
|
12376
|
-
"data-testid": "channel-preview-button",
|
|
12377
|
-
onClick: onSelectChannel,
|
|
12378
|
-
ref: channelPreviewButton,
|
|
12379
|
-
role: "option"
|
|
12380
|
-
},
|
|
12381
|
-
/* @__PURE__ */ import_react18.default.createElement("div", { className: "str-chat__channel-preview-messenger--left" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
12382
|
-
Avatar2,
|
|
12383
|
-
{
|
|
12384
|
-
className: "str-chat__avatar--channel-preview",
|
|
12385
|
-
groupChannelDisplayInfo,
|
|
12386
|
-
image: displayImage,
|
|
12387
|
-
name: avatarName
|
|
12361
|
+
if (node2.type === "element") {
|
|
12362
|
+
let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
|
|
12363
|
+
if (!remove && allowElement && typeof index3 === "number") {
|
|
12364
|
+
remove = !allowElement(node2, index3, parent);
|
|
12388
12365
|
}
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
}
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
);
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
};
|
|
12416
|
-
|
|
12417
|
-
// src/components/ChannelPreview/hooks/useChannelPreviewInfo.ts
|
|
12418
|
-
var import_react21 = require("react");
|
|
12366
|
+
if (remove && parent && typeof index3 === "number") {
|
|
12367
|
+
if (unwrapDisallowed && node2.children) {
|
|
12368
|
+
parent.children.splice(index3, 1, ...node2.children);
|
|
12369
|
+
} else {
|
|
12370
|
+
parent.children.splice(index3, 1);
|
|
12371
|
+
}
|
|
12372
|
+
return index3;
|
|
12373
|
+
}
|
|
12374
|
+
}
|
|
12375
|
+
}
|
|
12376
|
+
}
|
|
12377
|
+
function defaultUrlTransform(value) {
|
|
12378
|
+
const colon = value.indexOf(":");
|
|
12379
|
+
const questionMark = value.indexOf("?");
|
|
12380
|
+
const numberSign = value.indexOf("#");
|
|
12381
|
+
const slash = value.indexOf("/");
|
|
12382
|
+
if (
|
|
12383
|
+
// If there is no protocol, it’s relative.
|
|
12384
|
+
colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
12385
|
+
slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
|
|
12386
|
+
safeProtocol.test(value.slice(0, colon))
|
|
12387
|
+
) {
|
|
12388
|
+
return value;
|
|
12389
|
+
}
|
|
12390
|
+
return "";
|
|
12391
|
+
}
|
|
12419
12392
|
|
|
12420
12393
|
// src/components/ChannelPreview/utils.tsx
|
|
12421
|
-
var import_react20 = __toESM(require("react"));
|
|
12422
12394
|
var renderPreviewText = (text5) => /* @__PURE__ */ import_react20.default.createElement(Markdown, { skipHtml: true }, text5);
|
|
12423
12395
|
var getLatestPollVote = (latestVotesByOption) => {
|
|
12424
12396
|
let latestVote;
|
|
@@ -12685,6 +12657,35 @@ var ChannelPreview = (props) => {
|
|
|
12685
12657
|
);
|
|
12686
12658
|
};
|
|
12687
12659
|
|
|
12660
|
+
// src/components/Thread/Thread.tsx
|
|
12661
|
+
var import_react33 = __toESM(require("react"));
|
|
12662
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
12663
|
+
|
|
12664
|
+
// src/components/Message/utils.tsx
|
|
12665
|
+
var import_react_fast_compare = __toESM(require("react-fast-compare"));
|
|
12666
|
+
var import_emoji_regex = __toESM(require("emoji-regex"));
|
|
12667
|
+
var isUserMuted = (message, mutes) => {
|
|
12668
|
+
if (!mutes || !message) return false;
|
|
12669
|
+
const userMuted = mutes.filter((el) => el.target.id === message.user?.id);
|
|
12670
|
+
return !!userMuted.length;
|
|
12671
|
+
};
|
|
12672
|
+
var MESSAGE_ACTIONS = {
|
|
12673
|
+
delete: "delete",
|
|
12674
|
+
edit: "edit",
|
|
12675
|
+
flag: "flag",
|
|
12676
|
+
markUnread: "markUnread",
|
|
12677
|
+
mute: "mute",
|
|
12678
|
+
pin: "pin",
|
|
12679
|
+
quote: "quote",
|
|
12680
|
+
react: "react",
|
|
12681
|
+
reply: "reply"
|
|
12682
|
+
};
|
|
12683
|
+
var ACTIONS_NOT_WORKING_IN_THREAD = [
|
|
12684
|
+
MESSAGE_ACTIONS.pin,
|
|
12685
|
+
MESSAGE_ACTIONS.reply,
|
|
12686
|
+
MESSAGE_ACTIONS.markUnread
|
|
12687
|
+
];
|
|
12688
|
+
|
|
12688
12689
|
// src/components/Message/hooks/useUserRole.ts
|
|
12689
12690
|
var useUserRole = (message, onlySenderCanEdit, disableQuotedMessages) => {
|
|
12690
12691
|
const { channel, channelCapabilities = {} } = useChannelStateContext("useUserRole");
|
|
@@ -12717,51 +12718,13 @@ var useUserRole = (message, onlySenderCanEdit, disableQuotedMessages) => {
|
|
|
12717
12718
|
};
|
|
12718
12719
|
};
|
|
12719
12720
|
|
|
12720
|
-
// src/components/Message/icons.tsx
|
|
12721
|
-
var import_react24 = __toESM(require("react"));
|
|
12722
|
-
var ActionsIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement(
|
|
12723
|
-
"svg",
|
|
12724
|
-
{
|
|
12725
|
-
className,
|
|
12726
|
-
height: "4",
|
|
12727
|
-
viewBox: "0 0 11 4",
|
|
12728
|
-
width: "11",
|
|
12729
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
12730
|
-
},
|
|
12731
|
-
/* @__PURE__ */ import_react24.default.createElement(
|
|
12732
|
-
"path",
|
|
12733
|
-
{
|
|
12734
|
-
d: "M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",
|
|
12735
|
-
fillRule: "nonzero"
|
|
12736
|
-
}
|
|
12737
|
-
)
|
|
12738
|
-
);
|
|
12739
|
-
var ReactionIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement(
|
|
12740
|
-
"svg",
|
|
12741
|
-
{
|
|
12742
|
-
className,
|
|
12743
|
-
height: "12",
|
|
12744
|
-
viewBox: "0 0 12 12",
|
|
12745
|
-
width: "12",
|
|
12746
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
12747
|
-
},
|
|
12748
|
-
/* @__PURE__ */ import_react24.default.createElement("g", { clipRule: "evenodd", fillRule: "evenodd" }, /* @__PURE__ */ import_react24.default.createElement("path", { d: "M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z" }), /* @__PURE__ */ import_react24.default.createElement("path", { d: "M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z" }))
|
|
12749
|
-
);
|
|
12750
|
-
var ThreadIcon = ({ className = "" }) => /* @__PURE__ */ import_react24.default.createElement("svg", { className, height: "10", width: "14", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
12751
|
-
"path",
|
|
12752
|
-
{
|
|
12753
|
-
d: "M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z",
|
|
12754
|
-
fillRule: "evenodd"
|
|
12755
|
-
}
|
|
12756
|
-
));
|
|
12757
|
-
|
|
12758
12721
|
// src/components/MessageActions/MessageActions.tsx
|
|
12759
12722
|
var import_clsx5 = __toESM(require("clsx"));
|
|
12760
12723
|
var import_react26 = __toESM(require("react"));
|
|
12761
12724
|
|
|
12762
12725
|
// src/components/Dialog/DialogAnchor.tsx
|
|
12763
12726
|
var import_clsx4 = __toESM(require("clsx"));
|
|
12764
|
-
var
|
|
12727
|
+
var import_react24 = __toESM(require("react"));
|
|
12765
12728
|
var import_focus = require("@react-aria/focus");
|
|
12766
12729
|
var import_react_popper = require("react-popper");
|
|
12767
12730
|
function useDialogAnchor({
|
|
@@ -12769,7 +12732,7 @@ function useDialogAnchor({
|
|
|
12769
12732
|
placement,
|
|
12770
12733
|
referenceElement
|
|
12771
12734
|
}) {
|
|
12772
|
-
const [popperElement, setPopperElement] = (0,
|
|
12735
|
+
const [popperElement, setPopperElement] = (0, import_react24.useState)(null);
|
|
12773
12736
|
const { attributes, styles, update } = (0, import_react_popper.usePopper)(referenceElement, popperElement, {
|
|
12774
12737
|
modifiers: [
|
|
12775
12738
|
{
|
|
@@ -12784,7 +12747,7 @@ function useDialogAnchor({
|
|
|
12784
12747
|
],
|
|
12785
12748
|
placement
|
|
12786
12749
|
});
|
|
12787
|
-
(0,
|
|
12750
|
+
(0, import_react24.useEffect)(() => {
|
|
12788
12751
|
if (open && popperElement) {
|
|
12789
12752
|
update?.();
|
|
12790
12753
|
}
|
|
@@ -12805,6 +12768,7 @@ var DialogAnchor = ({
|
|
|
12805
12768
|
id,
|
|
12806
12769
|
placement = "auto",
|
|
12807
12770
|
referenceElement = null,
|
|
12771
|
+
tabIndex,
|
|
12808
12772
|
trapFocus,
|
|
12809
12773
|
...restDivProps
|
|
12810
12774
|
}) => {
|
|
@@ -12815,7 +12779,7 @@ var DialogAnchor = ({
|
|
|
12815
12779
|
placement,
|
|
12816
12780
|
referenceElement
|
|
12817
12781
|
});
|
|
12818
|
-
(0,
|
|
12782
|
+
(0, import_react24.useEffect)(() => {
|
|
12819
12783
|
if (!open) return;
|
|
12820
12784
|
const hideOnEscape = (event) => {
|
|
12821
12785
|
if (event.key !== "Escape") return;
|
|
@@ -12829,7 +12793,7 @@ var DialogAnchor = ({
|
|
|
12829
12793
|
if (!open) {
|
|
12830
12794
|
return null;
|
|
12831
12795
|
}
|
|
12832
|
-
return /* @__PURE__ */
|
|
12796
|
+
return /* @__PURE__ */ import_react24.default.createElement(DialogPortalEntry, { dialogId: id }, /* @__PURE__ */ import_react24.default.createElement(import_focus.FocusScope, { autoFocus: focus, contain: trapFocus, restoreFocus: true }, /* @__PURE__ */ import_react24.default.createElement(
|
|
12833
12797
|
"div",
|
|
12834
12798
|
{
|
|
12835
12799
|
...restDivProps,
|
|
@@ -12838,12 +12802,50 @@ var DialogAnchor = ({
|
|
|
12838
12802
|
"data-testid": "str-chat__dialog-contents",
|
|
12839
12803
|
ref: setPopperElement,
|
|
12840
12804
|
style: styles.popper,
|
|
12841
|
-
tabIndex: 0
|
|
12805
|
+
tabIndex: typeof tabIndex !== "undefined" ? tabIndex : 0
|
|
12842
12806
|
},
|
|
12843
12807
|
children
|
|
12844
12808
|
)));
|
|
12845
12809
|
};
|
|
12846
12810
|
|
|
12811
|
+
// src/components/Message/icons.tsx
|
|
12812
|
+
var import_react25 = __toESM(require("react"));
|
|
12813
|
+
var ActionsIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement(
|
|
12814
|
+
"svg",
|
|
12815
|
+
{
|
|
12816
|
+
className,
|
|
12817
|
+
height: "4",
|
|
12818
|
+
viewBox: "0 0 11 4",
|
|
12819
|
+
width: "11",
|
|
12820
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
12821
|
+
},
|
|
12822
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
12823
|
+
"path",
|
|
12824
|
+
{
|
|
12825
|
+
d: "M1.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm4 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",
|
|
12826
|
+
fillRule: "nonzero"
|
|
12827
|
+
}
|
|
12828
|
+
)
|
|
12829
|
+
);
|
|
12830
|
+
var ReactionIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement(
|
|
12831
|
+
"svg",
|
|
12832
|
+
{
|
|
12833
|
+
className,
|
|
12834
|
+
height: "12",
|
|
12835
|
+
viewBox: "0 0 12 12",
|
|
12836
|
+
width: "12",
|
|
12837
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
12838
|
+
},
|
|
12839
|
+
/* @__PURE__ */ import_react25.default.createElement("g", { clipRule: "evenodd", fillRule: "evenodd" }, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M6 1.2C3.3 1.2 1.2 3.3 1.2 6c0 2.7 2.1 4.8 4.8 4.8 2.7 0 4.8-2.1 4.8-4.8 0-2.7-2.1-4.8-4.8-4.8zM0 6c0-3.3 2.7-6 6-6s6 2.7 6 6-2.7 6-6 6-6-2.7-6-6z" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M5.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM8.4 4.5c0 .5-.4.9-.9.9s-.9-.4-.9-.9.4-.9.9-.9.9.4.9.9zM3.3 6.7c.3-.2.6-.1.8.1.3.4.8.9 1.5 1 .6.2 1.4.1 2.4-1 .2-.2.6-.3.8 0 .2.2.3.6 0 .8-1.1 1.3-2.4 1.7-3.5 1.5-1-.2-1.8-.9-2.2-1.5-.2-.3-.1-.7.2-.9z" }))
|
|
12840
|
+
);
|
|
12841
|
+
var ThreadIcon = ({ className = "" }) => /* @__PURE__ */ import_react25.default.createElement("svg", { className, height: "10", width: "14", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react25.default.createElement(
|
|
12842
|
+
"path",
|
|
12843
|
+
{
|
|
12844
|
+
d: "M8.516 3c4.78 0 4.972 6.5 4.972 6.5-1.6-2.906-2.847-3.184-4.972-3.184v2.872L3.772 4.994 8.516.5V3zM.484 5l4.5-4.237v1.78L2.416 5l2.568 2.125v1.828L.484 5z",
|
|
12845
|
+
fillRule: "evenodd"
|
|
12846
|
+
}
|
|
12847
|
+
));
|
|
12848
|
+
|
|
12847
12849
|
// src/components/MessageActions/MessageActions.tsx
|
|
12848
12850
|
var MessageActionsWrapper = (props) => {
|
|
12849
12851
|
const { children, customWrapperClass, inline, toggleOpen } = props;
|
|
@@ -13258,18 +13260,87 @@ var InfiniteScrollPaginator = (props) => {
|
|
|
13258
13260
|
);
|
|
13259
13261
|
};
|
|
13260
13262
|
|
|
13263
|
+
// src/components/Thread/Thread.tsx
|
|
13264
|
+
var LegacyThreadContext = import_react33.default.createContext({ legacyThread: void 0 });
|
|
13265
|
+
var useLegacyThreadContext = () => (0, import_react33.useContext)(LegacyThreadContext);
|
|
13266
|
+
|
|
13267
|
+
// src/components/MessageInput/hooks/useMessageComposer.ts
|
|
13268
|
+
var queueCache = new import_stream_chat.FixedSizeQueueCache(64);
|
|
13269
|
+
var useMessageComposer = () => {
|
|
13270
|
+
const { client } = useChatContext();
|
|
13271
|
+
const { channel } = useChannelStateContext();
|
|
13272
|
+
const { editing, message: editedMessage } = useMessageContext();
|
|
13273
|
+
const { legacyThread: parentMessage } = useLegacyThreadContext();
|
|
13274
|
+
const threadInstance = useThreadContext();
|
|
13275
|
+
const cachedEditedMessage = (0, import_react34.useMemo)(() => {
|
|
13276
|
+
if (!editedMessage) return void 0;
|
|
13277
|
+
return editedMessage;
|
|
13278
|
+
}, [editedMessage?.id]);
|
|
13279
|
+
const cachedParentMessage = (0, import_react34.useMemo)(() => {
|
|
13280
|
+
if (!parentMessage) return void 0;
|
|
13281
|
+
return parentMessage;
|
|
13282
|
+
}, [parentMessage?.id]);
|
|
13283
|
+
const messageComposer = (0, import_react34.useMemo)(() => {
|
|
13284
|
+
if (editing && cachedEditedMessage) {
|
|
13285
|
+
const tag = import_stream_chat.MessageComposer.constructTag(cachedEditedMessage);
|
|
13286
|
+
const cachedComposer = queueCache.get(tag);
|
|
13287
|
+
if (cachedComposer) return cachedComposer;
|
|
13288
|
+
return new import_stream_chat.MessageComposer({
|
|
13289
|
+
client,
|
|
13290
|
+
composition: cachedEditedMessage,
|
|
13291
|
+
compositionContext: cachedEditedMessage
|
|
13292
|
+
});
|
|
13293
|
+
} else if (threadInstance) {
|
|
13294
|
+
return threadInstance.messageComposer;
|
|
13295
|
+
} else if (cachedParentMessage) {
|
|
13296
|
+
const compositionContext = {
|
|
13297
|
+
...cachedParentMessage,
|
|
13298
|
+
legacyThreadId: cachedParentMessage.id
|
|
13299
|
+
};
|
|
13300
|
+
const tag = import_stream_chat.MessageComposer.constructTag(compositionContext);
|
|
13301
|
+
const cachedComposer = queueCache.get(tag);
|
|
13302
|
+
if (cachedComposer) return cachedComposer;
|
|
13303
|
+
return new import_stream_chat.MessageComposer({
|
|
13304
|
+
client,
|
|
13305
|
+
compositionContext
|
|
13306
|
+
});
|
|
13307
|
+
} else {
|
|
13308
|
+
return channel.messageComposer;
|
|
13309
|
+
}
|
|
13310
|
+
}, [
|
|
13311
|
+
cachedEditedMessage,
|
|
13312
|
+
cachedParentMessage,
|
|
13313
|
+
channel,
|
|
13314
|
+
client,
|
|
13315
|
+
editing,
|
|
13316
|
+
threadInstance
|
|
13317
|
+
]);
|
|
13318
|
+
if (["legacy_thread", "message"].includes(
|
|
13319
|
+
messageComposer.contextType
|
|
13320
|
+
) && !queueCache.peek(messageComposer.tag)) {
|
|
13321
|
+
queueCache.add(messageComposer.tag, messageComposer);
|
|
13322
|
+
}
|
|
13323
|
+
(0, import_react34.useEffect)(() => {
|
|
13324
|
+
const unsubscribe = messageComposer.registerSubscriptions();
|
|
13325
|
+
return () => {
|
|
13326
|
+
unsubscribe();
|
|
13327
|
+
};
|
|
13328
|
+
}, [messageComposer]);
|
|
13329
|
+
return messageComposer;
|
|
13330
|
+
};
|
|
13331
|
+
|
|
13261
13332
|
// src/experimental/Search/hooks/useSearchQueriesInProgress.ts
|
|
13262
|
-
var
|
|
13333
|
+
var import_react35 = require("react");
|
|
13263
13334
|
var searchControllerStateSelector = (value) => ({
|
|
13264
13335
|
sources: value.sources
|
|
13265
13336
|
});
|
|
13266
13337
|
var useSearchQueriesInProgress = (searchController) => {
|
|
13267
|
-
const [queriesInProgress, setQueriesInProgress] = (0,
|
|
13338
|
+
const [queriesInProgress, setQueriesInProgress] = (0, import_react35.useState)([]);
|
|
13268
13339
|
const { sources } = useStateStore(
|
|
13269
13340
|
searchController.state,
|
|
13270
13341
|
searchControllerStateSelector
|
|
13271
13342
|
);
|
|
13272
|
-
(0,
|
|
13343
|
+
(0, import_react35.useEffect)(() => {
|
|
13273
13344
|
const subscriptions = sources.map(
|
|
13274
13345
|
(source) => source.state.subscribeWithSelector(
|
|
13275
13346
|
(value) => ({ isLoading: value.isLoading }),
|
|
@@ -13289,7 +13360,7 @@ var useSearchQueriesInProgress = (searchController) => {
|
|
|
13289
13360
|
};
|
|
13290
13361
|
|
|
13291
13362
|
// src/experimental/MessageActions/hooks/useBaseMessageActionSetFilter.ts
|
|
13292
|
-
var
|
|
13363
|
+
var import_react36 = require("react");
|
|
13293
13364
|
var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
13294
13365
|
const { initialMessage: isInitialMessage, message } = useMessageContext();
|
|
13295
13366
|
const {
|
|
@@ -13303,7 +13374,7 @@ var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
|
13303
13374
|
canReply
|
|
13304
13375
|
} = useUserRole(message);
|
|
13305
13376
|
const isMessageThreadReply = typeof message.parent_id === "string";
|
|
13306
|
-
return (0,
|
|
13377
|
+
return (0, import_react36.useMemo)(() => {
|
|
13307
13378
|
if (disable2) return messageActionSet;
|
|
13308
13379
|
if (isInitialMessage || // not sure whether this thing even works anymore
|
|
13309
13380
|
!message.type || message.type === "error" || message.type === "system" || message.type === "ephemeral" || message.status === "failed" || message.status === "sending")
|
|
@@ -13334,8 +13405,8 @@ var useBaseMessageActionSetFilter = (messageActionSet, disable2 = false) => {
|
|
|
13334
13405
|
};
|
|
13335
13406
|
|
|
13336
13407
|
// src/experimental/MessageActions/hooks/useSplitMessageActionSet.ts
|
|
13337
|
-
var
|
|
13338
|
-
var useSplitMessageActionSet = (messageActionSet) => (0,
|
|
13408
|
+
var import_react37 = require("react");
|
|
13409
|
+
var useSplitMessageActionSet = (messageActionSet) => (0, import_react37.useMemo)(() => {
|
|
13339
13410
|
const quickActionSet = [];
|
|
13340
13411
|
const dropdownActionSet = [];
|
|
13341
13412
|
for (const action of messageActionSet) {
|
|
@@ -13346,70 +13417,70 @@ var useSplitMessageActionSet = (messageActionSet) => (0, import_react35.useMemo)
|
|
|
13346
13417
|
}, [messageActionSet]);
|
|
13347
13418
|
|
|
13348
13419
|
// src/experimental/MessageActions/defaults.tsx
|
|
13349
|
-
var
|
|
13420
|
+
var import_react38 = __toESM(require("react"));
|
|
13350
13421
|
var DefaultDropdownActionButton = ({
|
|
13351
13422
|
"aria-selected": ariaSelected = "false",
|
|
13352
13423
|
children,
|
|
13353
13424
|
className = "str-chat__message-actions-list-item-button",
|
|
13354
13425
|
role = "option",
|
|
13355
13426
|
...rest
|
|
13356
|
-
}) => /* @__PURE__ */
|
|
13427
|
+
}) => /* @__PURE__ */ import_react38.default.createElement("button", { "aria-selected": ariaSelected, className, role, ...rest }, children);
|
|
13357
13428
|
var DefaultMessageActionComponents = {
|
|
13358
13429
|
dropdown: {
|
|
13359
13430
|
Quote() {
|
|
13360
|
-
const { setQuotedMessage } = useChannelActionContext();
|
|
13361
13431
|
const { message } = useMessageContext();
|
|
13362
13432
|
const { t } = useTranslationContext();
|
|
13433
|
+
const messageComposer = useMessageComposer();
|
|
13363
13434
|
const handleQuote = () => {
|
|
13364
|
-
setQuotedMessage(message);
|
|
13435
|
+
messageComposer.setQuotedMessage(message);
|
|
13365
13436
|
const elements = message.parent_id ? document.querySelectorAll(".str-chat__thread .str-chat__textarea__textarea") : document.getElementsByClassName("str-chat__textarea__textarea");
|
|
13366
13437
|
const textarea = elements.item(0);
|
|
13367
13438
|
if (textarea instanceof HTMLTextAreaElement) {
|
|
13368
13439
|
textarea.focus();
|
|
13369
13440
|
}
|
|
13370
13441
|
};
|
|
13371
|
-
return /* @__PURE__ */
|
|
13442
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleQuote }, t("Quote"));
|
|
13372
13443
|
},
|
|
13373
13444
|
Pin() {
|
|
13374
13445
|
const { handlePin, message } = useMessageContext();
|
|
13375
13446
|
const { t } = useTranslationContext();
|
|
13376
|
-
return /* @__PURE__ */
|
|
13447
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handlePin }, !message.pinned ? t("Pin") : t("Unpin"));
|
|
13377
13448
|
},
|
|
13378
13449
|
MarkUnread() {
|
|
13379
13450
|
const { handleMarkUnread } = useMessageContext();
|
|
13380
13451
|
const { t } = useTranslationContext();
|
|
13381
|
-
return /* @__PURE__ */
|
|
13452
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleMarkUnread }, t("Mark as unread"));
|
|
13382
13453
|
},
|
|
13383
13454
|
Flag() {
|
|
13384
13455
|
const { handleFlag } = useMessageContext();
|
|
13385
13456
|
const { t } = useTranslationContext();
|
|
13386
|
-
return /* @__PURE__ */
|
|
13457
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleFlag }, t("Flag"));
|
|
13387
13458
|
},
|
|
13388
13459
|
Mute() {
|
|
13389
13460
|
const { handleMute, message } = useMessageContext();
|
|
13390
13461
|
const { mutes } = useChatContext();
|
|
13391
13462
|
const { t } = useTranslationContext();
|
|
13392
|
-
return /* @__PURE__ */
|
|
13463
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleMute }, isUserMuted(message, mutes) ? t("Unmute") : t("Mute"));
|
|
13393
13464
|
},
|
|
13394
13465
|
Edit() {
|
|
13395
13466
|
const { handleEdit } = useMessageContext();
|
|
13396
13467
|
const { t } = useTranslationContext();
|
|
13397
|
-
return /* @__PURE__ */
|
|
13468
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleEdit }, t("Edit Message"));
|
|
13398
13469
|
},
|
|
13399
13470
|
Delete() {
|
|
13400
13471
|
const { handleDelete } = useMessageContext();
|
|
13401
13472
|
const { t } = useTranslationContext();
|
|
13402
|
-
return /* @__PURE__ */
|
|
13473
|
+
return /* @__PURE__ */ import_react38.default.createElement(DefaultDropdownActionButton, { onClick: handleDelete }, t("Delete"));
|
|
13403
13474
|
}
|
|
13404
13475
|
},
|
|
13405
13476
|
quick: {
|
|
13406
13477
|
React() {
|
|
13407
|
-
return /* @__PURE__ */
|
|
13478
|
+
return /* @__PURE__ */ import_react38.default.createElement(ReactionSelectorWithButton, { ReactionIcon });
|
|
13408
13479
|
},
|
|
13409
13480
|
Reply() {
|
|
13410
13481
|
const { handleOpenThread } = useMessageContext();
|
|
13411
13482
|
const { t } = useTranslationContext();
|
|
13412
|
-
return /* @__PURE__ */
|
|
13483
|
+
return /* @__PURE__ */ import_react38.default.createElement(
|
|
13413
13484
|
"button",
|
|
13414
13485
|
{
|
|
13415
13486
|
"aria-label": t("aria/Open Thread"),
|
|
@@ -13417,7 +13488,7 @@ var DefaultMessageActionComponents = {
|
|
|
13417
13488
|
"data-testid": "thread-action",
|
|
13418
13489
|
onClick: handleOpenThread
|
|
13419
13490
|
},
|
|
13420
|
-
/* @__PURE__ */
|
|
13491
|
+
/* @__PURE__ */ import_react38.default.createElement(ThreadIcon, { className: "str-chat__message-action-icon" })
|
|
13421
13492
|
);
|
|
13422
13493
|
}
|
|
13423
13494
|
}
|
|
@@ -13479,7 +13550,7 @@ var MessageActions = ({
|
|
|
13479
13550
|
const { theme } = useChatContext();
|
|
13480
13551
|
const { isMyMessage, message } = useMessageContext();
|
|
13481
13552
|
const { t } = useTranslationContext();
|
|
13482
|
-
const [actionsBoxButtonElement, setActionsBoxButtonElement] = (0,
|
|
13553
|
+
const [actionsBoxButtonElement, setActionsBoxButtonElement] = (0, import_react39.useState)(null);
|
|
13483
13554
|
const filteredMessageActionSet = useBaseMessageActionSetFilter(
|
|
13484
13555
|
messageActionSet,
|
|
13485
13556
|
disableBaseMessageActionSetFilter
|
|
@@ -13495,14 +13566,14 @@ var MessageActions = ({
|
|
|
13495
13566
|
if (dropdownActionSet.length + quickActionSet.length === 0) {
|
|
13496
13567
|
return null;
|
|
13497
13568
|
}
|
|
13498
|
-
return /* @__PURE__ */
|
|
13569
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
13499
13570
|
"div",
|
|
13500
13571
|
{
|
|
13501
|
-
className: (0,
|
|
13572
|
+
className: (0, import_clsx9.default)(`str-chat__message-${theme}__actions str-chat__message-options`, {
|
|
13502
13573
|
"str-chat__message-options--active": dropdownDialogIsOpen || reactionSelectorDialogIsOpen
|
|
13503
13574
|
})
|
|
13504
13575
|
},
|
|
13505
|
-
dropdownActionSet.length > 0 && /* @__PURE__ */
|
|
13576
|
+
dropdownActionSet.length > 0 && /* @__PURE__ */ import_react39.default.createElement(MessageActionsWrapper, { inline: false, toggleOpen: dialog?.toggle }, /* @__PURE__ */ import_react39.default.createElement(
|
|
13506
13577
|
"button",
|
|
13507
13578
|
{
|
|
13508
13579
|
"aria-expanded": dropdownDialogIsOpen,
|
|
@@ -13512,30 +13583,31 @@ var MessageActions = ({
|
|
|
13512
13583
|
"data-testid": "message-actions-toggle-button",
|
|
13513
13584
|
ref: setActionsBoxButtonElement
|
|
13514
13585
|
},
|
|
13515
|
-
/* @__PURE__ */
|
|
13516
|
-
), /* @__PURE__ */
|
|
13586
|
+
/* @__PURE__ */ import_react39.default.createElement(ActionsIcon, { className: "str-chat__message-action-icon" })
|
|
13587
|
+
), /* @__PURE__ */ import_react39.default.createElement(
|
|
13517
13588
|
DialogAnchor,
|
|
13518
13589
|
{
|
|
13519
13590
|
id: dropdownDialogId,
|
|
13520
13591
|
placement: isMyMessage() ? "top-end" : "top-start",
|
|
13521
13592
|
referenceElement: actionsBoxButtonElement,
|
|
13593
|
+
tabIndex: -1,
|
|
13522
13594
|
trapFocus: true
|
|
13523
13595
|
},
|
|
13524
|
-
/* @__PURE__ */
|
|
13596
|
+
/* @__PURE__ */ import_react39.default.createElement(DropdownBox, { open: dropdownDialogIsOpen }, dropdownActionSet.map(({ Component: DropdownActionComponent, type }) => /* @__PURE__ */ import_react39.default.createElement(DropdownActionComponent, { key: type })))
|
|
13525
13597
|
)),
|
|
13526
|
-
quickActionSet.map(({ Component: QuickActionComponent, type }) => /* @__PURE__ */
|
|
13598
|
+
quickActionSet.map(({ Component: QuickActionComponent, type }) => /* @__PURE__ */ import_react39.default.createElement(QuickActionComponent, { key: type }))
|
|
13527
13599
|
);
|
|
13528
13600
|
};
|
|
13529
13601
|
var DropdownBox = ({ children, open }) => {
|
|
13530
13602
|
const { t } = useTranslationContext();
|
|
13531
|
-
return /* @__PURE__ */
|
|
13603
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
13532
13604
|
"div",
|
|
13533
13605
|
{
|
|
13534
|
-
className: (0,
|
|
13606
|
+
className: (0, import_clsx9.default)("str-chat__message-actions-box", {
|
|
13535
13607
|
"str-chat__message-actions-box--open": open
|
|
13536
13608
|
})
|
|
13537
13609
|
},
|
|
13538
|
-
/* @__PURE__ */
|
|
13610
|
+
/* @__PURE__ */ import_react39.default.createElement(
|
|
13539
13611
|
"div",
|
|
13540
13612
|
{
|
|
13541
13613
|
"aria-label": t("aria/Message Options"),
|
|
@@ -13548,22 +13620,22 @@ var DropdownBox = ({ children, open }) => {
|
|
|
13548
13620
|
};
|
|
13549
13621
|
|
|
13550
13622
|
// src/experimental/Search/Search.tsx
|
|
13551
|
-
var
|
|
13552
|
-
var
|
|
13623
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
13624
|
+
var import_react52 = __toESM(require("react"));
|
|
13553
13625
|
|
|
13554
13626
|
// src/experimental/Search/SearchBar/SearchBar.tsx
|
|
13555
|
-
var
|
|
13556
|
-
var
|
|
13627
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
13628
|
+
var import_react41 = __toESM(require("react"));
|
|
13557
13629
|
|
|
13558
13630
|
// src/experimental/Search/SearchContext.tsx
|
|
13559
|
-
var
|
|
13560
|
-
var SearchContext = (0,
|
|
13631
|
+
var import_react40 = __toESM(require("react"));
|
|
13632
|
+
var SearchContext = (0, import_react40.createContext)(void 0);
|
|
13561
13633
|
var SearchContextProvider = ({
|
|
13562
13634
|
children,
|
|
13563
13635
|
value
|
|
13564
|
-
}) => /* @__PURE__ */
|
|
13636
|
+
}) => /* @__PURE__ */ import_react40.default.createElement(SearchContext.Provider, { value }, children);
|
|
13565
13637
|
var useSearchContext = () => {
|
|
13566
|
-
const contextValue = (0,
|
|
13638
|
+
const contextValue = (0, import_react40.useContext)(SearchContext);
|
|
13567
13639
|
return contextValue;
|
|
13568
13640
|
};
|
|
13569
13641
|
|
|
@@ -13576,12 +13648,12 @@ var SearchBar = () => {
|
|
|
13576
13648
|
const { t } = useTranslationContext();
|
|
13577
13649
|
const { disabled, exitSearchOnInputBlur, placeholder, searchController } = useSearchContext();
|
|
13578
13650
|
const queriesInProgress = useSearchQueriesInProgress(searchController);
|
|
13579
|
-
const [input, setInput] = (0,
|
|
13651
|
+
const [input, setInput] = (0, import_react41.useState)(null);
|
|
13580
13652
|
const { isActive, searchQuery } = useStateStore(
|
|
13581
13653
|
searchController.state,
|
|
13582
13654
|
searchControllerStateSelector2
|
|
13583
13655
|
);
|
|
13584
|
-
(0,
|
|
13656
|
+
(0, import_react41.useEffect)(() => {
|
|
13585
13657
|
if (!input) return;
|
|
13586
13658
|
const handleKeyDown = (event) => {
|
|
13587
13659
|
if (event.key === "Escape") {
|
|
@@ -13594,15 +13666,15 @@ var SearchBar = () => {
|
|
|
13594
13666
|
document.removeEventListener("keydown", handleKeyDown);
|
|
13595
13667
|
};
|
|
13596
13668
|
}, [searchController, input]);
|
|
13597
|
-
return /* @__PURE__ */
|
|
13669
|
+
return /* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-bar", "data-testid": "search-bar" }, /* @__PURE__ */ import_react41.default.createElement(
|
|
13598
13670
|
"div",
|
|
13599
13671
|
{
|
|
13600
|
-
className: (0,
|
|
13672
|
+
className: (0, import_clsx10.default)("str-chat__search-input--wrapper", {
|
|
13601
13673
|
"str-chat__search-input--wrapper-active": isActive
|
|
13602
13674
|
})
|
|
13603
13675
|
},
|
|
13604
|
-
/* @__PURE__ */
|
|
13605
|
-
/* @__PURE__ */
|
|
13676
|
+
/* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-input--icon" }),
|
|
13677
|
+
/* @__PURE__ */ import_react41.default.createElement(
|
|
13606
13678
|
"input",
|
|
13607
13679
|
{
|
|
13608
13680
|
className: "str-chat__search-input",
|
|
@@ -13625,7 +13697,7 @@ var SearchBar = () => {
|
|
|
13625
13697
|
value: searchQuery
|
|
13626
13698
|
}
|
|
13627
13699
|
),
|
|
13628
|
-
searchQuery && /* @__PURE__ */
|
|
13700
|
+
searchQuery && /* @__PURE__ */ import_react41.default.createElement(
|
|
13629
13701
|
"button",
|
|
13630
13702
|
{
|
|
13631
13703
|
className: "str-chat__search-input--clear-button",
|
|
@@ -13636,12 +13708,12 @@ var SearchBar = () => {
|
|
|
13636
13708
|
input?.focus();
|
|
13637
13709
|
}
|
|
13638
13710
|
},
|
|
13639
|
-
/* @__PURE__ */
|
|
13711
|
+
/* @__PURE__ */ import_react41.default.createElement("div", { className: "str-chat__search-input--clear-button-icon" })
|
|
13640
13712
|
)
|
|
13641
|
-
), isActive ? /* @__PURE__ */
|
|
13713
|
+
), isActive ? /* @__PURE__ */ import_react41.default.createElement(
|
|
13642
13714
|
"button",
|
|
13643
13715
|
{
|
|
13644
|
-
className: (0,
|
|
13716
|
+
className: (0, import_clsx10.default)(
|
|
13645
13717
|
"str-chat__search-bar-button str-chat__search-bar-button--exit-search"
|
|
13646
13718
|
),
|
|
13647
13719
|
"data-testid": "search-bar-button",
|
|
@@ -13655,27 +13727,25 @@ var SearchBar = () => {
|
|
|
13655
13727
|
};
|
|
13656
13728
|
|
|
13657
13729
|
// src/experimental/Search/SearchResults/SearchResults.tsx
|
|
13658
|
-
var
|
|
13730
|
+
var import_react51 = __toESM(require("react"));
|
|
13659
13731
|
|
|
13660
13732
|
// src/experimental/Search/SearchResults/SearchSourceResults.tsx
|
|
13661
|
-
var
|
|
13733
|
+
var import_react48 = __toESM(require("react"));
|
|
13662
13734
|
|
|
13663
13735
|
// src/experimental/Search/SearchResults/SearchSourceResultList.tsx
|
|
13664
|
-
var
|
|
13736
|
+
var import_react46 = __toESM(require("react"));
|
|
13665
13737
|
|
|
13666
13738
|
// src/experimental/Search/SearchResults/SearchResultItem.tsx
|
|
13739
|
+
var import_react42 = __toESM(require("react"));
|
|
13667
13740
|
var import_lodash3 = __toESM(require("lodash.uniqby"));
|
|
13668
|
-
var
|
|
13669
|
-
var ChannelSearchResultItem = ({
|
|
13670
|
-
item
|
|
13671
|
-
}) => {
|
|
13741
|
+
var ChannelSearchResultItem = ({ item }) => {
|
|
13672
13742
|
const { setActiveChannel } = useChatContext();
|
|
13673
13743
|
const { setChannels } = useChannelListContext();
|
|
13674
|
-
const onSelect = (0,
|
|
13744
|
+
const onSelect = (0, import_react42.useCallback)(() => {
|
|
13675
13745
|
setActiveChannel(item);
|
|
13676
13746
|
setChannels?.((channels) => (0, import_lodash3.default)([item, ...channels], "cid"));
|
|
13677
13747
|
}, [item, setActiveChannel, setChannels]);
|
|
13678
|
-
return /* @__PURE__ */
|
|
13748
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
13679
13749
|
ChannelPreview,
|
|
13680
13750
|
{
|
|
13681
13751
|
channel: item,
|
|
@@ -13694,13 +13764,13 @@ var MessageSearchResultItem = ({
|
|
|
13694
13764
|
setActiveChannel
|
|
13695
13765
|
} = useChatContext();
|
|
13696
13766
|
const { setChannels } = useChannelListContext();
|
|
13697
|
-
const channel = (0,
|
|
13767
|
+
const channel = (0, import_react42.useMemo)(() => {
|
|
13698
13768
|
const { channel: channelData } = item;
|
|
13699
13769
|
const type = channelData?.type ?? "unknown";
|
|
13700
13770
|
const id = channelData?.id ?? "unknown";
|
|
13701
13771
|
return client.channel(type, id);
|
|
13702
13772
|
}, [client, item]);
|
|
13703
|
-
const onSelect = (0,
|
|
13773
|
+
const onSelect = (0, import_react42.useCallback)(async () => {
|
|
13704
13774
|
if (!channel) return;
|
|
13705
13775
|
await channel.state.loadMessageIntoState(
|
|
13706
13776
|
item.id,
|
|
@@ -13711,9 +13781,9 @@ var MessageSearchResultItem = ({
|
|
|
13711
13781
|
setActiveChannel(channel);
|
|
13712
13782
|
setChannels?.((channels) => (0, import_lodash3.default)([channel, ...channels], "cid"));
|
|
13713
13783
|
}, [channel, item, searchController, setActiveChannel, setChannels]);
|
|
13714
|
-
const getLatestMessagePreview2 = (0,
|
|
13784
|
+
const getLatestMessagePreview2 = (0, import_react42.useCallback)(() => item.text, [item]);
|
|
13715
13785
|
if (!channel) return;
|
|
13716
|
-
return /* @__PURE__ */
|
|
13786
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
13717
13787
|
ChannelPreview,
|
|
13718
13788
|
{
|
|
13719
13789
|
active: channel.cid === activeChannel?.cid && item.id === searchController._internalState.getLatestValue().focusedMessage?.id,
|
|
@@ -13724,13 +13794,11 @@ var MessageSearchResultItem = ({
|
|
|
13724
13794
|
}
|
|
13725
13795
|
);
|
|
13726
13796
|
};
|
|
13727
|
-
var UserSearchResultItem = ({
|
|
13728
|
-
item
|
|
13729
|
-
}) => {
|
|
13797
|
+
var UserSearchResultItem = ({ item }) => {
|
|
13730
13798
|
const { client, setActiveChannel } = useChatContext();
|
|
13731
13799
|
const { setChannels } = useChannelListContext();
|
|
13732
13800
|
const { directMessagingChannelType } = useSearchContext();
|
|
13733
|
-
const onClick = (0,
|
|
13801
|
+
const onClick = (0, import_react42.useCallback)(() => {
|
|
13734
13802
|
const newChannel = client.channel(directMessagingChannelType, {
|
|
13735
13803
|
members: [client.userID, item.id]
|
|
13736
13804
|
});
|
|
@@ -13738,7 +13806,7 @@ var UserSearchResultItem = ({
|
|
|
13738
13806
|
setActiveChannel(newChannel);
|
|
13739
13807
|
setChannels?.((channels) => (0, import_lodash3.default)([newChannel, ...channels], "cid"));
|
|
13740
13808
|
}, [client, item, setActiveChannel, setChannels, directMessagingChannelType]);
|
|
13741
|
-
return /* @__PURE__ */
|
|
13809
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
13742
13810
|
"button",
|
|
13743
13811
|
{
|
|
13744
13812
|
"aria-label": `Select User Channel: ${item.name || ""}`,
|
|
@@ -13747,7 +13815,7 @@ var UserSearchResultItem = ({
|
|
|
13747
13815
|
onClick,
|
|
13748
13816
|
role: "option"
|
|
13749
13817
|
},
|
|
13750
|
-
/* @__PURE__ */
|
|
13818
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
13751
13819
|
Avatar,
|
|
13752
13820
|
{
|
|
13753
13821
|
className: "str-chat__avatar--channel-preview",
|
|
@@ -13756,7 +13824,7 @@ var UserSearchResultItem = ({
|
|
|
13756
13824
|
user: item
|
|
13757
13825
|
}
|
|
13758
13826
|
),
|
|
13759
|
-
/* @__PURE__ */
|
|
13827
|
+
/* @__PURE__ */ import_react42.default.createElement("div", { className: "str-chat__search-result--display-name" }, item.name || item.id)
|
|
13760
13828
|
);
|
|
13761
13829
|
};
|
|
13762
13830
|
var DefaultSearchResultItems = {
|
|
@@ -13766,18 +13834,18 @@ var DefaultSearchResultItems = {
|
|
|
13766
13834
|
};
|
|
13767
13835
|
|
|
13768
13836
|
// src/experimental/Search/SearchResults/SearchSourceResultListFooter.tsx
|
|
13769
|
-
var
|
|
13837
|
+
var import_react45 = __toESM(require("react"));
|
|
13770
13838
|
|
|
13771
13839
|
// src/experimental/Search/SearchResults/SearchSourceResultsLoadingIndicator.tsx
|
|
13772
|
-
var
|
|
13840
|
+
var import_react44 = __toESM(require("react"));
|
|
13773
13841
|
|
|
13774
13842
|
// src/experimental/Search/SearchSourceResultsContext.tsx
|
|
13775
|
-
var
|
|
13776
|
-
var SearchSourceResultsContext = (0,
|
|
13843
|
+
var import_react43 = __toESM(require("react"));
|
|
13844
|
+
var SearchSourceResultsContext = (0, import_react43.createContext)(void 0);
|
|
13777
13845
|
var SearchSourceResultsContextProvider = ({
|
|
13778
13846
|
children,
|
|
13779
13847
|
value
|
|
13780
|
-
}) => /* @__PURE__ */
|
|
13848
|
+
}) => /* @__PURE__ */ import_react43.default.createElement(
|
|
13781
13849
|
SearchSourceResultsContext.Provider,
|
|
13782
13850
|
{
|
|
13783
13851
|
value
|
|
@@ -13785,7 +13853,7 @@ var SearchSourceResultsContextProvider = ({
|
|
|
13785
13853
|
children
|
|
13786
13854
|
);
|
|
13787
13855
|
var useSearchSourceResultsContext = () => {
|
|
13788
|
-
const contextValue = (0,
|
|
13856
|
+
const contextValue = (0, import_react43.useContext)(SearchSourceResultsContext);
|
|
13789
13857
|
return contextValue;
|
|
13790
13858
|
};
|
|
13791
13859
|
|
|
@@ -13793,7 +13861,7 @@ var useSearchSourceResultsContext = () => {
|
|
|
13793
13861
|
var SearchSourceResultsLoadingIndicator = () => {
|
|
13794
13862
|
const { t } = useTranslationContext();
|
|
13795
13863
|
const { searchSource } = useSearchSourceResultsContext();
|
|
13796
|
-
return /* @__PURE__ */
|
|
13864
|
+
return /* @__PURE__ */ import_react44.default.createElement(
|
|
13797
13865
|
"div",
|
|
13798
13866
|
{
|
|
13799
13867
|
className: "str-chat__search-source-results__loading-indicator",
|
|
@@ -13818,13 +13886,13 @@ var SearchSourceResultListFooter = () => {
|
|
|
13818
13886
|
searchSource.state,
|
|
13819
13887
|
searchSourceStateSelector
|
|
13820
13888
|
);
|
|
13821
|
-
return /* @__PURE__ */
|
|
13889
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
|
13822
13890
|
"div",
|
|
13823
13891
|
{
|
|
13824
13892
|
className: "str-chat__search-source-result-list__footer",
|
|
13825
13893
|
"data-testid": "search-footer"
|
|
13826
13894
|
},
|
|
13827
|
-
isLoading ? /* @__PURE__ */
|
|
13895
|
+
isLoading ? /* @__PURE__ */ import_react45.default.createElement(SearchSourceResultsLoadingIndicator2, null) : !hasNext ? /* @__PURE__ */ import_react45.default.createElement("div", { className: "str-chat__search-source-results---empty" }, t("All results loaded")) : null
|
|
13828
13896
|
);
|
|
13829
13897
|
};
|
|
13830
13898
|
|
|
@@ -13842,36 +13910,36 @@ var SearchSourceResultList = ({
|
|
|
13842
13910
|
const { items } = useStateStore(searchSource.state, searchSourceStateSelector2);
|
|
13843
13911
|
const SearchResultItem = SearchResultItems[searchSource.type];
|
|
13844
13912
|
if (!SearchResultItem) return null;
|
|
13845
|
-
return /* @__PURE__ */
|
|
13913
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
13846
13914
|
"div",
|
|
13847
13915
|
{
|
|
13848
13916
|
className: "str-chat__search-source-result-list",
|
|
13849
13917
|
"data-testid": "search-source-result-list"
|
|
13850
13918
|
},
|
|
13851
|
-
/* @__PURE__ */
|
|
13919
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
13852
13920
|
InfiniteScrollPaginator,
|
|
13853
13921
|
{
|
|
13854
13922
|
loadNextDebounceMs: loadMoreDebounceMs,
|
|
13855
13923
|
loadNextOnScrollToBottom: searchSource.search,
|
|
13856
13924
|
threshold: loadMoreThresholdPx
|
|
13857
13925
|
},
|
|
13858
|
-
items?.map((item, i) => /* @__PURE__ */
|
|
13926
|
+
items?.map((item, i) => /* @__PURE__ */ import_react46.default.createElement(
|
|
13859
13927
|
SearchResultItem,
|
|
13860
13928
|
{
|
|
13861
13929
|
item,
|
|
13862
13930
|
key: `source-search-result-${searchSource.type}-${i}`
|
|
13863
13931
|
}
|
|
13864
13932
|
)),
|
|
13865
|
-
/* @__PURE__ */
|
|
13933
|
+
/* @__PURE__ */ import_react46.default.createElement(SearchSourceResultListFooter2, null)
|
|
13866
13934
|
)
|
|
13867
13935
|
);
|
|
13868
13936
|
};
|
|
13869
13937
|
|
|
13870
13938
|
// src/experimental/Search/SearchResults/SearchSourceResultsEmpty.tsx
|
|
13871
|
-
var
|
|
13939
|
+
var import_react47 = __toESM(require("react"));
|
|
13872
13940
|
var SearchSourceResultsEmpty = () => {
|
|
13873
13941
|
const { t } = useTranslationContext();
|
|
13874
|
-
return /* @__PURE__ */
|
|
13942
|
+
return /* @__PURE__ */ import_react47.default.createElement("div", { className: "str-chat__search-source-results-empty" }, t("No results found"));
|
|
13875
13943
|
};
|
|
13876
13944
|
|
|
13877
13945
|
// src/experimental/Search/SearchResults/SearchSourceResultsHeader.tsx
|
|
@@ -13882,9 +13950,7 @@ var searchSourceStateSelector3 = (nextValue) => ({
|
|
|
13882
13950
|
isLoading: nextValue.isLoading,
|
|
13883
13951
|
items: nextValue.items
|
|
13884
13952
|
});
|
|
13885
|
-
var SearchSourceResults = ({
|
|
13886
|
-
searchSource
|
|
13887
|
-
}) => {
|
|
13953
|
+
var SearchSourceResults = ({ searchSource }) => {
|
|
13888
13954
|
const {
|
|
13889
13955
|
SearchSourceResultList: SearchSourceResultList2 = SearchSourceResultList,
|
|
13890
13956
|
SearchSourceResultsEmpty: SearchSourceResultsEmpty2 = SearchSourceResultsEmpty,
|
|
@@ -13895,35 +13961,33 @@ var SearchSourceResults = ({
|
|
|
13895
13961
|
searchSourceStateSelector3
|
|
13896
13962
|
);
|
|
13897
13963
|
if (!items && !isLoading) return null;
|
|
13898
|
-
return /* @__PURE__ */
|
|
13964
|
+
return /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsContextProvider, { value: { searchSource } }, /* @__PURE__ */ import_react48.default.createElement(
|
|
13899
13965
|
"div",
|
|
13900
13966
|
{
|
|
13901
13967
|
className: "str-chat__search-source-results",
|
|
13902
13968
|
"data-testid": "search-source-results"
|
|
13903
13969
|
},
|
|
13904
|
-
/* @__PURE__ */
|
|
13905
|
-
items?.length || isLoading ? /* @__PURE__ */
|
|
13970
|
+
/* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsHeader2, null),
|
|
13971
|
+
items?.length || isLoading ? /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultList2, null) : /* @__PURE__ */ import_react48.default.createElement(SearchSourceResultsEmpty2, null)
|
|
13906
13972
|
));
|
|
13907
13973
|
};
|
|
13908
13974
|
|
|
13909
13975
|
// src/experimental/Search/SearchResults/SearchResultsHeader.tsx
|
|
13910
|
-
var
|
|
13911
|
-
var
|
|
13976
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
13977
|
+
var import_react49 = __toESM(require("react"));
|
|
13912
13978
|
var searchSourceStateSelector4 = (nextValue) => ({
|
|
13913
13979
|
isActive: nextValue.isActive
|
|
13914
13980
|
});
|
|
13915
|
-
var SearchSourceFilterButton = ({
|
|
13916
|
-
source
|
|
13917
|
-
}) => {
|
|
13981
|
+
var SearchSourceFilterButton = ({ source }) => {
|
|
13918
13982
|
const { t } = useTranslationContext();
|
|
13919
13983
|
const { searchController } = useSearchContext();
|
|
13920
13984
|
const { isActive } = useStateStore(source.state, searchSourceStateSelector4);
|
|
13921
13985
|
const label = `search-results-header-filter-source-button-label--${source.type}`;
|
|
13922
|
-
return /* @__PURE__ */
|
|
13986
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
13923
13987
|
"button",
|
|
13924
13988
|
{
|
|
13925
13989
|
"aria-label": t("aria/Search results header filter button"),
|
|
13926
|
-
className: (0,
|
|
13990
|
+
className: (0, import_clsx11.default)("str-chat__search-results-header__filter-source-button", {
|
|
13927
13991
|
"str-chat__search-results-header__filter-source-button--active": isActive
|
|
13928
13992
|
}),
|
|
13929
13993
|
key: label,
|
|
@@ -13942,13 +14006,13 @@ var SearchSourceFilterButton = ({
|
|
|
13942
14006
|
};
|
|
13943
14007
|
var SearchResultsHeader = () => {
|
|
13944
14008
|
const { searchController } = useSearchContext();
|
|
13945
|
-
return /* @__PURE__ */
|
|
14009
|
+
return /* @__PURE__ */ import_react49.default.createElement("div", { className: "str-chat__search-results-header", "data-testid": "search-results-header" }, /* @__PURE__ */ import_react49.default.createElement(
|
|
13946
14010
|
"div",
|
|
13947
14011
|
{
|
|
13948
14012
|
className: "str-chat__search-results-header__filter-source-buttons",
|
|
13949
14013
|
"data-testid": "filter-source-buttons"
|
|
13950
14014
|
},
|
|
13951
|
-
searchController.sources.map((source) => /* @__PURE__ */
|
|
14015
|
+
searchController.sources.map((source) => /* @__PURE__ */ import_react49.default.createElement(
|
|
13952
14016
|
SearchSourceFilterButton,
|
|
13953
14017
|
{
|
|
13954
14018
|
key: `search-source-filter-button-${source.type}`,
|
|
@@ -13959,10 +14023,10 @@ var SearchResultsHeader = () => {
|
|
|
13959
14023
|
};
|
|
13960
14024
|
|
|
13961
14025
|
// src/experimental/Search/SearchResults/SearchResultsPresearch.tsx
|
|
13962
|
-
var
|
|
14026
|
+
var import_react50 = __toESM(require("react"));
|
|
13963
14027
|
var SearchResultsPresearch = () => {
|
|
13964
14028
|
const { t } = useTranslationContext();
|
|
13965
|
-
return /* @__PURE__ */
|
|
14029
|
+
return /* @__PURE__ */ import_react50.default.createElement("div", { className: "str-chat__search-results-presearch" }, t("Start typing to search"));
|
|
13966
14030
|
};
|
|
13967
14031
|
|
|
13968
14032
|
// src/experimental/Search/SearchResults/SearchResults.tsx
|
|
@@ -13983,7 +14047,7 @@ var SearchResults = () => {
|
|
|
13983
14047
|
searchController.state,
|
|
13984
14048
|
searchControllerStateSelector3
|
|
13985
14049
|
);
|
|
13986
|
-
return !isActive ? null : /* @__PURE__ */
|
|
14050
|
+
return !isActive ? null : /* @__PURE__ */ import_react51.default.createElement("div", { "aria-label": t("aria/Search results"), className: "str-chat__search-results" }, /* @__PURE__ */ import_react51.default.createElement(SearchResultsHeader2, null), !searchQuery ? /* @__PURE__ */ import_react51.default.createElement(SearchResultsPresearch2, { activeSources }) : activeSources.map((source) => /* @__PURE__ */ import_react51.default.createElement(SearchSourceResults2, { key: source.type, searchSource: source })));
|
|
13987
14051
|
};
|
|
13988
14052
|
|
|
13989
14053
|
// src/experimental/Search/Search.tsx
|
|
@@ -13997,7 +14061,7 @@ var Search = ({
|
|
|
13997
14061
|
const { SearchBar: SearchBar2 = SearchBar, SearchResults: SearchResults2 = SearchResults } = useComponentContext();
|
|
13998
14062
|
const { searchController } = useChatContext();
|
|
13999
14063
|
const { isActive } = useStateStore(searchController.state, searchControllerStateSelector4);
|
|
14000
|
-
return /* @__PURE__ */
|
|
14064
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
14001
14065
|
SearchContextProvider,
|
|
14002
14066
|
{
|
|
14003
14067
|
value: {
|
|
@@ -14008,16 +14072,16 @@ var Search = ({
|
|
|
14008
14072
|
searchController
|
|
14009
14073
|
}
|
|
14010
14074
|
},
|
|
14011
|
-
/* @__PURE__ */
|
|
14075
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
14012
14076
|
"div",
|
|
14013
14077
|
{
|
|
14014
|
-
className: (0,
|
|
14078
|
+
className: (0, import_clsx12.default)("str-chat__search", {
|
|
14015
14079
|
"str-chat__search--active": isActive
|
|
14016
14080
|
}),
|
|
14017
14081
|
"data-testid": "search"
|
|
14018
14082
|
},
|
|
14019
|
-
/* @__PURE__ */
|
|
14020
|
-
/* @__PURE__ */
|
|
14083
|
+
/* @__PURE__ */ import_react52.default.createElement(SearchBar2, null),
|
|
14084
|
+
/* @__PURE__ */ import_react52.default.createElement(SearchResults2, null)
|
|
14021
14085
|
)
|
|
14022
14086
|
);
|
|
14023
14087
|
};
|