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KtqC,EAAKuqC,MAAQ,WAAQztC,GACxD,mBAACopE,GAAA,EAAD,CACE9E,OAAQ+E,GAAAA,EAAAA,KACR1C,WAAY6uD,GACZznF,KAvFQ,IAwFRhqB,UCzHiF,yBD4HnF,mBAAC0xG,GAAA,EAAD,CACE9sF,IAAI,gBACJ+sF,kBAAgB,EAChBC,8BAA4B,EAC5B9iH,UAAWA,EACXZ,MAAO4iH,EACPthF,YAAarwC,EAAK,qCAClB0yH,YAAa1yH,EAAK,QAClB2yH,WAAYT,EACZU,kBAAmBf,EACnBgB,UAAQ,EACRC,2BAA4BhB,EAC5BiB,SAAUZ,IApCd,0BAAKtxG,UCpG8G,wBDqGjH,4BACE,mBAACmyG,GAAA,EAAD,CAAM5oF,QAAS4nF,GAAf,WAAuD,IADzD,wCAIA,4BACE,mBAACpnF,GAAA,EAAD,CAAQH,MAAM,cAAcI,KAAK,OAAOihB,QAAM,EAAC1hB,QAAS4nF,GACrDhyH,EAAK,8BAmCZ,mBAACiiD,GAAA,EAAD,CACE/jD,OAAQ6zH,EACR38E,QAAS68E,EACTnzH,KAAMkB,EAAK,mBACXkiD,aAAcliD,EAAK,0BACnBmiD,eAAgBkwE,EAChBpmE,sBAAoB,SE7IxBvlC,EAAAA,IAEFC,QAAQC,IAAI,+BAGd,MAAM,gBAAEsf,GAAiB52B,UAAU,eAAEwB,MAAqBlN,EAAAA,EAAAA,MACrDsiC,IAAoBp1B,KACvB4M,EAAAA,EAAAA,MAAa1M,W","sources":["webpack://telegram-t/./src/global/actions/ui/localSearch.ts","webpack://telegram-t/./src/global/actions/ui/chats.ts","webpack://telegram-t/./src/global/actions/ui/messages.ts","webpack://telegram-t/./src/global/actions/ui/globalSearch.ts","webpack://telegram-t/./src/global/actions/ui/stickerSearch.ts","webpack://telegram-t/./src/global/actions/ui/users.ts","webpack://telegram-t/./src/global/actions/ui/misc.ts","webpack://telegram-t/./src/global/actions/ui/payments.ts","webpack://telegram-t/./src/global/actions/ui/mediaViewer.ts","webpack://telegram-t/./src/global/actions/ui/passcode.ts","webpack://telegram-t/./src/global/actions/api/messages.ts","webpack://telegram-t/./src/global/actions/api/symbols.ts","webpack://telegram-t/./src/global/actions/api/globalSearch.ts","webpack://telegram-t/./src/global/actions/api/localSearch.ts","webpack://telegram-t/./src/global/actions/api/management.ts","webpack://telegram-t/./src/global/actions/api/sync.ts","webpack://telegram-t/./src/global/actions/api/accounts.ts","webpack://telegram-t/./src/global/actions/api/users.ts","webpack://telegram-t/./src/global/reducers/bots.ts","webpack://telegram-t/./src/util/PopupManager.ts","webpack://telegram-t/./src/global/actions/api/bots.ts","webpack://telegram-t/./src/global/actions/api/payments.ts","webpack://telegram-t/./src/global/actions/api/twoFaSettings.ts","webpack://telegram-t/./src/util/requestQuery.ts","webpack://telegram-t/./src/components/middle/helpers/calculateMiddleFooterTransforms.ts","webpack://telegram-t/./src/global/reducers/reactions.ts","webpack://telegram-t/./src/global/actions/api/reactions.ts","webpack://telegram-t/./src/global/actions/api/statistics.ts","webpack://telegram-t/./src/util/areDeepEqual.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/chats.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/messages.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/users.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/symbols.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/misc.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/settings.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/twoFaSettings.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/calls.ts","webpack://telegram-t/./src/global/actions/apiUpdaters/payments.ts","webpack://telegram-t/./src/hooks/useBeforeUnload.ts","webpack://telegram-t/./src/hooks/usePreventPinchZoomGesture.ts","webpack://telegram-t/./src/components/common/StickerSetModal.async.tsx","webpack://telegram-t/./src/components/common/UnreadCounter.tsx","webpack://telegram-t/./src/hooks/useConnectionStatus.ts","webpack://telegram-t/./src/hooks/useBrowserOnline.ts","webpack://telegram-t/./src/components/left/ConnectionStatusOverlay.tsx","webpack://telegram-t/./src/components/left/main/LeftMainHeader.tsx","webpack://telegram-t/./src/util/permanentWebVersion.ts","webpack://telegram-t/./src/components/left/main/ChatFolders.tsx","webpack://telegram-t/./src/components/left/search/LeftSearch.async.tsx","webpack://telegram-t/./src/components/left/main/ContactList.async.tsx","webpack://telegram-t/./src/components/left/NewChatButton.tsx","webpack://telegram-t/./src/components/left/main/LeftMain.tsx","webpack://telegram-t/./src/components/left/settings/Settings.async.tsx","webpack://telegram-t/./src/components/left/newChat/NewChat.async.tsx","webpack://telegram-t/./src/components/left/ArchivedChats.async.tsx","webpack://telegram-t/./src/components/left/LeftColumn.tsx","webpack://telegram-t/./src/hooks/useResize.ts","webpack://telegram-t/./src/components/middle/HeaderMenuContainer.async.tsx","webpack://telegram-t/./src/components/middle/HeaderActions.tsx","webpack://telegram-t/./src/components/middle/PinnedMessageNavigation.tsx","webpack://telegram-t/./src/components/middle/HeaderPinnedMessage.tsx","webpack://telegram-t/./src/util/imageResize.ts","webpack://telegram-t/./src/hooks/useMessageMediaMetadata.ts","webpack://telegram-t/./src/components/middle/AudioPlayer.tsx","webpack://telegram-t/./src/components/calls/group/GroupCallTopPane.tsx","webpack://telegram-t/./src/components/middle/ChatReportPanel.tsx","webpack://telegram-t/./src/components/middle/MiddleHeader.tsx","webpack://telegram-t/./src/components/middle/helpers/groupMessages.ts","webpack://telegram-t/./src/components/middle/hooks/useMessageObservers.ts","webpack://telegram-t/./src/components/middle/message/helpers/buildContentClassName.ts","webpack://telegram-t/./src/components/middle/message/helpers/mediaDimensions.ts","webpack://telegram-t/./src/components/middle/message/helpers/calculateAlbumLayout.ts","webpack://telegram-t/./src/components/middle/message/helpers/calculateAuthorWidth.ts","webpack://telegram-t/./src/components/middle/message/hooks/useFocusMessage.ts","webpack://telegram-t/./src/components/middle/message/hooks/useOuterHandlers.ts","webpack://telegram-t/./src/components/middle/message/ContextMenuContainer.async.tsx","webpack://telegram-t/./src/components/middle/ActionMessage.tsx","webpack://telegram-t/./src/components/common/EmbeddedMessage.tsx","webpack://telegram-t/./src/components/middle/message/ReactionAnimatedEmoji.tsx","webpack://telegram-t/./src/components/middle/message/MessageMeta.tsx","webpack://telegram-t/./src/components/middle/message/Sticker.tsx","webpack://telegram-t/./src/components/middle/message/AnimatedEmoji.tsx","webpack://telegram-t/./src/components/common/hooks/useAnimatedEmoji.ts","webpack://telegram-t/./src/components/middle/message/hooks/useBlurredMediaThumbRef.ts","webpack://telegram-t/./src/components/middle/message/helpers/getCustomAppendixBg.ts","webpack://telegram-t/./src/components/middle/message/Photo.tsx","webpack://telegram-t/./src/components/middle/message/Video.tsx","webpack://telegram-t/./src/components/middle/message/Contact.tsx","webpack://telegram-t/./src/components/middle/message/PollOption.tsx","webpack://telegram-t/./src/components/middle/message/Poll.tsx","webpack://telegram-t/./src/components/middle/message/WebPage.tsx","webpack://telegram-t/./src/components/middle/message/Invoice.tsx","webpack://telegram-t/./src/util/map.ts","webpack://telegram-t/./src/components/middle/message/Location.tsx","webpack://telegram-t/./src/components/middle/message/Game.tsx","webpack://telegram-t/./src/components/middle/message/hocs/withSelectControl.tsx","webpack://telegram-t/./src/components/middle/message/Album.tsx","webpack://telegram-t/./src/components/middle/message/RoundVideo.tsx","webpack://telegram-t/./src/components/middle/message/InlineButtons.tsx","webpack://telegram-t/./src/components/middle/message/CommentButton.tsx","webpack://telegram-t/./src/components/middle/message/ReactionButton.tsx","webpack://telegram-t/./src/components/middle/message/Reactions.tsx","webpack://telegram-t/./src/components/middle/message/MessagePhoneCall.tsx","webpack://telegram-t/./src/components/middle/message/MessagePhoneCall.module.scss?15a3","webpack://telegram-t/./src/components/middle/message/Message.tsx","webpack://telegram-t/./src/components/middle/message/hooks/useInnerHandlers.ts","webpack://telegram-t/./src/components/common/AboutAdsModal.async.tsx","webpack://telegram-t/./src/components/middle/message/SponsoredMessageContextMenuContainer.async.tsx","webpack://telegram-t/./src/components/middle/message/SponsoredMessage.tsx","webpack://telegram-t/./src/components/middle/MessageListContent.tsx","webpack://telegram-t/./src/components/middle/hooks/useScrollHooks.ts","webpack://telegram-t/./src/components/middle/ContactGreeting.tsx","webpack://telegram-t/./src/components/middle/NoMessages.tsx","webpack://telegram-t/./src/components/middle/MessageList.tsx","webpack://telegram-t/./src/hooks/useNativeCopySelectedMessages.ts","webpack://telegram-t/./src/components/middle/hooks/useStickyDates.ts","webpack://telegram-t/./src/components/middle/ScrollDownButton.tsx","webpack://telegram-t/./src/components/middle/ScrollDownButton.module.scss?272e","webpack://telegram-t/./src/components/middle/FloatingActionButtons.tsx","webpack://telegram-t/./src/components/middle/FloatingActionButtons.module.scss?b2b2","webpack://telegram-t/./src/components/middle/composer/helpers/buildAttachment.ts","webpack://telegram-t/./src/util/audio.ts","webpack://telegram-t/./src/util/selection.ts","webpack://telegram-t/./src/components/middle/composer/helpers/applyIosAutoCapitalizationFix.ts","webpack://telegram-t/./src/util/voiceRecording.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useClipboardPaste.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useDraft.ts","webpack://telegram-t/./src/hooks/useDebouncedMemo.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useInlineBotTooltip.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useBotCommandTooltip.ts","webpack://telegram-t/./src/components/common/DeleteMessageModal.async.tsx","webpack://telegram-t/./src/components/ui/ResponsiveHoverButton.tsx","webpack://telegram-t/./src/components/middle/composer/AttachmentMenuBotIcon.module.scss?adba","webpack://telegram-t/./src/components/middle/composer/AttachmentMenuBotIcon.tsx","webpack://telegram-t/./src/components/middle/composer/AttachmentMenuBotItem.tsx","webpack://telegram-t/./src/components/middle/composer/AttachMenu.tsx","webpack://telegram-t/./src/components/middle/composer/SymbolMenu.async.tsx","webpack://telegram-t/./src/components/middle/composer/InlineBotTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/MentionTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/StickerTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/BotKeyboardMenu.tsx","webpack://telegram-t/./src/components/middle/composer/ComposerEmbeddedMessage.tsx","webpack://telegram-t/./src/components/middle/composer/AttachmentModal.async.tsx","webpack://telegram-t/./src/components/middle/composer/BotCommandMenu.async.tsx","webpack://telegram-t/./src/components/middle/composer/PollModal.async.tsx","webpack://telegram-t/./src/components/middle/composer/DropArea.async.tsx","webpack://telegram-t/./src/components/middle/composer/WebPagePreview.tsx","webpack://telegram-t/./src/components/middle/composer/SendAsMenu.async.tsx","webpack://telegram-t/./src/components/middle/composer/BotMenuButton.tsx","webpack://telegram-t/./src/components/middle/composer/Composer.tsx","webpack://telegram-t/./src/components/middle/composer/hooks/useVoiceRecording.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useStickerTooltip.ts","webpack://telegram-t/./src/util/deleteLastCharacterOutsideSelection.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useEditing.ts","webpack://telegram-t/./src/components/middle/MobileSearch.async.tsx","webpack://telegram-t/./src/components/middle/MessageSelectToolbar.async.tsx","webpack://telegram-t/./src/components/common/UnpinAllMessagesModal.async.tsx","webpack://telegram-t/./src/components/common/SeenByModal.async.tsx","webpack://telegram-t/./src/components/middle/EmojiInteractionAnimation.async.tsx","webpack://telegram-t/./src/components/middle/ReactorListModal.async.tsx","webpack://telegram-t/./src/components/main/premium/GiftPremiumModal.async.tsx","webpack://telegram-t/./src/components/middle/MiddleColumn.tsx","webpack://telegram-t/./src/hooks/useCustomBackground.ts","webpack://telegram-t/./src/components/middle/MiddleColumn.module.scss?b2f0","webpack://telegram-t/./src/components/right/RightHeader.tsx","webpack://telegram-t/./src/components/right/hooks/useProfileViewportIds.ts","webpack://telegram-t/./src/components/right/hooks/useProfileState.ts","webpack://telegram-t/./src/components/right/Profile.tsx","webpack://telegram-t/./src/components/right/hooks/useTransitionFixes.ts","webpack://telegram-t/./src/hooks/useCacheBuster.ts","webpack://telegram-t/./src/components/right/RightSearch.async.tsx","webpack://telegram-t/./src/components/right/management/Management.async.tsx","webpack://telegram-t/./src/components/right/statistics/Statistics.async.tsx","webpack://telegram-t/./src/components/right/statistics/MessageStatistics.async.tsx","webpack://telegram-t/./src/components/right/StickerSearch.async.tsx","webpack://telegram-t/./src/components/right/GifSearch.async.tsx","webpack://telegram-t/./src/components/right/PollResults.async.tsx","webpack://telegram-t/./src/components/right/AddChatMembers.tsx","webpack://telegram-t/./src/components/right/RightColumn.tsx","webpack://telegram-t/./src/components/mediaViewer/MediaViewer.async.tsx","webpack://telegram-t/./src/util/download.ts","webpack://telegram-t/./src/components/main/DownloadManager.tsx","webpack://telegram-t/./src/components/main/GameModal.tsx","webpack://telegram-t/./src/components/main/Notifications.async.tsx","webpack://telegram-t/./src/components/main/Dialogs.async.tsx","webpack://telegram-t/./src/components/main/ForwardPicker.async.tsx","webpack://telegram-t/./src/components/main/SafeLinkModal.async.tsx","webpack://telegram-t/./src/components/main/HistoryCalendar.async.tsx","webpack://telegram-t/./src/components/calls/group/GroupCall.async.tsx","webpack://telegram-t/./src/components/calls/ActiveCallHeader.async.tsx","webpack://telegram-t/./src/components/calls/phone/PhoneCall.async.tsx","webpack://telegram-t/./src/components/middle/MessageListHistoryHandler.tsx","webpack://telegram-t/./src/components/main/NewContactModal.async.tsx","webpack://telegram-t/./src/components/calls/phone/RatePhoneCallModal.async.tsx","webpack://telegram-t/./src/components/main/WebAppModal.async.tsx","webpack://telegram-t/./src/components/main/BotTrustModal.async.tsx","webpack://telegram-t/./src/components/main/BotAttachModal.async.tsx","webpack://telegram-t/./src/components/main/ConfettiContainer.module.scss?d9a9","webpack://telegram-t/./src/components/main/ConfettiContainer.tsx","webpack://telegram-t/./src/components/main/UrlAuthModal.async.tsx","webpack://telegram-t/./src/components/main/premium/PremiumMainModal.async.tsx","webpack://telegram-t/./src/components/payment/PaymentModal.async.tsx","webpack://telegram-t/./src/components/payment/ReceiptModal.async.tsx","webpack://telegram-t/./src/components/main/premium/common/PremiumLimitReachedModal.async.tsx","webpack://telegram-t/./src/components/main/DeleteFolderDialog.async.tsx","webpack://telegram-t/./src/components/common/CustomEmojiSetsModal.async.tsx","webpack://telegram-t/./src/components/main/Main.tsx","webpack://telegram-t/./src/components/main/LockScreen.tsx","webpack://telegram-t/./src/components/main/LockScreen.module.scss?8252","webpack://telegram-t/./src/bundles/main.ts"],"sourcesContent":["import { addActionHandler } from '../../index';\n\nimport {\n updateLocalTextSearch,\n replaceLocalTextSearchResults,\n updateLocalMediaSearchType,\n} from '../../reducers';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport { selectCurrentMessageList } from '../../selectors';\nimport { buildChatThreadKey } from '../../helpers';\nimport type { GlobalState } from '../../types';\n\naddActionHandler('openLocalTextSearch', (global) => {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId) {\n return undefined;\n }\n\n return updateLocalTextSearch(global, chatId, threadId, true);\n});\n\naddActionHandler('closeLocalTextSearch', closeLocalTextSearch);\n\naddActionHandler('setLocalTextSearchQuery', (global, actions, payload) => {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId) {\n return undefined;\n }\n\n const { query } = payload!;\n const chatThreadKey = buildChatThreadKey(chatId, threadId);\n const { query: currentQuery } = global.localTextSearch.byChatThreadKey[chatThreadKey] || {};\n\n if (query !== currentQuery) {\n global = replaceLocalTextSearchResults(global, chatId, threadId, MEMO_EMPTY_ARRAY);\n }\n\n global = updateLocalTextSearch(global, chatId, threadId, true, query);\n\n return global;\n});\n\naddActionHandler('setLocalMediaSearchType', (global, actions, payload) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return undefined;\n }\n\n const { mediaType } = payload!;\n return updateLocalMediaSearchType(global, chatId, mediaType);\n});\n\nexport function closeLocalTextSearch(global: GlobalState): GlobalState {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId) {\n return global;\n }\n\n global = updateLocalTextSearch(global, chatId, threadId, false);\n global = replaceLocalTextSearchResults(global, chatId, threadId, undefined);\n return global;\n}\n","import { addActionHandler, setGlobal } from '../../index';\n\nimport { MAIN_THREAD_ID } from '../../../api/types';\n\nimport {\n exitMessageSelectMode, replaceThreadParam, updateCurrentMessageList,\n} from '../../reducers';\nimport { selectCurrentMessageList } from '../../selectors';\nimport { closeLocalTextSearch } from './localSearch';\n\naddActionHandler('openChat', (global, actions, payload) => {\n const {\n id,\n threadId = MAIN_THREAD_ID,\n type = 'thread',\n shouldReplaceHistory = false,\n } = payload;\n\n const currentMessageList = selectCurrentMessageList(global);\n\n if (global.premiumModal?.promo && global.premiumModal?.isOpen) {\n global = {\n ...global,\n premiumModal: {\n ...global.premiumModal,\n isOpen: false,\n },\n };\n }\n\n if (!currentMessageList\n || (\n currentMessageList.chatId !== id\n || currentMessageList.threadId !== threadId\n || currentMessageList.type !== type\n )) {\n if (id) {\n global = replaceThreadParam(global, id, threadId, 'replyStack', []);\n }\n\n global = exitMessageSelectMode(global);\n global = closeLocalTextSearch(global);\n\n global = {\n ...global,\n isStatisticsShown: false,\n messages: {\n ...global.messages,\n contentToBeScheduled: undefined,\n },\n ...(id !== global.forwardMessages.toChatId && {\n forwardMessages: {},\n }),\n };\n }\n\n return updateCurrentMessageList(global, id, threadId, type, shouldReplaceHistory);\n});\n\naddActionHandler('openPreviousChat', (global) => {\n return updateCurrentMessageList(global, undefined);\n});\n\naddActionHandler('openChatWithInfo', (global, actions, payload) => {\n setGlobal({\n ...global,\n isChatInfoShown: true,\n });\n\n actions.openChat(payload);\n});\n\naddActionHandler('openChatWithText', (global, actions, payload) => {\n const { chatId, text } = payload;\n\n actions.openChat({ id: chatId });\n\n return {\n ...global,\n openChatWithText: {\n chatId,\n text,\n },\n };\n});\n\naddActionHandler('resetChatCreation', (global) => {\n return {\n ...global,\n chatCreation: undefined,\n };\n});\n\naddActionHandler('setNewChatMembersDialogState', (global, actions, payload) => {\n return {\n ...global,\n newChatMembersProgress: payload,\n };\n});\n\naddActionHandler('openNextChat', (global, actions, payload) => {\n const { targetIndexDelta, orderedIds } = payload;\n\n const { chatId } = selectCurrentMessageList(global) || {};\n\n if (!chatId) {\n actions.openChat({ id: orderedIds[0] });\n return;\n }\n\n const position = orderedIds.indexOf(chatId);\n\n if (position === -1) {\n return;\n }\n const nextId = orderedIds[position + targetIndexDelta];\n\n actions.openChat({ id: nextId, shouldReplaceHistory: true });\n});\n\naddActionHandler('openDeleteChatFolderModal', (global, actions, payload) => {\n const { folderId } = payload;\n return {\n ...global,\n deleteFolderDialogModal: folderId,\n };\n});\n\naddActionHandler('closeDeleteChatFolderModal', (global) => {\n return {\n ...global,\n deleteFolderDialogModal: undefined,\n };\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type { ApiMessage } from '../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\nimport { FocusDirection } from '../../../types';\n\nimport {\n ANIMATION_END_DELAY,\n APP_VERSION,\n FAST_SMOOTH_MAX_DURATION,\n SERVICE_NOTIFICATIONS_USER_ID,\n} from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport {\n enterMessageSelectMode,\n toggleMessageSelection,\n exitMessageSelectMode,\n replaceThreadParam,\n updateFocusDirection,\n updateFocusedMessage,\n} from '../../reducers';\nimport {\n selectCurrentChat,\n selectViewportIds,\n selectIsRightColumnShown,\n selectCurrentMessageList,\n selectChat,\n selectThreadInfo,\n selectChatMessages,\n selectAllowedMessageActions,\n selectMessageIdsByGroupId,\n selectForwardedMessageIdsByGroupId,\n selectIsViewportNewest,\n selectReplyingToId,\n selectReplyStack,\n selectSender,\n selectScheduledMessages,\n} from '../../selectors';\nimport { findLast } from '../../../util/iteratees';\nimport { getServerTime } from '../../../util/serverTime';\n\nimport versionNotification from '../../../versionNotification.txt';\nimport parseMessageInput from '../../../util/parseMessageInput';\nimport { getMessageSummaryText, getSenderTitle } from '../../helpers';\nimport * as langProvider from '../../../util/langProvider';\nimport { copyTextToClipboard } from '../../../util/clipboard';\nimport type { GlobalState } from '../../types';\n\nconst FOCUS_DURATION = 1500;\nconst FOCUS_NO_HIGHLIGHT_DURATION = FAST_SMOOTH_MAX_DURATION + ANIMATION_END_DELAY;\nconst POLL_RESULT_OPEN_DELAY_MS = 450;\nconst SERVICE_NOTIFICATIONS_MAX_AMOUNT = 1e3;\n\nlet blurTimeout: number | undefined;\n\naddActionHandler('setScrollOffset', (global, actions, payload) => {\n const { chatId, threadId, scrollOffset } = payload!;\n\n return replaceThreadParam(global, chatId, threadId, 'scrollOffset', scrollOffset);\n});\n\naddActionHandler('setReplyingToId', (global, actions, payload) => {\n const { messageId } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n const { chatId, threadId } = currentMessageList;\n\n return replaceThreadParam(global, chatId, threadId, 'replyingToId', messageId);\n});\n\naddActionHandler('setEditingId', (global, actions, payload) => {\n const { messageId } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n\n const { chatId, threadId, type } = currentMessageList;\n const paramName = type === 'scheduled' ? 'editingScheduledId' : 'editingId';\n\n return replaceThreadParam(global, chatId, threadId, paramName, messageId);\n});\n\naddActionHandler('setEditingDraft', (global, actions, payload) => {\n const {\n text, chatId, threadId, type,\n } = payload;\n\n const paramName = type === 'scheduled' ? 'editingScheduledDraft' : 'editingDraft';\n\n return replaceThreadParam(global, chatId, threadId, paramName, text);\n});\n\naddActionHandler('editLastMessage', (global) => {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId) {\n return undefined;\n }\n\n const chatMessages = selectChatMessages(global, chatId);\n const viewportIds = selectViewportIds(global, chatId, threadId);\n if (!chatMessages || !viewportIds) {\n return undefined;\n }\n\n const lastOwnEditableMessageId = findLast(viewportIds, (id) => {\n return Boolean(chatMessages[id] && selectAllowedMessageActions(global, chatMessages[id], threadId).canEdit);\n });\n\n if (!lastOwnEditableMessageId) {\n return undefined;\n }\n\n return replaceThreadParam(global, chatId, threadId, 'editingId', lastOwnEditableMessageId);\n});\n\naddActionHandler('replyToNextMessage', (global, actions, payload) => {\n const { targetIndexDelta } = payload;\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId) {\n return;\n }\n\n const chatMessages = selectChatMessages(global, chatId);\n const viewportIds = selectViewportIds(global, chatId, threadId);\n if (!chatMessages || !viewportIds) {\n return;\n }\n\n const replyingToId = selectReplyingToId(global, chatId, threadId);\n const isLatest = selectIsViewportNewest(global, chatId, threadId);\n\n let messageId: number | undefined;\n\n if (!isLatest || !replyingToId) {\n if (threadId === MAIN_THREAD_ID) {\n const chat = selectChat(global, chatId);\n\n messageId = chat?.lastMessage?.id;\n } else {\n const threadInfo = selectThreadInfo(global, chatId, threadId);\n\n messageId = threadInfo?.lastMessageId;\n }\n } else {\n const chatMessageKeys = Object.keys(chatMessages);\n const indexOfCurrent = chatMessageKeys.indexOf(replyingToId.toString());\n const newIndex = indexOfCurrent + targetIndexDelta;\n messageId = newIndex <= chatMessageKeys.length + 1 && newIndex >= 0\n ? Number(chatMessageKeys[newIndex])\n : undefined;\n }\n actions.setReplyingToId({ messageId });\n actions.focusMessage({\n chatId, threadId, messageId,\n });\n});\n\naddActionHandler('openAudioPlayer', (global, actions, payload) => {\n const {\n chatId, threadId, messageId, origin, volume, playbackRate, isMuted,\n } = payload;\n\n return {\n ...global,\n audioPlayer: {\n chatId,\n threadId,\n messageId,\n origin: origin ?? global.audioPlayer.origin,\n volume: volume ?? global.audioPlayer.volume,\n playbackRate: playbackRate || global.audioPlayer.playbackRate,\n isMuted: isMuted || global.audioPlayer.isMuted,\n },\n };\n});\n\naddActionHandler('setAudioPlayerVolume', (global, actions, payload) => {\n const {\n volume,\n } = payload;\n\n return {\n ...global,\n audioPlayer: {\n ...global.audioPlayer,\n volume,\n isMuted: false,\n },\n };\n});\n\naddActionHandler('setAudioPlayerPlaybackRate', (global, actions, payload) => {\n const {\n playbackRate,\n } = payload;\n\n return {\n ...global,\n audioPlayer: {\n ...global.audioPlayer,\n playbackRate,\n },\n };\n});\n\naddActionHandler('setAudioPlayerMuted', (global, actions, payload) => {\n const {\n isMuted,\n } = payload;\n\n return {\n ...global,\n audioPlayer: {\n ...global.audioPlayer,\n isMuted,\n },\n };\n});\n\naddActionHandler('setAudioPlayerOrigin', (global, actions, payload) => {\n const {\n origin,\n } = payload;\n\n return {\n ...global,\n audioPlayer: {\n ...global.audioPlayer,\n origin,\n },\n };\n});\n\naddActionHandler('closeAudioPlayer', (global) => {\n return {\n ...global,\n audioPlayer: {\n volume: global.audioPlayer.volume,\n playbackRate: global.audioPlayer.playbackRate,\n isMuted: global.audioPlayer.isMuted,\n },\n };\n});\n\naddActionHandler('openPollResults', (global, actions, payload) => {\n const { chatId, messageId } = payload!;\n\n const shouldOpenInstantly = selectIsRightColumnShown(global);\n\n if (!shouldOpenInstantly) {\n window.setTimeout(() => {\n global = getGlobal();\n\n setGlobal({\n ...global,\n pollResults: {\n chatId,\n messageId,\n voters: {},\n },\n });\n }, POLL_RESULT_OPEN_DELAY_MS);\n } else if (chatId !== global.pollResults.chatId || messageId !== global.pollResults.messageId) {\n return {\n ...global,\n pollResults: {\n chatId,\n messageId,\n voters: {},\n },\n };\n }\n\n return undefined;\n});\n\naddActionHandler('closePollResults', (global) => {\n return {\n ...global,\n pollResults: {},\n };\n});\n\naddActionHandler('focusLastMessage', (global, actions) => {\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId, threadId } = currentMessageList;\n\n let lastMessageId: number | undefined;\n if (threadId === MAIN_THREAD_ID) {\n const chat = selectChat(global, chatId);\n\n lastMessageId = chat?.lastMessage?.id;\n } else {\n const threadInfo = selectThreadInfo(global, chatId, threadId);\n\n lastMessageId = threadInfo?.lastMessageId;\n }\n\n if (!lastMessageId) {\n return;\n }\n\n actions.focusMessage({\n chatId, threadId, messageId: lastMessageId, noHighlight: true,\n });\n});\n\naddActionHandler('focusNextReply', (global, actions) => {\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n\n const { chatId, threadId } = currentMessageList;\n\n const replyStack = selectReplyStack(global, chatId, threadId);\n\n if (!replyStack || replyStack.length === 0) {\n actions.focusLastMessage();\n } else {\n const messageId = replyStack.pop();\n\n global = replaceThreadParam(global, chatId, threadId, 'replyStack', [...replyStack]);\n\n setGlobal(global);\n\n actions.focusMessage({\n chatId,\n threadId,\n messageId,\n });\n }\n\n return undefined;\n});\n\naddActionHandler('focusMessage', (global, actions, payload) => {\n const {\n chatId, threadId = MAIN_THREAD_ID, messageListType = 'thread', noHighlight, groupedId, groupedChatId,\n replyMessageId, isResizingContainer, shouldReplaceHistory,\n } = payload!;\n\n let { messageId } = payload!;\n\n if (groupedId !== undefined) {\n const ids = selectForwardedMessageIdsByGroupId(global, groupedChatId, groupedId);\n if (ids?.length) {\n ([messageId] = ids);\n }\n }\n\n const currentMessageList = selectCurrentMessageList(global);\n const shouldSwitchChat = !currentMessageList || (\n chatId !== currentMessageList.chatId\n || threadId !== currentMessageList.threadId\n || messageListType !== currentMessageList.type\n );\n\n if (blurTimeout) {\n clearTimeout(blurTimeout);\n blurTimeout = undefined;\n }\n blurTimeout = window.setTimeout(() => {\n let newGlobal = getGlobal();\n newGlobal = updateFocusedMessage(newGlobal);\n newGlobal = updateFocusDirection(newGlobal);\n setGlobal(newGlobal);\n }, noHighlight ? FOCUS_NO_HIGHLIGHT_DURATION : FOCUS_DURATION);\n\n global = updateFocusedMessage(global, chatId, messageId, noHighlight, isResizingContainer);\n global = updateFocusDirection(global, undefined);\n\n if (replyMessageId) {\n const replyStack = selectReplyStack(global, chatId, threadId) || [];\n global = replaceThreadParam(global, chatId, threadId, 'replyStack', [...replyStack, replyMessageId]);\n }\n\n if (shouldSwitchChat) {\n global = updateFocusDirection(global, FocusDirection.Static);\n }\n\n const viewportIds = selectViewportIds(global, chatId, threadId);\n if (viewportIds && viewportIds.includes(messageId)) {\n setGlobal(global);\n actions.openChat({ id: chatId, threadId, shouldReplaceHistory });\n return undefined;\n }\n\n if (shouldSwitchChat) {\n global = replaceThreadParam(global, chatId, threadId, 'viewportIds', undefined);\n }\n\n global = replaceThreadParam(global, chatId, threadId, 'outlyingIds', undefined);\n\n if (viewportIds && !shouldSwitchChat) {\n const direction = messageId > viewportIds[0] ? FocusDirection.Down : FocusDirection.Up;\n global = updateFocusDirection(global, direction);\n }\n\n setGlobal(global);\n\n actions.openChat({ id: chatId, threadId, shouldReplaceHistory });\n actions.loadViewportMessages();\n return undefined;\n});\n\naddActionHandler('openForwardMenu', (global, actions, payload) => {\n const {\n fromChatId, messageIds, groupedId, withMyScore,\n } = payload;\n let groupedMessageIds;\n if (groupedId) {\n groupedMessageIds = selectMessageIdsByGroupId(global, fromChatId, groupedId);\n }\n return {\n ...global,\n forwardMessages: {\n fromChatId,\n messageIds: groupedMessageIds || messageIds,\n isModalShown: true,\n withMyScore,\n },\n };\n});\n\naddActionHandler('changeForwardRecipient', (global) => {\n return {\n ...global,\n forwardMessages: {\n ...global.forwardMessages,\n toChatId: undefined,\n isModalShown: true,\n noAuthors: false,\n noCaptions: false,\n },\n };\n});\n\naddActionHandler('setForwardNoAuthors', (global, actions, payload) => {\n return {\n ...global,\n forwardMessages: {\n ...global.forwardMessages,\n noAuthors: payload,\n noCaptions: payload && global.forwardMessages.noCaptions, // `noCaptions` cannot be true when `noAuthors` is false\n },\n };\n});\n\naddActionHandler('setForwardNoCaptions', (global, actions, payload) => {\n return {\n ...global,\n forwardMessages: {\n ...global.forwardMessages,\n noCaptions: payload,\n noAuthors: payload, // On other clients `noAuthors` updates together with `noCaptions`\n },\n };\n});\n\naddActionHandler('exitForwardMode', (global) => {\n setGlobal({\n ...global,\n forwardMessages: {},\n });\n});\n\naddActionHandler('openForwardMenuForSelectedMessages', (global, actions) => {\n if (!global.selectedMessages) {\n return;\n }\n\n const { chatId: fromChatId, messageIds } = global.selectedMessages;\n\n actions.openForwardMenu({ fromChatId, messageIds });\n});\n\naddActionHandler('cancelMessageMediaDownload', (global, actions, payload) => {\n const { message } = payload;\n\n const byChatId = global.activeDownloads.byChatId[message.chatId];\n if (!byChatId || !byChatId.length) return;\n\n setGlobal({\n ...global,\n activeDownloads: {\n byChatId: {\n ...global.activeDownloads.byChatId,\n [message.chatId]: byChatId.filter((id) => id !== message.id),\n },\n },\n });\n});\n\naddActionHandler('cancelMessagesMediaDownload', (global, actions, payload) => {\n const { messages } = payload;\n\n const byChatId = global.activeDownloads.byChatId;\n const newByChatId: GlobalState['activeDownloads']['byChatId'] = {};\n Object.keys(byChatId).forEach((chatId) => {\n newByChatId[chatId] = byChatId[chatId].filter((id) => !messages.find((message) => message.id === id));\n });\n return {\n ...global,\n activeDownloads: {\n byChatId: newByChatId,\n },\n };\n});\n\naddActionHandler('downloadMessageMedia', (global, actions, payload) => {\n const { message } = payload;\n\n setGlobal({\n ...global,\n activeDownloads: {\n byChatId: {\n ...global.activeDownloads.byChatId,\n [message.chatId]: [...(global.activeDownloads.byChatId[message.chatId] || []), message.id],\n },\n },\n });\n});\n\naddActionHandler('downloadSelectedMessages', (global, actions) => {\n if (!global.selectedMessages) {\n return;\n }\n\n const { chatId, messageIds } = global.selectedMessages;\n const { threadId } = selectCurrentMessageList(global) || {};\n\n const chatMessages = selectChatMessages(global, chatId);\n if (!chatMessages || !threadId) return;\n const messages = messageIds.map((id) => chatMessages[id])\n .filter((message) => selectAllowedMessageActions(global, message, threadId).canDownload);\n messages.forEach((message) => actions.downloadMessageMedia({ message }));\n});\n\naddActionHandler('enterMessageSelectMode', (global, actions, payload) => {\n const { messageId } = payload || {};\n const openChat = selectCurrentChat(global);\n if (!openChat) {\n return global;\n }\n\n return enterMessageSelectMode(global, openChat.id, messageId);\n});\n\naddActionHandler('toggleMessageSelection', (global, actions, payload) => {\n const {\n messageId,\n groupedId,\n childMessageIds,\n withShift,\n } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId, threadId, type: messageListType } = currentMessageList;\n\n global = toggleMessageSelection(\n global, chatId, threadId, messageListType, messageId, groupedId, childMessageIds, withShift,\n );\n\n setGlobal(global);\n\n if (global.shouldShowContextMenuHint) {\n actions.disableContextMenuHint();\n actions.showNotification({\n // eslint-disable-next-line max-len\n message: `To **edit** or **reply**, close this menu. Then ${IS_TOUCH_ENV ? 'long tap' : 'right click'} on a message.`,\n });\n }\n});\n\naddActionHandler('disableContextMenuHint', (global) => {\n if (!global.shouldShowContextMenuHint) {\n return undefined;\n }\n\n return {\n ...global,\n shouldShowContextMenuHint: false,\n };\n});\n\naddActionHandler('exitMessageSelectMode', exitMessageSelectMode);\n\naddActionHandler('openPollModal', (global, actions, payload) => {\n const { isQuiz } = payload || {};\n return {\n ...global,\n pollModal: {\n isOpen: true,\n isQuiz,\n },\n };\n});\n\naddActionHandler('closePollModal', (global) => {\n return {\n ...global,\n pollModal: {\n isOpen: false,\n },\n };\n});\n\naddActionHandler('checkVersionNotification', (global, actions) => {\n const currentVersion = APP_VERSION.split('.').slice(0, 2).join('.');\n const { serviceNotifications } = global;\n\n if (serviceNotifications.find(({ version }) => version === currentVersion)) {\n return;\n }\n\n const message: Omit<ApiMessage, 'id'> = {\n chatId: SERVICE_NOTIFICATIONS_USER_ID,\n date: getServerTime(global.serverTimeOffset),\n content: {\n text: parseMessageInput(versionNotification, true),\n },\n isOutgoing: false,\n };\n\n actions.createServiceNotification({\n message,\n version: currentVersion,\n });\n});\n\naddActionHandler('createServiceNotification', (global, actions, payload) => {\n const { message, version } = payload;\n const { serviceNotifications } = global;\n const serviceChat = selectChat(global, SERVICE_NOTIFICATIONS_USER_ID)!;\n\n const maxId = Math.max(\n serviceChat.lastMessage?.id || 0,\n ...serviceNotifications.map(({ id }) => id),\n );\n const fractionalPart = (serviceNotifications.length + 1) / SERVICE_NOTIFICATIONS_MAX_AMOUNT;\n // The fractional ID is made of the largest integer ID and an incremented fractional part\n const id = Math.floor(maxId) + fractionalPart;\n\n message.previousLocalId = message.id;\n message.id = id;\n\n const serviceNotification = {\n id,\n message,\n version,\n isUnread: true,\n };\n\n setGlobal({\n ...global,\n serviceNotifications: [\n ...serviceNotifications.slice(-SERVICE_NOTIFICATIONS_MAX_AMOUNT),\n serviceNotification,\n ],\n });\n\n actions.apiUpdate({\n '@type': 'newMessage',\n id: message.id,\n chatId: message.chatId,\n message,\n });\n});\n\naddActionHandler('openReactorListModal', (global, actions, payload) => {\n const { chatId, messageId } = payload!;\n\n return {\n ...global,\n reactorModal: { chatId, messageId },\n };\n});\n\naddActionHandler('closeReactorListModal', (global) => {\n return {\n ...global,\n reactorModal: undefined,\n };\n});\n\naddActionHandler('openSeenByModal', (global, actions, payload) => {\n const { chatId, messageId } = payload!;\n\n return {\n ...global,\n seenByModal: { chatId, messageId },\n };\n});\n\naddActionHandler('closeSeenByModal', (global) => {\n return {\n ...global,\n seenByModal: undefined,\n };\n});\n\naddActionHandler('copySelectedMessages', (global) => {\n if (!global.selectedMessages) {\n return;\n }\n\n const { chatId, messageIds } = global.selectedMessages;\n copyTextForMessages(global, chatId, messageIds);\n});\n\naddActionHandler('copyMessagesByIds', (global, actions, payload: { messageIds?: number[] }) => {\n const { messageIds } = payload;\n const chat = selectCurrentChat(global);\n if (!messageIds || messageIds.length === 0 || !chat) {\n return;\n }\n\n copyTextForMessages(global, chat.id, messageIds);\n});\n\nfunction copyTextForMessages(global: GlobalState, chatId: string, messageIds: number[]) {\n const { type: messageListType, threadId } = selectCurrentMessageList(global) || {};\n const lang = langProvider.getTranslation;\n\n const chatMessages = messageListType === 'scheduled'\n ? selectScheduledMessages(global, chatId)\n : selectChatMessages(global, chatId);\n if (!chatMessages || !threadId) return;\n const messages = messageIds\n .map((id) => chatMessages[id])\n .filter((message) => selectAllowedMessageActions(global, message, threadId).canCopy)\n .sort((message1, message2) => message1.id - message2.id);\n\n const result = messages.reduce((acc, message) => {\n const sender = selectSender(global, message);\n acc.push(`> ${sender ? getSenderTitle(lang, sender) : ''}:`);\n acc.push(`${getMessageSummaryText(lang, message, false, 0, undefined, true)}\\n`);\n\n return acc;\n }, [] as string[]);\n\n copyTextToClipboard(result.join('\\n'));\n}\n","import { addActionHandler } from '../../index';\n\nimport { updateGlobalSearch, updateGlobalSearchContent } from '../../reducers';\n\nconst MAX_RECENTLY_FOUND_IDS = 10;\n\naddActionHandler('setGlobalSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n const { chatId } = global.globalSearch;\n\n return updateGlobalSearch(global, {\n globalResults: {},\n localResults: {},\n resultsByType: undefined,\n ...(query ? { fetchingStatus: { chats: !chatId, messages: true } } : { fetchingStatus: undefined }),\n query,\n });\n});\n\naddActionHandler('addRecentlyFoundChatId', (global, actions, payload) => {\n const { id } = payload!;\n const { recentlyFoundChatIds } = global.globalSearch;\n\n if (!recentlyFoundChatIds) {\n return updateGlobalSearch(global, { recentlyFoundChatIds: [id] });\n }\n\n const newRecentIds = recentlyFoundChatIds.filter((chatId) => chatId !== id);\n newRecentIds.unshift(id);\n if (newRecentIds.length > MAX_RECENTLY_FOUND_IDS) {\n newRecentIds.pop();\n }\n\n return updateGlobalSearch(global, { recentlyFoundChatIds: newRecentIds });\n});\n\naddActionHandler('clearRecentlyFoundChats', (global) => {\n return updateGlobalSearch(global, { recentlyFoundChatIds: undefined });\n});\n\naddActionHandler('setGlobalSearchContent', (global, actions, payload) => {\n const { content } = payload!;\n\n return updateGlobalSearchContent(global, content);\n});\n\naddActionHandler('setGlobalSearchChatId', (global, actions, payload) => {\n const { id } = payload!;\n\n return updateGlobalSearch(global, { chatId: id, query: undefined, resultsByType: undefined });\n});\n","import { addActionHandler } from '../../index';\n\naddActionHandler('setStickerSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n return {\n ...global,\n stickers: {\n ...global.stickers,\n search: {\n query,\n resultIds: undefined,\n },\n },\n };\n});\n\naddActionHandler('setGifSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n return {\n ...global,\n gifs: {\n ...global.gifs,\n search: {\n query,\n offsetId: undefined,\n results: undefined,\n },\n },\n };\n});\n","import { addActionHandler } from '../../index';\n\nimport { closeNewContactDialog, updateUserSearch } from '../../reducers';\n\naddActionHandler('setUserSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n return updateUserSearch(global, {\n globalUserIds: undefined,\n localUserIds: undefined,\n fetchingStatus: Boolean(query),\n query,\n });\n});\n\naddActionHandler('openAddContactDialog', (global, actions, payload) => {\n const { userId } = payload!;\n\n return {\n ...global,\n newContact: { userId },\n };\n});\n\naddActionHandler('openNewContactDialog', (global) => {\n return {\n ...global,\n newContact: {\n isByPhoneNumber: true,\n },\n };\n});\n\naddActionHandler('closeNewContactDialog', (global) => {\n return closeNewContactDialog(global);\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type { ApiError } from '../../../api/types';\n\nimport { APP_VERSION, GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TABLET_COLUMN_LAYOUT } from '../../../util/environment';\nimport getReadableErrorText from '../../../util/getReadableErrorText';\nimport { selectChatMessage, selectCurrentMessageList, selectIsTrustedBot } from '../../selectors';\nimport generateIdFor from '../../../util/generateIdFor';\nimport { unique } from '../../../util/iteratees';\n\nexport const APP_VERSION_URL = 'version.txt';\nconst MAX_STORED_EMOJIS = 8 * 4; // Represents four rows of recent emojis\n\naddActionHandler('toggleChatInfo', (global, action, payload) => {\n return {\n ...global,\n isChatInfoShown: payload !== undefined ? payload : !global.isChatInfoShown,\n };\n});\n\naddActionHandler('setLeftColumnWidth', (global, actions, payload) => {\n const leftColumnWidth = payload;\n\n return {\n ...global,\n leftColumnWidth,\n };\n});\n\naddActionHandler('resetLeftColumnWidth', (global) => {\n return {\n ...global,\n leftColumnWidth: undefined,\n };\n});\n\naddActionHandler('toggleManagement', (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n\n if (!chatId) {\n return undefined;\n }\n\n return {\n ...global,\n management: {\n byChatId: {\n ...global.management.byChatId,\n [chatId]: {\n ...global.management.byChatId[chatId],\n isActive: !(global.management.byChatId[chatId] || {}).isActive,\n },\n },\n },\n };\n});\n\naddActionHandler('requestNextManagementScreen', (global, actions, payload) => {\n const { screen } = payload || {};\n const { chatId } = selectCurrentMessageList(global) || {};\n\n if (!chatId) {\n return undefined;\n }\n\n return {\n ...global,\n management: {\n byChatId: {\n ...global.management.byChatId,\n [chatId]: {\n ...global.management.byChatId[chatId],\n isActive: true,\n nextScreen: screen,\n },\n },\n },\n };\n});\n\naddActionHandler('closeManagement', (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n\n if (!chatId) {\n return undefined;\n }\n\n return {\n ...global,\n management: {\n byChatId: {\n ...global.management.byChatId,\n [chatId]: {\n ...global.management.byChatId[chatId],\n isActive: false,\n },\n },\n },\n };\n});\n\naddActionHandler('openChat', (global) => {\n if (!IS_SINGLE_COLUMN_LAYOUT && !IS_TABLET_COLUMN_LAYOUT) {\n return undefined;\n }\n\n return {\n ...global,\n isLeftColumnShown: global.messages.messageLists.length === 0,\n };\n});\n\naddActionHandler('toggleStatistics', (global) => {\n return {\n ...global,\n isStatisticsShown: !global.isStatisticsShown,\n statistics: {\n ...global.statistics,\n currentMessageId: undefined,\n },\n };\n});\n\naddActionHandler('toggleMessageStatistics', (global, action, payload) => {\n return {\n ...global,\n statistics: {\n ...global.statistics,\n currentMessageId: payload?.messageId,\n },\n };\n});\n\naddActionHandler('toggleLeftColumn', (global) => {\n return {\n ...global,\n isLeftColumnShown: !global.isLeftColumnShown,\n };\n});\n\naddActionHandler('addRecentEmoji', (global, action, payload) => {\n const { emoji } = payload;\n const { recentEmojis } = global;\n if (!recentEmojis) {\n return {\n ...global,\n recentEmojis: [emoji],\n };\n }\n\n const newEmojis = recentEmojis.filter((e) => e !== emoji);\n newEmojis.unshift(emoji);\n if (newEmojis.length > MAX_STORED_EMOJIS) {\n newEmojis.pop();\n }\n\n return {\n ...global,\n recentEmojis: newEmojis,\n };\n});\n\naddActionHandler('addRecentSticker', (global, action, payload) => {\n const { sticker } = payload;\n const { recent } = global.stickers;\n if (!recent) {\n return {\n ...global,\n stickers: {\n ...global.stickers,\n recent: {\n hash: '0',\n stickers: [sticker],\n },\n },\n };\n }\n\n const newStickers = recent.stickers.filter((s) => s.id !== sticker.id);\n newStickers.unshift(sticker);\n\n return {\n ...global,\n stickers: {\n ...global.stickers,\n recent: {\n ...recent,\n stickers: newStickers,\n },\n },\n };\n});\n\naddActionHandler('reorderStickerSets', (global, action, payload) => {\n const { order, isCustomEmoji } = payload;\n return {\n ...global,\n stickers: {\n ...global.stickers,\n [isCustomEmoji ? 'customEmoji' : 'added']: {\n setIds: order,\n },\n },\n };\n});\n\naddActionHandler('showNotification', (global, actions, payload) => {\n const notification = payload!;\n notification.localId = generateIdFor({});\n\n const newNotifications = [...global.notifications];\n const existingNotificationIndex = newNotifications.findIndex((n) => n.message === notification.message);\n if (existingNotificationIndex !== -1) {\n newNotifications.splice(existingNotificationIndex, 1);\n }\n\n newNotifications.push(notification);\n\n return {\n ...global,\n notifications: newNotifications,\n };\n});\n\naddActionHandler('dismissNotification', (global, actions, payload) => {\n const newNotifications = global.notifications.filter(({ localId }) => localId !== payload.localId);\n\n return {\n ...global,\n notifications: newNotifications,\n };\n});\n\naddActionHandler('showDialog', (global, actions, payload) => {\n const { data } = payload!;\n\n // Filter out errors that we don't want to show to the user\n if ('message' in data && data.hasErrorKey && !getReadableErrorText(data)) {\n return global;\n }\n\n const newDialogs = [...global.dialogs];\n if ('message' in data) {\n const existingErrorIndex = newDialogs.findIndex((err) => (err as ApiError).message === data.message);\n if (existingErrorIndex !== -1) {\n newDialogs.splice(existingErrorIndex, 1);\n }\n }\n\n newDialogs.push(data);\n\n return {\n ...global,\n dialogs: newDialogs,\n };\n});\n\naddActionHandler('dismissDialog', (global) => {\n const newDialogs = [...global.dialogs];\n\n newDialogs.pop();\n\n return {\n ...global,\n dialogs: newDialogs,\n };\n});\n\naddActionHandler('toggleSafeLinkModal', (global, actions, payload) => {\n const { url: safeLinkModalUrl } = payload;\n\n return {\n ...global,\n safeLinkModalUrl,\n };\n});\n\naddActionHandler('openHistoryCalendar', (global, actions, payload) => {\n const { selectedAt } = payload;\n\n return {\n ...global,\n historyCalendarSelectedAt: selectedAt,\n };\n});\n\naddActionHandler('closeHistoryCalendar', (global) => {\n return {\n ...global,\n historyCalendarSelectedAt: undefined,\n };\n});\n\naddActionHandler('openGame', (global, actions, payload) => {\n const { url, chatId, messageId } = payload;\n\n const message = selectChatMessage(global, chatId, messageId);\n if (!message) return;\n\n const botId = message.viaBotId || message.senderId;\n if (!botId) return;\n\n if (!selectIsTrustedBot(global, botId)) {\n setGlobal({\n ...global,\n botTrustRequest: {\n botId,\n type: 'game',\n onConfirm: {\n action: 'openGame',\n payload,\n },\n },\n });\n return;\n }\n\n setGlobal({\n ...global,\n openedGame: {\n url,\n chatId,\n messageId,\n },\n });\n});\n\naddActionHandler('closeGame', (global) => {\n return {\n ...global,\n openedGame: undefined,\n };\n});\n\naddActionHandler('requestConfetti', (global, actions, payload) => {\n const {\n top, left, width, height,\n } = payload || {};\n const { animationLevel } = global.settings.byKey;\n if (animationLevel === 0) return undefined;\n\n return {\n ...global,\n confetti: {\n lastConfettiTime: Date.now(),\n top,\n left,\n width,\n height,\n },\n };\n});\n\naddActionHandler('openLimitReachedModal', (global, actions, payload) => {\n const { limit } = payload;\n\n return {\n ...global,\n limitReachedModal: {\n limit,\n },\n };\n});\n\naddActionHandler('closeLimitReachedModal', (global) => {\n return {\n ...global,\n limitReachedModal: undefined,\n };\n});\n\naddActionHandler('closeStickerSetModal', (global) => {\n return {\n ...global,\n openedStickerSetShortName: undefined,\n };\n});\n\naddActionHandler('openCustomEmojiSets', (global, actions, payload) => {\n const { setIds } = payload;\n return {\n ...global,\n openedCustomEmojiSetIds: setIds,\n };\n});\n\naddActionHandler('closeCustomEmojiSets', (global) => {\n return {\n ...global,\n openedCustomEmojiSetIds: undefined,\n };\n});\n\naddActionHandler('updateLastRenderedCustomEmojis', (global, actions, payload) => {\n const { ids } = payload;\n const { lastRendered } = global.customEmojis;\n\n return {\n ...global,\n customEmojis: {\n ...global.customEmojis,\n lastRendered: unique([...lastRendered, ...ids]).slice(0, GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT),\n },\n };\n});\n\naddActionHandler('checkAppVersion', () => {\n const APP_VERSION_REGEX = /^\\d+\\.\\d+(\\.\\d+)?$/;\n\n fetch(`${APP_VERSION_URL}?${Date.now()}`)\n .then((response) => {\n return response.text();\n }).then((version) => {\n version = version.trim();\n\n if (APP_VERSION_REGEX.test(version) && version !== APP_VERSION) {\n setGlobal({\n ...getGlobal(),\n isUpdateAvailable: true,\n });\n }\n });\n});\n","import { addActionHandler } from '../../index';\n\nimport { clearPayment, closeInvoice } from '../../reducers';\n\naddActionHandler('closePaymentModal', (global) => {\n const status = global.payment.status;\n global = clearPayment(global);\n global = closeInvoice(global);\n global = {\n ...global,\n payment: {\n ...global.payment,\n status,\n },\n };\n return global;\n});\n\naddActionHandler('addPaymentError', (global, actions, payload) => {\n const { error } = payload!;\n\n return {\n ...global,\n payment: {\n ...global.payment,\n status: 'failed',\n error,\n },\n };\n});\n","import { addActionHandler } from '../../index';\n\naddActionHandler('openMediaViewer', (global, actions, payload) => {\n const {\n chatId, threadId, mediaId, avatarOwnerId, profilePhotoIndex, origin, volume, playbackRate, isMuted,\n } = payload;\n\n return {\n ...global,\n mediaViewer: {\n ...global.mediaViewer,\n chatId,\n threadId,\n mediaId,\n avatarOwnerId,\n profilePhotoIndex,\n origin,\n volume: volume ?? global.mediaViewer.volume,\n playbackRate: playbackRate || global.mediaViewer.playbackRate,\n isMuted: isMuted || global.mediaViewer.isMuted,\n },\n forwardMessages: {},\n };\n});\n\naddActionHandler('closeMediaViewer', (global) => {\n const { volume, isMuted, playbackRate } = global.mediaViewer;\n return {\n ...global,\n mediaViewer: {\n volume,\n isMuted,\n playbackRate,\n },\n };\n});\n\naddActionHandler('setMediaViewerVolume', (global, actions, payload) => {\n const {\n volume,\n } = payload;\n\n return {\n ...global,\n mediaViewer: {\n ...global.mediaViewer,\n volume,\n isMuted: false,\n },\n };\n});\n\naddActionHandler('setMediaViewerPlaybackRate', (global, actions, payload) => {\n const {\n playbackRate,\n } = payload;\n\n return {\n ...global,\n mediaViewer: {\n ...global.mediaViewer,\n playbackRate,\n },\n };\n});\n\naddActionHandler('setMediaViewerMuted', (global, actions, payload) => {\n const {\n isMuted,\n } = payload;\n\n return {\n ...global,\n mediaViewer: {\n ...global.mediaViewer,\n isMuted,\n },\n };\n});\n","import { addActionHandler, setGlobal, getGlobal } from '../../index';\n\nimport { clearPasscodeSettings, updatePasscodeSettings } from '../../reducers';\nimport { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions';\nimport { clearEncryptedSession, encryptSession, setupPasscode } from '../../../util/passcode';\nimport { forceUpdateCache, migrateCache, serializeGlobal } from '../../cache';\nimport { onBeforeUnload } from '../../../util/schedulers';\nimport { cloneDeep } from '../../../util/iteratees';\nimport { INITIAL_STATE } from '../../initialState';\n\nlet noLockOnUnload = false;\nonBeforeUnload(() => {\n if (getGlobal().passcode.hasPasscode && !noLockOnUnload) {\n clearStoredSession();\n }\n});\n\naddActionHandler('setPasscode', async (global, actions, { passcode }) => {\n setGlobal(updatePasscodeSettings(global, {\n isLoading: true,\n }));\n await setupPasscode(passcode);\n\n const sessionJson = JSON.stringify({ ...loadStoredSession(), userId: global.currentUserId });\n const globalJson = serializeGlobal(updatePasscodeSettings(getGlobal(), {\n hasPasscode: true,\n error: undefined,\n isLoading: false,\n }));\n\n await encryptSession(sessionJson, globalJson);\n\n setGlobal(updatePasscodeSettings(getGlobal(), {\n hasPasscode: true,\n error: undefined,\n isLoading: false,\n }));\n\n forceUpdateCache(true);\n});\n\naddActionHandler('clearPasscode', (global) => {\n void clearEncryptedSession();\n\n return clearPasscodeSettings(global);\n});\n\naddActionHandler('unlockScreen', (global, actions, { sessionJson, globalJson }) => {\n const session = JSON.parse(sessionJson);\n storeSession(session, session.userId);\n\n global = JSON.parse(globalJson);\n migrateCache(global, cloneDeep(INITIAL_STATE));\n\n setGlobal(updatePasscodeSettings(\n global,\n {\n isScreenLocked: false,\n error: undefined,\n invalidAttemptsCount: 0,\n },\n ));\n\n actions.initApi();\n});\n\naddActionHandler('logInvalidUnlockAttempt', (global) => {\n return updatePasscodeSettings(global, {\n invalidAttemptsCount: (global.passcode?.invalidAttemptsCount ?? 0) + 1,\n });\n});\n\naddActionHandler('resetInvalidUnlockAttempts', (global) => {\n return updatePasscodeSettings(global, {\n invalidAttemptsCount: 0,\n });\n});\n\naddActionHandler('setPasscodeError', (global, actions, payload) => {\n const { error } = payload;\n\n return updatePasscodeSettings(global, { error });\n});\n\naddActionHandler('clearPasscodeError', (global) => {\n return updatePasscodeSettings(global, { error: undefined });\n});\n\naddActionHandler('skipLockOnUnload', () => {\n noLockOnUnload = true;\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type { GlobalActions } from '../../types';\nimport type {\n ApiAttachment,\n ApiChat,\n ApiMessage,\n ApiMessageEntity,\n ApiNewPoll,\n ApiOnProgress,\n ApiSticker,\n ApiUser,\n ApiVideo,\n} from '../../../api/types';\nimport {\n MAIN_THREAD_ID,\n MESSAGE_DELETED,\n} from '../../../api/types';\nimport { LoadMoreDirection } from '../../../types';\n\nimport {\n MAX_MEDIA_FILES_FOR_ALBUM,\n MESSAGE_LIST_SLICE,\n RE_TELEGRAM_LINK,\n RE_TG_LINK,\n RE_TME_LINK,\n SERVICE_NOTIFICATIONS_USER_ID,\n} from '../../../config';\nimport { IS_IOS } from '../../../util/environment';\nimport { callApi, cancelApiProgress } from '../../../api/gramjs';\nimport {\n areSortedArraysIntersecting, buildCollectionByKey, split, unique,\n} from '../../../util/iteratees';\nimport {\n addUsers,\n addChatMessagesById,\n replaceThreadParam,\n safeReplaceViewportIds,\n updateChatMessage,\n addChats,\n updateListedIds,\n updateOutlyingIds,\n replaceScheduledMessages,\n updateThreadInfos,\n updateChat,\n updateThreadUnreadFromForwardedMessage,\n updateSponsoredMessage,\n} from '../../reducers';\nimport {\n selectChat,\n selectChatMessage,\n selectCurrentMessageList,\n selectFocusedMessageId,\n selectCurrentChat,\n selectListedIds,\n selectOutlyingIds,\n selectViewportIds,\n selectRealLastReadId,\n selectReplyingToId,\n selectEditingId,\n selectDraft,\n selectThreadOriginChat,\n selectThreadTopMessageId,\n selectEditingScheduledId,\n selectEditingMessage,\n selectScheduledMessage,\n selectNoWebPage,\n selectFirstUnreadId,\n selectUser,\n selectSendAs,\n selectSponsoredMessage,\n selectIsCurrentUserPremium,\n selectForwardsContainVoiceMessages,\n} from '../../selectors';\nimport {\n debounce, onTickEnd, rafPromise,\n} from '../../../util/schedulers';\nimport { getMessageOriginalId, getUserFullName, isServiceNotificationMessage } from '../../helpers';\nimport { getTranslation } from '../../../util/langProvider';\nimport { ensureProtocol } from '../../../util/ensureProtocol';\n\nconst AUTOLOGIN_TOKEN_KEY = 'autologin_token';\n\nconst uploadProgressCallbacks = new Map<number, ApiOnProgress>();\n\nconst runDebouncedForMarkRead = debounce((cb) => cb(), 500, false);\n\naddActionHandler('loadViewportMessages', (global, actions, payload) => {\n const {\n direction = LoadMoreDirection.Around,\n isBudgetPreload = false,\n } = payload || {};\n\n let { chatId, threadId } = payload || {};\n\n if (!chatId) {\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n\n chatId = currentMessageList.chatId;\n threadId = currentMessageList.threadId;\n }\n\n const chat = selectChat(global, chatId);\n // TODO Revise if `chat.isRestricted` check is needed\n if (!chat || chat.isRestricted) {\n return undefined;\n }\n\n const viewportIds = selectViewportIds(global, chatId, threadId);\n const listedIds = selectListedIds(global, chatId, threadId);\n const outlyingIds = selectOutlyingIds(global, chatId, threadId);\n\n if (!viewportIds || !viewportIds.length || direction === LoadMoreDirection.Around) {\n const offsetId = selectFocusedMessageId(global, chatId) || selectRealLastReadId(global, chatId, threadId);\n const isOutlying = Boolean(offsetId && listedIds && !listedIds.includes(offsetId));\n const historyIds = (isOutlying ? outlyingIds : listedIds) || [];\n const {\n newViewportIds, areSomeLocal, areAllLocal,\n } = getViewportSlice(historyIds, offsetId, LoadMoreDirection.Around);\n\n if (areSomeLocal && newViewportIds.length >= MESSAGE_LIST_SLICE) {\n global = safeReplaceViewportIds(global, chatId, threadId, newViewportIds);\n }\n\n if (!areAllLocal) {\n onTickEnd(() => {\n void loadViewportMessages(chat, threadId, offsetId, LoadMoreDirection.Around, isOutlying, isBudgetPreload);\n });\n }\n } else {\n const offsetId = direction === LoadMoreDirection.Backwards ? viewportIds[0] : viewportIds[viewportIds.length - 1];\n const isOutlying = Boolean(outlyingIds);\n const historyIds = (isOutlying ? outlyingIds : listedIds)!;\n const {\n newViewportIds, areSomeLocal, areAllLocal,\n } = getViewportSlice(historyIds, offsetId, direction);\n\n if (areSomeLocal) {\n global = safeReplaceViewportIds(global, chatId, threadId, newViewportIds);\n }\n\n onTickEnd(() => {\n void loadWithBudget(actions, areAllLocal, isOutlying, isBudgetPreload, chat, threadId, direction, offsetId);\n });\n\n if (isBudgetPreload) {\n return undefined;\n }\n }\n\n return global;\n});\n\nasync function loadWithBudget(\n actions: GlobalActions,\n areAllLocal: boolean, isOutlying: boolean, isBudgetPreload: boolean,\n chat: ApiChat, threadId: number, direction: LoadMoreDirection, offsetId?: number,\n) {\n if (!areAllLocal) {\n await loadViewportMessages(\n chat, threadId, offsetId, direction, isOutlying, isBudgetPreload,\n );\n }\n\n if (!isBudgetPreload) {\n actions.loadViewportMessages({\n chatId: chat.id, threadId, direction, isBudgetPreload: true,\n });\n }\n}\n\naddActionHandler('loadMessage', async (global, actions, payload) => {\n const {\n chatId, messageId, replyOriginForId, threadUpdate,\n } = payload!;\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const message = await loadMessage(chat, messageId, replyOriginForId);\n if (message && threadUpdate) {\n const { lastMessageId, isDeleting } = threadUpdate;\n\n setGlobal(updateThreadUnreadFromForwardedMessage(\n getGlobal(),\n message,\n chatId,\n lastMessageId,\n isDeleting,\n ));\n }\n});\n\naddActionHandler('sendMessage', (global, actions, payload) => {\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n\n const { chatId, threadId, type } = currentMessageList;\n\n if (type === 'scheduled' && !payload.scheduledAt) {\n return {\n ...global,\n messages: {\n ...global.messages,\n contentToBeScheduled: payload,\n },\n };\n }\n\n const chat = selectChat(global, chatId)!;\n\n const params = {\n ...payload,\n chat,\n replyingTo: selectReplyingToId(global, chatId, threadId),\n noWebPage: selectNoWebPage(global, chatId, threadId),\n sendAs: selectSendAs(global, chatId),\n };\n\n actions.setReplyingToId({ messageId: undefined });\n actions.clearWebPagePreview({ chatId, threadId, value: false });\n\n const isSingle = !payload.attachments || payload.attachments.length <= 1;\n const isGrouped = !isSingle && payload.attachments && payload.attachments.length > 1;\n\n if (isSingle) {\n const { attachments, ...restParams } = params;\n sendMessage({\n ...restParams,\n attachment: attachments ? attachments[0] : undefined,\n });\n } else if (isGrouped) {\n const {\n text, entities, attachments, ...commonParams\n } = params;\n const groupedAttachments = split(attachments as ApiAttachment[], MAX_MEDIA_FILES_FOR_ALBUM);\n for (let i = 0; i < groupedAttachments.length; i++) {\n const [firstAttachment, ...restAttachments] = groupedAttachments[i];\n const groupedId = `${Date.now()}${i}`;\n\n sendMessage({\n ...commonParams,\n text: i === 0 ? text : undefined,\n entities: i === 0 ? entities : undefined,\n attachment: firstAttachment,\n groupedId: restAttachments.length > 0 ? groupedId : undefined,\n });\n\n restAttachments.forEach((attachment: ApiAttachment) => {\n sendMessage({\n ...commonParams,\n attachment,\n groupedId,\n });\n });\n }\n } else {\n const {\n text, entities, attachments, replyingTo, ...commonParams\n } = params;\n\n if (text) {\n sendMessage({\n ...commonParams,\n text,\n entities,\n replyingTo,\n });\n }\n\n attachments.forEach((attachment: ApiAttachment) => {\n sendMessage({\n ...commonParams,\n attachment,\n });\n });\n }\n\n return undefined;\n});\n\naddActionHandler('editMessage', (global, actions, payload) => {\n const { serverTimeOffset } = global;\n const { text, entities } = payload!;\n\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId, threadId, type: messageListType } = currentMessageList;\n const chat = selectChat(global, chatId);\n const message = selectEditingMessage(global, chatId, threadId, messageListType);\n if (!chat || !message) {\n return;\n }\n\n void callApi('editMessage', {\n chat, message, text, entities, noWebPage: selectNoWebPage(global, chatId, threadId), serverTimeOffset,\n });\n\n actions.setEditingId({ messageId: undefined });\n});\n\naddActionHandler('cancelSendingMessage', (global, actions, payload) => {\n const { chatId, messageId } = payload!;\n const message = selectChatMessage(global, chatId, messageId);\n const progressCallback = message && uploadProgressCallbacks.get(getMessageOriginalId(message));\n if (progressCallback) {\n cancelApiProgress(progressCallback);\n }\n\n actions.apiUpdate({\n '@type': 'deleteMessages',\n ids: [messageId],\n chatId,\n });\n});\n\naddActionHandler('saveDraft', (global, actions, payload) => {\n const { chatId, threadId, draft } = payload!;\n if (!draft) {\n return undefined;\n }\n\n const { text, entities } = draft;\n const chat = selectChat(global, chatId)!;\n\n if (threadId === MAIN_THREAD_ID) {\n void callApi('saveDraft', {\n chat,\n text,\n entities,\n replyToMsgId: selectReplyingToId(global, chatId, threadId),\n });\n }\n\n global = replaceThreadParam(global, chatId, threadId, 'draft', draft);\n global = updateChat(global, chatId, { draftDate: Math.round(Date.now() / 1000) });\n\n return global;\n});\n\naddActionHandler('clearDraft', (global, actions, payload) => {\n const { chatId, threadId, localOnly } = payload!;\n if (!selectDraft(global, chatId, threadId)) {\n return undefined;\n }\n\n const chat = selectChat(global, chatId)!;\n\n if (!localOnly && threadId === MAIN_THREAD_ID) {\n void callApi('clearDraft', chat);\n }\n\n global = replaceThreadParam(global, chatId, threadId, 'draft', undefined);\n global = updateChat(global, chatId, { draftDate: undefined });\n\n return global;\n});\n\naddActionHandler('toggleMessageWebPage', (global, actions, payload) => {\n const { chatId, threadId, noWebPage } = payload!;\n\n return replaceThreadParam(global, chatId, threadId, 'noWebPage', noWebPage);\n});\n\naddActionHandler('pinMessage', (global, actions, payload) => {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n\n const {\n messageId, isUnpin, isOneSide, isSilent,\n } = payload!;\n\n void callApi('pinMessage', {\n chat, messageId, isUnpin, isOneSide, isSilent,\n });\n});\n\naddActionHandler('unpinAllMessages', (global, actions, payload) => {\n const chat = selectChat(global, payload.chatId);\n if (!chat) {\n return;\n }\n\n void unpinAllMessages(chat);\n});\n\nasync function unpinAllMessages(chat: ApiChat) {\n await callApi('unpinAllMessages', { chat });\n let global = getGlobal();\n global = replaceThreadParam(global, chat.id, MAIN_THREAD_ID, 'pinnedIds', []);\n setGlobal(global);\n}\n\naddActionHandler('deleteMessages', (global, actions, payload) => {\n const { messageIds, shouldDeleteForAll } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n const { chatId, threadId } = currentMessageList;\n const chat = selectChat(global, chatId)!;\n\n void callApi('deleteMessages', { chat, messageIds, shouldDeleteForAll });\n\n const editingId = selectEditingId(global, chatId, threadId);\n if (messageIds.includes(editingId)) {\n actions.setEditingId({ messageId: undefined });\n }\n});\n\naddActionHandler('deleteScheduledMessages', (global, actions, payload) => {\n const { messageIds } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId } = currentMessageList;\n const chat = selectChat(global, chatId)!;\n\n void callApi('deleteScheduledMessages', { chat, messageIds });\n\n const editingId = selectEditingScheduledId(global, chatId);\n if (messageIds.includes(editingId)) {\n actions.setEditingId({ messageId: undefined });\n }\n});\n\naddActionHandler('deleteHistory', async (global, actions, payload) => {\n const { chatId, shouldDeleteForAll } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const maxId = chat.lastMessage?.id;\n\n await callApi('deleteHistory', { chat, shouldDeleteForAll, maxId });\n\n const activeChat = selectCurrentMessageList(global);\n if (activeChat && activeChat.chatId === chatId) {\n actions.openChat({ id: undefined });\n }\n});\n\naddActionHandler('reportMessages', async (global, actions, payload) => {\n const {\n messageIds, reason, description,\n } = payload!;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId } = currentMessageList;\n const chat = selectChat(global, chatId)!;\n\n const result = await callApi('reportMessages', {\n peer: chat, messageIds, reason, description,\n });\n\n actions.showNotification({\n message: result\n ? getTranslation('ReportPeer.AlertSuccess')\n : 'An error occurred while submitting your report. Please, try again later.',\n });\n});\n\naddActionHandler('sendMessageAction', async (global, actions, payload) => {\n const { action, chatId, threadId } = payload!;\n if (chatId === global.currentUserId) return; // Message actions are disabled in Saved Messages\n\n const chat = selectChat(global, chatId)!;\n if (!chat) return;\n\n await callApi('sendMessageAction', {\n peer: chat, threadId, action,\n });\n});\n\naddActionHandler('markMessageListRead', (global, actions, payload) => {\n const { serverTimeOffset } = global;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return undefined;\n }\n\n const { chatId, threadId } = currentMessageList;\n const chat = selectThreadOriginChat(global, chatId, threadId);\n if (!chat) {\n return undefined;\n }\n\n const { maxId } = payload!;\n\n runDebouncedForMarkRead(() => {\n void callApi('markMessageListRead', {\n serverTimeOffset, chat, threadId, maxId,\n });\n });\n\n // TODO Support local marking read for threads\n if (threadId !== MAIN_THREAD_ID) {\n return undefined;\n }\n\n if (chatId === SERVICE_NOTIFICATIONS_USER_ID) {\n global = {\n ...global,\n serviceNotifications: global.serviceNotifications.map((notification) => {\n return notification.isUnread && notification.id <= maxId ? { ...notification, isUnread: false } : notification;\n }),\n };\n }\n\n const viewportIds = selectViewportIds(global, chatId, threadId);\n const minId = selectFirstUnreadId(global, chatId, threadId);\n if (!viewportIds || !minId || !chat.unreadCount) {\n return global;\n }\n\n const readCount = countSortedIds(viewportIds!, minId, maxId);\n if (!readCount) {\n return global;\n }\n\n return updateChat(global, chatId, {\n lastReadInboxMessageId: maxId,\n unreadCount: Math.max(0, chat.unreadCount - readCount),\n });\n});\n\naddActionHandler('markMessagesRead', (global, actions, payload) => {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n\n const { messageIds } = payload!;\n\n void callApi('markMessagesRead', { chat, messageIds });\n});\n\naddActionHandler('loadWebPagePreview', (global, actions, payload) => {\n const { text } = payload!;\n void loadWebPagePreview(text);\n});\n\naddActionHandler('clearWebPagePreview', (global) => {\n if (!global.webPagePreview) {\n return undefined;\n }\n\n return {\n ...global,\n webPagePreview: undefined,\n };\n});\n\naddActionHandler('sendPollVote', (global, actions, payload) => {\n const { chatId, messageId, options } = payload!;\n const chat = selectChat(global, chatId);\n\n if (chat) {\n void callApi('sendPollVote', { chat, messageId, options });\n }\n});\n\naddActionHandler('cancelPollVote', (global, actions, payload) => {\n const { chatId, messageId } = payload!;\n const chat = selectChat(global, chatId);\n\n if (chat) {\n void callApi('sendPollVote', { chat, messageId, options: [] });\n }\n});\n\naddActionHandler('closePoll', (global, actions, payload) => {\n const { chatId, messageId } = payload;\n const chat = selectChat(global, chatId);\n const poll = selectChatMessage(global, chatId, messageId)?.content.poll;\n if (chat && poll) {\n void callApi('closePoll', { chat, messageId, poll });\n }\n});\n\naddActionHandler('loadPollOptionResults', (global, actions, payload) => {\n const {\n chat, messageId, option, offset, limit, shouldResetVoters,\n } = payload!;\n\n void loadPollOptionResults(chat, messageId, option, offset, limit, shouldResetVoters);\n});\n\naddActionHandler('forwardMessages', (global, action, payload) => {\n const {\n fromChatId, messageIds, toChatId, withMyScore, noAuthors, noCaptions,\n } = global.forwardMessages;\n const isCurrentUserPremium = selectIsCurrentUserPremium(global);\n const fromChat = fromChatId ? selectChat(global, fromChatId) : undefined;\n const toChat = toChatId ? selectChat(global, toChatId) : undefined;\n const messages = fromChatId && messageIds\n ? messageIds\n .sort((a, b) => a - b)\n .map((id) => selectChatMessage(global, fromChatId, id)).filter<ApiMessage>(Boolean as any)\n : undefined;\n\n if (!fromChat || !toChat || !messages) {\n return;\n }\n\n const { isSilent, scheduledAt } = payload;\n const sendAs = selectSendAs(global, toChatId!);\n\n const realMessages = messages.filter((m) => !isServiceNotificationMessage(m));\n if (realMessages.length) {\n void callApi('forwardMessages', {\n fromChat,\n toChat,\n messages: realMessages,\n serverTimeOffset: getGlobal().serverTimeOffset,\n isSilent,\n scheduledAt,\n sendAs,\n withMyScore,\n noAuthors,\n noCaptions,\n isCurrentUserPremium,\n });\n }\n\n messages\n .filter((m) => isServiceNotificationMessage(m))\n .forEach((message) => {\n const { text, entities } = message.content.text || {};\n const { sticker, poll } = message.content;\n\n void sendMessage({\n chat: toChat,\n text,\n entities,\n sticker,\n poll,\n isSilent,\n scheduledAt,\n sendAs,\n });\n });\n\n setGlobal({\n ...getGlobal(),\n forwardMessages: {},\n });\n});\n\naddActionHandler('loadScheduledHistory', (global, actions, payload) => {\n const { chatId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n void loadScheduledHistory(chat);\n});\n\naddActionHandler('sendScheduledMessages', (global, actions, payload) => {\n const {\n chatId, id,\n } = payload!;\n\n const chat = selectChat(global, chatId);\n\n if (!chat) {\n return;\n }\n\n void callApi('sendScheduledMessages', {\n chat,\n ids: [id],\n });\n});\n\naddActionHandler('rescheduleMessage', (global, actions, payload) => {\n const {\n chatId, messageId, scheduledAt,\n } = payload!;\n\n const chat = selectChat(global, chatId);\n const message = chat && selectScheduledMessage(global, chat.id, messageId);\n if (!chat || !message) {\n return;\n }\n\n void callApi('rescheduleMessage', {\n chat,\n message,\n scheduledAt,\n });\n});\n\naddActionHandler('requestThreadInfoUpdate', (global, actions, payload) => {\n const { chatId, threadId } = payload;\n const chat = selectThreadOriginChat(global, chatId, threadId);\n if (!chat) {\n return;\n }\n\n void callApi('requestThreadInfoUpdate', { chat, threadId });\n});\n\naddActionHandler('transcribeAudio', async (global, actions, payload) => {\n const { messageId, chatId } = payload;\n\n const chat = selectChat(global, chatId);\n\n if (!chat) return;\n\n global = updateChatMessage(global, chatId, messageId, {\n transcriptionId: '',\n });\n\n setGlobal(global);\n\n const result = await callApi('transcribeAudio', { chat, messageId });\n\n global = updateChatMessage(getGlobal(), chatId, messageId, {\n transcriptionId: result,\n isTranscriptionError: !result,\n });\n\n setGlobal(global);\n});\n\naddActionHandler('loadCustomEmojis', async (global, actions, payload) => {\n const { ids, ignoreCache } = payload;\n const newCustomEmojiIds = ignoreCache ? ids\n : unique(ids.filter((documentId) => !global.customEmojis.byId[documentId]));\n const customEmoji = await callApi('fetchCustomEmoji', {\n documentId: newCustomEmojiIds,\n });\n if (!customEmoji) return;\n\n global = getGlobal();\n setGlobal({\n ...global,\n customEmojis: {\n ...global.customEmojis,\n byId: {\n ...global.customEmojis.byId,\n ...buildCollectionByKey(customEmoji, 'id'),\n },\n },\n });\n});\n\nasync function loadWebPagePreview(message: string) {\n const webPagePreview = await callApi('fetchWebPagePreview', { message });\n\n setGlobal({\n ...getGlobal(),\n webPagePreview,\n });\n}\n\nasync function loadViewportMessages(\n chat: ApiChat,\n threadId: number,\n offsetId: number | undefined,\n direction: LoadMoreDirection,\n isOutlying = false,\n isBudgetPreload = false,\n) {\n const chatId = chat.id;\n\n let addOffset: number | undefined;\n switch (direction) {\n case LoadMoreDirection.Backwards:\n addOffset = undefined;\n break;\n case LoadMoreDirection.Around:\n addOffset = -(Math.round(MESSAGE_LIST_SLICE / 2) + 1);\n break;\n case LoadMoreDirection.Forwards:\n addOffset = -(MESSAGE_LIST_SLICE + 1);\n break;\n }\n\n const result = await callApi('fetchMessages', {\n chat: selectThreadOriginChat(getGlobal(), chatId, threadId)!,\n offsetId,\n addOffset,\n limit: MESSAGE_LIST_SLICE,\n threadId,\n });\n\n if (!result) {\n return;\n }\n\n const {\n messages, users, chats, threadInfos,\n } = result;\n\n let global = getGlobal();\n\n const localMessages = chatId === SERVICE_NOTIFICATIONS_USER_ID\n ? global.serviceNotifications.map(({ message }) => message)\n : [];\n const allMessages = ([] as ApiMessage[]).concat(messages, localMessages);\n const byId = buildCollectionByKey(allMessages, 'id');\n const ids = Object.keys(byId).map(Number);\n\n global = addChatMessagesById(global, chatId, byId);\n global = isOutlying\n ? updateOutlyingIds(global, chatId, threadId, ids)\n : updateListedIds(global, chatId, threadId, ids);\n\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n global = updateThreadInfos(global, chatId, threadInfos);\n\n let listedIds = selectListedIds(global, chatId, threadId);\n const outlyingIds = selectOutlyingIds(global, chatId, threadId);\n\n if (isOutlying && listedIds && outlyingIds) {\n if (!outlyingIds.length || areSortedArraysIntersecting(listedIds, outlyingIds)) {\n global = updateListedIds(global, chatId, threadId, outlyingIds);\n listedIds = selectListedIds(global, chatId, threadId);\n global = replaceThreadParam(global, chatId, threadId, 'outlyingIds', undefined);\n isOutlying = false;\n }\n }\n\n if (!isBudgetPreload) {\n const historyIds = isOutlying ? outlyingIds! : listedIds!;\n const { newViewportIds } = getViewportSlice(historyIds, offsetId, direction);\n global = safeReplaceViewportIds(global, chatId, threadId, newViewportIds!);\n }\n\n setGlobal(global);\n}\n\nasync function loadMessage(chat: ApiChat, messageId: number, replyOriginForId: number) {\n const result = await callApi('fetchMessage', { chat, messageId });\n if (!result) {\n return undefined;\n }\n\n if (result === MESSAGE_DELETED) {\n if (replyOriginForId) {\n let global = getGlobal();\n const replyMessage = selectChatMessage(global, chat.id, replyOriginForId);\n global = updateChatMessage(global, chat.id, replyOriginForId, {\n ...replyMessage,\n replyToMessageId: undefined,\n });\n setGlobal(global);\n }\n\n return undefined;\n }\n\n let global = getGlobal();\n global = updateChatMessage(global, chat.id, messageId, result.message);\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n setGlobal(global);\n\n return result.message;\n}\n\nfunction findClosestIndex(sourceIds: number[], offsetId: number) {\n if (offsetId < sourceIds[0]) {\n return 0;\n }\n\n if (offsetId > sourceIds[sourceIds.length - 1]) {\n return sourceIds.length - 1;\n }\n\n return sourceIds.findIndex((id, i) => (\n id === offsetId\n || (id < offsetId && sourceIds[i + 1] > offsetId)\n ));\n}\n\nfunction getViewportSlice(\n sourceIds: number[],\n offsetId: number | undefined,\n direction: LoadMoreDirection,\n) {\n const { length } = sourceIds;\n const index = offsetId ? findClosestIndex(sourceIds, offsetId) : -1;\n const isBackwards = direction === LoadMoreDirection.Backwards;\n const indexForDirection = isBackwards ? index : (index + 1) || length;\n const from = indexForDirection - MESSAGE_LIST_SLICE;\n const to = indexForDirection + MESSAGE_LIST_SLICE - 1;\n const newViewportIds = sourceIds.slice(Math.max(0, from), to + 1);\n\n let areSomeLocal;\n let areAllLocal;\n switch (direction) {\n case LoadMoreDirection.Backwards:\n areSomeLocal = indexForDirection > 0;\n areAllLocal = from >= 0;\n break;\n case LoadMoreDirection.Forwards:\n areSomeLocal = indexForDirection < length;\n areAllLocal = to <= length - 1;\n break;\n case LoadMoreDirection.Around:\n default:\n areSomeLocal = newViewportIds.length > 0;\n areAllLocal = newViewportIds.length === MESSAGE_LIST_SLICE;\n break;\n }\n\n return { newViewportIds, areSomeLocal, areAllLocal };\n}\n\nasync function sendMessage(params: {\n chat: ApiChat;\n text?: string;\n entities?: ApiMessageEntity[];\n replyingTo?: number;\n attachment?: ApiAttachment;\n sticker?: ApiSticker;\n gif?: ApiVideo;\n poll?: ApiNewPoll;\n serverTimeOffset?: number;\n isSilent?: boolean;\n scheduledAt?: number;\n sendAs?: ApiChat | ApiUser;\n replyingToTopId?: number;\n}) {\n let localId: number | undefined;\n const progressCallback = params.attachment ? (progress: number, messageLocalId: number) => {\n if (!uploadProgressCallbacks.has(messageLocalId)) {\n localId = messageLocalId;\n uploadProgressCallbacks.set(messageLocalId, progressCallback!);\n }\n\n const global = getGlobal();\n\n setGlobal({\n ...global,\n fileUploads: {\n byMessageLocalId: {\n ...global.fileUploads.byMessageLocalId,\n [messageLocalId]: { progress },\n },\n },\n });\n } : undefined;\n\n // @optimization\n if (params.replyingTo || IS_IOS) {\n await rafPromise();\n }\n\n const global = getGlobal();\n params.serverTimeOffset = global.serverTimeOffset;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n const { threadId } = currentMessageList;\n\n if (!params.replyingTo && threadId !== MAIN_THREAD_ID) {\n params.replyingTo = selectThreadTopMessageId(global, params.chat.id, threadId)!;\n }\n\n if (params.replyingTo && !params.replyingToTopId && threadId !== MAIN_THREAD_ID) {\n params.replyingToTopId = selectThreadTopMessageId(global, params.chat.id, threadId)!;\n }\n\n await callApi('sendMessage', params, progressCallback);\n\n if (progressCallback && localId) {\n uploadProgressCallbacks.delete(localId);\n }\n}\n\nasync function loadPollOptionResults(\n chat: ApiChat,\n messageId: number,\n option: string,\n offset?: string,\n limit?: number,\n shouldResetVoters?: boolean,\n) {\n const result = await callApi('loadPollOptionResults', {\n chat, messageId, option, offset, limit,\n });\n\n if (!result) {\n return;\n }\n\n let global = getGlobal();\n\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n const { voters } = global.pollResults;\n\n setGlobal({\n ...global,\n pollResults: {\n ...global.pollResults,\n voters: {\n ...voters,\n [option]: unique([\n ...(!shouldResetVoters && voters && voters[option] ? voters[option] : []),\n ...(result && result.users.map((user) => user.id)),\n ]),\n },\n offsets: {\n ...(global.pollResults.offsets ? global.pollResults.offsets : {}),\n [option]: result.nextOffset || '',\n },\n },\n });\n}\n\naddActionHandler('loadPinnedMessages', (global, actions, payload) => {\n const { chatId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n void loadPinnedMessages(chat);\n});\n\naddActionHandler('loadSeenBy', async (global, actions, payload) => {\n const { chatId, messageId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('fetchSeenBy', { chat, messageId });\n if (!result) {\n return;\n }\n\n setGlobal(updateChatMessage(getGlobal(), chatId, messageId, {\n seenByUserIds: result,\n }));\n});\n\naddActionHandler('saveDefaultSendAs', (global, actions, payload) => {\n const { chatId, sendAsId } = payload;\n const chat = selectChat(global, chatId);\n const sendAsChat = selectChat(global, sendAsId) || selectUser(global, sendAsId);\n if (!chat || !sendAsChat) {\n return undefined;\n }\n\n void callApi('saveDefaultSendAs', { sendAs: sendAsChat, chat });\n\n return updateChat(global, chatId, {\n fullInfo: {\n ...chat.fullInfo,\n sendAsId,\n },\n });\n});\n\naddActionHandler('loadSendAs', async (global, actions, payload) => {\n const { chatId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('fetchSendAs', { chat });\n if (!result) {\n setGlobal(updateChat(getGlobal(), chatId, {\n sendAsIds: [],\n }));\n\n return;\n }\n\n global = getGlobal();\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addChats(global, buildCollectionByKey(result.chats, 'id'));\n global = updateChat(global, chatId, { sendAsIds: result.ids });\n setGlobal(global);\n});\n\nasync function loadPinnedMessages(chat: ApiChat) {\n const result = await callApi('fetchPinnedMessages', { chat });\n if (!result) {\n return;\n }\n\n const { messages, chats, users } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const ids = Object.keys(byId).map(Number).sort((a, b) => b - a);\n\n let global = getGlobal();\n global = addChatMessagesById(global, chat.id, byId);\n global = replaceThreadParam(global, chat.id, MAIN_THREAD_ID, 'pinnedIds', ids);\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n setGlobal(global);\n}\n\nasync function loadScheduledHistory(chat: ApiChat) {\n const result = await callApi('fetchScheduledHistory', { chat });\n if (!result) {\n return;\n }\n\n const { messages } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const ids = Object.keys(byId).map(Number).sort((a, b) => b - a);\n\n let global = getGlobal();\n global = replaceScheduledMessages(global, chat.id, byId);\n global = replaceThreadParam(global, chat.id, MAIN_THREAD_ID, 'scheduledIds', ids);\n setGlobal(global);\n}\n\naddActionHandler('loadSponsoredMessages', async (global, actions, payload) => {\n const { chatId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('fetchSponsoredMessages', { chat });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n global = updateSponsoredMessage(global, chatId, result.messages[0]);\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n global = addChats(global, buildCollectionByKey(result.chats, 'id'));\n setGlobal(global);\n});\n\naddActionHandler('viewSponsoredMessage', (global, actions, payload) => {\n const { chatId } = payload;\n const chat = selectChat(global, chatId);\n const message = selectSponsoredMessage(global, chatId);\n if (!chat || !message) {\n return;\n }\n\n void callApi('viewSponsoredMessage', { chat, random: message.randomId });\n});\n\naddActionHandler('fetchUnreadMentions', async (global, actions, payload) => {\n const { chatId, offsetId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n\n const result = await callApi('fetchUnreadMentions', { chat, offsetId });\n\n if (!result) return;\n\n const { messages, chats, users } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const ids = Object.keys(byId).map(Number);\n\n global = getGlobal();\n global = addChatMessagesById(global, chat.id, byId);\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n global = updateChat(global, chatId, {\n unreadMentions: [...(chat.unreadMentions || []), ...ids],\n });\n\n setGlobal(global);\n});\n\naddActionHandler('markMentionsRead', (global, actions, payload) => {\n const { messageIds } = payload;\n\n const chat = selectCurrentChat(global);\n if (!chat) return;\n\n if (!chat.unreadMentionsCount) {\n return;\n }\n\n const unreadMentionsCount = chat.unreadMentionsCount - messageIds.length;\n const unreadMentions = (chat.unreadMentions || []).filter((id) => !messageIds.includes(id));\n global = updateChat(global, chat.id, {\n unreadMentions,\n });\n\n setGlobal(global);\n\n if (!unreadMentions.length && unreadMentionsCount) {\n actions.fetchUnreadMentions({\n chatId: chat.id,\n offsetId: Math.max(...messageIds),\n });\n }\n\n actions.markMessagesRead({ messageIds });\n});\n\naddActionHandler('focusNextMention', (global, actions) => {\n const chat = selectCurrentChat(global);\n\n if (!chat?.unreadMentions) return;\n\n actions.focusMessage({ chatId: chat.id, messageId: chat.unreadMentions[0] });\n});\n\naddActionHandler('readAllMentions', (global) => {\n const chat = selectCurrentChat(global);\n if (!chat) return undefined;\n\n callApi('readAllMentions', { chat });\n\n return updateChat(global, chat.id, {\n unreadMentionsCount: undefined,\n unreadMentions: undefined,\n });\n});\n\naddActionHandler('openUrl', (global, actions, payload) => {\n const { url, shouldSkipModal } = payload;\n const urlWithProtocol = ensureProtocol(url)!;\n\n if (urlWithProtocol.match(RE_TME_LINK) || urlWithProtocol.match(RE_TG_LINK)) {\n actions.openTelegramLink({ url });\n return;\n }\n\n const { appConfig } = global;\n if (appConfig) {\n const parsedUrl = new URL(urlWithProtocol);\n\n if (appConfig.autologinDomains.includes(parsedUrl.hostname)) {\n parsedUrl.searchParams.set(AUTOLOGIN_TOKEN_KEY, appConfig.autologinToken);\n window.open(parsedUrl.href, '_blank', 'noopener');\n return;\n }\n\n if (appConfig.urlAuthDomains.includes(parsedUrl.hostname)) {\n actions.requestLinkUrlAuth({ url });\n return;\n }\n }\n\n const shouldDisplayModal = !urlWithProtocol.match(RE_TELEGRAM_LINK) && !shouldSkipModal;\n\n if (shouldDisplayModal) {\n actions.toggleSafeLinkModal({ url: urlWithProtocol });\n } else {\n window.open(urlWithProtocol, '_blank', 'noopener');\n }\n});\n\naddActionHandler('setForwardChatId', async (global, actions, payload) => {\n const { id } = payload;\n let user = selectUser(global, id);\n if (user && selectForwardsContainVoiceMessages(global)) {\n if (!user.fullInfo) {\n const { accessHash } = user;\n user = await callApi('fetchFullUser', { id, accessHash });\n }\n\n if (user?.fullInfo!.noVoiceMessages) {\n actions.showDialog({\n data: {\n message: getTranslation('VoiceMessagesRestrictedByPrivacy', getUserFullName(user)),\n },\n });\n return;\n }\n }\n\n setGlobal({\n ...global,\n forwardMessages: {\n ...global.forwardMessages,\n toChatId: id,\n isModalShown: false,\n },\n });\n\n actions.openChat({ id });\n actions.closeMediaViewer();\n actions.exitMessageSelectMode();\n});\n\nfunction countSortedIds(ids: number[], from: number, to: number) {\n let count = 0;\n\n for (let i = 0, l = ids.length; i < l; i++) {\n if (ids[i] >= from && ids[i] <= to) {\n count++;\n }\n\n if (ids[i] >= to) {\n break;\n }\n }\n\n return count;\n}\n","import {\n addActionHandler, getActions, getGlobal, setGlobal,\n} from '../../index';\n\nimport type { ApiStickerSetInfo, ApiSticker } from '../../../api/types';\nimport type { LangCode } from '../../../types';\nimport { callApi } from '../../../api/gramjs';\nimport { onTickEnd, pause, throttle } from '../../../util/schedulers';\nimport {\n updateStickerSets,\n updateStickerSet,\n replaceAnimatedEmojis,\n updateGifSearch,\n updateStickersForEmoji,\n rebuildStickersForEmoji,\n} from '../../reducers';\nimport searchWords from '../../../util/searchWords';\nimport { selectIsCurrentUserPremium, selectStickerSet } from '../../selectors';\nimport { getTranslation } from '../../../util/langProvider';\nimport { selectCurrentLimit, selectPremiumLimit } from '../../selectors/limits';\nimport * as langProvider from '../../../util/langProvider';\n\nconst ADDED_SETS_THROTTLE = 200;\nconst ADDED_SETS_THROTTLE_CHUNK = 10;\n\nconst searchThrottled = throttle((cb) => cb(), 500, false);\n\naddActionHandler('loadStickerSets', (global, actions) => {\n void loadStickerSets(global.stickers.added.hash);\n void loadCustomEmojiSets(global.customEmojis.added.hash);\n actions.loadCustomEmojis({\n ids: global.recentCustomEmojis,\n });\n});\n\naddActionHandler('loadAddedStickers', async (global, actions) => {\n const {\n added: {\n setIds: addedSetIds = [],\n },\n setsById: cached,\n } = global.stickers;\n const {\n added: {\n setIds: customEmojiSetIds = [],\n },\n } = global.customEmojis;\n const setIdsToLoad = [...addedSetIds, ...customEmojiSetIds];\n if (!setIdsToLoad.length) {\n return;\n }\n\n for (let i = 0; i < setIdsToLoad.length; i++) {\n const id = setIdsToLoad[i];\n if (cached[id]?.stickers) {\n continue; // Already loaded\n }\n actions.loadStickers({\n stickerSetInfo: { id, accessHash: cached[id].accessHash },\n });\n\n if (i % ADDED_SETS_THROTTLE_CHUNK === 0 && i > 0) {\n await pause(ADDED_SETS_THROTTLE);\n }\n }\n});\n\naddActionHandler('loadRecentStickers', (global) => {\n const { hash } = global.stickers.recent || {};\n void loadRecentStickers(hash);\n});\n\naddActionHandler('loadFavoriteStickers', (global) => {\n const { hash } = global.stickers.favorite || {};\n void loadFavoriteStickers(hash);\n});\n\naddActionHandler('loadPremiumStickers', async (global) => {\n const { hash } = global.stickers.premium || {};\n\n const result = await callApi('fetchStickersForEmoji', { emoji: '⭐️⭐️', hash });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n premium: {\n hash: result.hash,\n stickers: result.stickers,\n },\n },\n });\n});\n\naddActionHandler('loadPremiumSetStickers', async (global) => {\n const { hash } = global.stickers.premium || {};\n\n const result = await callApi('fetchStickersForEmoji', { emoji: '📂⭐️', hash });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n premiumSet: {\n hash: result.hash,\n stickers: result.stickers,\n },\n },\n });\n});\n\naddActionHandler('loadGreetingStickers', async (global) => {\n const { hash } = global.stickers.greeting || {};\n\n const greeting = await callApi('fetchStickersForEmoji', { emoji: '👋⭐️', hash });\n if (!greeting) {\n return;\n }\n\n global = getGlobal();\n\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n greeting: {\n hash: greeting.hash,\n stickers: greeting.stickers.filter((sticker) => sticker.emoji === '👋'),\n },\n },\n });\n});\n\naddActionHandler('loadFeaturedStickers', (global) => {\n const { hash } = global.stickers.featured || {};\n void loadFeaturedStickers(hash);\n});\n\naddActionHandler('loadPremiumGifts', async () => {\n const stickerSet = await callApi('fetchPremiumGifts');\n if (!stickerSet) {\n return;\n }\n\n const { set, stickers } = stickerSet;\n\n setGlobal({\n ...getGlobal(),\n premiumGifts: { ...set, stickers },\n });\n});\n\naddActionHandler('loadStickers', (global, actions, payload) => {\n const { stickerSetInfo } = payload;\n const cachedSet = selectStickerSet(global, stickerSetInfo);\n if (cachedSet && cachedSet.count === cachedSet?.stickers?.length) return; // Already fully loaded\n void loadStickers(stickerSetInfo);\n});\n\naddActionHandler('loadAnimatedEmojis', () => {\n void loadAnimatedEmojis();\n void loadAnimatedEmojiEffects();\n});\n\naddActionHandler('loadSavedGifs', (global) => {\n const { hash } = global.gifs.saved;\n void loadSavedGifs(hash);\n});\n\naddActionHandler('saveGif', async (global, actions, payload) => {\n const { gif, shouldUnsave } = payload!;\n const length = global.gifs.saved.gifs?.length;\n\n const limit = selectCurrentLimit(global, 'savedGifs');\n const premiumLimit = selectPremiumLimit(global, 'savedGifs');\n const isPremium = selectIsCurrentUserPremium(global);\n\n if (!shouldUnsave && length && length >= limit) {\n actions.showNotification({\n title: langProvider.getTranslation('LimitReachedFavoriteGifs', limit.toString()),\n message: isPremium ? langProvider.getTranslation('LimitReachedFavoriteGifsSubtitlePremium')\n : langProvider.getTranslation('LimitReachedFavoriteGifsSubtitle',\n premiumLimit.toString()),\n ...(!isPremium && { action: actions.openPremiumModal }),\n className: 'bold-link',\n });\n }\n\n const result = await callApi('saveGif', { gif, shouldUnsave });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n const gifs = global.gifs.saved.gifs?.filter(({ id }) => id !== gif.id) || [];\n const newGifs = shouldUnsave ? gifs : [gif, ...gifs];\n\n setGlobal({\n ...global,\n gifs: {\n ...global.gifs,\n saved: {\n ...global.gifs.saved,\n gifs: newGifs,\n },\n },\n });\n});\n\naddActionHandler('faveSticker', (global, actions, payload) => {\n const { sticker } = payload!;\n const current = global.stickers.favorite.stickers.length;\n const limit = selectCurrentLimit(global, 'stickersFaved');\n const premiumLimit = selectPremiumLimit(global, 'stickersFaved');\n const isPremium = selectIsCurrentUserPremium(global);\n\n if (current >= limit) {\n actions.showNotification({\n title: langProvider.getTranslation('LimitReachedFavoriteStickers', limit.toString()),\n message: isPremium ? langProvider.getTranslation('LimitReachedFavoriteStickersSubtitlePremium')\n : langProvider.getTranslation('LimitReachedFavoriteStickersSubtitle',\n premiumLimit.toString()),\n ...(!isPremium && { action: actions.openPremiumModal }),\n className: 'bold-link',\n });\n }\n\n if (sticker) {\n void callApi('faveSticker', { sticker });\n }\n});\n\naddActionHandler('unfaveSticker', (global, actions, payload) => {\n const { sticker } = payload!;\n\n if (sticker) {\n void unfaveSticker(sticker);\n }\n});\n\naddActionHandler('removeRecentSticker', async (global, action, payload) => {\n const { sticker } = payload!;\n\n const result = await callApi('removeRecentSticker', { sticker });\n\n if (!result) return;\n\n loadRecentStickers();\n});\n\naddActionHandler('clearRecentStickers', async (global) => {\n const result = await callApi('clearRecentStickers');\n\n if (!result) return;\n\n global = getGlobal();\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n recent: {\n stickers: [],\n },\n },\n });\n});\n\naddActionHandler('toggleStickerSet', (global, actions, payload) => {\n const { stickerSetId } = payload!;\n const stickerSet = selectStickerSet(global, stickerSetId);\n if (!stickerSet) {\n return;\n }\n\n const { accessHash, installedDate } = stickerSet;\n\n void callApi(!installedDate ? 'installStickerSet' : 'uninstallStickerSet', { stickerSetId, accessHash });\n});\n\naddActionHandler('loadEmojiKeywords', async (global, actions, payload: { language: LangCode }) => {\n const { language } = payload;\n\n let currentEmojiKeywords = global.emojiKeywords[language];\n if (currentEmojiKeywords?.isLoading) {\n return;\n }\n\n setGlobal({\n ...global,\n emojiKeywords: {\n ...global.emojiKeywords,\n [language]: {\n ...currentEmojiKeywords,\n isLoading: true,\n },\n },\n });\n\n const emojiKeywords = await callApi('fetchEmojiKeywords', {\n language,\n fromVersion: currentEmojiKeywords ? currentEmojiKeywords.version : 0,\n });\n\n global = getGlobal();\n currentEmojiKeywords = global.emojiKeywords[language];\n\n if (!emojiKeywords) {\n setGlobal({\n ...global,\n emojiKeywords: {\n ...global.emojiKeywords,\n [language]: {\n ...currentEmojiKeywords,\n isLoading: false,\n },\n },\n });\n\n return;\n }\n\n setGlobal({\n ...global,\n emojiKeywords: {\n ...global.emojiKeywords,\n [language]: {\n isLoading: false,\n version: emojiKeywords.version,\n keywords: {\n ...(currentEmojiKeywords?.keywords),\n ...emojiKeywords.keywords,\n },\n },\n },\n });\n});\n\nasync function loadCustomEmojiSets(hash?: string) {\n const addedCustomEmojis = await callApi('fetchCustomEmojiSets', { hash });\n if (!addedCustomEmojis) {\n return;\n }\n\n setGlobal(updateStickerSets(\n getGlobal(),\n 'added',\n addedCustomEmojis.hash,\n addedCustomEmojis.sets,\n ));\n}\n\nasync function loadStickerSets(hash?: string) {\n const addedStickers = await callApi('fetchStickerSets', { hash });\n if (!addedStickers) {\n return;\n }\n\n setGlobal(updateStickerSets(\n getGlobal(),\n 'added',\n addedStickers.hash,\n addedStickers.sets,\n ));\n}\n\nasync function loadRecentStickers(hash?: string) {\n const recentStickers = await callApi('fetchRecentStickers', { hash });\n if (!recentStickers) {\n return;\n }\n\n const global = getGlobal();\n\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n recent: recentStickers,\n },\n });\n}\n\nasync function loadFavoriteStickers(hash?: string) {\n const favoriteStickers = await callApi('fetchFavoriteStickers', { hash });\n if (!favoriteStickers) {\n return;\n }\n\n const global = getGlobal();\n\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n favorite: favoriteStickers,\n },\n });\n}\n\nasync function loadFeaturedStickers(hash?: string) {\n const featuredStickers = await callApi('fetchFeaturedStickers', { hash });\n if (!featuredStickers) {\n return;\n }\n\n setGlobal(updateStickerSets(\n getGlobal(),\n 'featured',\n featuredStickers.hash,\n featuredStickers.sets,\n ));\n}\n\nasync function loadStickers(stickerSetInfo: ApiStickerSetInfo) {\n const stickerSet = await callApi(\n 'fetchStickers',\n { stickerSetInfo },\n );\n let global = getGlobal();\n\n if (!stickerSet) {\n onTickEnd(() => {\n getActions().showNotification({\n message: getTranslation('StickerPack.ErrorNotFound'),\n });\n });\n if ('shortName' in stickerSetInfo && global.openedStickerSetShortName === stickerSetInfo.shortName) {\n setGlobal({\n ...global,\n openedStickerSetShortName: undefined,\n });\n }\n return;\n }\n\n const { set, stickers, packs } = stickerSet;\n\n global = updateStickerSet(global, set.id, { ...set, stickers, packs });\n\n const currentEmoji = global.stickers.forEmoji.emoji;\n if (currentEmoji && packs[currentEmoji]) {\n global = rebuildStickersForEmoji(global);\n }\n\n setGlobal(global);\n}\n\nasync function loadAnimatedEmojis() {\n const stickerSet = await callApi('fetchAnimatedEmojis');\n if (!stickerSet) {\n return;\n }\n\n const { set, stickers } = stickerSet;\n\n setGlobal(replaceAnimatedEmojis(getGlobal(), { ...set, stickers }));\n}\n\nasync function loadAnimatedEmojiEffects() {\n const stickerSet = await callApi('fetchAnimatedEmojiEffects');\n if (!stickerSet) {\n return;\n }\n\n const { set, stickers } = stickerSet;\n\n setGlobal({\n ...getGlobal(),\n animatedEmojiEffects: { ...set, stickers },\n });\n}\n\nfunction unfaveSticker(sticker: ApiSticker) {\n const global = getGlobal();\n\n // Remove sticker preemptively to get instant feedback when user removes sticker\n // from favorites while in Sticker Picker\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n favorite: {\n ...global.stickers.favorite,\n stickers: global.stickers.favorite.stickers.filter(({ id }) => id !== sticker.id),\n },\n },\n });\n\n void callApi('faveSticker', { sticker, unfave: true });\n}\n\naddActionHandler('setStickerSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n if (query) {\n void searchThrottled(() => {\n searchStickers(query);\n });\n }\n});\n\naddActionHandler('setGifSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n if (typeof query === 'string') {\n void searchThrottled(() => {\n searchGifs(query);\n });\n }\n});\n\naddActionHandler('searchMoreGifs', (global) => {\n const { query, offset } = global.gifs.search;\n\n if (typeof query === 'string') {\n void searchThrottled(() => {\n searchGifs(query, offset);\n });\n }\n});\n\naddActionHandler('loadStickersForEmoji', (global, actions, payload) => {\n const { emoji } = payload;\n const { hash } = global.stickers.forEmoji;\n\n void searchThrottled(() => {\n loadStickersForEmoji(emoji, hash);\n });\n});\n\naddActionHandler('clearStickersForEmoji', (global) => {\n return {\n ...global,\n stickers: {\n ...global.stickers,\n forEmoji: {},\n },\n };\n});\n\naddActionHandler('openStickerSet', async (global, actions, payload) => {\n const { stickerSetInfo } = payload;\n if (!selectStickerSet(global, stickerSetInfo)) {\n await loadStickers(stickerSetInfo);\n }\n\n global = getGlobal();\n const set = selectStickerSet(global, stickerSetInfo);\n if (!set?.shortName) {\n actions.showNotification({\n message: getTranslation('StickerPack.ErrorNotFound'),\n });\n return;\n }\n\n setGlobal({\n ...global,\n openedStickerSetShortName: set.shortName,\n });\n});\n\nasync function searchStickers(query: string, hash?: string) {\n const result = await callApi('searchStickers', { query, hash });\n\n if (!result) {\n return;\n }\n\n const global = getGlobal();\n const { setsById, added } = global.stickers;\n\n const resultIds = result.sets.map(({ id }) => id);\n\n if (added.setIds) {\n added.setIds.forEach((id) => {\n if (!resultIds.includes(id)) {\n const { title } = setsById[id] || {};\n if (title && searchWords(title, query)) {\n resultIds.unshift(id);\n }\n }\n });\n }\n\n setGlobal(updateStickerSets(\n global,\n 'search',\n result.hash,\n result.sets,\n resultIds,\n ));\n}\n\nasync function searchGifs(query: string, offset?: string) {\n const result = await callApi('searchGifs', { query, offset });\n if (!result) {\n return;\n }\n\n setGlobal(updateGifSearch(getGlobal(), !offset, result.gifs, result.nextOffset));\n}\n\nasync function loadSavedGifs(hash?: string) {\n const savedGifs = await callApi('fetchSavedGifs', { hash });\n if (!savedGifs) {\n return;\n }\n\n const global = getGlobal();\n\n setGlobal({\n ...global,\n gifs: {\n ...global.gifs,\n saved: savedGifs,\n },\n });\n}\n\nasync function loadStickersForEmoji(emoji: string, hash?: string) {\n let global = getGlobal();\n setGlobal({\n ...global,\n stickers: {\n ...global.stickers,\n forEmoji: {\n ...global.stickers.forEmoji,\n emoji,\n },\n },\n });\n\n const result = await callApi('fetchStickersForEmoji', { emoji, hash });\n\n global = getGlobal();\n\n if (!result || global.stickers.forEmoji.emoji !== emoji) {\n return;\n }\n\n global = updateStickersForEmoji(global, emoji, result.stickers, result.hash);\n\n setGlobal(global);\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { callApi } from '../../../api/gramjs';\nimport type { ApiChat, ApiGlobalMessageSearchType } from '../../../api/types';\n\nimport {\n addChats,\n addMessages,\n addUsers,\n updateGlobalSearch,\n updateGlobalSearchFetchingStatus,\n updateGlobalSearchResults,\n} from '../../reducers';\nimport { throttle } from '../../../util/schedulers';\nimport { selectChat, selectCurrentGlobalSearchQuery } from '../../selectors';\nimport { buildCollectionByKey } from '../../../util/iteratees';\nimport { GLOBAL_SEARCH_SLICE } from '../../../config';\nimport { timestampPlusDay } from '../../../util/dateFormat';\n\nconst searchThrottled = throttle((cb) => cb(), 500, false);\n\naddActionHandler('setGlobalSearchQuery', (global, actions, payload) => {\n const { chatId } = global.globalSearch;\n const { query } = payload!;\n\n if (query && !chatId) {\n void searchThrottled(() => {\n searchChats(query);\n });\n }\n});\n\naddActionHandler('setGlobalSearchDate', (global, actions, payload) => {\n const { date } = payload!;\n const maxDate = date ? timestampPlusDay(date) : date;\n\n global = updateGlobalSearch(global, {\n date,\n query: '',\n resultsByType: {\n ...global.globalSearch.resultsByType,\n text: {\n totalCount: undefined,\n foundIds: [],\n nextOffsetId: 0,\n },\n },\n });\n setGlobal(global);\n\n const { chatId } = global.globalSearch;\n const chat = chatId ? selectChat(global, chatId) : undefined;\n searchMessagesGlobal('', 'text', undefined, chat, maxDate, date);\n});\n\naddActionHandler('searchMessagesGlobal', (global, actions, payload) => {\n const {\n query, resultsByType, chatId, date,\n } = global.globalSearch;\n const maxDate = date ? timestampPlusDay(date) : date;\n const { type } = payload;\n const nextOffsetId = (resultsByType?.[type as ApiGlobalMessageSearchType])?.nextOffsetId;\n\n const chat = chatId ? selectChat(global, chatId) : undefined;\n\n searchMessagesGlobal(query, type, nextOffsetId, chat, maxDate, date);\n});\n\nasync function searchChats(query: string) {\n const result = await callApi('searchChats', { query });\n\n let global = getGlobal();\n const currentSearchQuery = selectCurrentGlobalSearchQuery(global);\n if (!result || !currentSearchQuery || (query !== currentSearchQuery)) {\n setGlobal(updateGlobalSearchFetchingStatus(global, { chats: false }));\n return;\n }\n\n const {\n localChats, localUsers, globalChats, globalUsers,\n } = result;\n\n if (localChats.length || globalChats.length) {\n global = addChats(global, buildCollectionByKey([...localChats, ...globalChats], 'id'));\n }\n\n if (localUsers.length || globalUsers.length) {\n global = addUsers(global, buildCollectionByKey([...localUsers, ...globalUsers], 'id'));\n }\n\n global = updateGlobalSearchFetchingStatus(global, { chats: false });\n global = updateGlobalSearch(global, {\n localResults: {\n chatIds: localChats.map(({ id }) => id),\n userIds: localUsers.map(({ id }) => id),\n },\n globalResults: {\n ...global.globalSearch.globalResults,\n chatIds: globalChats.map(({ id }) => id),\n userIds: globalUsers.map(({ id }) => id),\n },\n });\n\n setGlobal(global);\n}\n\nasync function searchMessagesGlobal(\n query = '', type: ApiGlobalMessageSearchType, offsetRate?: number, chat?: ApiChat, maxDate?: number, minDate?: number,\n) {\n let result;\n\n if (chat) {\n const localResult = await callApi('searchMessagesLocal', {\n chat,\n query,\n type,\n limit: GLOBAL_SEARCH_SLICE,\n offsetId: offsetRate,\n minDate,\n maxDate,\n });\n\n if (localResult) {\n const {\n messages, users, totalCount, nextOffsetId,\n } = localResult;\n\n result = {\n messages,\n users,\n chats: [],\n totalCount,\n nextRate: nextOffsetId,\n };\n }\n } else {\n result = await callApi('searchMessagesGlobal', {\n query,\n offsetRate,\n limit: GLOBAL_SEARCH_SLICE,\n type,\n maxDate,\n minDate,\n });\n }\n\n let global = getGlobal();\n const currentSearchQuery = selectCurrentGlobalSearchQuery(global);\n if (!result || (query !== '' && query !== currentSearchQuery)) {\n setGlobal(updateGlobalSearchFetchingStatus(global, { messages: false }));\n return;\n }\n\n const {\n messages, users, chats, totalCount, nextRate,\n } = result;\n\n if (chats.length) {\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n }\n\n if (users.length) {\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n }\n\n if (messages.length) {\n global = addMessages(global, messages);\n }\n\n global = updateGlobalSearchResults(\n global,\n messages,\n totalCount,\n type,\n nextRate,\n );\n\n setGlobal(global);\n}\n","import {\n addActionHandler, getActions, getGlobal, setGlobal,\n} from '../../index';\n\nimport type { ApiChat } from '../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\n\nimport { MESSAGE_SEARCH_SLICE, SHARED_MEDIA_SLICE } from '../../../config';\nimport { callApi } from '../../../api/gramjs';\nimport {\n selectCurrentTextSearch,\n selectCurrentMediaSearch,\n selectCurrentMessageList,\n selectChat,\n selectThreadInfo,\n} from '../../selectors';\nimport { buildCollectionByKey } from '../../../util/iteratees';\nimport {\n addChatMessagesById,\n addChats,\n addUsers,\n updateLocalMediaSearchResults,\n updateLocalTextSearchResults,\n} from '../../reducers';\nimport type { SharedMediaType } from '../../../types';\n\naddActionHandler('searchTextMessagesLocal', (global) => {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n const currentSearch = selectCurrentTextSearch(global);\n if (!chat || !currentSearch || !threadId) {\n return;\n }\n\n const { query, results } = currentSearch;\n const offsetId = results?.nextOffsetId;\n\n let topMessageId: number | undefined;\n if (threadId !== MAIN_THREAD_ID) {\n const threadInfo = selectThreadInfo(global, chatId!, threadId);\n topMessageId = threadInfo?.topMessageId;\n }\n\n void searchTextMessages(chat, threadId, topMessageId, query, offsetId);\n});\n\naddActionHandler('searchMediaMessagesLocal', (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return;\n }\n\n const chat = selectChat(global, chatId);\n const currentSearch = selectCurrentMediaSearch(global);\n\n if (!chat || !currentSearch) {\n return;\n }\n\n const { currentType: type, resultsByType } = currentSearch;\n const currentResults = type && resultsByType && resultsByType[type];\n const offsetId = currentResults?.nextOffsetId;\n\n if (!type) {\n return;\n }\n\n void searchSharedMedia(chat, type, offsetId);\n});\n\naddActionHandler('searchMessagesByDate', (global, actions, payload) => {\n const { timestamp } = payload!;\n\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return;\n }\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n void searchMessagesByDate(chat, timestamp);\n});\n\nasync function searchTextMessages(\n chat: ApiChat,\n threadId: number,\n topMessageId?: number,\n query?: string,\n offsetId?: number,\n) {\n if (!query) {\n return;\n }\n\n const result = await callApi('searchMessagesLocal', {\n chat,\n type: 'text',\n query,\n topMessageId,\n limit: MESSAGE_SEARCH_SLICE,\n offsetId,\n });\n\n if (!result) {\n return;\n }\n\n const {\n chats, users, messages, totalCount, nextOffsetId,\n } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const newFoundIds = Object.keys(byId).map(Number);\n\n let global = getGlobal();\n\n const currentSearch = selectCurrentTextSearch(global);\n if (!currentSearch || query !== currentSearch.query) {\n return;\n }\n\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChatMessagesById(global, chat.id, byId);\n global = updateLocalTextSearchResults(global, chat.id, threadId, newFoundIds, totalCount, nextOffsetId);\n setGlobal(global);\n}\n\nasync function searchSharedMedia(\n chat: ApiChat,\n type: SharedMediaType,\n offsetId?: number,\n isBudgetPreload = false,\n) {\n const result = await callApi('searchMessagesLocal', {\n chat,\n type,\n limit: SHARED_MEDIA_SLICE * 2,\n offsetId,\n });\n\n if (!result) {\n return;\n }\n\n const {\n chats, users, messages, totalCount, nextOffsetId,\n } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const newFoundIds = Object.keys(byId).map(Number);\n\n let global = getGlobal();\n\n const currentSearch = selectCurrentMediaSearch(global);\n if (!currentSearch) {\n return;\n }\n\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChatMessagesById(global, chat.id, byId);\n global = updateLocalMediaSearchResults(global, chat.id, type, newFoundIds, totalCount, nextOffsetId);\n setGlobal(global);\n\n if (!isBudgetPreload) {\n searchSharedMedia(chat, type, nextOffsetId, true);\n }\n}\n\nasync function searchMessagesByDate(chat: ApiChat, timestamp: number) {\n const messageId = await callApi('findFirstMessageIdAfterDate', {\n chat,\n timestamp,\n });\n\n if (!messageId) {\n return;\n }\n\n getActions().focusMessage({\n chatId: chat.id,\n messageId,\n });\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { ManagementProgress } from '../../../types';\nimport { callApi } from '../../../api/gramjs';\nimport {\n addUsers, updateChat, updateManagement, updateManagementProgress,\n} from '../../reducers';\nimport { selectChat, selectCurrentMessageList, selectUser } from '../../selectors';\nimport { migrateChat } from './chats';\nimport { isChatBasicGroup } from '../../helpers';\n\naddActionHandler('checkPublicLink', async (global, actions, payload) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return;\n }\n\n // No need to check the username if already in progress\n if (global.management.progress === ManagementProgress.InProgress) {\n return;\n }\n\n const { username } = payload!;\n\n global = updateManagementProgress(global, ManagementProgress.InProgress);\n global = updateManagement(global, chatId, { isUsernameAvailable: undefined });\n setGlobal(global);\n\n const isUsernameAvailable = await callApi('checkChatUsername', { username })!;\n\n global = getGlobal();\n global = updateManagementProgress(\n global, isUsernameAvailable ? ManagementProgress.Complete : ManagementProgress.Error,\n );\n global = updateManagement(global, chatId, { isUsernameAvailable });\n setGlobal(global);\n\n if (isUsernameAvailable === undefined) {\n actions.openLimitReachedModal({ limit: 'channelsPublic' });\n }\n});\n\naddActionHandler('updatePublicLink', async (global, actions, payload) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n let chat = chatId && selectChat(global, chatId);\n if (!chatId || !chat) {\n return;\n }\n\n const { username } = payload!;\n\n global = updateManagementProgress(global, ManagementProgress.InProgress);\n setGlobal(global);\n\n if (isChatBasicGroup(chat)) {\n chat = await migrateChat(chat);\n\n if (!chat) {\n return;\n }\n\n actions.openChat({ id: chat.id });\n }\n\n const result = await callApi('setChatUsername', { chat, username });\n\n global = getGlobal();\n global = updateManagementProgress(global, result ? ManagementProgress.Complete : ManagementProgress.Error);\n global = updateManagement(global, chatId, { isUsernameAvailable: undefined });\n setGlobal(global);\n});\n\naddActionHandler('updatePrivateLink', (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n const chat = chatId && selectChat(global, chatId);\n if (!chatId || !chat) {\n return;\n }\n\n callApi('updatePrivateLink', { chat });\n});\n\naddActionHandler('setEditingExportedInvite', (global, actions, payload) => {\n const { chatId, invite } = payload;\n\n setGlobal(updateManagement(global, chatId, { editingInvite: invite }));\n});\n\naddActionHandler('setOpenedInviteInfo', (global, actions, payload) => {\n const { chatId, invite } = payload;\n\n const update = invite ? { inviteInfo: { invite } } : { inviteInfo: undefined };\n\n setGlobal(updateManagement(global, chatId, update));\n});\n\naddActionHandler('loadExportedChatInvites', async (global, actions, payload) => {\n const {\n chatId, adminId, isRevoked, limit,\n } = payload!;\n const peer = selectChat(global, chatId);\n const admin = selectUser(global, adminId || global.currentUserId);\n if (!peer || !admin) return;\n\n const result = await callApi('fetchExportedChatInvites', {\n peer, admin, isRevoked, limit,\n });\n if (!result) {\n return;\n }\n\n const update = isRevoked ? { revokedInvites: result } : { invites: result };\n\n setGlobal(updateManagement(getGlobal(), chatId, update));\n});\n\naddActionHandler('editExportedChatInvite', async (global, actions, payload) => {\n const {\n chatId, link, isRevoked, expireDate, usageLimit, isRequestNeeded, title,\n } = payload!;\n const peer = selectChat(global, chatId);\n if (!peer) return;\n\n const result = await callApi('editExportedChatInvite', {\n peer,\n link,\n isRevoked,\n expireDate,\n usageLimit,\n isRequestNeeded,\n title,\n });\n if (!result) {\n return;\n }\n\n const { oldInvite, newInvite } = result;\n\n global = getGlobal();\n const invites = (global.management.byChatId[chatId].invites || [])\n .filter((current) => current.link !== oldInvite.link);\n const revokedInvites = [...(global.management.byChatId[chatId].revokedInvites || [])];\n\n if (newInvite.isRevoked) {\n revokedInvites.unshift(newInvite);\n } else {\n invites.push(newInvite);\n }\n\n setGlobal(updateManagement(global, chatId, {\n invites,\n revokedInvites,\n }));\n});\n\naddActionHandler('exportChatInvite', async (global, actions, payload) => {\n const {\n chatId, expireDate, usageLimit, isRequestNeeded, title,\n } = payload!;\n const peer = selectChat(global, chatId);\n if (!peer) return;\n\n const result = await callApi('exportChatInvite', {\n peer,\n expireDate,\n usageLimit,\n isRequestNeeded,\n title,\n });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n const invites = global.management.byChatId[chatId].invites || [];\n setGlobal(updateManagement(global, chatId, {\n invites: [...invites, result],\n }));\n});\n\naddActionHandler('deleteExportedChatInvite', async (global, actions, payload) => {\n const {\n chatId, link,\n } = payload!;\n const peer = selectChat(global, chatId);\n if (!peer) return;\n\n const result = await callApi('deleteExportedChatInvite', {\n peer,\n link,\n });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n const managementState = global.management.byChatId[chatId];\n setGlobal(updateManagement(global, chatId, {\n invites: managementState?.invites?.filter((invite) => invite.link !== link),\n revokedInvites: managementState?.revokedInvites?.filter((invite) => invite.link !== link),\n }));\n});\n\naddActionHandler('deleteRevokedExportedChatInvites', async (global, actions, payload) => {\n const {\n chatId, adminId,\n } = payload!;\n const peer = selectChat(global, chatId);\n const admin = selectUser(global, adminId || global.currentUserId);\n if (!peer || !admin) return;\n\n const result = await callApi('deleteRevokedExportedChatInvites', {\n peer,\n admin,\n });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n setGlobal(updateManagement(global, chatId, {\n revokedInvites: [],\n }));\n});\n\naddActionHandler('loadChatInviteImporters', async (global, actions, payload) => {\n const {\n chatId, link, offsetDate, offsetUserId, limit,\n } = payload!;\n const peer = selectChat(global, chatId);\n const offsetUser = selectUser(global, offsetUserId);\n if (!peer || (offsetUserId && !offsetUser)) return;\n\n const result = await callApi('fetchChatInviteImporters', {\n peer,\n link,\n offsetDate,\n offsetUser,\n limit,\n });\n if (!result) {\n return;\n }\n const { importers, users } = result;\n\n global = getGlobal();\n const currentInviteInfo = global.management.byChatId[chatId]?.inviteInfo;\n if (!currentInviteInfo?.invite || currentInviteInfo.invite.link !== link) {\n return;\n }\n\n global = updateManagement(global, chatId, {\n inviteInfo: {\n ...currentInviteInfo,\n importers,\n },\n });\n global = addUsers(global, users);\n setGlobal(global);\n});\n\naddActionHandler('loadChatInviteRequesters', async (global, actions, payload) => {\n const {\n chatId, link, offsetDate, offsetUserId, limit,\n } = payload!;\n const peer = selectChat(global, chatId);\n const offsetUser = selectUser(global, offsetUserId);\n if (!peer || (offsetUserId && !offsetUser)) return;\n\n const result = await callApi('fetchChatInviteImporters', {\n peer,\n link,\n offsetDate,\n offsetUser,\n limit,\n isRequested: true,\n });\n if (!result) {\n return;\n }\n const { importers, users } = result;\n\n global = getGlobal();\n const currentInviteInfo = global.management.byChatId[chatId]?.inviteInfo;\n if (!currentInviteInfo?.invite || currentInviteInfo.invite.link !== link) {\n return;\n }\n global = updateManagement(global, chatId, {\n inviteInfo: {\n ...currentInviteInfo,\n requesters: importers,\n },\n });\n global = addUsers(global, users);\n setGlobal(global);\n});\n\naddActionHandler('loadChatJoinRequests', async (global, actions, payload) => {\n const {\n chatId, offsetDate, offsetUserId, limit,\n } = payload!;\n const peer = selectChat(global, chatId);\n const offsetUser = selectUser(global, offsetUserId);\n if (!peer || (offsetUserId && !offsetUser)) return;\n\n const result = await callApi('fetchChatInviteImporters', {\n peer,\n offsetDate,\n offsetUser,\n limit,\n isRequested: true,\n });\n if (!result) {\n return;\n }\n const { importers, users } = result;\n\n global = getGlobal();\n global = updateChat(global, chatId, { joinRequests: importers });\n global = addUsers(global, users);\n setGlobal(global);\n});\n\naddActionHandler('hideChatJoinRequest', async (global, actions, payload) => {\n const {\n chatId, userId, isApproved,\n } = payload!;\n const peer = selectChat(global, chatId);\n const user = selectUser(global, userId);\n if (!peer || !user) return;\n\n const result = await callApi('hideChatJoinRequest', {\n peer,\n user,\n isApproved,\n });\n if (!result) return;\n\n global = getGlobal();\n const targetChat = selectChat(global, chatId);\n if (!targetChat) return;\n\n setGlobal(updateChat(global, chatId, {\n joinRequests: targetChat.joinRequests?.filter((importer) => importer.userId !== userId),\n }));\n});\n\naddActionHandler('hideAllChatJoinRequests', async (global, actions, payload) => {\n const {\n chatId, isApproved, link,\n } = payload!;\n const peer = selectChat(global, chatId);\n if (!peer) return;\n\n const result = await callApi('hideAllChatJoinRequests', {\n peer,\n isApproved,\n link,\n });\n if (!result) return;\n\n global = getGlobal();\n const targetChat = selectChat(global, chatId);\n if (!targetChat) return;\n\n setGlobal(updateChat(global, chatId, {\n joinRequests: [],\n fullInfo: {\n ...targetChat.fullInfo,\n recentRequesterIds: [],\n requestsPending: 0,\n },\n }));\n});\n\naddActionHandler('hideChatReportPanel', async (global, actions, payload) => {\n const { chatId } = payload!;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n\n const result = await callApi('hideChatReportPanel', chat);\n if (!result) return;\n\n setGlobal(updateChat(getGlobal(), chatId, {\n settings: undefined,\n }));\n});\n","import {\n addActionHandler, getGlobal, setGlobal, getActions,\n} from '../../index';\n\nimport type { ApiChat, ApiMessage } from '../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\nimport type { Thread } from '../../types';\n\nimport {\n DEBUG, MESSAGE_LIST_SLICE, SERVICE_NOTIFICATIONS_USER_ID,\n} from '../../../config';\nimport { callApi } from '../../../api/gramjs';\nimport { buildCollectionByKey } from '../../../util/iteratees';\nimport {\n updateUsers,\n updateChats,\n updateThreadInfos,\n updateListedIds,\n safeReplaceViewportIds,\n addChatMessagesById,\n updateThread,\n} from '../../reducers';\nimport {\n selectCurrentMessageList,\n selectDraft,\n selectChatMessage,\n selectThreadInfo,\n selectEditingId,\n selectEditingDraft,\n} from '../../selectors';\nimport { init as initFolderManager } from '../../../util/folderManager';\n\nconst RELEASE_STATUS_TIMEOUT = 15000; // 15 sec;\n\nlet releaseStatusTimeout: number | undefined;\n\naddActionHandler('sync', () => {\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.log('>>> START SYNC');\n }\n\n if (releaseStatusTimeout) {\n clearTimeout(releaseStatusTimeout);\n }\n\n setGlobal({ ...getGlobal(), isSyncing: true });\n\n // Workaround for `isSyncing = true` sometimes getting stuck for some reason\n releaseStatusTimeout = window.setTimeout(() => {\n setGlobal({ ...getGlobal(), isSyncing: false });\n releaseStatusTimeout = undefined;\n }, RELEASE_STATUS_TIMEOUT);\n\n const { loadAllChats, preloadTopChatMessages } = getActions();\n\n loadAllChats({\n listType: 'active',\n shouldReplace: true,\n onReplace: async () => {\n await loadAndReplaceMessages();\n\n setGlobal({\n ...getGlobal(),\n lastSyncTime: Date.now(),\n isSyncing: false,\n });\n\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.log('>>> FINISH SYNC');\n }\n\n initFolderManager();\n loadAllChats({ listType: 'archived', shouldReplace: true });\n void callApi('fetchCurrentUser');\n preloadTopChatMessages();\n },\n });\n});\n\nasync function loadAndReplaceMessages() {\n let areMessagesLoaded = false;\n\n let global = getGlobal();\n\n // Memoize drafts\n const draftChatIds = Object.keys(global.messages.byChatId);\n const draftsByChatId = draftChatIds.reduce<Record<string, Partial<Thread>>>((acc, chatId) => {\n acc[chatId] = {};\n acc[chatId].draft = selectDraft(global, chatId, MAIN_THREAD_ID);\n acc[chatId].editingId = selectEditingId(global, chatId, MAIN_THREAD_ID);\n acc[chatId].editingDraft = selectEditingDraft(global, chatId, MAIN_THREAD_ID);\n\n return acc;\n }, {});\n\n const { chatId: currentChatId, threadId: currentThreadId } = selectCurrentMessageList(global) || {};\n const currentChat = currentChatId ? global.chats.byId[currentChatId] : undefined;\n if (currentChatId && currentChat) {\n const result = await loadTopMessages(currentChat);\n global = getGlobal();\n const { chatId: newCurrentChatId } = selectCurrentMessageList(global) || {};\n const threadInfo = currentThreadId && selectThreadInfo(global, currentChatId, currentThreadId);\n\n if (result && newCurrentChatId === currentChatId) {\n const currentMessageListInfo = global.messages.byChatId[currentChatId];\n const localMessages = currentChatId === SERVICE_NOTIFICATIONS_USER_ID\n ? global.serviceNotifications.map(({ message }) => message)\n : [];\n const allMessages = ([] as ApiMessage[]).concat(result.messages, localMessages);\n const byId = buildCollectionByKey(allMessages, 'id');\n const listedIds = Object.keys(byId).map(Number);\n\n global = {\n ...global,\n messages: {\n ...global.messages,\n byChatId: {},\n },\n };\n\n global = addChatMessagesById(global, currentChatId, byId);\n global = updateListedIds(global, currentChatId, MAIN_THREAD_ID, listedIds);\n global = safeReplaceViewportIds(global, currentChatId, MAIN_THREAD_ID, listedIds);\n\n if (currentThreadId && threadInfo && threadInfo.originChannelId) {\n const { originChannelId } = threadInfo;\n const currentMessageListInfoOrigin = global.messages.byChatId[originChannelId];\n const resultOrigin = await loadTopMessages(global.chats.byId[originChannelId]);\n if (resultOrigin) {\n const byIdOrigin = buildCollectionByKey(resultOrigin.messages, 'id');\n const listedIdsOrigin = Object.keys(byIdOrigin).map(Number);\n\n global = {\n ...global,\n messages: {\n ...global.messages,\n byChatId: {\n ...global.messages.byChatId,\n [threadInfo.originChannelId]: {\n byId: byIdOrigin,\n threadsById: {\n [MAIN_THREAD_ID]: {\n ...(currentMessageListInfoOrigin?.threadsById[MAIN_THREAD_ID]),\n listedIds: listedIdsOrigin,\n viewportIds: listedIdsOrigin,\n outlyingIds: undefined,\n },\n },\n },\n [currentChatId]: {\n ...global.messages.byChatId[currentChatId],\n threadsById: {\n ...global.messages.byChatId[currentChatId].threadsById,\n [currentThreadId]: {\n ...(currentMessageListInfo?.threadsById[currentThreadId]),\n outlyingIds: undefined,\n },\n },\n },\n },\n },\n };\n }\n }\n\n global = updateChats(global, buildCollectionByKey(result.chats, 'id'));\n global = updateUsers(global, buildCollectionByKey(result.users, 'id'));\n global = updateThreadInfos(global, currentChatId, result.threadInfos);\n\n areMessagesLoaded = true;\n }\n }\n\n if (!areMessagesLoaded) {\n global = {\n ...global,\n messages: {\n ...global.messages,\n byChatId: {},\n },\n };\n }\n\n // Restore drafts\n Object.keys(draftsByChatId).forEach((chatId) => {\n global = updateThread(global, chatId, MAIN_THREAD_ID, draftsByChatId[chatId]);\n });\n\n setGlobal(global);\n\n const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;\n if (audioChatId && audioMessageId && !selectChatMessage(global, audioChatId, audioMessageId)) {\n getActions().closeAudioPlayer();\n }\n}\n\nfunction loadTopMessages(chat: ApiChat) {\n return callApi('fetchMessages', {\n chat,\n threadId: MAIN_THREAD_ID,\n offsetId: chat.lastReadInboxMessageId,\n addOffset: -(Math.round(MESSAGE_LIST_SLICE / 2) + 1),\n limit: MESSAGE_LIST_SLICE,\n });\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\nimport { selectChat } from '../../selectors';\nimport { callApi } from '../../../api/gramjs';\nimport { getTranslation } from '../../../util/langProvider';\n\naddActionHandler('reportPeer', async (global, actions, payload) => {\n const {\n chatId,\n reason,\n description,\n } = payload;\n if (!chatId) {\n return;\n }\n\n const chat = selectChat(global, chatId)!;\n if (!chat) {\n return;\n }\n\n const result = await callApi('reportPeer', {\n peer: chat,\n reason,\n description,\n });\n\n actions.showNotification({\n message: result\n ? getTranslation('ReportPeer.AlertSuccess')\n : 'An error occurred while submitting your report. Please, try again later.',\n });\n});\n\naddActionHandler('reportProfilePhoto', async (global, actions, payload) => {\n const {\n chatId,\n reason,\n description,\n photo,\n } = payload;\n if (!chatId) {\n return;\n }\n\n const chat = selectChat(global, chatId)!;\n if (!chat || !photo) {\n return;\n }\n\n const result = await callApi('reportProfilePhoto', {\n peer: chat,\n photo,\n reason,\n description,\n });\n\n actions.showNotification({\n message: result\n ? getTranslation('ReportPeer.AlertSuccess')\n : 'An error occurred while submitting your report. Please, try again later.',\n });\n});\n\naddActionHandler('loadAuthorizations', async () => {\n const result = await callApi('fetchAuthorizations');\n if (!result) {\n return;\n }\n\n setGlobal({\n ...getGlobal(),\n activeSessions: {\n byHash: result.authorizations,\n orderedHashes: Object.keys(result.authorizations),\n ttlDays: result.ttlDays,\n },\n });\n});\n\naddActionHandler('terminateAuthorization', async (global, actions, payload) => {\n const { hash } = payload!;\n\n const result = await callApi('terminateAuthorization', hash);\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n const { [hash]: removedSessions, ...newSessions } = global.activeSessions.byHash;\n\n setGlobal({\n ...global,\n activeSessions: {\n byHash: newSessions,\n orderedHashes: global.activeSessions.orderedHashes.filter((el) => el !== hash),\n },\n });\n});\n\naddActionHandler('terminateAllAuthorizations', async (global) => {\n const result = await callApi('terminateAllAuthorizations');\n if (!result) {\n return;\n }\n\n global = getGlobal();\n const currentSessionHash = global.activeSessions.orderedHashes\n .find((hash) => global.activeSessions.byHash[hash].isCurrent);\n if (!currentSessionHash) {\n return;\n }\n const currentSession = global.activeSessions.byHash[currentSessionHash];\n\n setGlobal({\n ...global,\n activeSessions: {\n byHash: {\n [currentSessionHash]: currentSession,\n },\n orderedHashes: [currentSessionHash],\n },\n });\n});\n\naddActionHandler('changeSessionSettings', async (global, actions, payload) => {\n const { hash, areCallsEnabled, areSecretChatsEnabled } = payload;\n const result = await callApi('changeSessionSettings', {\n hash,\n areCallsEnabled,\n areSecretChatsEnabled,\n });\n\n if (!result) {\n return;\n }\n\n global = getGlobal();\n setGlobal({\n ...global,\n activeSessions: {\n ...global.activeSessions,\n byHash: {\n ...global.activeSessions.byHash,\n [hash]: {\n ...global.activeSessions.byHash[hash],\n ...(areCallsEnabled !== undefined ? { areCallsEnabled } : undefined),\n ...(areSecretChatsEnabled !== undefined ? { areSecretChatsEnabled } : undefined),\n },\n },\n },\n });\n});\n\naddActionHandler('changeSessionTtl', async (global, actions, payload) => {\n const { days } = payload;\n\n const result = await callApi('changeSessionTtl', { days });\n\n if (!result) {\n return;\n }\n\n global = getGlobal();\n setGlobal({\n ...global,\n activeSessions: {\n ...global.activeSessions,\n ttlDays: days,\n },\n });\n});\n\naddActionHandler('loadWebAuthorizations', async () => {\n const result = await callApi('fetchWebAuthorizations');\n if (!result) {\n return;\n }\n\n setGlobal({\n ...getGlobal(),\n activeWebSessions: {\n byHash: result,\n orderedHashes: Object.keys(result),\n },\n });\n});\n\naddActionHandler('terminateWebAuthorization', async (global, actions, payload) => {\n const { hash } = payload!;\n\n const result = await callApi('terminateWebAuthorization', hash);\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n const { [hash]: removedSessions, ...newSessions } = global.activeWebSessions.byHash;\n\n setGlobal({\n ...global,\n activeWebSessions: {\n byHash: newSessions,\n orderedHashes: global.activeWebSessions.orderedHashes.filter((el) => el !== hash),\n },\n });\n});\n\naddActionHandler('terminateAllWebAuthorizations', async (global) => {\n const result = await callApi('terminateAllWebAuthorizations');\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n setGlobal({\n ...global,\n activeWebSessions: {\n byHash: {},\n orderedHashes: [],\n },\n });\n});\n","import {\n addActionHandler, getActions, getGlobal, setGlobal,\n} from '../../index';\n\nimport type { ApiUser } from '../../../api/types';\nimport { ManagementProgress } from '../../../types';\n\nimport { throttle } from '../../../util/schedulers';\nimport { buildCollectionByKey, unique } from '../../../util/iteratees';\nimport { isUserBot, isUserId } from '../../helpers';\nimport { callApi } from '../../../api/gramjs';\nimport { selectChat, selectCurrentMessageList, selectUser } from '../../selectors';\nimport {\n addChats,\n addUsers,\n addUserStatuses,\n closeNewContactDialog,\n replaceUserStatuses,\n updateChat,\n updateManagementProgress,\n updateUser,\n updateUsers,\n updateUserSearch,\n updateUserSearchFetchingStatus,\n} from '../../reducers';\nimport { getServerTime } from '../../../util/serverTime';\nimport * as langProvider from '../../../util/langProvider';\n\nconst TOP_PEERS_REQUEST_COOLDOWN = 60; // 1 min\nconst runThrottledForSearch = throttle((cb) => cb(), 500, false);\n\naddActionHandler('loadFullUser', (global, actions, payload) => {\n const { userId } = payload!;\n const user = selectUser(global, userId);\n if (!user) {\n return;\n }\n\n const { id, accessHash } = user;\n callApi('fetchFullUser', { id, accessHash });\n});\n\naddActionHandler('loadUser', async (global, actions, payload) => {\n const { userId } = payload!;\n const user = selectUser(global, userId);\n if (!user) {\n return;\n }\n\n const result = await callApi('fetchUsers', { users: [user] });\n if (!result) {\n return;\n }\n\n const { users, userStatusesById } = result;\n\n global = getGlobal();\n global = updateUsers(global, buildCollectionByKey(users, 'id'));\n global = replaceUserStatuses(global, {\n ...global.users.statusesById,\n ...userStatusesById,\n });\n setGlobal(global);\n});\n\naddActionHandler('loadTopUsers', (global) => {\n const { topPeers: { lastRequestedAt } } = global;\n\n if (!lastRequestedAt || getServerTime(global.serverTimeOffset) - lastRequestedAt > TOP_PEERS_REQUEST_COOLDOWN) {\n void loadTopUsers();\n }\n});\n\naddActionHandler('loadContactList', () => {\n void loadContactList();\n});\n\naddActionHandler('loadCurrentUser', () => {\n void callApi('fetchCurrentUser');\n});\n\naddActionHandler('loadCommonChats', async (global) => {\n const { chatId } = selectCurrentMessageList(global) || {};\n const user = chatId ? selectUser(global, chatId) : undefined;\n if (!user || isUserBot(user) || user.commonChats?.isFullyLoaded) {\n return;\n }\n\n const maxId = user.commonChats?.maxId;\n const result = await callApi('fetchCommonChats', user.id, user.accessHash!, maxId);\n if (!result) {\n return;\n }\n\n const { chats, chatIds, isFullyLoaded } = result;\n\n global = getGlobal();\n if (chats.length) {\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n }\n global = updateUser(global, user.id, {\n commonChats: {\n maxId: chatIds.length ? chatIds[chatIds.length - 1] : '0',\n ids: unique((user.commonChats?.ids || []).concat(chatIds)),\n isFullyLoaded,\n },\n });\n\n setGlobal(global);\n});\n\naddActionHandler('updateContact', (global, actions, payload) => {\n const {\n userId, isMuted = false, firstName, lastName, shouldSharePhoneNumber,\n } = payload;\n\n void updateContact(userId, isMuted, firstName, lastName, shouldSharePhoneNumber);\n});\n\naddActionHandler('deleteContact', (global, actions, payload) => {\n const { userId } = payload!;\n\n void deleteContact(userId);\n});\n\nasync function loadTopUsers() {\n const result = await callApi('fetchTopUsers');\n if (!result) {\n return;\n }\n\n const { ids, users } = result;\n\n let global = getGlobal();\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = {\n ...global,\n topPeers: {\n ...global.topPeers,\n userIds: ids,\n lastRequestedAt: getServerTime(global.serverTimeOffset),\n },\n };\n setGlobal(global);\n}\n\nasync function loadContactList() {\n const contactList = await callApi('fetchContactList');\n if (!contactList) {\n return;\n }\n\n let global = addUsers(getGlobal(), buildCollectionByKey(contactList.users, 'id'));\n global = addChats(global, buildCollectionByKey(contactList.chats, 'id'));\n global = addUserStatuses(global, contactList.userStatusesById);\n\n // Sort contact list by Last Name (or First Name), with latin names being placed first\n const getCompareString = (user: ApiUser) => (user.lastName || user.firstName || '');\n const collator = new Intl.Collator('en-US');\n\n const sortedUsers = contactList.users.sort((a, b) => (\n collator.compare(getCompareString(a), getCompareString(b))\n )).filter((user) => !user.isSelf);\n\n setGlobal({\n ...global,\n contactList: {\n userIds: sortedUsers.map((user) => user.id),\n },\n });\n}\n\nasync function updateContact(\n userId: string,\n isMuted: boolean,\n firstName: string,\n lastName?: string,\n shouldSharePhoneNumber?: boolean,\n) {\n let global = getGlobal();\n const user = selectUser(global, userId);\n if (!user) {\n return;\n }\n\n getActions().updateChatMutedState({ chatId: userId, isMuted });\n\n setGlobal(updateManagementProgress(getGlobal(), ManagementProgress.InProgress));\n\n let result;\n if (!user.isContact && user.phoneNumber) {\n result = await callApi('importContact', { phone: user.phoneNumber, firstName, lastName });\n } else {\n const { id, accessHash } = user;\n result = await callApi('updateContact', {\n id,\n accessHash,\n phoneNumber: '',\n firstName,\n lastName,\n shouldSharePhoneNumber,\n });\n }\n\n if (result) {\n getActions().loadChatSettings({ chatId: userId });\n\n setGlobal(updateUser(\n getGlobal(),\n user.id,\n {\n firstName,\n lastName,\n },\n ));\n }\n\n global = getGlobal();\n global = updateManagementProgress(global, ManagementProgress.Complete);\n global = closeNewContactDialog(global);\n setGlobal(global);\n}\n\nasync function deleteContact(userId: string) {\n const global = getGlobal();\n const user = selectUser(global, userId);\n\n if (!user) {\n return;\n }\n\n const { id, accessHash } = user;\n\n await callApi('deleteContact', { id, accessHash });\n}\n\naddActionHandler('loadProfilePhotos', async (global, actions, payload) => {\n const { profileId } = payload!;\n const isPrivate = isUserId(profileId);\n\n const user = isPrivate ? selectUser(global, profileId) : undefined;\n const chat = !isPrivate ? selectChat(global, profileId) : undefined;\n if (!user && !chat) {\n return;\n }\n\n const result = await callApi('fetchProfilePhotos', user, chat);\n if (!result || !result.photos) {\n return;\n }\n\n global = getGlobal();\n\n if (isPrivate) {\n global = updateUser(global, profileId, { photos: result.photos });\n } else {\n global = addUsers(global, buildCollectionByKey(result.users!, 'id'));\n global = updateChat(global, profileId, { photos: result.photos });\n }\n\n setGlobal(global);\n});\n\naddActionHandler('setUserSearchQuery', (global, actions, payload) => {\n const { query } = payload!;\n\n if (!query) return;\n\n void runThrottledForSearch(() => {\n searchUsers(query);\n });\n});\n\naddActionHandler('importContact', async (global, actions, payload) => {\n const { phoneNumber: phone, firstName, lastName } = payload!;\n\n const result = await callApi('importContact', { phone, firstName, lastName });\n if (!result) {\n actions.showNotification({\n message: langProvider.getTranslation('Contacts.PhoneNumber.NotRegistred'),\n });\n\n return;\n }\n\n actions.openChat({ id: result });\n\n setGlobal(closeNewContactDialog(getGlobal()));\n});\n\naddActionHandler('reportSpam', (global, actions, payload) => {\n const { chatId } = payload!;\n const userOrChat = isUserId(chatId) ? selectUser(global, chatId) : selectChat(global, chatId);\n if (!userOrChat) {\n return;\n }\n\n void callApi('reportSpam', userOrChat);\n});\n\nasync function searchUsers(query: string) {\n const result = await callApi('searchChats', { query });\n\n let global = getGlobal();\n const currentSearchQuery = global.userSearch.query;\n\n if (!result || !currentSearchQuery || (query !== currentSearchQuery)) {\n setGlobal(updateUserSearchFetchingStatus(global, false));\n return;\n }\n\n const { localUsers, globalUsers } = result;\n\n let localUserIds;\n let globalUserIds;\n if (localUsers.length) {\n global = addUsers(global, buildCollectionByKey(localUsers, 'id'));\n localUserIds = localUsers.map(({ id }) => id);\n }\n if (globalUsers.length) {\n global = addUsers(global, buildCollectionByKey(globalUsers, 'id'));\n globalUserIds = globalUsers.map(({ id }) => id);\n }\n\n global = updateUserSearchFetchingStatus(global, false);\n global = updateUserSearch(global, { localUserIds, globalUserIds });\n\n setGlobal(global);\n}\n","import type { GlobalState } from '../types';\nimport type { InlineBotSettings } from '../../types';\n\nexport function replaceInlineBotSettings(\n global: GlobalState, username: string, inlineBotSettings: InlineBotSettings | false,\n): GlobalState {\n return {\n ...global,\n inlineBots: {\n ...global.inlineBots,\n byUsername: {\n ...global.inlineBots.byUsername,\n [username]: inlineBotSettings,\n },\n },\n };\n}\n\nexport function replaceInlineBotsIsLoading(global: GlobalState, isLoading: boolean): GlobalState {\n return {\n ...global,\n inlineBots: {\n ...global.inlineBots,\n isLoading,\n },\n };\n}\n","import { IS_ANDROID, IS_IOS } from './environment';\n\nconst SHOULD_PRE_OPEN = IS_IOS || IS_ANDROID;\n\nexport default class PopupManager {\n private preOpened?: WindowProxy | null;\n\n constructor(private features?: string, private onFail?: NoneToVoidFunction) {\n }\n\n preOpenIfNeeded() {\n if (!SHOULD_PRE_OPEN) return;\n\n this.preOpened = window.open('about:blank', undefined, this.features);\n if (this.preOpened) {\n this.preOpened.blur();\n } else {\n this.onFail?.();\n }\n }\n\n open(url: string) {\n if (this.preOpened) {\n this.preOpened!.location.href = url;\n this.preOpened!.focus();\n this.preOpened = undefined;\n\n return;\n }\n\n if (!SHOULD_PRE_OPEN) {\n const popup = window.open(url, undefined, this.features);\n if (popup) {\n popup.focus();\n } else {\n this.onFail?.();\n }\n }\n }\n\n cancelPreOpen() {\n this.preOpened?.close();\n this.preOpened = undefined;\n }\n}\n","import {\n addActionHandler, getActions, getGlobal, setGlobal,\n} from '../../index';\n\nimport type {\n ApiChat, ApiContact, ApiUrlAuthResult, ApiUser,\n} from '../../../api/types';\nimport type { InlineBotSettings } from '../../../types';\n\nimport { callApi } from '../../../api/gramjs';\nimport {\n selectChat, selectChatBot, selectChatMessage, selectCurrentChat, selectCurrentMessageList,\n selectIsTrustedBot, selectReplyingToId, selectSendAs, selectUser,\n} from '../../selectors';\nimport { addChats, addUsers, removeBlockedContact } from '../../reducers';\nimport { buildCollectionByKey } from '../../../util/iteratees';\nimport { debounce } from '../../../util/schedulers';\nimport { replaceInlineBotSettings, replaceInlineBotsIsLoading } from '../../reducers/bots';\nimport { getServerTime } from '../../../util/serverTime';\nimport { extractCurrentThemeParams } from '../../../util/themeStyle';\nimport PopupManager from '../../../util/PopupManager';\n\nconst GAMEE_URL = 'https://prizes.gamee.com/';\nconst TOP_PEERS_REQUEST_COOLDOWN = 60; // 1 min\nconst runDebouncedForSearch = debounce((cb) => cb(), 500, false);\n\naddActionHandler('clickBotInlineButton', (global, actions, payload) => {\n const { messageId, button } = payload;\n\n switch (button.type) {\n case 'command':\n actions.sendBotCommand({ command: button.text });\n break;\n case 'url': {\n const { url } = button;\n actions.openUrl({ url });\n break;\n }\n case 'callback': {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n\n void answerCallbackButton(chat, messageId, button.data);\n break;\n }\n case 'requestPoll':\n actions.openPollModal({ isQuiz: button.isQuiz });\n break;\n case 'requestPhone': {\n const user = global.currentUserId ? selectUser(global, global.currentUserId) : undefined;\n if (!user) {\n return;\n }\n actions.showDialog({\n data: {\n phoneNumber: user.phoneNumber,\n firstName: user.firstName,\n lastName: user.lastName,\n userId: user.id,\n } as ApiContact,\n });\n break;\n }\n case 'receipt': {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n const { receiptMessageId } = button;\n actions.getReceipt({ receiptMessageId, chatId: chat.id, messageId });\n break;\n }\n case 'buy': {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n actions.openInvoice({\n chatId: chat.id,\n messageId,\n });\n break;\n }\n case 'game': {\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n\n void answerCallbackButton(chat, messageId, undefined, true);\n break;\n }\n case 'switchBotInline': {\n const { query, isSamePeer } = button;\n actions.switchBotInline({ query, isSamePeer, messageId });\n break;\n }\n\n case 'userProfile': {\n const { userId } = button;\n actions.openChatWithInfo({ id: userId });\n break;\n }\n\n case 'simpleWebView': {\n const { url } = button;\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return;\n }\n const message = selectChatMessage(global, chatId, messageId);\n if (!message?.senderId) return;\n const theme = extractCurrentThemeParams();\n actions.requestSimpleWebView({\n url, botId: message?.senderId, theme, buttonText: button.text,\n });\n break;\n }\n\n case 'webView': {\n const { url } = button;\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n const message = selectChatMessage(global, chat.id, messageId);\n if (!message) {\n return;\n }\n const botId = message.viaBotId || message.senderId;\n if (!botId) {\n return;\n }\n const theme = extractCurrentThemeParams();\n actions.requestWebView({\n url,\n botId,\n peerId: chat.id,\n theme,\n buttonText: button.text,\n });\n break;\n }\n case 'urlAuth': {\n const { url } = button;\n const chat = selectCurrentChat(global);\n if (!chat) {\n return;\n }\n actions.requestBotUrlAuth({\n chatId: chat.id,\n messageId,\n buttonId: button.buttonId,\n url,\n });\n break;\n }\n }\n});\n\naddActionHandler('sendBotCommand', (global, actions, payload) => {\n const { command, chatId } = payload;\n const { currentUserId } = global;\n const chat = chatId ? selectChat(global, chatId) : selectCurrentChat(global);\n const currentMessageList = selectCurrentMessageList(global);\n\n if (!currentUserId || !chat || !currentMessageList) {\n return;\n }\n\n const { threadId } = currentMessageList;\n actions.setReplyingToId({ messageId: undefined });\n actions.clearWebPagePreview({ chatId: chat.id, threadId, value: false });\n\n void sendBotCommand(\n chat, currentUserId, command, selectReplyingToId(global, chat.id, threadId), selectSendAs(global, chatId),\n );\n});\n\naddActionHandler('restartBot', async (global, actions, payload) => {\n const { chatId } = payload;\n const { currentUserId } = global;\n const chat = selectCurrentChat(global);\n const bot = currentUserId && selectChatBot(global, chatId);\n if (!currentUserId || !chat || !bot) {\n return;\n }\n\n const result = await callApi('unblockContact', bot.id, bot.accessHash);\n if (!result) {\n return;\n }\n\n setGlobal(removeBlockedContact(getGlobal(), bot.id));\n void sendBotCommand(chat, currentUserId, '/start', undefined, selectSendAs(global, chatId));\n});\n\naddActionHandler('loadTopInlineBots', async (global) => {\n const { lastRequestedAt } = global.topInlineBots;\n if (lastRequestedAt && getServerTime(global.serverTimeOffset) - lastRequestedAt < TOP_PEERS_REQUEST_COOLDOWN) {\n return;\n }\n\n const result = await callApi('fetchTopInlineBots');\n if (!result) {\n return;\n }\n\n const { ids, users } = result;\n\n global = getGlobal();\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = {\n ...global,\n topInlineBots: {\n ...global.topInlineBots,\n userIds: ids,\n lastRequestedAt: getServerTime(global.serverTimeOffset),\n },\n };\n setGlobal(global);\n});\n\naddActionHandler('queryInlineBot', async (global, actions, payload) => {\n const {\n chatId, username, query, offset,\n } = payload;\n\n let inlineBotData = global.inlineBots.byUsername[username];\n if (inlineBotData === false) {\n return;\n }\n\n if (inlineBotData === undefined) {\n const { user: inlineBot, chat } = await callApi('fetchInlineBot', { username }) || {};\n global = getGlobal();\n if (!inlineBot || !chat) {\n setGlobal(replaceInlineBotSettings(global, username, false));\n return;\n }\n\n global = addUsers(global, { [inlineBot.id]: inlineBot });\n global = addChats(global, { [chat.id]: chat });\n inlineBotData = {\n id: inlineBot.id,\n query: '',\n offset: '',\n switchPm: undefined,\n canLoadMore: true,\n results: [],\n };\n\n global = replaceInlineBotSettings(global, username, inlineBotData);\n setGlobal(global);\n }\n\n if (query === inlineBotData.query && !inlineBotData.canLoadMore) {\n return;\n }\n\n void runDebouncedForSearch(() => {\n searchInlineBot({\n username,\n inlineBotData: inlineBotData as InlineBotSettings,\n chatId,\n query,\n offset,\n });\n });\n});\n\naddActionHandler('switchBotInline', (global, actions, payload) => {\n const { query, isSamePeer, messageId } = payload;\n const chat = selectCurrentChat(global);\n if (!chat) {\n return undefined;\n }\n const message = selectChatMessage(global, chat.id, messageId);\n if (!message) {\n return undefined;\n }\n\n const botSender = selectChatBot(global, message.senderId!);\n if (!botSender) {\n return undefined;\n }\n\n const text = `@${botSender.username} ${query}`;\n\n if (isSamePeer) {\n actions.openChatWithText({ chatId: chat.id, text });\n return undefined;\n }\n\n return {\n ...global,\n switchBotInline: {\n query,\n botUsername: botSender.username,\n },\n };\n});\n\naddActionHandler('resetSwitchBotInline', (global) => {\n return {\n ...global,\n switchBotInline: undefined,\n };\n});\n\naddActionHandler('sendInlineBotResult', (global, actions, payload) => {\n const {\n id, queryId, isSilent, scheduledAt,\n } = payload;\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList || !id) {\n return;\n }\n\n const { chatId, threadId } = currentMessageList;\n\n const chat = selectChat(global, chatId)!;\n\n actions.setReplyingToId({ messageId: undefined });\n actions.clearWebPagePreview({ chatId, threadId, value: false });\n\n void callApi('sendInlineBotResult', {\n chat,\n resultId: id,\n queryId,\n replyingTo: selectReplyingToId(global, chatId, threadId),\n sendAs: selectSendAs(global, chatId),\n isSilent,\n scheduleDate: scheduledAt,\n });\n});\n\naddActionHandler('resetInlineBot', (global, actions, payload) => {\n const { username } = payload;\n\n let inlineBotData = global.inlineBots.byUsername[username];\n\n if (!inlineBotData) {\n return;\n }\n\n inlineBotData = {\n id: inlineBotData.id,\n query: '',\n offset: '',\n switchPm: undefined,\n canLoadMore: true,\n results: [],\n };\n\n setGlobal(replaceInlineBotSettings(global, username, inlineBotData));\n});\n\naddActionHandler('startBot', async (global, actions, payload) => {\n const { botId, param } = payload;\n\n let bot = selectUser(global, botId);\n if (!bot) {\n return;\n }\n if (!bot.fullInfo) await callApi('fetchFullUser', { id: bot.id, accessHash: bot.accessHash });\n bot = selectUser(getGlobal(), botId)!;\n if (bot.fullInfo?.isBlocked) await callApi('unblockContact', bot.id, bot.accessHash);\n\n await callApi('startBot', {\n bot,\n startParam: param,\n });\n});\n\naddActionHandler('requestSimpleWebView', async (global, actions, payload) => {\n const {\n url, botId, theme, buttonText,\n } = payload;\n\n const bot = selectUser(global, botId);\n if (!bot) return;\n\n if (!selectIsTrustedBot(global, botId)) {\n setGlobal({\n ...global,\n botTrustRequest: {\n botId,\n type: 'webApp',\n onConfirm: {\n action: 'requestSimpleWebView',\n payload,\n },\n },\n });\n return;\n }\n\n const webViewUrl = await callApi('requestSimpleWebView', { url, bot, theme });\n if (!webViewUrl) {\n return;\n }\n\n global = getGlobal();\n setGlobal({\n ...global,\n webApp: {\n url: webViewUrl,\n botId,\n buttonText,\n },\n });\n});\n\naddActionHandler('requestWebView', async (global, actions, payload) => {\n const {\n url, botId, peerId, theme, isSilent, buttonText, isFromBotMenu, startParam,\n } = payload;\n\n const bot = selectUser(global, botId);\n if (!bot) return;\n const peer = selectChat(global, peerId);\n if (!peer) return;\n\n if (!selectIsTrustedBot(global, botId)) {\n setGlobal({\n ...global,\n botTrustRequest: {\n botId,\n type: 'webApp',\n onConfirm: {\n action: 'requestWebView',\n payload,\n },\n },\n });\n return;\n }\n\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return;\n }\n\n const { chatId, threadId } = currentMessageList;\n const reply = chatId && selectReplyingToId(global, chatId, threadId);\n const sendAs = selectSendAs(global, chatId);\n const result = await callApi('requestWebView', {\n url,\n bot,\n peer,\n theme,\n isSilent,\n replyToMessageId: reply || undefined,\n isFromBotMenu,\n startParam,\n sendAs,\n });\n if (!result) {\n return;\n }\n\n const { url: webViewUrl, queryId } = result;\n\n global = getGlobal();\n setGlobal({\n ...global,\n webApp: {\n url: webViewUrl,\n botId,\n queryId,\n buttonText,\n },\n });\n});\n\naddActionHandler('prolongWebView', async (global, actions, payload) => {\n const {\n botId, peerId, isSilent, replyToMessageId, queryId,\n } = payload;\n\n const bot = selectUser(global, botId);\n if (!bot) return;\n const peer = selectChat(global, peerId);\n if (!peer) return;\n\n const sendAs = selectSendAs(global, peerId);\n\n const result = await callApi('prolongWebView', {\n bot,\n peer,\n isSilent,\n replyToMessageId,\n queryId,\n sendAs,\n });\n\n if (!result) {\n actions.closeWebApp();\n }\n});\n\naddActionHandler('sendWebViewData', (global, actions, payload) => {\n const {\n bot, data, buttonText,\n } = payload;\n\n callApi('sendWebViewData', {\n bot,\n data,\n buttonText,\n });\n});\n\naddActionHandler('closeWebApp', (global) => {\n return {\n ...global,\n webApp: undefined,\n };\n});\n\naddActionHandler('setWebAppPaymentSlug', (global, actions, payload) => {\n if (!global.webApp?.url) return undefined;\n return {\n ...global,\n webApp: {\n ...global.webApp,\n slug: payload.slug,\n },\n };\n});\n\naddActionHandler('cancelBotTrustRequest', (global) => {\n return {\n ...global,\n botTrustRequest: undefined,\n };\n});\n\naddActionHandler('markBotTrusted', (global, actions, payload) => {\n const { botId } = payload;\n const { trustedBotIds } = global;\n\n const newTrustedBotIds = new Set(trustedBotIds);\n newTrustedBotIds.add(botId);\n setGlobal({\n ...global,\n botTrustRequest: undefined,\n trustedBotIds: Array.from(newTrustedBotIds),\n });\n\n if (global.botTrustRequest?.onConfirm) {\n const { action, payload: callbackPayload } = global.botTrustRequest.onConfirm;\n actions[action](callbackPayload);\n }\n});\n\naddActionHandler('loadAttachMenuBots', async (global, actions, payload) => {\n const { hash } = payload || {};\n await loadAttachMenuBots(hash);\n});\n\naddActionHandler('toggleBotInAttachMenu', async (global, actions, payload) => {\n const { botId, isEnabled } = payload;\n\n const bot = selectUser(global, botId);\n\n if (!bot) return;\n\n await toggleBotInAttachMenu(bot, isEnabled);\n});\n\nasync function toggleBotInAttachMenu(bot: ApiUser, isEnabled: boolean) {\n await callApi('toggleBotInAttachMenu', { bot, isEnabled });\n await loadAttachMenuBots();\n}\n\nasync function loadAttachMenuBots(hash?: string) {\n const result = await callApi('loadAttachMenuBots', { hash });\n if (!result) {\n return;\n }\n\n const global = getGlobal();\n setGlobal({\n ...global,\n attachMenu: {\n hash: result.hash,\n bots: result.bots,\n },\n });\n}\n\naddActionHandler('callAttachMenuBot', (global, actions, payload) => {\n const {\n chatId, botId, isFromBotMenu, url, startParam,\n } = payload;\n const { attachMenu: { bots } } = global;\n if (!isFromBotMenu && !bots[botId]) {\n return {\n ...global,\n botAttachRequest: {\n botId,\n chatId,\n startParam,\n },\n };\n }\n const theme = extractCurrentThemeParams();\n actions.requestWebView({\n url,\n peerId: chatId,\n botId,\n theme,\n buttonText: '',\n isFromBotMenu,\n startParam,\n });\n\n return undefined;\n});\n\naddActionHandler('confirmBotAttachRequest', async (global, actions) => {\n const { botAttachRequest } = global;\n if (!botAttachRequest) return;\n\n const { botId, chatId, startParam } = botAttachRequest;\n\n setGlobal({\n ...global,\n botAttachRequest: undefined,\n });\n\n const bot = selectUser(global, botId);\n if (!bot) return;\n\n await toggleBotInAttachMenu(bot, true);\n\n actions.callAttachMenuBot({ chatId, botId, startParam });\n});\n\naddActionHandler('closeBotAttachRequestModal', (global) => {\n return {\n ...global,\n botAttachRequest: undefined,\n };\n});\n\naddActionHandler('requestBotUrlAuth', async (global, actions, payload) => {\n const {\n chatId, buttonId, messageId, url,\n } = payload;\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('requestBotUrlAuth', {\n chat,\n buttonId,\n messageId,\n });\n\n if (!result) return;\n global = getGlobal();\n setGlobal({\n ...global,\n urlAuth: {\n url,\n button: {\n buttonId,\n messageId,\n chatId: chat.id,\n },\n },\n });\n handleUrlAuthResult(url, result);\n});\n\naddActionHandler('acceptBotUrlAuth', async (global, actions, payload) => {\n const { isWriteAllowed } = payload;\n if (!global.urlAuth?.button) return;\n const {\n button, url,\n } = global.urlAuth;\n const { chatId, messageId, buttonId } = button;\n\n const chat = selectChat(global, chatId);\n if (!chat) {\n return;\n }\n\n const result = await callApi('acceptBotUrlAuth', {\n chat,\n messageId,\n buttonId,\n isWriteAllowed,\n });\n if (!result) return;\n handleUrlAuthResult(url, result);\n});\n\naddActionHandler('requestLinkUrlAuth', async (global, actions, payload) => {\n const { url } = payload;\n\n const result = await callApi('requestLinkUrlAuth', { url });\n if (!result) return;\n global = getGlobal();\n setGlobal({\n ...global,\n urlAuth: {\n url,\n },\n });\n handleUrlAuthResult(url, result);\n});\n\naddActionHandler('acceptLinkUrlAuth', async (global, actions, payload) => {\n const { isWriteAllowed } = payload;\n if (!global.urlAuth?.url) return;\n const { url } = global.urlAuth;\n\n const result = await callApi('acceptLinkUrlAuth', { url, isWriteAllowed });\n if (!result) return;\n handleUrlAuthResult(url, result);\n});\n\naddActionHandler('closeUrlAuthModal', (global) => {\n return {\n ...global,\n urlAuth: undefined,\n };\n});\n\nfunction handleUrlAuthResult(url: string, result: ApiUrlAuthResult) {\n if (result.type === 'request') {\n const global = getGlobal();\n if (!global.urlAuth) return;\n const { domain, bot, shouldRequestWriteAccess } = result;\n setGlobal({\n ...global,\n urlAuth: {\n ...global.urlAuth,\n request: {\n domain,\n botId: bot.id,\n shouldRequestWriteAccess,\n },\n },\n });\n return;\n }\n\n const siteUrl = result.type === 'accepted' ? result.url : url;\n window.open(siteUrl, '_blank', 'noopener');\n getActions().closeUrlAuthModal();\n}\n\nasync function searchInlineBot({\n username,\n inlineBotData,\n chatId,\n query,\n offset,\n}: {\n username: string;\n inlineBotData: InlineBotSettings;\n chatId: string;\n query: string;\n offset?: string;\n}) {\n let global = getGlobal();\n const bot = selectUser(global, inlineBotData.id);\n const chat = selectChat(global, chatId);\n if (!bot || !chat) {\n return;\n }\n\n const shouldReplaceSettings = inlineBotData.query !== query;\n global = replaceInlineBotsIsLoading(global, true);\n global = replaceInlineBotSettings(global, username, {\n ...inlineBotData,\n query,\n ...(shouldReplaceSettings && { offset: undefined, results: [] }),\n });\n setGlobal(global);\n\n const result = await callApi('fetchInlineBotResults', {\n bot,\n chat,\n query,\n offset: shouldReplaceSettings ? undefined : offset,\n });\n\n const newInlineBotData = global.inlineBots.byUsername[username];\n global = replaceInlineBotsIsLoading(getGlobal(), false);\n if (!result || !newInlineBotData || query !== newInlineBotData.query) {\n setGlobal(global);\n return;\n }\n\n const currentIds = new Set((newInlineBotData.results || []).map((data) => data.id));\n const newResults = result.results.filter((data) => !currentIds.has(data.id));\n\n global = replaceInlineBotSettings(global, username, {\n ...newInlineBotData,\n help: result.help,\n ...(newResults.length && { isGallery: result.isGallery }),\n ...(result.switchPm && { switchPm: result.switchPm }),\n canLoadMore: result.results.length > 0 && Boolean(result.nextOffset),\n results: newInlineBotData.offset === '' || newInlineBotData.offset === result.nextOffset\n ? result.results\n : (newInlineBotData.results || []).concat(newResults),\n offset: newResults.length ? result.nextOffset : '',\n });\n\n setGlobal(global);\n}\n\nasync function sendBotCommand(\n chat: ApiChat, currentUserId: string, command: string, replyingTo?: number, sendAs?: ApiChat | ApiUser,\n) {\n await callApi('sendMessage', {\n chat,\n text: command,\n replyingTo,\n sendAs,\n });\n}\n\nlet gameePopups: PopupManager | undefined;\n\nasync function answerCallbackButton(chat: ApiChat, messageId: number, data?: string, isGame = false) {\n const {\n showDialog, showNotification, openUrl, openGame,\n } = getActions();\n\n if (isGame) {\n if (!gameePopups) {\n gameePopups = new PopupManager('popup,width=800,height=600', () => {\n showNotification({ message: 'Allow browser to open popup window' });\n });\n }\n\n gameePopups.preOpenIfNeeded();\n }\n\n const result = await callApi('answerCallbackButton', {\n chatId: chat.id,\n accessHash: chat.accessHash,\n messageId,\n data,\n isGame,\n });\n\n if (!result) {\n return;\n }\n const { message, alert: isError, url } = result;\n\n if (isError) {\n showDialog({ data: { message: message || 'Error' } });\n } else if (message) {\n showNotification({ message });\n } else if (url) {\n if (isGame) {\n // Workaround for Gamee embedding bug\n if (url.includes(GAMEE_URL)) {\n gameePopups!.open(url);\n } else {\n gameePopups!.cancelPreOpen();\n openGame({ url, chatId: chat.id, messageId });\n }\n } else {\n openUrl({ url });\n }\n }\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { PaymentStep } from '../../../types';\nimport type { ApiChat, ApiRequestInputInvoice } from '../../../api/types';\n\nimport {\n selectPaymentRequestId,\n selectProviderPublishableKey,\n selectStripeCredentials,\n selectChatMessage,\n selectChat,\n selectPaymentFormId,\n selectProviderPublicToken,\n selectSmartGlocalCredentials,\n selectPaymentInputInvoice,\n} from '../../selectors';\nimport { callApi } from '../../../api/gramjs';\nimport { getStripeError } from '../../helpers';\nimport { buildQueryString } from '../../../util/requestQuery';\nimport { DEBUG_PAYMENT_SMART_GLOCAL } from '../../../config';\n\nimport {\n updateShippingOptions,\n setPaymentStep,\n setRequestInfoId,\n setPaymentForm,\n setStripeCardInfo,\n setReceipt,\n clearPayment,\n closeInvoice,\n setSmartGlocalCardInfo, addUsers, setInvoiceInfo,\n} from '../../reducers';\nimport { buildCollectionByKey } from '../../../util/iteratees';\n\naddActionHandler('validateRequestedInfo', (global, actions, payload) => {\n const { requestInfo, saveInfo } = payload;\n const inputInvoice = selectPaymentInputInvoice(global);\n if (!inputInvoice) return;\n if ('slug' in inputInvoice) {\n void validateRequestedInfo(inputInvoice, requestInfo, saveInfo);\n } else {\n const chat = selectChat(global, inputInvoice.chatId);\n if (!chat) return;\n void validateRequestedInfo({\n chat,\n messageId: inputInvoice.messageId,\n }, requestInfo, saveInfo);\n }\n});\n\nasync function validateRequestedInfo(inputInvoice: ApiRequestInputInvoice, requestInfo: any, shouldSave?: true) {\n const result = await callApi('validateRequestedInfo', {\n inputInvoice, requestInfo, shouldSave,\n });\n if (!result) {\n return;\n }\n\n const { id, shippingOptions } = result;\n if (!id) {\n return;\n }\n\n let global = setRequestInfoId(getGlobal(), id);\n if (shippingOptions) {\n global = updateShippingOptions(global, shippingOptions);\n global = setPaymentStep(global, PaymentStep.Shipping);\n } else {\n global = setPaymentStep(global, PaymentStep.PaymentInfo);\n }\n setGlobal(global);\n}\n\naddActionHandler('openInvoice', async (global, actions, payload) => {\n let invoice;\n if ('slug' in payload) {\n invoice = await getPaymentForm({ slug: payload.slug });\n } else {\n const chat = selectChat(global, payload.chatId);\n if (!chat) return;\n invoice = await getPaymentForm({\n chat,\n messageId: payload.messageId,\n });\n }\n if (!invoice) return;\n\n global = getGlobal();\n global = setInvoiceInfo(global, invoice);\n setGlobal({\n ...global,\n payment: {\n ...global.payment,\n inputInvoice: payload,\n isPaymentModalOpen: true,\n status: 'cancelled',\n },\n });\n});\n\nasync function getPaymentForm(inputInvoice: ApiRequestInputInvoice) {\n const result = await callApi('getPaymentForm', inputInvoice);\n if (!result) {\n return undefined;\n }\n const { form, invoice } = result;\n let global = setPaymentForm(getGlobal(), form);\n let step = PaymentStep.PaymentInfo;\n const {\n shippingAddressRequested, nameRequested, phoneRequested, emailRequested,\n } = global.payment.invoice || {};\n if (shippingAddressRequested || nameRequested || phoneRequested || emailRequested) {\n step = PaymentStep.ShippingInfo;\n }\n global = setPaymentStep(global, step);\n setGlobal(global);\n return invoice;\n}\n\naddActionHandler('getReceipt', (global, actions, payload) => {\n const { receiptMessageId, chatId, messageId } = payload;\n const chat = chatId && selectChat(global, chatId);\n if (!messageId || !receiptMessageId || !chat) {\n return;\n }\n\n void getReceipt(chat, messageId, receiptMessageId);\n});\n\nasync function getReceipt(chat: ApiChat, messageId: number, receiptMessageId: number) {\n const result = await callApi('getReceipt', chat, receiptMessageId);\n if (!result) {\n return;\n }\n\n let global = getGlobal();\n const message = selectChatMessage(global, chat.id, messageId);\n global = setReceipt(global, result, message);\n setGlobal(global);\n}\n\naddActionHandler('clearPaymentError', (global) => {\n setGlobal({\n ...global,\n payment: {\n ...global.payment,\n error: undefined,\n },\n });\n});\n\naddActionHandler('clearReceipt', (global) => {\n setGlobal({\n ...global,\n payment: {\n ...global.payment,\n receipt: undefined,\n },\n });\n});\n\naddActionHandler('sendCredentialsInfo', (global, actions, payload) => {\n const { nativeProvider } = global.payment;\n const { credentials } = payload;\n const { data } = credentials;\n\n if (nativeProvider === 'stripe') {\n const publishableKey = selectProviderPublishableKey(global);\n if (!publishableKey) {\n return;\n }\n void sendStripeCredentials(data, publishableKey);\n } else if (nativeProvider === 'smartglocal') {\n const publicToken = selectProviderPublicToken(global);\n if (!publicToken) {\n return;\n }\n void sendSmartGlocalCredentials(data, publicToken);\n }\n});\n\naddActionHandler('sendPaymentForm', (global, actions, payload) => {\n const { shippingOptionId, saveCredentials } = payload;\n const inputInvoice = selectPaymentInputInvoice(global);\n const formId = selectPaymentFormId(global);\n const requestInfoId = selectPaymentRequestId(global);\n const { nativeProvider } = global.payment;\n const publishableKey = nativeProvider === 'stripe'\n ? selectProviderPublishableKey(global) : selectProviderPublicToken(global);\n\n if (!inputInvoice || !publishableKey || !formId || !nativeProvider) {\n return undefined;\n }\n\n let requestInputInvoice;\n if ('slug' in inputInvoice) {\n requestInputInvoice = {\n slug: inputInvoice.slug,\n };\n } else {\n const chat = selectChat(global, inputInvoice.chatId);\n if (!chat) {\n return undefined;\n }\n\n requestInputInvoice = {\n chat,\n messageId: inputInvoice.messageId,\n };\n }\n\n void sendPaymentForm(requestInputInvoice, formId, {\n save: saveCredentials,\n data: nativeProvider === 'stripe' ? selectStripeCredentials(global) : selectSmartGlocalCredentials(global),\n }, requestInfoId, shippingOptionId);\n\n return {\n ...global,\n payment: {\n ...global.payment,\n status: 'pending',\n },\n };\n});\n\nasync function sendStripeCredentials(\n data: {\n cardNumber: string;\n cardholder?: string;\n expiryMonth: string;\n expiryYear: string;\n cvv: string;\n country: string;\n zip: string;\n },\n publishableKey: string,\n) {\n const query = buildQueryString({\n 'card[number]': data.cardNumber,\n 'card[exp_month]': data.expiryMonth,\n 'card[exp_year]': data.expiryYear,\n 'card[cvc]': data.cvv,\n 'card[address_zip]': data.zip,\n 'card[address_country]': data.country,\n });\n\n const response = await fetch(`https://api.stripe.com/v1/tokens${query}`, {\n method: 'POST',\n credentials: 'same-origin',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n Authorization: `Bearer ${publishableKey}`,\n },\n });\n const result = await response.json();\n if (result.error) {\n const error = getStripeError(result.error);\n const global = getGlobal();\n setGlobal({\n ...global,\n payment: {\n ...global.payment,\n status: 'failed',\n error: {\n ...error,\n },\n },\n });\n return;\n }\n let global = setStripeCardInfo(getGlobal(), {\n type: result.type,\n id: result.id,\n });\n global = setPaymentStep(global, PaymentStep.Checkout);\n setGlobal(global);\n}\n\nasync function sendSmartGlocalCredentials(\n data: {\n cardNumber: string;\n cardholder?: string;\n expiryMonth: string;\n expiryYear: string;\n cvv: string;\n },\n publicToken: string,\n) {\n const params = {\n card: {\n number: data.cardNumber.replace(/[^\\d]+/g, ''),\n expiration_month: data.expiryMonth,\n expiration_year: data.expiryYear,\n security_code: data.cvv.replace(/[^\\d]+/g, ''),\n },\n };\n const url = DEBUG_PAYMENT_SMART_GLOCAL\n ? 'https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card'\n : 'https://tgb.smart-glocal.com/cds/v1/tokenize/card';\n\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-PUBLIC-TOKEN': publicToken,\n },\n body: JSON.stringify(params),\n });\n const result = await response.json();\n\n if (result.status !== 'ok') {\n // TODO после получения документации сделать аналог getStripeError(result.error);\n const error = { description: 'payment error' };\n const global = getGlobal();\n setGlobal({\n ...global,\n payment: {\n ...global.payment,\n status: 'failed',\n error: {\n ...error,\n },\n },\n });\n return;\n }\n\n let global = setSmartGlocalCardInfo(getGlobal(), {\n type: 'card',\n token: result.data.token,\n });\n global = setPaymentStep(global, PaymentStep.Checkout);\n setGlobal(global);\n}\n\nasync function sendPaymentForm(\n inputInvoice: ApiRequestInputInvoice,\n formId: string,\n credentials: any,\n requestedInfoId?: string,\n shippingOptionId?: string,\n) {\n const result = await callApi('sendPaymentForm', {\n inputInvoice, formId, credentials, requestedInfoId, shippingOptionId,\n });\n\n if (result === true) {\n let global = clearPayment(getGlobal());\n global = {\n ...global,\n payment: {\n ...global.payment,\n status: 'paid',\n },\n };\n setGlobal(closeInvoice(global));\n }\n}\n\naddActionHandler('setPaymentStep', (global, actions, payload = {}) => {\n return setPaymentStep(global, payload.step || PaymentStep.ShippingInfo);\n});\n\naddActionHandler('closePremiumModal', (global, actions, payload) => {\n if (!global.premiumModal) return undefined;\n const { isClosed } = payload || {};\n return {\n ...global,\n premiumModal: {\n ...global.premiumModal,\n ...(isClosed && { isOpen: false }),\n isClosing: !isClosed,\n },\n };\n});\n\naddActionHandler('openPremiumModal', async (global, actions, payload) => {\n const {\n initialSection, fromUserId, isSuccess, isGift, monthsAmount, toUserId,\n } = payload || {};\n\n actions.loadPremiumStickers();\n\n const result = await callApi('fetchPremiumPromo');\n if (!result) return;\n\n global = getGlobal();\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n\n setGlobal({\n ...global,\n premiumModal: {\n promo: result.promo,\n initialSection,\n isOpen: true,\n fromUserId,\n toUserId,\n isGift,\n monthsAmount,\n isSuccess,\n },\n });\n});\n\naddActionHandler('openGiftPremiumModal', async (global, actions, payload) => {\n const { forUserId } = payload || {};\n const result = await callApi('fetchPremiumPromo');\n if (!result) return;\n\n global = getGlobal();\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n\n setGlobal({\n ...global,\n giftPremiumModal: {\n isOpen: true,\n forUserId,\n monthlyCurrency: result.promo.currency,\n monthlyAmount: result.promo.monthlyAmount,\n },\n });\n});\n\naddActionHandler('closeGiftPremiumModal', (global) => {\n setGlobal({\n ...global,\n giftPremiumModal: { isOpen: false },\n });\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { callApi } from '../../../api/gramjs';\nimport { replaceSettings, updateTwoFaSettings } from '../../reducers';\n\naddActionHandler('loadPasswordInfo', async (global) => {\n const result = await callApi('getPasswordInfo');\n if (!result) {\n return;\n }\n\n global = getGlobal();\n global = replaceSettings(global, { hasPassword: result.hasPassword });\n global = updateTwoFaSettings(global, { hint: result.hint });\n setGlobal(global);\n});\n\naddActionHandler('checkPassword', async (global, actions, payload) => {\n const { currentPassword, onSuccess } = payload;\n\n setGlobal(updateTwoFaSettings(global, { isLoading: true, error: undefined }));\n\n const isSuccess = await callApi('checkPassword', currentPassword);\n\n setGlobal(updateTwoFaSettings(getGlobal(), { isLoading: false }));\n\n if (isSuccess) {\n onSuccess();\n }\n});\n\naddActionHandler('clearPassword', async (global, actions, payload) => {\n const { currentPassword, onSuccess } = payload;\n\n setGlobal(updateTwoFaSettings(global, { isLoading: true, error: undefined }));\n\n const isSuccess = await callApi('clearPassword', currentPassword);\n\n setGlobal(updateTwoFaSettings(getGlobal(), { isLoading: false }));\n\n if (isSuccess) {\n onSuccess();\n }\n});\n\naddActionHandler('updatePassword', async (global, actions, payload) => {\n const {\n currentPassword, password, hint, email, onSuccess,\n } = payload;\n\n setGlobal(updateTwoFaSettings(global, { isLoading: true, error: undefined }));\n\n const isSuccess = await callApi('updatePassword', currentPassword, password, hint, email);\n\n setGlobal(updateTwoFaSettings(getGlobal(), { isLoading: false }));\n\n if (isSuccess) {\n onSuccess();\n }\n});\n\naddActionHandler('updateRecoveryEmail', async (global, actions, payload) => {\n const {\n currentPassword, email, onSuccess,\n } = payload;\n\n setGlobal(updateTwoFaSettings(global, { isLoading: true, error: undefined }));\n\n const isSuccess = await callApi('updateRecoveryEmail', currentPassword, email);\n\n setGlobal(updateTwoFaSettings(getGlobal(), { isLoading: false, waitingEmailCodeLength: undefined }));\n\n if (isSuccess) {\n onSuccess();\n }\n});\n\naddActionHandler('provideTwoFaEmailCode', (global, actions, payload) => {\n const { code } = payload;\n\n void callApi('provideRecoveryEmailCode', code);\n});\n\naddActionHandler('clearTwoFaError', (global) => {\n return updateTwoFaSettings(global, { error: undefined });\n});\n","export function buildQueryString(data: Record<string, string>) {\n const query = Object.keys(data).map((k) => `${k}=${data[k]}`).join('&');\n return query.length > 0 ? `?${query}` : '';\n}\n","import {\n MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN,\n MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,\n MOBILE_SCREEN_MAX_WIDTH,\n} from '../../../config';\n\nconst REM = 16; // px\nconst MAX_TOOLBAR_WIDTH = 32 * REM;\nconst MAX_MESSAGES_LIST_WIDTH = 45.5 * REM;\nexport const SIDE_COLUMN_MAX_WIDTH = 26.5 * REM;\nexport const MIN_LEFT_COLUMN_WIDTH = 18 * REM;\nconst UNPIN_BUTTON_WIDTH = 16.125 * REM;\n\nexport default function calculateMiddleFooterTransforms(windowWidth: number, canPost?: boolean) {\n const sidePadding = windowWidth <= MOBILE_SCREEN_MAX_WIDTH\n ? REM\n : 2 * REM;\n const messageListWidth = getMessageListWidth(windowWidth);\n const sendButtonWidth = windowWidth <= MOBILE_SCREEN_MAX_WIDTH\n ? 3.375 * REM\n : 4 * REM;\n\n const composerWidth = canPost\n ? messageListWidth - sidePadding - sendButtonWidth\n : messageListWidth - sidePadding;\n const toolbarWidth = windowWidth > MOBILE_SCREEN_MAX_WIDTH\n ? Math.min(messageListWidth - sidePadding, MAX_TOOLBAR_WIDTH)\n : messageListWidth - sidePadding;\n\n const composerHiddenScale = toolbarWidth / composerWidth;\n const toolbarHiddenScale = composerWidth / toolbarWidth;\n const unpinHiddenScale = toolbarWidth / UNPIN_BUTTON_WIDTH;\n const toolbarForUnpinHiddenScale = UNPIN_BUTTON_WIDTH / toolbarWidth;\n\n const composerTranslateX = canPost\n ? (sendButtonWidth / 2) * toolbarHiddenScale\n : 0;\n\n const toolbarTranslateX = canPost\n ? (sendButtonWidth / 2) * -1 * composerHiddenScale\n : 0;\n\n return {\n composerHiddenScale,\n toolbarHiddenScale,\n composerTranslateX,\n toolbarTranslateX,\n unpinHiddenScale,\n toolbarForUnpinHiddenScale,\n };\n}\n\nfunction getMessageListWidth(windowWidth: number) {\n if (windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN) {\n const leftColumnWidth = Math.min(\n Math.max(windowWidth * 0.25, MIN_LEFT_COLUMN_WIDTH),\n SIDE_COLUMN_MAX_WIDTH,\n );\n\n const rightColumnWidth = Math.min(\n windowWidth * 0.25,\n SIDE_COLUMN_MAX_WIDTH,\n );\n\n return Math.min(\n windowWidth - leftColumnWidth - rightColumnWidth,\n MAX_MESSAGES_LIST_WIDTH,\n );\n }\n\n if (windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN) {\n const leftColumnWidth = Math.min(\n Math.max(windowWidth * 0.4, MIN_LEFT_COLUMN_WIDTH),\n SIDE_COLUMN_MAX_WIDTH,\n );\n\n return Math.min(\n windowWidth - leftColumnWidth,\n MAX_MESSAGES_LIST_WIDTH,\n );\n }\n\n if (windowWidth > MAX_MESSAGES_LIST_WIDTH) {\n return MAX_MESSAGES_LIST_WIDTH;\n }\n\n return windowWidth;\n}\n","import { updateChatMessage } from './messages';\nimport type { GlobalState } from '../types';\nimport { selectChatMessage } from '../selectors';\nimport { MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN } from '../../config';\nimport {\n MIN_LEFT_COLUMN_WIDTH,\n SIDE_COLUMN_MAX_WIDTH,\n} from '../../components/middle/helpers/calculateMiddleFooterTransforms';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport windowSize from '../../util/windowSize';\nimport { updateChat } from './chats';\nimport type { ApiChat } from '../../api/types';\n\nfunction getLeftColumnWidth(windowWidth: number) {\n if (windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN) {\n return Math.min(\n Math.max(windowWidth * 0.25, MIN_LEFT_COLUMN_WIDTH),\n windowWidth * 0.33,\n );\n }\n\n if (windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN) {\n return Math.min(\n Math.max(windowWidth * 0.33, MIN_LEFT_COLUMN_WIDTH),\n windowWidth * 0.4,\n );\n }\n\n return SIDE_COLUMN_MAX_WIDTH;\n}\n\nexport function subtractXForEmojiInteraction(global: GlobalState, x: number) {\n return x - ((global.isLeftColumnShown && !IS_SINGLE_COLUMN_LAYOUT)\n ? global.leftColumnWidth || getLeftColumnWidth(windowSize.get().width)\n : 0);\n}\n\nexport function addMessageReaction(global: GlobalState, chatId: string, messageId: number, reaction: string) {\n const { reactions } = selectChatMessage(global, chatId, messageId) || {};\n\n if (!reactions) {\n return global;\n }\n\n // Update UI without waiting for server response\n let results = reactions.results.map((l) => (l.reaction === reaction\n ? {\n ...l,\n count: l.isChosen ? l.count : l.count + 1,\n isChosen: true,\n } : (l.isChosen ? {\n ...l,\n isChosen: false,\n count: l.count - 1,\n } : l)))\n .filter((l) => l.count > 0);\n\n let { recentReactions } = reactions;\n\n if (reaction && !results.some((l) => l.reaction === reaction)) {\n const { currentUserId } = global;\n\n results = [...results, {\n reaction,\n isChosen: true,\n count: 1,\n }];\n\n if (reactions.canSeeList) {\n recentReactions = [...(recentReactions || []), {\n userId: currentUserId!,\n reaction,\n }];\n }\n }\n\n return updateChatMessage(global, chatId, messageId, {\n reactions: {\n ...reactions,\n results,\n recentReactions,\n },\n });\n}\n\nexport function updateUnreadReactions(\n global: GlobalState, chatId: string, update: Pick<ApiChat, 'unreadReactionsCount' | 'unreadReactions'>,\n) {\n return updateChat(global, chatId, update, undefined, true);\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\nimport { callApi } from '../../../api/gramjs';\nimport * as mediaLoader from '../../../util/mediaLoader';\nimport type { ApiAppConfig } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\nimport {\n selectChat,\n selectChatMessage, selectCurrentChat,\n selectDefaultReaction,\n selectLocalAnimatedEmojiEffectByName,\n selectMessageIdsByGroupId,\n} from '../../selectors';\nimport { addMessageReaction, subtractXForEmojiInteraction, updateUnreadReactions } from '../../reducers/reactions';\nimport {\n addChatMessagesById, addChats, addUsers, updateChatMessage,\n} from '../../reducers';\nimport { buildCollectionByKey, omit } from '../../../util/iteratees';\nimport { ANIMATION_LEVEL_MAX } from '../../../config';\nimport { isMessageLocal } from '../../helpers';\n\nconst INTERACTION_RANDOM_OFFSET = 40;\n\nlet interactionLocalId = 0;\n\naddActionHandler('loadAvailableReactions', async () => {\n const result = await callApi('getAvailableReactions');\n if (!result) {\n return;\n }\n\n // Preload animations\n result.forEach((availableReaction) => {\n if (availableReaction.aroundAnimation) {\n mediaLoader.fetch(`sticker${availableReaction.aroundAnimation.id}`, ApiMediaFormat.BlobUrl);\n }\n if (availableReaction.centerIcon) {\n mediaLoader.fetch(`sticker${availableReaction.centerIcon.id}`, ApiMediaFormat.BlobUrl);\n }\n });\n\n setGlobal({\n ...getGlobal(),\n availableReactions: result,\n });\n});\n\naddActionHandler('interactWithAnimatedEmoji', (global, actions, payload) => {\n const {\n emoji, x, y, localEffect, startSize, isReversed,\n } = payload!;\n\n const activeEmojiInteraction = {\n id: interactionLocalId++,\n animatedEffect: emoji || localEffect,\n x: subtractXForEmojiInteraction(global, x) + Math.random()\n * INTERACTION_RANDOM_OFFSET - INTERACTION_RANDOM_OFFSET / 2,\n y: y + Math.random() * INTERACTION_RANDOM_OFFSET - INTERACTION_RANDOM_OFFSET / 2,\n startSize,\n isReversed,\n };\n\n return {\n ...global,\n activeEmojiInteractions: [...(global.activeEmojiInteractions || []), activeEmojiInteraction],\n };\n});\n\naddActionHandler('sendEmojiInteraction', (global, actions, payload) => {\n const {\n messageId, chatId, emoji, interactions, localEffect,\n } = payload!;\n\n const chat = selectChat(global, chatId);\n\n if (!chat || (!emoji && !localEffect) || chatId === global.currentUserId) {\n return;\n }\n\n void callApi('sendEmojiInteraction', {\n chat,\n messageId,\n emoticon: emoji || selectLocalAnimatedEmojiEffectByName(localEffect),\n timestamps: interactions,\n });\n});\n\naddActionHandler('sendDefaultReaction', (global, actions, payload) => {\n const {\n chatId, messageId, x, y,\n } = payload;\n const reaction = selectDefaultReaction(global, chatId);\n const message = selectChatMessage(global, chatId, messageId);\n\n if (!reaction || !message || isMessageLocal(message)) return;\n\n actions.sendReaction({\n chatId,\n messageId,\n reaction,\n x,\n y,\n });\n});\n\naddActionHandler('sendReaction', (global, actions, payload) => {\n const {\n chatId,\n }: { chatId: string } = payload;\n let { messageId } = payload;\n\n let { reaction } = payload;\n\n const chat = selectChat(global, chatId);\n let message = selectChatMessage(global, chatId, messageId);\n\n if (!chat || !message) {\n return undefined;\n }\n\n const isInDocumentGroup = Boolean(message.groupedId) && !message.isInAlbum;\n const documentGroupFirstMessageId = isInDocumentGroup\n ? selectMessageIdsByGroupId(global, chatId, message.groupedId!)![0]\n : undefined;\n message = isInDocumentGroup\n ? selectChatMessage(global, chatId, documentGroupFirstMessageId!) || message\n : message;\n messageId = message?.id || messageId;\n\n if (message.reactions?.results?.some((l) => l.reaction === reaction && l.isChosen)) {\n reaction = undefined;\n }\n\n void callApi('sendReaction', { chat, messageId, reaction });\n\n const { animationLevel } = global.settings.byKey;\n\n if (animationLevel === ANIMATION_LEVEL_MAX) {\n global = {\n ...global,\n activeReactions: {\n ...(reaction ? global.activeReactions : omit(global.activeReactions, [messageId])),\n ...(reaction && {\n [messageId]: {\n reaction,\n messageId,\n },\n }),\n },\n };\n }\n\n return addMessageReaction(global, chatId, messageId, reaction);\n});\n\naddActionHandler('openChat', (global) => {\n return {\n ...global,\n activeReactions: {},\n };\n});\n\naddActionHandler('stopActiveReaction', (global, actions, payload) => {\n const { messageId, reaction } = payload;\n\n if (global.activeReactions[messageId]?.reaction !== reaction) {\n return global;\n }\n\n return {\n ...global,\n activeReactions: omit(global.activeReactions, [messageId]),\n };\n});\n\naddActionHandler('setDefaultReaction', async (global, actions, payload) => {\n const { reaction } = payload;\n\n const result = await callApi('setDefaultReaction', { reaction });\n if (!result) {\n return;\n }\n\n setGlobal({\n ...getGlobal(),\n appConfig: {\n ...global.appConfig,\n defaultReaction: reaction,\n } as ApiAppConfig,\n });\n});\n\naddActionHandler('stopActiveEmojiInteraction', (global, actions, payload) => {\n const { id } = payload;\n\n return {\n ...global,\n activeEmojiInteractions: global.activeEmojiInteractions?.filter((l) => l.id !== id),\n };\n});\n\naddActionHandler('loadReactors', async (global, actions, payload) => {\n const { chatId, messageId, reaction } = payload;\n const chat = selectChat(global, chatId);\n const message = selectChatMessage(global, chatId, messageId);\n if (!chat || !message) {\n return;\n }\n\n const offset = message.reactors?.nextOffset;\n const result = await callApi('fetchMessageReactionsList', {\n reaction,\n chat,\n messageId,\n offset,\n });\n\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n if (result.users?.length) {\n global = addUsers(global, buildCollectionByKey(result.users, 'id'));\n }\n\n const { nextOffset, count, reactions } = result;\n\n setGlobal(updateChatMessage(global, chatId, messageId, {\n reactors: {\n nextOffset,\n count,\n reactions: [\n ...(message.reactors?.reactions || []),\n ...reactions,\n ],\n },\n }));\n});\n\naddActionHandler('loadMessageReactions', (global, actions, payload) => {\n const { ids, chatId } = payload;\n\n const chat = selectChat(global, chatId);\n\n if (!chat) {\n return;\n }\n\n callApi('fetchMessageReactions', { ids, chat });\n});\n\naddActionHandler('sendWatchingEmojiInteraction', (global, actions, payload) => {\n const {\n chatId, emoticon, x, y, startSize, isReversed, id,\n } = payload;\n\n const chat = selectChat(global, chatId);\n\n if (!chat || !global.activeEmojiInteractions?.some((l) => l.id === id) || chatId === global.currentUserId) {\n return undefined;\n }\n\n callApi('sendWatchingEmojiInteraction', { chat, emoticon });\n\n return {\n ...global,\n activeEmojiInteractions: global.activeEmojiInteractions.map((activeEmojiInteraction) => {\n if (activeEmojiInteraction.id === id) {\n return {\n ...activeEmojiInteraction,\n x: subtractXForEmojiInteraction(global, x),\n y,\n startSize,\n isReversed,\n };\n }\n return activeEmojiInteraction;\n }),\n };\n});\n\naddActionHandler('fetchUnreadReactions', async (global, actions, payload) => {\n const { chatId, offsetId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat) return;\n\n const result = await callApi('fetchUnreadReactions', { chat, offsetId, addOffset: offsetId ? -1 : undefined });\n\n // Server side bug, when server returns unread reactions count > 0 for deleted messages\n if (!result || !result.messages.length) {\n global = getGlobal();\n global = updateUnreadReactions(global, chatId, {\n unreadReactionsCount: 0,\n });\n\n setGlobal(global);\n return;\n }\n\n const { messages, chats, users } = result;\n\n const byId = buildCollectionByKey(messages, 'id');\n const ids = Object.keys(byId).map(Number);\n\n global = getGlobal();\n global = addChatMessagesById(global, chat.id, byId);\n global = addUsers(global, buildCollectionByKey(users, 'id'));\n global = addChats(global, buildCollectionByKey(chats, 'id'));\n global = updateUnreadReactions(global, chatId, {\n unreadReactions: [...(chat.unreadReactions || []), ...ids],\n });\n\n setGlobal(global);\n});\n\naddActionHandler('animateUnreadReaction', (global, actions, payload) => {\n const { messageIds } = payload;\n\n const { animationLevel } = global.settings.byKey;\n\n const chat = selectCurrentChat(global);\n if (!chat) return undefined;\n\n if (chat.unreadReactionsCount) {\n const unreadReactionsCount = chat.unreadReactionsCount - messageIds.length;\n const unreadReactions = (chat.unreadReactions || []).filter((id) => !messageIds.includes(id));\n\n global = updateUnreadReactions(global, chat.id, {\n unreadReactions,\n });\n\n setGlobal(global);\n\n if (!unreadReactions.length && unreadReactionsCount) {\n actions.fetchUnreadReactions({ chatId: chat.id, offsetId: Math.min(...messageIds) });\n }\n }\n\n actions.markMessagesRead({ messageIds });\n\n if (animationLevel !== ANIMATION_LEVEL_MAX) return undefined;\n\n global = getGlobal();\n\n return {\n ...global,\n activeReactions: {\n ...global.activeReactions,\n ...Object.fromEntries(messageIds.map((messageId) => {\n const message = selectChatMessage(global, chat.id, messageId);\n\n if (!message) return undefined;\n\n const unread = message.reactions?.recentReactions?.find((l) => l.isUnread);\n\n if (!unread) return undefined;\n\n const reaction = unread?.reaction;\n\n return [messageId, {\n messageId,\n reaction,\n }];\n }).filter(Boolean)),\n },\n };\n});\n\naddActionHandler('focusNextReaction', (global, actions) => {\n const chat = selectCurrentChat(global);\n\n if (!chat?.unreadReactions) return;\n\n actions.focusMessage({ chatId: chat.id, messageId: chat.unreadReactions[0] });\n});\n\naddActionHandler('readAllReactions', (global) => {\n const chat = selectCurrentChat(global);\n if (!chat) return undefined;\n\n callApi('readAllReactions', { chat });\n\n return updateUnreadReactions(global, chat.id, {\n unreadReactionsCount: undefined,\n unreadReactions: undefined,\n });\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type { ApiChannelStatistics } from '../../../api/types';\nimport { callApi } from '../../../api/gramjs';\nimport { updateStatistics, updateMessageStatistics, updateStatisticsGraph } from '../../reducers';\nimport { selectChatMessages, selectChat } from '../../selectors';\n\naddActionHandler('loadStatistics', async (global, actions, payload) => {\n const { chatId, isGroup } = payload;\n const chat = selectChat(global, chatId);\n if (!chat?.fullInfo) {\n return;\n }\n\n const result = await callApi(isGroup ? 'fetchGroupStatistics' : 'fetchChannelStatistics', { chat });\n if (!result) {\n return;\n }\n\n global = getGlobal();\n\n if ((result as ApiChannelStatistics).recentTopMessages?.length) {\n const messages = selectChatMessages(global, chatId);\n\n (result as ApiChannelStatistics).recentTopMessages = (result as ApiChannelStatistics).recentTopMessages\n .map((message) => ({ ...message, ...messages[message.msgId] }));\n }\n\n setGlobal(updateStatistics(global, chatId, result));\n});\n\naddActionHandler('loadMessageStatistics', async (global, actions, payload) => {\n const { chatId, messageId } = payload;\n const chat = selectChat(global, chatId);\n if (!chat?.fullInfo) {\n return;\n }\n\n let result = await callApi('fetchMessageStatistics', { chat, messageId });\n if (!result) {\n result = {};\n }\n\n global = getGlobal();\n\n const { views, forwards } = selectChatMessages(global, chatId)[messageId];\n result.views = views;\n result.forwards = forwards;\n\n const dcId = chat.fullInfo!.statisticsDcId;\n const publicForwards = await callApi('fetchMessagePublicForwards', { chat, messageId, dcId });\n result.publicForwards = publicForwards?.length;\n result.publicForwardsData = publicForwards;\n\n global = getGlobal();\n\n setGlobal(updateMessageStatistics(global, result));\n});\n\naddActionHandler('loadStatisticsAsyncGraph', async (global, actions, payload) => {\n const {\n chatId, token, name, isPercentage,\n } = payload;\n const chat = selectChat(global, chatId);\n if (!chat?.fullInfo) {\n return;\n }\n\n const dcId = chat.fullInfo!.statisticsDcId;\n const result = await callApi('fetchStatisticsAsyncGraph', { token, dcId, isPercentage });\n\n if (!result) {\n return;\n }\n\n setGlobal(updateStatisticsGraph(getGlobal(), chatId, name, result));\n});\n","export function areDeepEqual<T extends any>(value1: T, value2: T): boolean {\n const type1 = typeof value1;\n const type2 = typeof value2;\n if (type1 !== type2) {\n return false;\n }\n\n if (type1 !== 'object') {\n return value1 === value2;\n }\n\n const isArray1 = Array.isArray(value1);\n const isArray2 = Array.isArray(value2);\n\n if (isArray1 !== isArray2) {\n return false;\n }\n\n if (isArray1) {\n const array1 = value1 as any[];\n const array2 = value2 as any[];\n\n if (array1.length !== array2.length) {\n return false;\n }\n\n return array1.every((member1, i) => areDeepEqual(member1, array2[i]));\n }\n\n const object1 = value1 as AnyLiteral;\n const object2 = value2 as AnyLiteral;\n const keys1 = Object.keys(object1);\n\n return keys1.every((key1) => areDeepEqual(object1[key1], object2[key1]));\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { MAIN_THREAD_ID } from '../../../api/types';\n\nimport { ARCHIVED_FOLDER_ID, MAX_ACTIVE_PINNED_CHATS } from '../../../config';\nimport { pick } from '../../../util/iteratees';\nimport { closeMessageNotifications, notifyAboutMessage } from '../../../util/notifications';\nimport {\n updateChat,\n updateChatListIds,\n updateChatListType,\n replaceThreadParam,\n leaveChat,\n} from '../../reducers';\nimport {\n selectChat,\n selectCommonBoxChatId,\n selectIsChatListed,\n selectChatListType,\n selectCurrentMessageList,\n} from '../../selectors';\nimport { updateUnreadReactions } from '../../reducers/reactions';\n\nconst TYPING_STATUS_CLEAR_DELAY = 6000; // 6 seconds\n// Enough to animate and mark as read in Message List\nconst CURRENT_CHAT_UNREAD_DELAY = 1500;\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updateChat': {\n setGlobal(updateChat(global, update.id, update.chat, update.newProfilePhoto));\n\n if (!update.noTopChatsRequest && !selectIsChatListed(global, update.id)) {\n // Chat can appear in dialogs list.\n actions.loadTopChats();\n }\n\n if (update.chat.id) {\n closeMessageNotifications({\n chatId: update.chat.id,\n lastReadInboxMessageId: update.chat.lastReadInboxMessageId,\n });\n }\n\n return undefined;\n }\n\n case 'updateChatJoin': {\n const listType = selectChatListType(global, update.id);\n if (!listType) {\n return undefined;\n }\n\n global = updateChatListIds(global, listType, [update.id]);\n global = updateChat(global, update.id, { isNotJoined: false });\n setGlobal(global);\n\n const chat = selectChat(global, update.id);\n if (chat) {\n actions.requestChatUpdate({ chatId: chat.id });\n }\n\n return undefined;\n }\n\n case 'updateChatLeave': {\n return leaveChat(global, update.id);\n }\n\n case 'updateChatInbox': {\n return updateChat(global, update.id, update.chat);\n }\n\n case 'updateChatTypingStatus': {\n const { id, typingStatus } = update;\n setGlobal(updateChat(global, id, { typingStatus }));\n\n setTimeout(() => {\n global = getGlobal();\n const chat = selectChat(global, id);\n if (chat && typingStatus && chat.typingStatus && chat.typingStatus.timestamp === typingStatus.timestamp) {\n setGlobal(updateChat(global, id, { typingStatus: undefined }));\n }\n }, TYPING_STATUS_CLEAR_DELAY);\n\n return undefined;\n }\n\n case 'newMessage': {\n const { message } = update;\n const { chatId: currentChatId, threadId, type: messageListType } = selectCurrentMessageList(global) || {};\n\n if (message.senderId === global.currentUserId && !message.isFromScheduled) {\n return undefined;\n }\n\n const chat = selectChat(global, update.chatId);\n if (!chat) {\n return undefined;\n }\n\n const isActiveChat = (\n messageListType === 'thread'\n && threadId === MAIN_THREAD_ID\n && update.chatId === currentChatId\n );\n\n if (isActiveChat) {\n setTimeout(() => {\n actions.requestChatUpdate({ chatId: update.chatId });\n }, CURRENT_CHAT_UNREAD_DELAY);\n }\n\n setGlobal(updateChat(global, update.chatId, {\n unreadCount: chat.unreadCount ? chat.unreadCount + 1 : 1,\n ...(update.message.id && update.message.hasUnreadMention && {\n unreadMentionsCount: (chat.unreadMentionsCount || 0) + 1,\n unreadMentions: [...(chat.unreadMentions || []), update.message.id],\n }),\n }));\n\n notifyAboutMessage({\n chat,\n message,\n });\n\n return undefined;\n }\n\n case 'updateCommonBoxMessages':\n case 'updateChannelMessages': {\n const { ids, messageUpdate } = update;\n if (messageUpdate.hasUnreadMention !== false) {\n return undefined;\n }\n\n ids.forEach((id) => {\n const chatId = ('channelId' in update ? update.channelId : selectCommonBoxChatId(global, id))!;\n const chat = selectChat(global, chatId);\n\n if (chat?.unreadReactionsCount) {\n global = updateUnreadReactions(global, chatId, {\n unreadReactionsCount: (chat.unreadReactionsCount - 1) || undefined,\n unreadReactions: chat.unreadReactions?.filter((i) => i !== id),\n });\n }\n\n if (chat?.unreadMentionsCount) {\n global = updateChat(global, chatId, {\n unreadMentionsCount: (chat.unreadMentionsCount - 1) || undefined,\n unreadMentions: chat.unreadMentions?.filter((i) => i !== id),\n });\n }\n });\n\n return global;\n }\n\n case 'updateChatFullInfo': {\n const { fullInfo } = update;\n const targetChat = global.chats.byId[update.id];\n if (!targetChat) {\n return undefined;\n }\n\n return updateChat(global, update.id, {\n fullInfo: {\n ...targetChat.fullInfo,\n ...fullInfo,\n },\n });\n }\n\n case 'updatePinnedChatIds': {\n const { ids, folderId } = update;\n const listType = folderId === ARCHIVED_FOLDER_ID ? 'archived' : 'active';\n\n return {\n ...global,\n chats: {\n ...global.chats,\n orderedPinnedIds: {\n ...global.chats.orderedPinnedIds,\n [listType]: ids.length ? ids : undefined,\n },\n },\n };\n }\n\n case 'updateChatPinned': {\n const { id, isPinned } = update;\n const listType = selectChatListType(global, id);\n if (!listType) {\n return undefined;\n }\n\n const { [listType]: orderedPinnedIds } = global.chats.orderedPinnedIds;\n\n let newOrderedPinnedIds = orderedPinnedIds || [];\n if (!isPinned) {\n newOrderedPinnedIds = newOrderedPinnedIds.filter((pinnedId) => pinnedId !== id);\n } else if (!newOrderedPinnedIds.includes(id)) {\n // When moving pinned chats to archive, active ordered pinned ids don't get updated\n // (to preserve chat pinned state when it returns from archive)\n // If user already has max pinned chats, we should check for orderedIds\n // that don't point to listed chats\n if (listType === 'active' && newOrderedPinnedIds.length >= MAX_ACTIVE_PINNED_CHATS) {\n const listIds = global.chats.listIds.active;\n newOrderedPinnedIds = newOrderedPinnedIds.filter((pinnedId) => listIds && listIds.includes(pinnedId));\n }\n\n newOrderedPinnedIds = [id, ...newOrderedPinnedIds];\n }\n\n return {\n ...global,\n chats: {\n ...global.chats,\n orderedPinnedIds: {\n ...global.chats.orderedPinnedIds,\n [listType]: newOrderedPinnedIds.length ? newOrderedPinnedIds : undefined,\n },\n },\n };\n }\n\n case 'updateChatListType': {\n const { id, folderId } = update;\n\n return updateChatListType(global, id, folderId);\n }\n\n case 'updateChatFolder': {\n const { id, folder } = update;\n const { byId: chatFoldersById, orderedIds } = global.chatFolders;\n\n const newChatFoldersById = folder\n ? { ...chatFoldersById, [id]: folder }\n : pick(\n chatFoldersById,\n Object.keys(chatFoldersById).map(Number).filter((folderId) => folderId !== id),\n );\n\n const newOrderedIds = folder\n ? orderedIds && orderedIds.includes(id) ? orderedIds : [...(orderedIds || []), id]\n : orderedIds ? orderedIds.filter((orderedId) => orderedId !== id) : undefined;\n\n return {\n ...global,\n chatFolders: {\n ...global.chatFolders,\n byId: newChatFoldersById,\n orderedIds: newOrderedIds,\n },\n };\n }\n\n case 'updateChatFoldersOrder': {\n const { orderedIds } = update;\n\n return {\n ...global,\n chatFolders: {\n ...global.chatFolders,\n orderedIds,\n },\n };\n }\n\n case 'updateRecommendedChatFolders': {\n const { folders } = update;\n\n return {\n ...global,\n chatFolders: {\n ...global.chatFolders,\n recommended: folders,\n },\n };\n }\n\n case 'updateChatMembers': {\n const targetChat = global.chats.byId[update.id];\n const { replacedMembers, addedMember, deletedMemberId } = update;\n if (!targetChat) {\n return undefined;\n }\n\n let shouldUpdate = false;\n let members = targetChat.fullInfo?.members\n ? [...targetChat.fullInfo.members]\n : [];\n\n if (replacedMembers) {\n members = replacedMembers;\n shouldUpdate = true;\n } else if (addedMember) {\n if (\n !members.length\n || !members.some((m) => m.userId === addedMember.userId)\n ) {\n members.push(addedMember);\n shouldUpdate = true;\n }\n } else if (members.length && deletedMemberId) {\n const deleteIndex = members.findIndex((m) => m.userId === deletedMemberId);\n if (deleteIndex > -1) {\n members.slice(deleteIndex, 1);\n shouldUpdate = true;\n }\n }\n\n if (shouldUpdate) {\n const adminMembers = members.filter(({ isOwner, isAdmin }) => isOwner || isAdmin);\n // TODO Kicked members?\n\n return updateChat(global, update.id, {\n membersCount: members.length,\n fullInfo: {\n ...targetChat.fullInfo,\n members,\n adminMembers,\n },\n });\n }\n\n return undefined;\n }\n\n case 'deleteProfilePhotos': {\n const { chatId, ids } = update;\n const chat = global.chats.byId[chatId];\n\n if (chat?.photos) {\n return updateChat(global, chatId, {\n photos: chat.photos.filter((photo) => !ids.includes(photo.id)),\n });\n }\n\n return undefined;\n }\n\n case 'draftMessage': {\n const {\n chatId, formattedText, date, replyingToId,\n } = update;\n const chat = global.chats.byId[chatId];\n if (!chat) {\n return undefined;\n }\n\n global = replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'draft', formattedText);\n global = replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'replyingToId', replyingToId);\n global = updateChat(global, chatId, { draftDate: date });\n return global;\n }\n\n case 'showInvite': {\n const { data } = update;\n\n actions.showDialog({ data });\n\n return undefined;\n }\n\n case 'updatePendingJoinRequests': {\n const { chatId, requestsPending, recentRequesterIds } = update;\n const chat = global.chats.byId[chatId];\n if (!chat) {\n return undefined;\n }\n\n global = updateChat(global, chatId, {\n fullInfo: {\n ...chat.fullInfo,\n requestsPending,\n recentRequesterIds,\n },\n });\n setGlobal(global);\n\n actions.loadChatJoinRequests({ chatId });\n }\n }\n\n return undefined;\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type {\n ApiChat,\n ApiMessage, ApiPollResult, ApiReactions, ApiThreadInfo,\n} from '../../../api/types';\nimport type { ActiveEmojiInteraction, GlobalActions, GlobalState } from '../../types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\n\nimport { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config';\nimport { unique } from '../../../util/iteratees';\nimport { areDeepEqual } from '../../../util/areDeepEqual';\nimport { notifyAboutMessage } from '../../../util/notifications';\nimport {\n updateChat,\n deleteChatMessages,\n updateChatMessage,\n updateListedIds,\n addViewportId,\n updateThreadInfo,\n replaceThreadParam,\n updateScheduledMessage,\n deleteChatScheduledMessages,\n updateThreadUnreadFromForwardedMessage,\n} from '../../reducers';\nimport {\n selectChatMessage,\n selectChatMessages,\n selectIsViewportNewest,\n selectListedIds,\n selectChatMessageByPollId,\n selectCommonBoxChatId,\n selectIsChatListed,\n selectThreadInfo,\n selectThreadByMessage,\n selectPinnedIds,\n selectScheduledMessage,\n selectScheduledMessages,\n selectIsMessageInCurrentMessageList,\n selectScheduledIds,\n selectCurrentMessageList,\n selectViewportIds,\n selectFirstUnreadId,\n selectChat,\n selectIsChatWithBot,\n selectIsServiceChatReady,\n selectLocalAnimatedEmojiEffect,\n selectLocalAnimatedEmoji,\n} from '../../selectors';\nimport {\n getMessageContent, isUserId, isMessageLocal, getMessageText, checkIfHasUnreadReactions,\n} from '../../helpers';\nimport { onTickEnd } from '../../../util/schedulers';\nimport { updateUnreadReactions } from '../../reducers/reactions';\n\nconst ANIMATION_DELAY = 350;\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'newMessage': {\n const {\n chatId, id, message, shouldForceReply,\n } = update;\n global = updateWithLocalMedia(global, chatId, id, message);\n global = updateListedAndViewportIds(global, actions, message as ApiMessage);\n\n if (message.threadInfo) {\n global = updateThreadInfo(\n global,\n message.threadInfo.chatId,\n message.threadInfo.threadId,\n message.threadInfo,\n );\n }\n\n const newMessage = selectChatMessage(global, chatId, id)!;\n\n if (selectIsMessageInCurrentMessageList(global, chatId, message as ApiMessage)) {\n if (message.isOutgoing && !(message.content?.action)) {\n const currentMessageList = selectCurrentMessageList(global);\n if (currentMessageList) {\n // We do not use `actions.focusLastMessage` as it may be set with a delay (see below)\n actions.focusMessage({\n chatId,\n threadId: currentMessageList.threadId,\n messageId: message.id,\n noHighlight: true,\n isResizingContainer: true,\n });\n }\n }\n\n const { threadInfo } = selectThreadByMessage(global, chatId, message as ApiMessage) || {};\n if (threadInfo) {\n actions.requestThreadInfoUpdate({ chatId, threadId: threadInfo.threadId });\n }\n\n // @perf Wait until scroll animation finishes or simply rely on delivery status update (which is itself delayed)\n if (!isMessageLocal(message as ApiMessage)) {\n setTimeout(() => {\n let delayedGlobal = getGlobal();\n if (shouldForceReply) {\n delayedGlobal = replaceThreadParam(delayedGlobal, chatId, MAIN_THREAD_ID, 'replyingToId', id);\n }\n setGlobal(updateChatLastMessage(delayedGlobal, chatId, newMessage));\n }, ANIMATION_DELAY);\n }\n } else {\n global = updateChatLastMessage(global, chatId, newMessage);\n }\n\n setGlobal(global);\n\n // Edge case: New message in an old (not loaded) chat.\n if (!selectIsChatListed(global, chatId)) {\n actions.loadTopChats();\n }\n\n break;\n }\n\n case 'updateStartEmojiInteraction': {\n const { chatId: currentChatId } = selectCurrentMessageList(global) || {};\n\n if (currentChatId !== update.id) return;\n const message = selectChatMessage(global, currentChatId, update.messageId);\n\n if (!message) return;\n\n // Workaround for a weird behavior when interaction is received after watching reaction\n if (getMessageText(message) !== update.emoji) return;\n\n const localEmoji = selectLocalAnimatedEmoji(global, update.emoji);\n\n global = {\n ...global,\n activeEmojiInteractions: [...(global.activeEmojiInteractions || []), {\n id: global.activeEmojiInteractions?.length || 0,\n animatedEffect: localEmoji ? selectLocalAnimatedEmojiEffect(localEmoji) : update.emoji,\n messageId: update.messageId,\n } as ActiveEmojiInteraction],\n };\n\n setGlobal(global);\n\n break;\n }\n\n case 'newScheduledMessage': {\n const { chatId, id, message } = update;\n\n global = updateWithLocalMedia(global, chatId, id, message, true);\n\n const scheduledIds = selectScheduledIds(global, chatId) || [];\n global = replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'scheduledIds', unique([...scheduledIds, id]));\n\n setGlobal(global);\n\n break;\n }\n\n case 'updateMessage': {\n const { chatId, id, message } = update;\n\n const currentMessage = selectChatMessage(global, chatId, id);\n\n const chat = selectChat(global, chatId);\n\n global = updateWithLocalMedia(global, chatId, id, message);\n\n const newMessage = selectChatMessage(global, chatId, id)!;\n if (message.threadInfo) {\n global = updateThreadInfo(\n global,\n message.threadInfo.chatId,\n message.threadInfo.threadId,\n message.threadInfo,\n );\n }\n if (currentMessage) {\n global = updateChatLastMessage(global, chatId, newMessage);\n }\n\n if (message.reactions && chat) {\n global = updateReactions(global, chatId, id, message.reactions, chat, message.isOutgoing, currentMessage);\n }\n\n setGlobal(global);\n\n // Scroll down if bot message height is changed with an updated inline keyboard.\n // A drawback: this will scroll down even if the previous scroll was not at bottom.\n if (\n currentMessage\n && chat\n && !message.isOutgoing\n && chat.lastMessage?.id === message.id\n && selectIsChatWithBot(global, chat)\n && selectIsMessageInCurrentMessageList(global, chatId, message as ApiMessage)\n && selectIsViewportNewest(global, chatId, message.threadInfo?.threadId || MAIN_THREAD_ID)\n ) {\n actions.focusLastMessage();\n }\n\n break;\n }\n\n case 'updateScheduledMessage': {\n const { chatId, id, message } = update;\n\n const currentMessage = selectScheduledMessage(global, chatId, id);\n if (!currentMessage) {\n return;\n }\n\n global = updateWithLocalMedia(global, chatId, id, message, true);\n const ids = Object.keys(selectScheduledMessages(global, chatId) || {}).map(Number).sort((a, b) => b - a);\n global = replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'scheduledIds', ids);\n setGlobal(global);\n\n break;\n }\n\n case 'updateMessageSendSucceeded': {\n const { chatId, localId, message } = update;\n\n global = updateListedAndViewportIds(global, actions, message as ApiMessage);\n\n const currentMessage = selectChatMessage(global, chatId, localId);\n\n global = deleteChatMessages(global, chatId, [localId]);\n\n // Edge case for \"Send When Online\"\n if (message.isScheduled) {\n global = deleteChatScheduledMessages(global, chatId, [localId]);\n }\n\n global = updateChatMessage(global, chatId, message.id, {\n ...currentMessage,\n ...message,\n previousLocalId: localId,\n });\n\n const newMessage = selectChatMessage(global, chatId, message.id)!;\n global = updateChatLastMessage(global, chatId, newMessage);\n\n const thread = selectThreadByMessage(global, chatId, message);\n // For some reason Telegram requires to manually mark outgoing thread messages read\n if (thread?.threadInfo) {\n actions.markMessageListRead({ maxId: message.id });\n\n global = replaceThreadParam(global, chatId, thread.threadInfo.threadId, 'threadInfo', {\n ...thread.threadInfo,\n lastMessageId: message.id,\n lastReadInboxMessageId: message.id,\n });\n }\n\n setGlobal(global);\n\n break;\n }\n\n case 'updateScheduledMessageSendSucceeded': {\n const { chatId, localId, message } = update;\n const scheduledIds = selectScheduledIds(global, chatId) || [];\n global = replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'scheduledIds', [...scheduledIds, message.id]);\n\n const currentMessage = selectScheduledMessage(global, chatId, localId);\n\n global = deleteChatScheduledMessages(global, chatId, [localId]);\n global = updateScheduledMessage(global, chatId, message.id, {\n ...currentMessage,\n ...message,\n previousLocalId: localId,\n });\n\n setGlobal(global);\n break;\n }\n\n case 'updatePinnedIds': {\n const { chatId, isPinned, messageIds } = update;\n\n const currentPinnedIds = selectPinnedIds(global, chatId) || [];\n const newPinnedIds = isPinned\n ? [...currentPinnedIds, ...messageIds].sort((a, b) => b - a)\n : currentPinnedIds.filter((id) => !messageIds.includes(id));\n\n setGlobal(replaceThreadParam(global, chatId, MAIN_THREAD_ID, 'pinnedIds', newPinnedIds));\n\n break;\n }\n\n case 'updateThreadInfo': {\n const {\n chatId, threadId, threadInfo, firstMessageId,\n } = update;\n\n const currentThreadInfo = selectThreadInfo(global, chatId, threadId);\n const newTheadInfo = {\n ...currentThreadInfo,\n ...threadInfo,\n };\n\n if (!newTheadInfo.threadId) {\n return;\n }\n\n global = updateThreadInfo(global, chatId, threadId, newTheadInfo as ApiThreadInfo);\n\n if (firstMessageId) {\n global = replaceThreadParam(global, chatId, threadId, 'firstMessageId', firstMessageId);\n }\n\n setGlobal(global);\n\n break;\n }\n\n case 'resetMessages': {\n const { id: chatId } = update;\n const messagesById = selectChatMessages(global, chatId);\n\n if (messagesById && !isUserId(chatId)) {\n global = deleteChatMessages(global, chatId, Object.keys(messagesById).map(Number));\n setGlobal(global);\n actions.loadFullChat({ chatId, force: true });\n }\n\n break;\n }\n\n case 'deleteMessages': {\n const { ids, chatId } = update;\n\n deleteMessages(chatId, ids, actions, global);\n break;\n }\n\n case 'deleteScheduledMessages': {\n const { ids, chatId } = update;\n\n deleteScheduledMessages(chatId, ids, actions, global);\n break;\n }\n\n case 'deleteHistory': {\n const { chatId } = update;\n const chatMessages = global.messages.byChatId[chatId];\n if (chatId === SERVICE_NOTIFICATIONS_USER_ID) {\n const lastNotification = global.serviceNotifications.sort((a, b) => b.id - a.id)?.[0];\n const serviceNotifications = lastNotification ? [{\n ...lastNotification,\n isHidden: true,\n }] : [];\n\n setGlobal({\n ...global,\n serviceNotifications,\n });\n }\n\n if (chatMessages) {\n const ids = Object.keys(chatMessages.byId).map(Number);\n deleteMessages(chatId, ids, actions, getGlobal());\n } else {\n actions.requestChatUpdate({ chatId });\n }\n\n break;\n }\n\n case 'updateCommonBoxMessages': {\n const { ids, messageUpdate } = update;\n\n ids.forEach((id) => {\n const chatId = selectCommonBoxChatId(global, id);\n if (chatId) {\n global = updateChatMessage(global, chatId, id, messageUpdate);\n }\n });\n\n setGlobal(global);\n\n break;\n }\n\n case 'updateChannelMessages': {\n const { channelId, ids, messageUpdate } = update;\n\n ids.forEach((id) => {\n global = updateChatMessage(global, channelId, id, messageUpdate);\n });\n\n setGlobal(global);\n\n break;\n }\n\n case 'updateMessagePoll': {\n const { pollId, pollUpdate } = update;\n\n const message = selectChatMessageByPollId(global, pollId);\n\n if (message?.content.poll) {\n const oldResults = message.content.poll.results;\n let newResults = oldResults;\n if (pollUpdate.results?.results) {\n if (!oldResults.results || !pollUpdate.results.isMin) {\n newResults = pollUpdate.results;\n } else if (oldResults.results) {\n newResults = {\n ...pollUpdate.results,\n results: pollUpdate.results.results.map((result) => ({\n ...result,\n isChosen: oldResults.results!.find((r) => r.option === result.option)?.isChosen,\n })),\n isMin: undefined,\n };\n }\n }\n const updatedPoll = { ...message.content.poll, ...pollUpdate, results: newResults };\n\n setGlobal(updateChatMessage(\n global,\n message.chatId,\n message.id,\n {\n content: {\n ...message.content,\n poll: updatedPoll,\n },\n },\n ));\n }\n break;\n }\n\n case 'updateMessagePollVote': {\n const { pollId, userId, options } = update;\n const message = selectChatMessageByPollId(global, pollId);\n if (!message || !message.content.poll || !message.content.poll.results) {\n break;\n }\n\n const { poll } = message.content;\n\n const { recentVoterIds, totalVoters, results } = poll.results;\n const newRecentVoterIds = recentVoterIds ? [...recentVoterIds] : [];\n const newTotalVoters = totalVoters ? totalVoters + 1 : 1;\n const newResults = results ? [...results] : [];\n\n newRecentVoterIds.push(userId);\n\n options.forEach((option) => {\n const targetOptionIndex = newResults.findIndex((result) => result.option === option);\n const targetOption = newResults[targetOptionIndex];\n const updatedOption: ApiPollResult = targetOption ? { ...targetOption } : { option, votersCount: 0 };\n\n updatedOption.votersCount += 1;\n if (userId === global.currentUserId) {\n updatedOption.isChosen = true;\n }\n\n if (targetOptionIndex) {\n newResults[targetOptionIndex] = updatedOption;\n } else {\n newResults.push(updatedOption);\n }\n });\n\n setGlobal(updateChatMessage(\n global,\n message.chatId,\n message.id,\n {\n content: {\n ...message.content,\n poll: {\n ...poll,\n results: {\n ...poll.results,\n recentVoterIds: newRecentVoterIds,\n totalVoters: newTotalVoters,\n results: newResults,\n },\n },\n },\n },\n ));\n\n break;\n }\n\n case 'updateServiceNotification': {\n const { message } = update;\n\n if (selectIsServiceChatReady(global)) {\n actions.createServiceNotification({ message });\n }\n\n break;\n }\n\n case 'updateMessageReactions': {\n const { chatId, id, reactions } = update;\n const message = selectChatMessage(global, chatId, id);\n const chat = selectChat(global, update.chatId);\n\n if (!chat || !message) return;\n\n setGlobal(updateReactions(global, chatId, id, reactions, chat, message.isOutgoing, message));\n break;\n }\n\n case 'updateTranscribedAudio': {\n const { transcriptionId, text, isPending } = update;\n\n setGlobal({\n ...global,\n transcriptions: {\n ...global.transcriptions,\n [transcriptionId]: {\n ...(global.transcriptions[transcriptionId] || {}),\n transcriptionId,\n text,\n isPending,\n },\n },\n });\n break;\n }\n }\n});\n\nfunction updateReactions(\n global: GlobalState,\n chatId: string,\n id: number,\n reactions: ApiReactions,\n chat: ApiChat,\n isOutgoing?: boolean,\n message?: ApiMessage,\n) {\n const currentReactions = message?.reactions;\n\n // `updateMessageReactions` happens with an interval, so we try to avoid redundant global state updates\n if (currentReactions && areDeepEqual(reactions, currentReactions)) {\n return global;\n }\n\n global = updateChatMessage(global, chatId, id, { reactions });\n\n if (!isOutgoing) {\n return global;\n }\n\n const alreadyHasUnreadReaction = chat.unreadReactions?.includes(id);\n\n // Only notify about added reactions, not removed ones\n if (checkIfHasUnreadReactions(global, reactions) && !alreadyHasUnreadReaction) {\n global = updateUnreadReactions(global, chatId, {\n unreadReactionsCount: (chat?.unreadReactionsCount || 0) + 1,\n unreadReactions: [...(chat?.unreadReactions || []), id],\n });\n\n const newMessage = selectChatMessage(global, chatId, id);\n\n if (!chat || !newMessage) return global;\n\n onTickEnd(() => {\n notifyAboutMessage({\n chat,\n message: newMessage,\n isReaction: true,\n });\n });\n } else if (alreadyHasUnreadReaction) {\n global = updateUnreadReactions(global, chatId, {\n unreadReactionsCount: (chat?.unreadReactionsCount || 1) - 1,\n unreadReactions: chat?.unreadReactions?.filter((i) => i !== id),\n });\n }\n\n return global;\n}\n\nfunction updateWithLocalMedia(\n global: GlobalState, chatId: string, id: number, message: Partial<ApiMessage>, isScheduled = false,\n) {\n // Preserve locally uploaded media.\n const currentMessage = isScheduled\n ? selectScheduledMessage(global, chatId, id)\n : selectChatMessage(global, chatId, id);\n if (currentMessage && message.content) {\n const {\n photo, video, sticker, document,\n } = getMessageContent(currentMessage);\n if (photo && message.content.photo) {\n message.content.photo.blobUrl = photo.blobUrl;\n message.content.photo.thumbnail = photo.thumbnail;\n } else if (video && message.content.video) {\n message.content.video.blobUrl = video.blobUrl;\n } else if (sticker && message.content.sticker) {\n message.content.sticker.isPreloadedGlobally = sticker.isPreloadedGlobally;\n } else if (document && message.content.document) {\n message.content.document.previewBlobUrl = document.previewBlobUrl;\n }\n }\n\n return isScheduled\n ? updateScheduledMessage(global, chatId, id, message)\n : updateChatMessage(global, chatId, id, message);\n}\n\nfunction updateThreadUnread(global: GlobalState, actions: GlobalActions, message: ApiMessage, isDeleting?: boolean) {\n const { chatId } = message;\n\n const { threadInfo } = selectThreadByMessage(global, chatId, message) || {};\n\n if (!threadInfo && message.replyToMessageId) {\n const originMessage = selectChatMessage(global, chatId, message.replyToMessageId);\n if (originMessage) {\n global = updateThreadUnreadFromForwardedMessage(global, originMessage, chatId, message.id, isDeleting);\n } else {\n actions.loadMessage({\n chatId,\n messageId: message.replyToMessageId,\n threadUpdate: {\n isDeleting,\n lastMessageId: message.id,\n },\n });\n }\n }\n\n return global;\n}\n\nfunction updateListedAndViewportIds(global: GlobalState, actions: GlobalActions, message: ApiMessage) {\n const { id, chatId } = message;\n\n const { threadInfo, firstMessageId } = selectThreadByMessage(global, chatId, message) || {};\n\n const chat = selectChat(global, chatId);\n const isUnreadChatNotLoaded = chat?.unreadCount && !selectListedIds(global, chatId, MAIN_THREAD_ID);\n\n global = updateThreadUnread(global, actions, message);\n\n if (threadInfo) {\n if (firstMessageId || !isMessageLocal(message)) {\n global = updateListedIds(global, chatId, threadInfo.threadId, [id]);\n\n if (selectIsViewportNewest(global, chatId, threadInfo.threadId)) {\n global = addViewportId(global, chatId, threadInfo.threadId, id);\n\n if (!firstMessageId) {\n global = replaceThreadParam(global, chatId, threadInfo.threadId, 'firstMessageId', message.id);\n }\n }\n }\n\n global = replaceThreadParam(global, chatId, threadInfo.threadId, 'threadInfo', {\n ...threadInfo,\n lastMessageId: message.id,\n messagesCount: threadInfo.messagesCount + 1,\n });\n }\n\n if (isUnreadChatNotLoaded) {\n return global;\n }\n\n global = updateListedIds(global, chatId, MAIN_THREAD_ID, [id]);\n\n if (selectIsViewportNewest(global, chatId, MAIN_THREAD_ID)) {\n // Always keep the first unread message in the viewport list\n const firstUnreadId = selectFirstUnreadId(global, chatId, MAIN_THREAD_ID);\n const candidateGlobal = addViewportId(global, chatId, MAIN_THREAD_ID, id);\n const newViewportIds = selectViewportIds(candidateGlobal, chatId, MAIN_THREAD_ID);\n\n if (!firstUnreadId || newViewportIds!.includes(firstUnreadId)) {\n global = candidateGlobal;\n }\n }\n\n return global;\n}\n\nfunction updateChatLastMessage(\n global: GlobalState,\n chatId: string,\n message: ApiMessage,\n force = false,\n) {\n const { chats } = global;\n const currentLastMessage = chats.byId[chatId]?.lastMessage;\n\n if (currentLastMessage && !force) {\n const isSameOrNewer = (\n currentLastMessage.id === message.id || currentLastMessage.id === message.previousLocalId\n ) || message.id > currentLastMessage.id;\n\n if (!isSameOrNewer) {\n return global;\n }\n }\n\n return updateChat(global, chatId, { lastMessage: message });\n}\n\nfunction findLastMessage(global: GlobalState, chatId: string) {\n const byId = selectChatMessages(global, chatId);\n const listedIds = selectListedIds(global, chatId, MAIN_THREAD_ID);\n\n if (!byId || !listedIds) {\n return undefined;\n }\n\n let i = listedIds.length;\n while (i--) {\n const message = byId[listedIds[i]];\n if (!message.isDeleting) {\n return message;\n }\n }\n\n return undefined;\n}\n\nfunction deleteMessages(chatId: string | undefined, ids: number[], actions: GlobalActions, global: GlobalState) {\n // Channel update\n\n if (chatId) {\n ids.forEach((id) => {\n global = updateChatMessage(global, chatId, id, {\n isDeleting: true,\n });\n\n const newLastMessage = findLastMessage(global, chatId);\n if (newLastMessage) {\n global = updateChatLastMessage(global, chatId, newLastMessage, true);\n }\n });\n\n actions.requestChatUpdate({ chatId });\n\n const threadIdsToUpdate: number[] = [];\n\n ids.forEach((id) => {\n const message = selectChatMessage(global, chatId, id);\n if (!message) {\n return;\n }\n\n global = updateThreadUnread(global, actions, message, true);\n\n const { threadInfo } = selectThreadByMessage(global, chatId, message) || {};\n if (threadInfo) {\n threadIdsToUpdate.push(threadInfo.threadId);\n }\n });\n\n setGlobal(global);\n\n setTimeout(() => {\n setGlobal(deleteChatMessages(getGlobal(), chatId, ids));\n\n unique(threadIdsToUpdate).forEach((threadId) => {\n actions.requestThreadInfoUpdate({ chatId, threadId });\n });\n }, ANIMATION_DELAY);\n\n return;\n }\n\n // Common box update\n\n const chatsIdsToUpdate: string[] = [];\n\n ids.forEach((id) => {\n const commonBoxChatId = selectCommonBoxChatId(global, id);\n if (commonBoxChatId) {\n chatsIdsToUpdate.push(commonBoxChatId);\n\n global = updateChatMessage(global, commonBoxChatId, id, {\n isDeleting: true,\n });\n\n const newLastMessage = findLastMessage(global, commonBoxChatId);\n if (newLastMessage) {\n global = updateChatLastMessage(global, commonBoxChatId, newLastMessage, true);\n }\n\n setTimeout(() => {\n setGlobal(deleteChatMessages(getGlobal(), commonBoxChatId, [id]));\n }, ANIMATION_DELAY);\n }\n });\n\n setGlobal(global);\n\n unique(chatsIdsToUpdate).forEach((id) => {\n actions.requestChatUpdate({ chatId: id });\n });\n}\n\nfunction deleteScheduledMessages(\n chatId: string | undefined, ids: number[], actions: GlobalActions, global: GlobalState,\n) {\n if (!chatId) {\n return;\n }\n\n ids.forEach((id) => {\n global = updateScheduledMessage(global, chatId, id, {\n isDeleting: true,\n });\n });\n\n setGlobal(global);\n\n setTimeout(() => {\n global = deleteChatScheduledMessages(getGlobal(), chatId, ids);\n const scheduledMessages = selectScheduledMessages(global, chatId);\n global = replaceThreadParam(\n global, chatId, MAIN_THREAD_ID, 'scheduledIds', Object.keys(scheduledMessages || {}).map(Number),\n );\n setGlobal(global);\n }, ANIMATION_DELAY);\n}\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport type { ApiUserStatus } from '../../../api/types';\n\nimport { deleteContact, replaceUserStatuses, updateUser } from '../../reducers';\nimport { throttle } from '../../../util/schedulers';\nimport { selectIsCurrentUserPremium, selectUser } from '../../selectors';\n\nconst STATUS_UPDATE_THROTTLE = 3000;\n\nconst flushStatusUpdatesThrottled = throttle(flushStatusUpdates, STATUS_UPDATE_THROTTLE, true);\n\nlet pendingStatusUpdates: Record<string, ApiUserStatus> = {};\n\nfunction scheduleStatusUpdate(userId: string, statusUpdate: ApiUserStatus) {\n pendingStatusUpdates[userId] = statusUpdate;\n flushStatusUpdatesThrottled();\n}\n\nfunction flushStatusUpdates() {\n const global = getGlobal();\n\n setGlobal(replaceUserStatuses(global, {\n ...global.users.statusesById,\n ...pendingStatusUpdates,\n }));\n\n pendingStatusUpdates = {};\n}\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'deleteContact': {\n return deleteContact(global, update.id);\n }\n\n case 'updateUser': {\n if (update.id === global.currentUserId && update.user.isPremium && !selectIsCurrentUserPremium(global)) {\n actions.openPremiumModal({ isSuccess: true });\n }\n\n return updateUser(global, update.id, update.user);\n }\n\n case 'updateUserStatus': {\n // Status updates come very often so we throttle them\n scheduleStatusUpdate(update.userId, update.status);\n return undefined;\n }\n\n case 'updateUserFullInfo': {\n const { id, fullInfo } = update;\n const targetUser = global.users.byId[id];\n if (!targetUser) {\n return undefined;\n }\n\n return updateUser(global, id, {\n fullInfo: {\n ...targetUser.fullInfo,\n ...fullInfo,\n },\n });\n }\n\n case 'updateBotMenuButton': {\n const { botId, button } = update;\n\n const targetUser = selectUser(global, botId);\n if (!targetUser?.fullInfo?.botInfo) {\n return undefined;\n }\n\n return updateUser(global, botId, {\n fullInfo: {\n ...targetUser.fullInfo,\n botInfo: {\n ...targetUser.fullInfo.botInfo,\n menuButton: button,\n },\n },\n });\n }\n }\n\n return undefined;\n});\n","import { addActionHandler } from '../../index';\n\nimport { updateStickerSet } from '../../reducers';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updateStickerSet': {\n return updateStickerSet(global, update.id, update.stickerSet);\n }\n }\n\n return undefined;\n});\n","import { addActionHandler, getGlobal, setGlobal } from '../../index';\n\nimport { PaymentStep } from '../../../types';\n\nimport {\n addBlockedContact, removeBlockedContact, setConfirmPaymentUrl, setPaymentStep,\n} from '../../reducers';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updatePeerBlocked':\n if (update.isBlocked) {\n return addBlockedContact(getGlobal(), update.id);\n } else {\n return removeBlockedContact(getGlobal(), update.id);\n }\n\n case 'updateResetContactList':\n setGlobal({\n ...getGlobal(),\n contactList: {\n userIds: [],\n },\n });\n break;\n\n case 'updateFavoriteStickers':\n actions.loadFavoriteStickers();\n break;\n\n case 'updateRecentStickers':\n actions.loadRecentStickers();\n break;\n\n case 'updateStickerSets':\n actions.loadStickerSets();\n break;\n\n case 'updateStickerSetsOrder':\n actions.reorderStickerSets({ order: update.order, isCustomEmoji: update.isCustomEmoji });\n break;\n\n case 'updateSavedGifs':\n actions.loadSavedGifs();\n break;\n\n case 'updatePrivacy':\n setGlobal({\n ...global,\n settings: {\n ...global.settings,\n privacy: {\n ...global.settings.privacy,\n [update.key]: update.rules,\n },\n },\n });\n break;\n\n case 'updatePaymentVerificationNeeded':\n global = setConfirmPaymentUrl(getGlobal(), update.url);\n global = setPaymentStep(global, PaymentStep.ConfirmPayment);\n setGlobal(global);\n break;\n\n case 'updateWebViewResultSent':\n if (global.webApp?.queryId === update.queryId) {\n actions.setReplyingToId({ messageId: undefined });\n actions.closeWebApp();\n }\n break;\n }\n\n return undefined;\n});\n","import { addActionHandler, setGlobal } from '../../index';\n\nimport { addNotifyException, updateChat, updateNotifySettings } from '../../reducers';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updateNotifySettings': {\n return updateNotifySettings(global, update.peerType, update.isSilent, update.shouldShowPreviews);\n }\n\n case 'updateNotifyExceptions': {\n const {\n chatId, isMuted, isSilent, shouldShowPreviews,\n } = update;\n const chat = global.chats.byId[chatId];\n\n if (chat) {\n global = updateChat(global, chatId, { isMuted });\n }\n\n setGlobal(addNotifyException(global, chatId, { isMuted, isSilent, shouldShowPreviews }));\n break;\n }\n }\n\n return undefined;\n});\n","import { addActionHandler } from '../../index';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updateTwoFaStateWaitCode': {\n return {\n ...global,\n twoFaSettings: {\n ...global.twoFaSettings,\n isLoading: false,\n waitingEmailCodeLength: update.length,\n },\n };\n }\n\n case 'updateTwoFaError': {\n return {\n ...global,\n twoFaSettings: {\n ...global.twoFaSettings,\n error: update.message,\n },\n };\n }\n }\n\n return undefined;\n});\n","import { addActionHandler, getGlobal } from '../../index';\nimport { removeGroupCall, updateGroupCall, updateGroupCallParticipant } from '../../reducers/calls';\nimport { omit } from '../../../util/iteratees';\nimport { selectChat } from '../../selectors';\nimport { updateChat } from '../../reducers';\nimport { ARE_CALLS_SUPPORTED } from '../../../util/environment';\nimport { notifyAboutCall } from '../../../util/notifications';\nimport { selectPhoneCallUser } from '../../selectors/calls';\nimport { initializeSoundsForSafari } from '../ui/calls';\nimport { onTickEnd } from '../../../util/schedulers';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updateGroupCall': {\n if (update.call.connectionState === 'discarded') {\n if (global.groupCalls.activeGroupCallId) {\n actions.leaveGroupCall({ shouldRemove: true });\n return undefined;\n } else {\n return removeGroupCall(global, update.call.id);\n }\n }\n\n return updateGroupCall(\n global,\n update.call.id,\n omit(update.call, ['connectionState']),\n undefined,\n update.call.participantsCount,\n );\n }\n case 'updateGroupCallChatId': {\n const chat = selectChat(global, update.chatId);\n if (chat) {\n global = updateChat(global, update.chatId, {\n fullInfo: {\n ...chat.fullInfo,\n groupCallId: update.call.id,\n },\n });\n }\n return global;\n }\n case 'updateGroupCallParticipants': {\n const { groupCallId, participants, nextOffset } = update;\n const { currentUserId } = global;\n\n // `secret-sauce` should disconnect if the participant is us but from another device\n global = getGlobal();\n participants.forEach((participant) => {\n if (participant.id) {\n global = updateGroupCallParticipant(\n global, groupCallId, participant.id, participant, Boolean(nextOffset) || currentUserId === participant.id,\n );\n }\n });\n if (nextOffset) {\n global = updateGroupCall(global, groupCallId, {\n nextOffset,\n });\n }\n return global;\n }\n case 'updatePhoneCall': {\n if (!ARE_CALLS_SUPPORTED) return undefined;\n\n const {\n phoneCall,\n currentUserId,\n } = global;\n\n const { call } = update;\n\n if (phoneCall) {\n if (call.state === 'discarded') {\n actions.playGroupCallSound({ sound: 'end' });\n return {\n ...global,\n ...(call.needRating && { ratingPhoneCall: call }),\n isCallPanelVisible: undefined,\n phoneCall: undefined,\n };\n }\n\n return undefined;\n }\n\n const isOutgoing = call?.adminId === currentUserId;\n\n if (!isOutgoing && call.state === 'requested') {\n onTickEnd(() => {\n notifyAboutCall({\n call,\n user: selectPhoneCallUser(getGlobal())!,\n });\n });\n\n void initializeSoundsForSafari();\n return {\n ...global,\n phoneCall: call,\n isCallPanelVisible: false,\n };\n }\n }\n }\n\n return undefined;\n});\n","import { addActionHandler } from '../../index';\n\nimport { IS_PRODUCTION_HOST } from '../../../util/environment';\nimport { clearPayment } from '../../reducers';\n\naddActionHandler('apiUpdate', (global, actions, update) => {\n switch (update['@type']) {\n case 'updatePaymentStateCompleted': {\n const { inputInvoice } = global.payment;\n // On the production host, the payment frame receives a message with the payment event,\n // after which the payment form closes. In other cases, the payment form must be closed manually.\n if (!IS_PRODUCTION_HOST) {\n global = clearPayment(global);\n }\n\n if (update.slug && inputInvoice && 'slug' in inputInvoice && inputInvoice.slug !== update.slug) {\n return !IS_PRODUCTION_HOST ? global : undefined;\n }\n\n return {\n ...global,\n payment: {\n ...global.payment,\n status: 'paid',\n },\n };\n }\n }\n\n return undefined;\n});\n","import { useEffect } from '../lib/teact/teact';\n\nimport { onBeforeUnload } from '../util/schedulers';\n\nexport default function useBeforeUnload(callback: AnyToVoidFunction) {\n useEffect(() => {\n return onBeforeUnload(callback);\n }, [callback]);\n}\n","import { useEffect } from '../lib/teact/teact';\nimport { IS_IOS, IS_PWA, IS_TOUCH_ENV } from '../util/environment';\n\nconst metaViewport = document.querySelector('meta[name=\"viewport\"]');\nconst defaultViewportContent = metaViewport?.getAttribute('content') || '';\nconst allowedZoomViewportContent = 'width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover';\n\nexport default function usePreventPinchZoomGesture(isDisabled = false) {\n useEffect(() => {\n if (!IS_TOUCH_ENV) {\n return undefined;\n }\n\n if (isDisabled) {\n // Clean viewport content from values values that disable the ability to zoom a webpage\n // https://web.dev/meta-viewport/\n metaViewport?.setAttribute('content', allowedZoomViewportContent);\n return undefined;\n }\n\n metaViewport?.setAttribute('content', defaultViewportContent);\n\n // Since iOS 10 `user-scaleable=no` is disabled in Safari for iOS,\n // this is only applicable for the browser and does not apply to the PWA mode.\n // https://newbedev.com/how-do-you-disable-viewport-zooming-on-mobile-safari\n if (IS_IOS && !IS_PWA) {\n document.addEventListener('gesturestart', preventEvent);\n }\n\n return () => {\n metaViewport?.setAttribute('content', 'width=device-width, initial-scale=1, shrink-to-fit=no');\n if (IS_IOS && !IS_PWA) {\n document.removeEventListener('gesturestart', preventEvent);\n }\n };\n }, [isDisabled]);\n}\n\nfunction preventEvent(e: Event) {\n e.preventDefault();\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './StickerSetModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst StickerSetModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const StickerSetModal = useModuleLoader(Bundles.Extra, 'StickerSetModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return StickerSetModal ? <StickerSetModal {...props} /> : undefined;\n};\n\nexport default memo(StickerSetModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useEffect } from '../../lib/teact/teact';\n\nimport { formatIntegerCompact } from '../../util/textFormat';\nimport { useFolderManagerForUnreadCounters } from '../../hooks/useFolderManager';\nimport { getAllNotificationsCount } from '../../util/folderManager';\nimport { updateAppBadge } from '../../util/appBadge';\n\ninterface OwnProps {\n isForAppBadge?: boolean;\n}\n\nconst UnreadCounter: FC<OwnProps> = ({ isForAppBadge }) => {\n useFolderManagerForUnreadCounters();\n const unreadNotificationsCount = getAllNotificationsCount();\n\n useEffect(() => {\n if (isForAppBadge) {\n updateAppBadge(unreadNotificationsCount);\n }\n }, [isForAppBadge, unreadNotificationsCount]);\n\n if (isForAppBadge || !unreadNotificationsCount) {\n return undefined;\n }\n\n return (\n <div className=\"unread-count active\">{formatIntegerCompact(unreadNotificationsCount)}</div>\n );\n};\n\nexport default memo(UnreadCounter);\n","import type { GlobalState } from '../global/types';\n\nimport useBrowserOnline from './useBrowserOnline';\nimport type { LangFn } from './useLang';\n\nexport enum ConnectionStatus {\n waitingForNetwork,\n syncing,\n online,\n}\n\ntype ConnectionStatusPosition =\n 'overlay'\n | 'minimized'\n | 'middleHeader'\n | 'none';\n\nexport default function useConnectionStatus(\n lang: LangFn,\n connectionState: GlobalState['connectionState'],\n isSyncing: GlobalState['isSyncing'],\n hasMiddleHeader: boolean,\n isMinimized?: boolean,\n isDisabled?: boolean,\n) {\n let status: ConnectionStatus;\n const isBrowserOnline = useBrowserOnline();\n if (!isBrowserOnline || connectionState === 'connectionStateConnecting') {\n status = ConnectionStatus.waitingForNetwork;\n } else if (isSyncing) {\n status = ConnectionStatus.syncing;\n } else {\n status = ConnectionStatus.online;\n }\n\n let position: ConnectionStatusPosition;\n if (status === ConnectionStatus.online || isDisabled) {\n position = 'none';\n } else if (hasMiddleHeader) {\n position = 'middleHeader';\n } else if (isMinimized) {\n position = 'minimized';\n } else {\n position = 'overlay';\n }\n\n let text: string | undefined;\n if (status === ConnectionStatus.waitingForNetwork) {\n text = lang('WaitingForNetwork');\n } else if (status === ConnectionStatus.syncing) {\n text = lang('Updating');\n }\n\n if (position === 'middleHeader') {\n text = text!.toLowerCase().replace(/\\.+$/, '');\n }\n\n return {\n connectionStatus: status,\n connectionStatusPosition: position,\n connectionStatusText: text,\n };\n}\n","import { useEffect, useState } from '../lib/teact/teact';\n\nexport default function useBrowserOnline() {\n const [isOnline, setIsOnline] = useState(window.navigator.onLine);\n\n useEffect(() => {\n function handleChange() {\n setIsOnline(window.navigator.onLine);\n }\n\n window.addEventListener('online', handleChange);\n window.addEventListener('offline', handleChange);\n\n return () => {\n window.removeEventListener('offline', handleChange);\n window.removeEventListener('online', handleChange);\n };\n }, []);\n\n return isOnline;\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\nimport type { ConnectionStatus } from '../../hooks/useConnectionStatus';\n\nimport Transition from '../ui/Transition';\nimport Spinner from '../ui/Spinner';\nimport Button from '../ui/Button';\n\nimport './ConnectionStatusOverlay.scss';\n\ntype OwnProps = {\n connectionStatus: ConnectionStatus;\n connectionStatusText: string;\n onClick?: NoneToVoidFunction;\n};\n\nconst ConnectionStatusOverlay: FC<OwnProps> = ({\n connectionStatus,\n connectionStatusText,\n onClick,\n}) => {\n const lang = useLang();\n\n return (\n <div id=\"ConnectionStatusOverlay\" dir={lang.isRtl ? 'rtl' : undefined} onClick={onClick}>\n <Spinner color=\"black\" />\n <div className=\"state-text\">\n <Transition activeKey={connectionStatus} name=\"slide-fade\">\n {connectionStatusText}\n </Transition>\n </div>\n <Button\n round\n size=\"tiny\"\n color=\"translucent-black\"\n >\n <span className=\"icon-close\" />\n </Button>\n </div>\n );\n};\n\nexport default memo(ConnectionStatusOverlay);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { AnimationLevel, ISettings } from '../../../types';\nimport { LeftColumnContent, SettingsScreens } from '../../../types';\nimport type { ApiChat } from '../../../api/types';\nimport type { GlobalState } from '../../../global/types';\n\nimport {\n ANIMATION_LEVEL_MAX,\n APP_NAME, APP_VERSION,\n BETA_CHANGELOG_URL,\n DEBUG,\n FEEDBACK_URL,\n IS_BETA,\n IS_TEST,\n PRODUCTION_HOSTNAME,\n} from '../../../config';\nimport { IS_PWA, IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport buildClassName from '../../../util/buildClassName';\nimport { formatDateToString } from '../../../util/dateFormat';\nimport switchTheme from '../../../util/switchTheme';\nimport { setPermanentWebVersion } from '../../../util/permanentWebVersion';\nimport { clearWebsync } from '../../../util/websync';\nimport { selectCurrentMessageList, selectTheme } from '../../../global/selectors';\nimport { isChatArchived } from '../../../global/helpers';\nimport useLang from '../../../hooks/useLang';\nimport useConnectionStatus from '../../../hooks/useConnectionStatus';\nimport { useHotkeys } from '../../../hooks/useHotkeys';\nimport { getPromptInstall } from '../../../util/installPrompt';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\n\nimport DropdownMenu from '../../ui/DropdownMenu';\nimport MenuItem from '../../ui/MenuItem';\nimport Button from '../../ui/Button';\nimport SearchInput from '../../ui/SearchInput';\nimport PickerSelectedItem from '../../common/PickerSelectedItem';\nimport Switcher from '../../ui/Switcher';\nimport ShowTransition from '../../ui/ShowTransition';\nimport ConnectionStatusOverlay from '../ConnectionStatusOverlay';\n\nimport './LeftMainHeader.scss';\n\ntype OwnProps = {\n content: LeftColumnContent;\n contactsFilter: string;\n shouldSkipTransition?: boolean;\n onSearchQuery: (query: string) => void;\n onSelectSettings: () => void;\n onSelectContacts: () => void;\n onSelectArchived: () => void;\n onReset: () => void;\n};\n\ntype StateProps =\n {\n searchQuery?: string;\n isLoading: boolean;\n currentUserId?: string;\n globalSearchChatId?: string;\n searchDate?: number;\n theme: ISettings['theme'];\n animationLevel: AnimationLevel;\n chatsById?: Record<string, ApiChat>;\n isMessageListOpen: boolean;\n isConnectionStatusMinimized: ISettings['isConnectionStatusMinimized'];\n areChatsLoaded?: boolean;\n hasPasscode?: boolean;\n }\n & Pick<GlobalState, 'connectionState' | 'isSyncing' | 'canInstall'>;\n\nconst LEGACY_VERSION_URL = 'https://web.telegram.org/?legacy=1';\nconst WEBK_VERSION_URL = 'https://web.telegram.org/k/';\n\nconst LeftMainHeader: FC<OwnProps & StateProps> = ({\n content,\n contactsFilter,\n onSearchQuery,\n onSelectSettings,\n onSelectContacts,\n onSelectArchived,\n onReset,\n searchQuery,\n isLoading,\n shouldSkipTransition,\n currentUserId,\n globalSearchChatId,\n searchDate,\n theme,\n animationLevel,\n chatsById,\n connectionState,\n isSyncing,\n isMessageListOpen,\n isConnectionStatusMinimized,\n areChatsLoaded,\n hasPasscode,\n canInstall,\n}) => {\n const {\n openChat,\n setGlobalSearchDate,\n setSettingOption,\n setGlobalSearchChatId,\n openChatByUsername,\n lockScreen,\n requestNextSettingsScreen,\n skipLockOnUnload,\n } = getActions();\n\n const lang = useLang();\n const hasMenu = content === LeftColumnContent.ChatList;\n const clearedDateSearchParam = { date: undefined };\n const clearedChatSearchParam = { id: undefined };\n const selectedSearchDate = useMemo(() => {\n return searchDate\n ? formatDateToString(new Date(searchDate * 1000))\n : undefined;\n }, [searchDate]);\n const archivedUnreadChatsCount = useMemo(() => {\n if (!hasMenu || !chatsById) {\n return 0;\n }\n\n return Object.values(chatsById).reduce((total, chat) => {\n if (!isChatArchived(chat)) {\n return total;\n }\n\n return chat.unreadCount ? total + 1 : total;\n }, 0);\n }, [hasMenu, chatsById]);\n\n const { connectionStatus, connectionStatusText, connectionStatusPosition } = useConnectionStatus(\n lang, connectionState, isSyncing, isMessageListOpen, isConnectionStatusMinimized, !areChatsLoaded,\n );\n\n const handleLockScreenHotkey = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (hasPasscode) {\n lockScreen();\n } else {\n requestNextSettingsScreen(SettingsScreens.PasscodeDisabled);\n }\n }, [hasPasscode, lockScreen, requestNextSettingsScreen]);\n\n useHotkeys({\n 'Ctrl+Shift+L': handleLockScreenHotkey,\n 'Alt+Shift+L': handleLockScreenHotkey,\n 'Meta+Shift+L': handleLockScreenHotkey,\n ...(IS_PWA && { 'Mod+L': handleLockScreenHotkey }),\n });\n\n const withOtherVersions = window.location.hostname === PRODUCTION_HOSTNAME || IS_TEST;\n\n const MainButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {\n return ({ onTrigger, isOpen }) => (\n <Button\n round\n ripple={hasMenu && !IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n className={isOpen ? 'active' : ''}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={hasMenu ? onTrigger : () => onReset()}\n ariaLabel={hasMenu ? lang('AccDescrOpenMenu2') : 'Return to chat list'}\n >\n <div className={buildClassName(\n 'animated-menu-icon',\n !hasMenu && 'state-back',\n shouldSkipTransition && 'no-animation',\n )}\n />\n </Button>\n );\n }, [hasMenu, lang, onReset, shouldSkipTransition]);\n\n const handleSearchFocus = useCallback(() => {\n if (!searchQuery) {\n onSearchQuery('');\n }\n }, [searchQuery, onSearchQuery]);\n\n const toggleConnectionStatus = useCallback(() => {\n setSettingOption({ isConnectionStatusMinimized: !isConnectionStatusMinimized });\n }, [isConnectionStatusMinimized, setSettingOption]);\n\n const handleSelectSaved = useCallback(() => {\n openChat({ id: currentUserId, shouldReplaceHistory: true });\n }, [currentUserId, openChat]);\n\n const handleDarkModeToggle = useCallback((e: React.SyntheticEvent<HTMLElement>) => {\n e.stopPropagation();\n const newTheme = theme === 'light' ? 'dark' : 'light';\n\n setSettingOption({ theme: newTheme });\n setSettingOption({ shouldUseSystemTheme: false });\n switchTheme(newTheme, animationLevel === ANIMATION_LEVEL_MAX);\n }, [animationLevel, setSettingOption, theme]);\n\n const handleChangelogClick = useCallback(() => {\n window.open(BETA_CHANGELOG_URL, '_blank', 'noopener');\n }, []);\n\n const handleSwitchToWebK = useCallback(() => {\n setPermanentWebVersion('K');\n clearWebsync();\n skipLockOnUnload();\n }, [skipLockOnUnload]);\n\n const handleSwitchToLegacy = useCallback(() => {\n skipLockOnUnload();\n }, [skipLockOnUnload]);\n\n const handleOpenTipsChat = useCallback(() => {\n openChatByUsername({ username: lang('Settings.TipsUsername') });\n }, [lang, openChatByUsername]);\n\n const handleLockScreen = useCallback(() => {\n lockScreen();\n }, [lockScreen]);\n\n const isSearchFocused = (\n Boolean(globalSearchChatId)\n || content === LeftColumnContent.GlobalSearch\n || content === LeftColumnContent.Contacts\n );\n\n useEffect(() => (isSearchFocused ? captureEscKeyListener(() => onReset()) : undefined), [isSearchFocused, onReset]);\n\n const searchInputPlaceholder = content === LeftColumnContent.Contacts\n ? lang('SearchFriends')\n : lang('Search');\n\n const versionString = IS_BETA ? `${APP_VERSION} Beta (${APP_REVISION})` : (DEBUG ? APP_REVISION : APP_VERSION);\n\n return (\n <div className=\"LeftMainHeader\">\n <div id=\"LeftMainHeader\" className=\"left-header\">\n <DropdownMenu\n trigger={MainButton}\n footer={`${APP_NAME} ${versionString}`}\n >\n <MenuItem\n icon=\"saved-messages\"\n onClick={handleSelectSaved}\n >\n {lang('SavedMessages')}\n </MenuItem>\n <MenuItem\n icon=\"archive\"\n onClick={onSelectArchived}\n >\n <span className=\"menu-item-name\">{lang('ArchivedChats')}</span>\n {archivedUnreadChatsCount > 0 && (\n <div className=\"archived-badge\">{archivedUnreadChatsCount}</div>\n )}\n </MenuItem>\n <MenuItem\n icon=\"user\"\n onClick={onSelectContacts}\n >\n {lang('Contacts')}\n </MenuItem>\n <MenuItem\n icon=\"settings\"\n onClick={onSelectSettings}\n >\n {lang('Settings')}\n </MenuItem>\n <MenuItem\n icon=\"darkmode\"\n onClick={handleDarkModeToggle}\n >\n <span className=\"menu-item-name\">{lang('lng_menu_night_mode')}</span>\n <Switcher\n id=\"darkmode\"\n label={lang(theme === 'dark' ? 'lng_settings_disable_night_theme' : 'lng_settings_enable_night_theme')}\n checked={theme === 'dark'}\n noAnimation\n />\n </MenuItem>\n <MenuItem\n icon=\"help\"\n onClick={handleOpenTipsChat}\n >\n {lang('TelegramFeatures')}\n </MenuItem>\n <MenuItem\n icon=\"bug\"\n href={FEEDBACK_URL}\n >\n Report Bug\n </MenuItem>\n {IS_BETA && (\n <MenuItem\n icon=\"permissions\"\n onClick={handleChangelogClick}\n >\n Beta Changelog\n </MenuItem>\n )}\n {withOtherVersions && (\n <>\n <MenuItem\n icon=\"char-K\"\n href={WEBK_VERSION_URL}\n onClick={handleSwitchToWebK}\n >\n Switch to K Version\n </MenuItem>\n <MenuItem\n icon=\"char-W\"\n href={LEGACY_VERSION_URL}\n onClick={handleSwitchToLegacy}\n >\n Switch to Old Version\n </MenuItem>\n </>\n )}\n {canInstall && (\n <MenuItem\n icon=\"install\"\n onClick={getPromptInstall()}\n >\n Install App\n </MenuItem>\n )}\n </DropdownMenu>\n <SearchInput\n inputId=\"telegram-search-input\"\n parentContainerClassName=\"LeftSearch\"\n className={globalSearchChatId || searchDate ? 'with-picker-item' : ''}\n value={contactsFilter || searchQuery}\n focused={isSearchFocused}\n isLoading={isLoading || connectionStatusPosition === 'minimized'}\n spinnerColor={connectionStatusPosition === 'minimized' ? 'yellow' : undefined}\n spinnerBackgroundColor={connectionStatusPosition === 'minimized' && theme === 'light' ? 'light' : undefined}\n placeholder={searchInputPlaceholder}\n autoComplete=\"off\"\n canClose={Boolean(globalSearchChatId || searchDate)}\n onChange={onSearchQuery}\n onReset={onReset}\n onFocus={handleSearchFocus}\n onSpinnerClick={connectionStatusPosition === 'minimized' ? toggleConnectionStatus : undefined}\n >\n {selectedSearchDate && (\n <PickerSelectedItem\n icon=\"calendar\"\n title={selectedSearchDate}\n canClose\n isMinimized={Boolean(globalSearchChatId)}\n className=\"search-date\"\n onClick={setGlobalSearchDate}\n clickArg={clearedDateSearchParam}\n />\n )}\n {globalSearchChatId && (\n <PickerSelectedItem\n chatOrUserId={globalSearchChatId}\n onClick={setGlobalSearchChatId}\n canClose\n clickArg={clearedChatSearchParam}\n />\n )}\n </SearchInput>\n {hasPasscode && (\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n ariaLabel={`${lang('ShortcutsController.Others.LockByPasscode')} (Ctrl+Shift+L)`}\n onClick={handleLockScreen}\n className=\"passcode-lock\"\n >\n <i className=\"icon-lock\" />\n </Button>\n )}\n <ShowTransition\n isOpen={connectionStatusPosition === 'overlay'}\n isCustom\n className=\"connection-state-wrapper\"\n >\n <ConnectionStatusOverlay\n connectionStatus={connectionStatus}\n connectionStatusText={connectionStatusText!}\n onClick={toggleConnectionStatus}\n />\n </ShowTransition>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n query: searchQuery, fetchingStatus, chatId, date,\n } = global.globalSearch;\n const { currentUserId, connectionState, isSyncing } = global;\n const { byId: chatsById } = global.chats;\n const { isConnectionStatusMinimized, animationLevel } = global.settings.byKey;\n\n return {\n searchQuery,\n isLoading: fetchingStatus ? Boolean(fetchingStatus.chats || fetchingStatus.messages) : false,\n currentUserId,\n chatsById,\n globalSearchChatId: chatId,\n searchDate: date,\n theme: selectTheme(global),\n animationLevel,\n connectionState,\n isSyncing,\n isMessageListOpen: Boolean(selectCurrentMessageList(global)),\n isConnectionStatusMinimized,\n areChatsLoaded: Boolean(global.chats.listIds.active),\n hasPasscode: Boolean(global.passcode.hasPasscode),\n canInstall: Boolean(global.canInstall),\n };\n },\n)(LeftMainHeader));\n","const PERMANENT_VERSION_KEY = 'kz_version';\nconst AVAILABLE_VERSIONS = ['Z', 'K'] as const;\n\nexport function setPermanentWebVersion(version: typeof AVAILABLE_VERSIONS[number]) {\n localStorage.setItem(PERMANENT_VERSION_KEY, JSON.stringify(version));\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChatFolder } from '../../../api/types';\nimport type { SettingsScreens } from '../../../types';\nimport type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { ALL_FOLDER_ID } from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { captureEvents, SwipeDirection } from '../../../util/captureEvents';\nimport buildClassName from '../../../util/buildClassName';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useLang from '../../../hooks/useLang';\nimport useHistoryBack from '../../../hooks/useHistoryBack';\n\nimport Transition from '../../ui/Transition';\nimport TabList from '../../ui/TabList';\nimport ChatList from './ChatList';\nimport { useFolderManagerForUnreadCounters } from '../../../hooks/useFolderManager';\nimport { selectCurrentLimit } from '../../../global/selectors/limits';\n\ntype OwnProps = {\n onScreenSelect: (screen: SettingsScreens) => void;\n foldersDispatch: FolderEditDispatch;\n};\n\ntype StateProps = {\n chatFoldersById: Record<number, ApiChatFolder>;\n orderedFolderIds?: number[];\n activeChatFolder: number;\n currentUserId?: string;\n lastSyncTime?: number;\n shouldSkipHistoryAnimations?: boolean;\n maxFolders: number;\n};\n\nconst SAVED_MESSAGES_HOTKEY = '0';\nconst FIRST_FOLDER_INDEX = 0;\n\nconst ChatFolders: FC<OwnProps & StateProps> = ({\n foldersDispatch,\n onScreenSelect,\n chatFoldersById,\n orderedFolderIds,\n activeChatFolder,\n currentUserId,\n lastSyncTime,\n shouldSkipHistoryAnimations,\n maxFolders,\n}) => {\n const {\n loadChatFolders,\n setActiveChatFolder,\n openChat,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const transitionRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n useEffect(() => {\n if (lastSyncTime) {\n loadChatFolders();\n }\n }, [lastSyncTime, loadChatFolders]);\n\n const allChatsFolder = useMemo(() => {\n return {\n id: ALL_FOLDER_ID,\n title: orderedFolderIds?.[0] === ALL_FOLDER_ID ? lang('FilterAllChatsShort') : lang('FilterAllChats'),\n };\n }, [orderedFolderIds, lang]);\n\n const displayedFolders = useMemo(() => {\n return orderedFolderIds\n ? orderedFolderIds.map((id) => {\n if (id === ALL_FOLDER_ID) {\n return allChatsFolder;\n }\n\n return chatFoldersById[id] || {};\n }).filter(Boolean)\n : undefined;\n }, [chatFoldersById, allChatsFolder, orderedFolderIds]);\n\n const allChatsFolderIndex = displayedFolders?.findIndex((folder) => folder.id === ALL_FOLDER_ID);\n const isInAllChatsFolder = allChatsFolderIndex === activeChatFolder;\n const isInFirstFolder = FIRST_FOLDER_INDEX === activeChatFolder;\n\n const folderCountersById = useFolderManagerForUnreadCounters();\n const folderTabs = useMemo(() => {\n if (!displayedFolders || !displayedFolders.length) {\n return undefined;\n }\n\n return displayedFolders.map(({ id, title }, i) => {\n const isBlocked = id !== ALL_FOLDER_ID && i > maxFolders - 1;\n\n return ({\n id,\n title,\n badgeCount: folderCountersById[id]?.chatsCount,\n isBadgeActive: Boolean(folderCountersById[id]?.notificationsCount),\n isBlocked,\n });\n });\n }, [displayedFolders, folderCountersById, maxFolders]);\n\n const handleSwitchTab = useCallback((index: number) => {\n setActiveChatFolder(index, { forceOnHeavyAnimation: true });\n }, [setActiveChatFolder]);\n\n // Prevent `activeTab` pointing at non-existing folder after update\n useEffect(() => {\n if (!folderTabs || !folderTabs.length) {\n return;\n }\n\n if (activeChatFolder >= folderTabs.length) {\n setActiveChatFolder(FIRST_FOLDER_INDEX);\n }\n }, [activeChatFolder, folderTabs, setActiveChatFolder]);\n\n useEffect(() => {\n if (!transitionRef.current || !IS_TOUCH_ENV || !folderTabs || !folderTabs.length) {\n return undefined;\n }\n\n return captureEvents(transitionRef.current, {\n selectorToPreventScroll: '.chat-list',\n onSwipe: ((e, direction) => {\n if (direction === SwipeDirection.Left) {\n setActiveChatFolder(Math.min(activeChatFolder + 1, folderTabs.length - 1), { forceOnHeavyAnimation: true });\n return true;\n } else if (direction === SwipeDirection.Right) {\n setActiveChatFolder(Math.max(0, activeChatFolder - 1), { forceOnHeavyAnimation: true });\n return true;\n }\n\n return false;\n }),\n });\n }, [activeChatFolder, folderTabs, setActiveChatFolder]);\n\n const isNotInFirstFolderRef = useRef();\n isNotInFirstFolderRef.current = !isInFirstFolder;\n useEffect(() => (isNotInFirstFolderRef.current ? captureEscKeyListener(() => {\n if (isNotInFirstFolderRef.current) {\n setActiveChatFolder(FIRST_FOLDER_INDEX);\n }\n }) : undefined), [activeChatFolder, setActiveChatFolder]);\n\n useHistoryBack({\n isActive: !isInFirstFolder,\n onBack: () => setActiveChatFolder(FIRST_FOLDER_INDEX, { forceOnHeavyAnimation: true }),\n });\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.ctrlKey && e.shiftKey && e.code.startsWith('Digit') && folderTabs) {\n const [, digit] = e.code.match(/Digit(\\d)/) || [];\n if (!digit) return;\n\n if (digit === SAVED_MESSAGES_HOTKEY) {\n openChat({ id: currentUserId, shouldReplaceHistory: true });\n return;\n }\n\n const folder = Number(digit) - 1;\n if (folder > folderTabs.length - 1) return;\n\n setActiveChatFolder(folder, { forceOnHeavyAnimation: true });\n e.preventDefault();\n }\n };\n\n document.addEventListener('keydown', handleKeyDown, true);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown, true);\n };\n }, [currentUserId, folderTabs, openChat, setActiveChatFolder]);\n\n const {\n shouldRender: shouldRenderPlaceholder, transitionClassNames,\n } = useShowTransition(!orderedFolderIds, undefined, true);\n\n function renderCurrentTab(isActive: boolean) {\n const activeFolder = Object.values(chatFoldersById)\n .find(({ id }) => id === folderTabs![activeChatFolder].id);\n\n if (!activeFolder || isInAllChatsFolder) {\n return (\n <ChatList\n folderType=\"all\"\n isActive={isActive}\n lastSyncTime={lastSyncTime}\n foldersDispatch={foldersDispatch}\n onScreenSelect={onScreenSelect}\n />\n );\n }\n\n return (\n <ChatList\n folderType=\"folder\"\n folderId={activeFolder.id}\n isActive={isActive}\n lastSyncTime={lastSyncTime}\n onScreenSelect={onScreenSelect}\n foldersDispatch={foldersDispatch}\n />\n );\n }\n\n const shouldRenderFolders = folderTabs && folderTabs.length > 1;\n\n return (\n <div className=\"ChatFolders\">\n {shouldRenderFolders ? (\n <TabList tabs={folderTabs} activeTab={activeChatFolder} onSwitchTab={handleSwitchTab} areFolders />\n ) : shouldRenderPlaceholder ? (\n <div className={buildClassName('tabs-placeholder', transitionClassNames)} />\n ) : undefined}\n <Transition\n ref={transitionRef}\n name={shouldSkipHistoryAnimations ? 'none' : lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized'}\n activeKey={activeChatFolder}\n renderCount={shouldRenderFolders ? folderTabs.length : undefined}\n >\n {renderCurrentTab}\n </Transition>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const {\n chatFolders: {\n byId: chatFoldersById,\n orderedIds: orderedFolderIds,\n activeChatFolder,\n },\n currentUserId,\n lastSyncTime,\n shouldSkipHistoryAnimations,\n } = global;\n\n const maxFolders = selectCurrentLimit(global, 'dialogFilters');\n\n return {\n chatFoldersById,\n orderedFolderIds,\n activeChatFolder,\n currentUserId,\n lastSyncTime,\n shouldSkipHistoryAnimations,\n maxFolders,\n };\n },\n)(ChatFolders));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\nimport type { OwnProps } from './LeftSearch';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst LeftSearchAsync: FC<OwnProps> = (props) => {\n const LeftSearch = useModuleLoader(Bundles.Extra, 'LeftSearch');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return LeftSearch ? <LeftSearch {...props} /> : <Loading />;\n};\n\nexport default memo(LeftSearchAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\nimport type { OwnProps } from './ContactList';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst ContactListAsync: FC<OwnProps> = (props) => {\n const ContactList = useModuleLoader(Bundles.Extra, 'ContactList');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ContactList ? <ContactList {...props} /> : <Loading />;\n};\n\nexport default memo(ContactListAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useState, useEffect, memo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Button from '../ui/Button';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './NewChatButton.scss';\n\ntype OwnProps = {\n isShown: boolean;\n onNewPrivateChat: () => void;\n onNewChannel: () => void;\n onNewGroup: () => void;\n};\n\nconst NewChatButton: FC<OwnProps> = ({\n isShown,\n onNewPrivateChat,\n onNewChannel,\n onNewGroup,\n}) => {\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n useEffect(() => {\n if (!isShown) {\n setIsMenuOpen(false);\n }\n }, [isShown]);\n\n const lang = useLang();\n\n const fabClassName = buildClassName(\n 'NewChatButton',\n isShown && 'revealed',\n isMenuOpen && 'menu-is-open',\n );\n\n const toggleIsMenuOpen = useCallback(() => {\n setIsMenuOpen(!isMenuOpen);\n }, [isMenuOpen]);\n\n const handleClose = useCallback(() => {\n setIsMenuOpen(false);\n }, []);\n\n return (\n <div className={fabClassName} dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n round\n color=\"primary\"\n className={isMenuOpen ? 'active' : ''}\n onClick={toggleIsMenuOpen}\n ariaLabel={lang(isMenuOpen ? 'Close' : 'NewMessageTitle')}\n tabIndex={-1}\n >\n <i className=\"icon-new-chat-filled\" />\n <i className=\"icon-close\" />\n </Button>\n <Menu\n isOpen={isMenuOpen}\n positionX={lang.isRtl ? 'left' : 'right'}\n positionY=\"bottom\"\n autoClose\n onClose={handleClose}\n >\n <MenuItem icon=\"channel\" onClick={onNewChannel}>{lang('NewChannel')}</MenuItem>\n <MenuItem icon=\"group\" onClick={onNewGroup}>{lang('NewGroup')}</MenuItem>\n <MenuItem icon=\"user\" onClick={onNewPrivateChat}>{lang('NewMessageTitle')}</MenuItem>\n </Menu>\n </div>\n );\n};\n\nexport default memo(NewChatButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { SettingsScreens } from '../../../types';\nimport { LeftColumnContent } from '../../../types';\nimport type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport buildClassName from '../../../util/buildClassName';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useLang from '../../../hooks/useLang';\n\nimport Transition from '../../ui/Transition';\nimport LeftMainHeader from './LeftMainHeader';\nimport ChatFolders from './ChatFolders';\nimport LeftSearch from '../search/LeftSearch.async';\nimport ContactList from './ContactList.async';\nimport NewChatButton from '../NewChatButton';\nimport Button from '../../ui/Button';\n\nimport './LeftMain.scss';\n\ntype OwnProps = {\n content: LeftColumnContent;\n searchQuery?: string;\n searchDate?: number;\n contactsFilter: string;\n shouldSkipTransition?: boolean;\n foldersDispatch: FolderEditDispatch;\n isUpdateAvailable?: boolean;\n onSearchQuery: (query: string) => void;\n onContentChange: (content: LeftColumnContent) => void;\n onScreenSelect: (screen: SettingsScreens) => void;\n onReset: () => void;\n};\n\nconst TRANSITION_RENDER_COUNT = Object.keys(LeftColumnContent).length / 2;\nconst BUTTON_CLOSE_DELAY_MS = 250;\n\nlet closeTimeout: number | undefined;\n\nconst LeftMain: FC<OwnProps> = ({\n content,\n searchQuery,\n searchDate,\n contactsFilter,\n shouldSkipTransition,\n foldersDispatch,\n isUpdateAvailable,\n onSearchQuery,\n onContentChange,\n onScreenSelect,\n onReset,\n}) => {\n const [isNewChatButtonShown, setIsNewChatButtonShown] = useState(IS_TOUCH_ENV);\n\n const {\n shouldRender: shouldRenderUpdateButton,\n transitionClassNames: updateButtonClassNames,\n } = useShowTransition(isUpdateAvailable);\n\n const isMouseInside = useRef(false);\n\n const handleMouseEnter = useCallback(() => {\n if (content !== LeftColumnContent.ChatList) {\n return;\n }\n isMouseInside.current = true;\n setIsNewChatButtonShown(true);\n }, [content]);\n\n const handleMouseLeave = useCallback(() => {\n isMouseInside.current = false;\n\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = undefined;\n }\n\n closeTimeout = window.setTimeout(() => {\n if (!isMouseInside.current) {\n setIsNewChatButtonShown(false);\n }\n }, BUTTON_CLOSE_DELAY_MS);\n }, []);\n\n const handleSelectSettings = useCallback(() => {\n onContentChange(LeftColumnContent.Settings);\n }, [onContentChange]);\n\n const handleSelectContacts = useCallback(() => {\n onContentChange(LeftColumnContent.Contacts);\n }, [onContentChange]);\n\n const handleSelectArchived = useCallback(() => {\n onContentChange(LeftColumnContent.Archived);\n }, [onContentChange]);\n\n const handleUpdateClick = useCallback(() => {\n window.location.reload();\n }, []);\n\n const handleSelectNewChannel = useCallback(() => {\n onContentChange(LeftColumnContent.NewChannelStep1);\n }, [onContentChange]);\n\n const handleSelectNewGroup = useCallback(() => {\n onContentChange(LeftColumnContent.NewGroupStep1);\n }, [onContentChange]);\n\n useEffect(() => {\n let autoCloseTimeout: number | undefined;\n if (content !== LeftColumnContent.ChatList) {\n autoCloseTimeout = window.setTimeout(() => {\n setIsNewChatButtonShown(false);\n }, BUTTON_CLOSE_DELAY_MS);\n } else if (isMouseInside.current || IS_TOUCH_ENV) {\n setIsNewChatButtonShown(true);\n }\n\n return () => {\n if (autoCloseTimeout) {\n clearTimeout(autoCloseTimeout);\n autoCloseTimeout = undefined;\n }\n };\n }, [content]);\n\n const lang = useLang();\n\n return (\n <div\n id=\"LeftColumn-main\"\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n >\n <LeftMainHeader\n content={content}\n contactsFilter={contactsFilter}\n onSearchQuery={onSearchQuery}\n onSelectSettings={handleSelectSettings}\n onSelectContacts={handleSelectContacts}\n onSelectArchived={handleSelectArchived}\n onReset={onReset}\n shouldSkipTransition={shouldSkipTransition}\n />\n <Transition\n name={shouldSkipTransition ? 'none' : 'zoom-fade'}\n renderCount={TRANSITION_RENDER_COUNT}\n activeKey={content}\n shouldCleanup\n cleanupExceptionKey={LeftColumnContent.ChatList}\n >\n {(isActive) => {\n switch (content) {\n case LeftColumnContent.ChatList:\n return <ChatFolders onScreenSelect={onScreenSelect} foldersDispatch={foldersDispatch} />;\n case LeftColumnContent.GlobalSearch:\n return (\n <LeftSearch\n searchQuery={searchQuery}\n searchDate={searchDate}\n isActive={isActive}\n onReset={onReset}\n />\n );\n case LeftColumnContent.Contacts:\n return <ContactList filter={contactsFilter} isActive={isActive} onReset={onReset} />;\n default:\n return undefined;\n }\n }}\n </Transition>\n {shouldRenderUpdateButton && (\n <Button\n fluid\n pill\n className={buildClassName('btn-update', updateButtonClassNames)}\n onClick={handleUpdateClick}\n >\n {lang('lng_update_telegram')}\n </Button>\n )}\n <NewChatButton\n isShown={isNewChatButtonShown}\n onNewPrivateChat={handleSelectContacts}\n onNewChannel={handleSelectNewChannel}\n onNewGroup={handleSelectNewGroup}\n />\n </div>\n );\n};\n\nexport default memo(LeftMain);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './Settings';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst SettingsAsync: FC<OwnProps> = (props) => {\n const Settings = useModuleLoader(Bundles.Extra, 'Settings');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return Settings ? <Settings {...props} /> : <Loading />;\n};\n\nexport default memo(SettingsAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './NewChat';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst NewChatAsync: FC<OwnProps> = (props) => {\n const NewChat = useModuleLoader(Bundles.Extra, 'NewChat');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return NewChat ? <NewChat {...props} /> : <Loading />;\n};\n\nexport default memo(NewChatAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './ArchivedChats';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport Loading from '../ui/Loading';\n\nconst ArchivedChatsAsync: FC<OwnProps> = (props) => {\n const ArchivedChats = useModuleLoader(Bundles.Extra, 'ArchivedChats');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ArchivedChats ? <ArchivedChats {...props} /> : <Loading />;\n};\n\nexport default memo(ArchivedChatsAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { LeftColumnContent, SettingsScreens } from '../../types';\n\nimport { IS_MAC_OS, IS_PWA, LAYERS_ANIMATION_NAME } from '../../util/environment';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport { selectCurrentChat } from '../../global/selectors';\nimport useFoldersReducer from '../../hooks/reducers/useFoldersReducer';\nimport { useResize } from '../../hooks/useResize';\nimport { useHotkeys } from '../../hooks/useHotkeys';\nimport useOnChange from '../../hooks/useOnChange';\n\nimport Transition from '../ui/Transition';\nimport LeftMain from './main/LeftMain';\nimport Settings from './settings/Settings.async';\nimport NewChat from './newChat/NewChat.async';\nimport ArchivedChats from './ArchivedChats.async';\n\nimport './LeftColumn.scss';\n\ntype StateProps = {\n searchQuery?: string;\n searchDate?: number;\n isFirstChatFolderActive: boolean;\n shouldSkipHistoryAnimations?: boolean;\n leftColumnWidth?: number;\n currentUserId?: string;\n hasPasscode?: boolean;\n nextSettingsScreen?: SettingsScreens;\n isChatOpen: boolean;\n isUpdateAvailable?: boolean;\n};\n\nenum ContentType {\n Main,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Settings,\n Archived,\n // eslint-disable-next-line no-shadow\n NewGroup,\n // eslint-disable-next-line no-shadow\n NewChannel,\n}\n\nconst RENDER_COUNT = Object.keys(ContentType).length / 2;\nconst RESET_TRANSITION_DELAY_MS = 250;\n\nconst LeftColumn: FC<StateProps> = ({\n searchQuery,\n searchDate,\n isFirstChatFolderActive,\n shouldSkipHistoryAnimations,\n leftColumnWidth,\n currentUserId,\n hasPasscode,\n nextSettingsScreen,\n isChatOpen,\n isUpdateAvailable,\n}) => {\n const {\n setGlobalSearchQuery,\n setGlobalSearchChatId,\n resetChatCreation,\n setGlobalSearchDate,\n loadPasswordInfo,\n clearTwoFaError,\n setLeftColumnWidth,\n resetLeftColumnWidth,\n openChat,\n requestNextSettingsScreen,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const resizeRef = useRef<HTMLDivElement>(null);\n const [content, setContent] = useState<LeftColumnContent>(LeftColumnContent.ChatList);\n const [settingsScreen, setSettingsScreen] = useState(SettingsScreens.Main);\n const [contactsFilter, setContactsFilter] = useState<string>('');\n const [foldersState, foldersDispatch] = useFoldersReducer();\n\n // Used to reset child components in background.\n const [lastResetTime, setLastResetTime] = useState<number>(0);\n\n let contentType: ContentType = ContentType.Main;\n switch (content) {\n case LeftColumnContent.Archived:\n contentType = ContentType.Archived;\n break;\n case LeftColumnContent.Settings:\n contentType = ContentType.Settings;\n break;\n case LeftColumnContent.NewChannelStep1:\n case LeftColumnContent.NewChannelStep2:\n contentType = ContentType.NewChannel;\n break;\n case LeftColumnContent.NewGroupStep1:\n case LeftColumnContent.NewGroupStep2:\n contentType = ContentType.NewGroup;\n break;\n }\n\n const handleReset = useCallback((forceReturnToChatList?: true | Event) => {\n function fullReset() {\n setContent(LeftColumnContent.ChatList);\n setContactsFilter('');\n setGlobalSearchQuery({ query: '' });\n setGlobalSearchDate({ date: undefined });\n setGlobalSearchChatId({ id: undefined });\n resetChatCreation();\n setTimeout(() => {\n setLastResetTime(Date.now());\n }, RESET_TRANSITION_DELAY_MS);\n }\n\n if (forceReturnToChatList === true) {\n fullReset();\n return;\n }\n\n if (content === LeftColumnContent.NewGroupStep2) {\n setContent(LeftColumnContent.NewGroupStep1);\n return;\n }\n\n if (content === LeftColumnContent.NewChannelStep2) {\n setContent(LeftColumnContent.NewChannelStep1);\n return;\n }\n\n if (content === LeftColumnContent.NewGroupStep1) {\n const pickerSearchInput = document.getElementById('new-group-picker-search');\n if (pickerSearchInput) {\n pickerSearchInput.blur();\n }\n }\n\n if (content === LeftColumnContent.Settings) {\n switch (settingsScreen) {\n case SettingsScreens.EditProfile:\n case SettingsScreens.Folders:\n case SettingsScreens.General:\n case SettingsScreens.Notifications:\n case SettingsScreens.DataStorage:\n case SettingsScreens.Privacy:\n case SettingsScreens.ActiveSessions:\n case SettingsScreens.Language:\n case SettingsScreens.Stickers:\n case SettingsScreens.Experimental:\n setSettingsScreen(SettingsScreens.Main);\n return;\n\n case SettingsScreens.GeneralChatBackground:\n setSettingsScreen(SettingsScreens.General);\n return;\n case SettingsScreens.GeneralChatBackgroundColor:\n setSettingsScreen(SettingsScreens.GeneralChatBackground);\n return;\n\n case SettingsScreens.PrivacyPhoneNumber:\n case SettingsScreens.PrivacyLastSeen:\n case SettingsScreens.PrivacyProfilePhoto:\n case SettingsScreens.PrivacyPhoneCall:\n case SettingsScreens.PrivacyPhoneP2P:\n case SettingsScreens.PrivacyForwarding:\n case SettingsScreens.PrivacyGroupChats:\n case SettingsScreens.PrivacyVoiceMessages:\n case SettingsScreens.PrivacyBlockedUsers:\n case SettingsScreens.ActiveWebsites:\n case SettingsScreens.TwoFaDisabled:\n case SettingsScreens.TwoFaEnabled:\n case SettingsScreens.TwoFaCongratulations:\n case SettingsScreens.PasscodeDisabled:\n case SettingsScreens.PasscodeEnabled:\n case SettingsScreens.PasscodeCongratulations:\n setSettingsScreen(SettingsScreens.Privacy);\n return;\n\n case SettingsScreens.PasscodeNewPasscode:\n setSettingsScreen(hasPasscode ? SettingsScreens.PasscodeEnabled : SettingsScreens.PasscodeDisabled);\n return;\n\n case SettingsScreens.PasscodeChangePasscodeCurrent:\n case SettingsScreens.PasscodeTurnOff:\n setSettingsScreen(SettingsScreens.PasscodeEnabled);\n return;\n\n case SettingsScreens.PasscodeNewPasscodeConfirm:\n setSettingsScreen(SettingsScreens.PasscodeNewPasscode);\n return;\n\n case SettingsScreens.PasscodeChangePasscodeNew:\n setSettingsScreen(SettingsScreens.PasscodeChangePasscodeCurrent);\n return;\n\n case SettingsScreens.PasscodeChangePasscodeConfirm:\n setSettingsScreen(SettingsScreens.PasscodeChangePasscodeNew);\n return;\n\n case SettingsScreens.PrivacyPhoneNumberAllowedContacts:\n case SettingsScreens.PrivacyPhoneNumberDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyPhoneNumber);\n return;\n case SettingsScreens.PrivacyLastSeenAllowedContacts:\n case SettingsScreens.PrivacyLastSeenDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyLastSeen);\n return;\n case SettingsScreens.PrivacyProfilePhotoAllowedContacts:\n case SettingsScreens.PrivacyProfilePhotoDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyProfilePhoto);\n return;\n case SettingsScreens.PrivacyPhoneCallAllowedContacts:\n case SettingsScreens.PrivacyPhoneCallDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyPhoneCall);\n return;\n case SettingsScreens.PrivacyPhoneP2PAllowedContacts:\n case SettingsScreens.PrivacyPhoneP2PDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyPhoneP2P);\n return;\n case SettingsScreens.PrivacyForwardingAllowedContacts:\n case SettingsScreens.PrivacyForwardingDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyForwarding);\n return;\n case SettingsScreens.PrivacyVoiceMessagesAllowedContacts:\n case SettingsScreens.PrivacyVoiceMessagesDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyVoiceMessages);\n return;\n case SettingsScreens.PrivacyGroupChatsAllowedContacts:\n case SettingsScreens.PrivacyGroupChatsDeniedContacts:\n setSettingsScreen(SettingsScreens.PrivacyGroupChats);\n return;\n case SettingsScreens.TwoFaNewPassword:\n setSettingsScreen(SettingsScreens.TwoFaDisabled);\n return;\n case SettingsScreens.TwoFaNewPasswordConfirm:\n setSettingsScreen(SettingsScreens.TwoFaNewPassword);\n return;\n case SettingsScreens.TwoFaNewPasswordHint:\n setSettingsScreen(SettingsScreens.TwoFaNewPasswordConfirm);\n return;\n case SettingsScreens.TwoFaNewPasswordEmail:\n setSettingsScreen(SettingsScreens.TwoFaNewPasswordHint);\n return;\n case SettingsScreens.TwoFaNewPasswordEmailCode:\n setSettingsScreen(SettingsScreens.TwoFaNewPasswordEmail);\n return;\n case SettingsScreens.TwoFaChangePasswordCurrent:\n case SettingsScreens.TwoFaTurnOff:\n case SettingsScreens.TwoFaRecoveryEmailCurrentPassword:\n setSettingsScreen(SettingsScreens.TwoFaEnabled);\n return;\n case SettingsScreens.TwoFaChangePasswordNew:\n setSettingsScreen(SettingsScreens.TwoFaChangePasswordCurrent);\n return;\n case SettingsScreens.TwoFaChangePasswordConfirm:\n setSettingsScreen(SettingsScreens.TwoFaChangePasswordNew);\n return;\n case SettingsScreens.TwoFaChangePasswordHint:\n setSettingsScreen(SettingsScreens.TwoFaChangePasswordConfirm);\n return;\n case SettingsScreens.TwoFaRecoveryEmail:\n setSettingsScreen(SettingsScreens.TwoFaRecoveryEmailCurrentPassword);\n return;\n case SettingsScreens.TwoFaRecoveryEmailCode:\n setSettingsScreen(SettingsScreens.TwoFaRecoveryEmail);\n return;\n\n case SettingsScreens.FoldersCreateFolder:\n case SettingsScreens.FoldersEditFolder:\n setSettingsScreen(SettingsScreens.Folders);\n return;\n\n case SettingsScreens.FoldersIncludedChatsFromChatList:\n case SettingsScreens.FoldersExcludedChatsFromChatList:\n setSettingsScreen(SettingsScreens.FoldersEditFolderFromChatList);\n return;\n\n case SettingsScreens.FoldersEditFolderFromChatList:\n setContent(LeftColumnContent.ChatList);\n setSettingsScreen(SettingsScreens.Main);\n return;\n\n case SettingsScreens.QuickReaction:\n case SettingsScreens.CustomEmoji:\n setSettingsScreen(SettingsScreens.Stickers);\n return;\n default:\n break;\n }\n }\n\n if (content === LeftColumnContent.ChatList && isFirstChatFolderActive) {\n setContent(LeftColumnContent.GlobalSearch);\n\n return;\n }\n\n fullReset();\n }, [\n content, isFirstChatFolderActive, settingsScreen, setGlobalSearchQuery, setGlobalSearchDate, setGlobalSearchChatId,\n resetChatCreation, hasPasscode,\n ]);\n\n const handleSearchQuery = useCallback((query: string) => {\n if (content === LeftColumnContent.Contacts) {\n setContactsFilter(query);\n return;\n }\n\n setContent(LeftColumnContent.GlobalSearch);\n\n if (query !== searchQuery) {\n setGlobalSearchQuery({ query });\n }\n }, [content, searchQuery, setGlobalSearchQuery]);\n\n useEffect(\n () => (content !== LeftColumnContent.ChatList || (isFirstChatFolderActive && !isChatOpen)\n ? captureEscKeyListener(() => handleReset())\n : undefined),\n [isFirstChatFolderActive, content, handleReset, isChatOpen],\n );\n\n const handleHotkeySearch = useCallback((e: KeyboardEvent) => {\n if (content === LeftColumnContent.GlobalSearch) {\n return;\n }\n\n e.preventDefault();\n setContent(LeftColumnContent.GlobalSearch);\n }, [content]);\n\n const handleHotkeySavedMessages = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n openChat({ id: currentUserId, shouldReplaceHistory: true });\n }, [currentUserId, openChat]);\n\n const handleHotkeySettings = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n setContent(LeftColumnContent.Settings);\n }, []);\n\n useHotkeys({\n 'Mod+Shift+F': handleHotkeySearch,\n 'Mod+Shift+S': handleHotkeySavedMessages,\n 'Mod+0': handleHotkeySavedMessages,\n ...(IS_MAC_OS && IS_PWA && { 'Mod+,': handleHotkeySettings }),\n });\n\n useEffect(() => {\n clearTwoFaError();\n\n if (settingsScreen === SettingsScreens.Privacy) {\n loadPasswordInfo();\n }\n }, [clearTwoFaError, loadPasswordInfo, settingsScreen]);\n\n useOnChange(() => {\n if (nextSettingsScreen) {\n setContent(LeftColumnContent.Settings);\n setSettingsScreen(nextSettingsScreen);\n requestNextSettingsScreen(undefined);\n }\n }, [nextSettingsScreen, requestNextSettingsScreen]);\n\n const {\n initResize, resetResize, handleMouseUp,\n } = useResize(resizeRef, setLeftColumnWidth, resetLeftColumnWidth, leftColumnWidth);\n\n const handleSettingsScreenSelect = useCallback((screen: SettingsScreens) => {\n setContent(LeftColumnContent.Settings);\n setSettingsScreen(screen);\n }, []);\n\n return (\n <div\n id=\"LeftColumn\"\n ref={resizeRef}\n >\n <Transition\n name={shouldSkipHistoryAnimations ? 'none' : LAYERS_ANIMATION_NAME}\n renderCount={RENDER_COUNT}\n activeKey={contentType}\n shouldCleanup\n cleanupExceptionKey={ContentType.Main}\n >\n {(isActive) => {\n switch (contentType) {\n case ContentType.Archived:\n return (\n <ArchivedChats\n isActive={isActive}\n onReset={handleReset}\n onContentChange={setContent}\n />\n );\n case ContentType.Settings:\n return (\n <Settings\n isActive={isActive}\n currentScreen={settingsScreen}\n foldersState={foldersState}\n foldersDispatch={foldersDispatch}\n onScreenSelect={handleSettingsScreenSelect}\n onReset={handleReset}\n shouldSkipTransition={shouldSkipHistoryAnimations}\n />\n );\n case ContentType.NewChannel:\n return (\n <NewChat\n key={lastResetTime}\n isActive={isActive}\n isChannel\n content={content}\n onContentChange={setContent}\n onReset={handleReset}\n />\n );\n case ContentType.NewGroup:\n return (\n <NewChat\n key={lastResetTime}\n isActive={isActive}\n content={content}\n onContentChange={setContent}\n onReset={handleReset}\n />\n );\n default:\n return (\n <LeftMain\n content={content}\n searchQuery={searchQuery}\n searchDate={searchDate}\n contactsFilter={contactsFilter}\n foldersDispatch={foldersDispatch}\n onContentChange={setContent}\n onSearchQuery={handleSearchQuery}\n onScreenSelect={handleSettingsScreenSelect}\n onReset={handleReset}\n shouldSkipTransition={shouldSkipHistoryAnimations}\n isUpdateAvailable={isUpdateAvailable}\n />\n );\n }\n }}\n </Transition>\n <div\n className=\"resize-handle\"\n onMouseDown={initResize}\n onMouseUp={handleMouseUp}\n onDoubleClick={resetResize}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n globalSearch: {\n query,\n date,\n },\n chatFolders: {\n activeChatFolder,\n },\n shouldSkipHistoryAnimations,\n leftColumnWidth,\n currentUserId,\n passcode: {\n hasPasscode,\n },\n settings: {\n nextScreen: nextSettingsScreen,\n },\n isUpdateAvailable,\n } = global;\n\n const isChatOpen = Boolean(selectCurrentChat(global)?.id);\n\n return {\n searchQuery: query,\n searchDate: date,\n isFirstChatFolderActive: activeChatFolder === 0,\n shouldSkipHistoryAnimations,\n leftColumnWidth,\n currentUserId,\n hasPasscode,\n nextSettingsScreen,\n isChatOpen,\n isUpdateAvailable,\n };\n },\n)(LeftColumn));\n","import type { RefObject } from 'react';\nimport { useState, useEffect, useLayoutEffect } from '../lib/teact/teact';\nimport useFlag from './useFlag';\n\nexport function useResize(\n elementRef: RefObject<HTMLElement>,\n onResize: (width: number) => void,\n onReset: NoneToVoidFunction,\n initialWidth?: number,\n) {\n const [isActive, markIsActive, unmarkIsActive] = useFlag();\n const [initialMouseX, setInitialMouseX] = useState<number>();\n const [initialElementWidth, setInitialElementWidth] = useState<number>();\n\n useLayoutEffect(() => {\n if (!elementRef.current || !initialWidth) {\n return;\n }\n\n elementRef.current.style.width = `${initialWidth}px`;\n }, [elementRef, initialWidth]);\n\n function handleMouseUp() {\n document.body.classList.remove('cursor-ew-resize');\n }\n\n function initResize(e: React.MouseEvent<HTMLElement, MouseEvent>) {\n e.preventDefault();\n\n document.body.classList.add('cursor-ew-resize');\n\n setInitialMouseX(e.clientX);\n setInitialElementWidth(elementRef.current!.offsetWidth);\n markIsActive();\n }\n\n function resetResize(e: React.MouseEvent<HTMLElement, MouseEvent>) {\n e.preventDefault();\n elementRef.current!.style.width = '';\n onReset();\n }\n\n useEffect(() => {\n if (!isActive) return undefined;\n\n const handleMouseMove = (e: MouseEvent) => {\n const newWidth = Math.ceil(initialElementWidth + e.clientX - initialMouseX);\n elementRef.current!.style.width = `${newWidth}px`;\n };\n\n function stopDrag() {\n cleanup();\n onResize(elementRef.current!.offsetWidth);\n }\n\n function cleanup() {\n handleMouseUp();\n document.removeEventListener('mousemove', handleMouseMove, false);\n document.removeEventListener('mouseup', stopDrag, false);\n document.removeEventListener('blur', stopDrag, false);\n unmarkIsActive();\n }\n\n document.addEventListener('mousemove', handleMouseMove, false);\n document.addEventListener('mouseup', stopDrag, false);\n document.addEventListener('blur', stopDrag, false);\n\n return cleanup;\n }, [initialElementWidth, initialMouseX, elementRef, onResize, isActive, unmarkIsActive]);\n\n return { initResize, resetResize, handleMouseUp };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './HeaderMenuContainer';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst HeaderMenuContainerAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const HeaderMenuContainer = useModuleLoader(Bundles.Extra, 'HeaderMenuContainer', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return HeaderMenuContainer ? <HeaderMenuContainer {...props} /> : undefined;\n};\n\nexport default memo(HeaderMenuContainerAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo,\n useRef,\n useCallback,\n useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { MessageListType } from '../../global/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\nimport type { IAnchorPosition } from '../../types';\nimport { ManagementScreens } from '../../types';\n\nimport {\n ARE_CALLS_SUPPORTED, IS_PWA, IS_SINGLE_COLUMN_LAYOUT,\n} from '../../util/environment';\nimport {\n isChatBasicGroup, isChatChannel, isChatSuperGroup, isUserId,\n} from '../../global/helpers';\nimport {\n selectChat,\n selectChatBot,\n selectIsUserBlocked,\n selectIsChatBotNotStarted,\n selectIsChatWithSelf,\n selectIsInSelectMode,\n selectIsRightColumnShown,\n} from '../../global/selectors';\nimport useLang from '../../hooks/useLang';\nimport { useHotkeys } from '../../hooks/useHotkeys';\n\nimport Button from '../ui/Button';\nimport HeaderMenuContainer from './HeaderMenuContainer.async';\n\ninterface OwnProps {\n chatId: string;\n threadId: number;\n messageListType: MessageListType;\n canExpandActions: boolean;\n}\n\ninterface StateProps {\n noMenu?: boolean;\n isChannel?: boolean;\n isRightColumnShown?: boolean;\n canStartBot?: boolean;\n canRestartBot?: boolean;\n canSubscribe?: boolean;\n canSearch?: boolean;\n canCall?: boolean;\n canMute?: boolean;\n canViewStatistics?: boolean;\n canLeave?: boolean;\n canEnterVoiceChat?: boolean;\n canCreateVoiceChat?: boolean;\n pendingJoinRequests?: number;\n shouldJoinToSend?: boolean;\n shouldSendJoinRequest?: boolean;\n}\n\n// Chrome breaks layout when focusing input during transition\nconst SEARCH_FOCUS_DELAY_MS = 400;\n\nconst HeaderActions: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n noMenu,\n isChannel,\n canStartBot,\n canRestartBot,\n canSubscribe,\n canSearch,\n canCall,\n canMute,\n canViewStatistics,\n canLeave,\n canEnterVoiceChat,\n canCreateVoiceChat,\n pendingJoinRequests,\n isRightColumnShown,\n canExpandActions,\n shouldJoinToSend,\n shouldSendJoinRequest,\n}) => {\n const {\n joinChannel,\n sendBotCommand,\n openLocalTextSearch,\n restartBot,\n requestCall,\n requestNextManagementScreen,\n showNotification,\n } = getActions();\n // eslint-disable-next-line no-null/no-null\n const menuButtonRef = useRef<HTMLButtonElement>(null);\n const lang = useLang();\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const [menuPosition, setMenuPosition] = useState<IAnchorPosition | undefined>(undefined);\n\n const handleHeaderMenuOpen = useCallback(() => {\n setIsMenuOpen(true);\n const rect = menuButtonRef.current!.getBoundingClientRect();\n setMenuPosition({ x: rect.right, y: rect.bottom });\n }, []);\n\n const handleHeaderMenuClose = useCallback(() => {\n setIsMenuOpen(false);\n }, []);\n\n const handleHeaderMenuHide = useCallback(() => {\n setMenuPosition(undefined);\n }, []);\n\n const handleSubscribeClick = useCallback(() => {\n joinChannel({ chatId });\n if (shouldSendJoinRequest) {\n showNotification({\n message: isChannel ? lang('RequestToJoinChannelSentDescription') : lang('RequestToJoinGroupSentDescription'),\n });\n }\n }, [joinChannel, chatId, shouldSendJoinRequest, showNotification, isChannel, lang]);\n\n const handleStartBot = useCallback(() => {\n sendBotCommand({ command: '/start' });\n }, [sendBotCommand]);\n\n const handleRestartBot = useCallback(() => {\n restartBot({ chatId });\n }, [chatId, restartBot]);\n\n const handleJoinRequestsClick = useCallback(() => {\n requestNextManagementScreen({ screen: ManagementScreens.JoinRequests });\n }, [requestNextManagementScreen]);\n\n const handleSearchClick = useCallback(() => {\n openLocalTextSearch();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n // iOS requires synchronous focus on user event.\n const searchInput = document.querySelector<HTMLInputElement>('#MobileSearch input')!;\n searchInput.focus();\n } else {\n setTimeout(() => {\n const searchInput = document.querySelector<HTMLInputElement>('.RightHeader .SearchInput input');\n if (searchInput) {\n searchInput.focus();\n }\n }, SEARCH_FOCUS_DELAY_MS);\n }\n }, [openLocalTextSearch]);\n\n function handleRequestCall() {\n requestCall({ userId: chatId });\n }\n\n const handleHotkeySearchClick = useCallback((e: KeyboardEvent) => {\n if (!canSearch || !IS_PWA || e.shiftKey) {\n return;\n }\n\n e.preventDefault();\n handleSearchClick();\n }, [canSearch, handleSearchClick]);\n\n useHotkeys({\n 'Mod+F': handleHotkeySearchClick,\n });\n\n return (\n <div className=\"HeaderActions\">\n {!IS_SINGLE_COLUMN_LAYOUT && (\n <>\n {canExpandActions && !shouldSendJoinRequest && (canSubscribe || shouldJoinToSend) && (\n <Button\n size=\"tiny\"\n ripple\n fluid\n onClick={handleSubscribeClick}\n >\n {lang(isChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}\n </Button>\n )}\n {canExpandActions && shouldSendJoinRequest && (\n <Button\n size=\"tiny\"\n ripple\n fluid\n onClick={handleSubscribeClick}\n >\n {lang('ChannelJoinRequest')}\n </Button>\n )}\n {canExpandActions && canStartBot && (\n <Button\n size=\"tiny\"\n ripple\n fluid\n onClick={handleStartBot}\n >\n {lang('BotStart')}\n </Button>\n )}\n {canExpandActions && canRestartBot && (\n <Button\n size=\"tiny\"\n ripple\n fluid\n onClick={handleRestartBot}\n >\n {lang('BotRestart')}\n </Button>\n )}\n {canSearch && (\n <Button\n round\n ripple={isRightColumnShown}\n color=\"translucent\"\n size=\"smaller\"\n onClick={handleSearchClick}\n ariaLabel=\"Search in this chat\"\n >\n <i className=\"icon-search\" />\n </Button>\n )}\n {canCall && (\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={handleRequestCall}\n ariaLabel=\"Call\"\n >\n <i className=\"icon-phone\" />\n </Button>\n )}\n </>\n )}\n {Boolean(pendingJoinRequests) && (\n <Button\n round\n className=\"badge-button\"\n ripple={isRightColumnShown}\n color=\"translucent\"\n size=\"smaller\"\n onClick={handleJoinRequestsClick}\n ariaLabel={isChannel ? lang('SubscribeRequests') : lang('MemberRequests')}\n >\n <i className=\"icon-user\" />\n <div className=\"badge\">{pendingJoinRequests}</div>\n </Button>\n )}\n <Button\n ref={menuButtonRef}\n className={isMenuOpen ? 'active' : ''}\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n size=\"smaller\"\n color=\"translucent\"\n disabled={noMenu}\n ariaLabel=\"More actions\"\n onClick={handleHeaderMenuOpen}\n >\n <i className=\"icon-more\" />\n </Button>\n {menuPosition && (\n <HeaderMenuContainer\n chatId={chatId}\n threadId={threadId}\n isOpen={isMenuOpen}\n anchor={menuPosition}\n withExtraActions={IS_SINGLE_COLUMN_LAYOUT || !canExpandActions}\n isChannel={isChannel}\n canStartBot={canStartBot}\n canRestartBot={canRestartBot}\n canSubscribe={canSubscribe}\n canSearch={canSearch}\n canCall={canCall}\n canMute={canMute}\n canViewStatistics={canViewStatistics}\n canLeave={canLeave}\n canEnterVoiceChat={canEnterVoiceChat}\n canCreateVoiceChat={canCreateVoiceChat}\n onSubscribeChannel={handleSubscribeClick}\n onSearchClick={handleSearchClick}\n onClose={handleHeaderMenuClose}\n onCloseAnimationEnd={handleHeaderMenuHide}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId, messageListType }): StateProps => {\n const chat = selectChat(global, chatId);\n const isChannel = Boolean(chat && isChatChannel(chat));\n\n if (!chat || chat.isRestricted || selectIsInSelectMode(global)) {\n return {\n noMenu: true,\n };\n }\n\n const bot = selectChatBot(global, chatId);\n const isChatWithSelf = selectIsChatWithSelf(global, chatId);\n const isMainThread = messageListType === 'thread' && threadId === MAIN_THREAD_ID;\n const isDiscussionThread = messageListType === 'thread' && threadId !== MAIN_THREAD_ID;\n const isRightColumnShown = selectIsRightColumnShown(global);\n\n const canRestartBot = Boolean(bot && selectIsUserBlocked(global, bot.id));\n const canStartBot = !canRestartBot && Boolean(selectIsChatBotNotStarted(global, chatId));\n const canSubscribe = Boolean(\n isMainThread && (isChannel || isChatSuperGroup(chat)) && chat.isNotJoined,\n );\n const canSearch = isMainThread || isDiscussionThread;\n const canCall = ARE_CALLS_SUPPORTED && isUserId(chat.id) && !isChatWithSelf && !bot;\n const canMute = isMainThread && !isChatWithSelf && !canSubscribe;\n const canLeave = isMainThread && !canSubscribe;\n const canEnterVoiceChat = ARE_CALLS_SUPPORTED && chat.isCallActive;\n const canCreateVoiceChat = ARE_CALLS_SUPPORTED && !chat.isCallActive\n && (chat.adminRights?.manageCall || (chat.isCreator && isChatBasicGroup(chat)));\n const canViewStatistics = chat.fullInfo?.canViewStatistics;\n const pendingJoinRequests = chat.fullInfo?.requestsPending;\n const shouldJoinToSend = Boolean(chat?.isNotJoined && chat.isJoinToSend);\n const shouldSendJoinRequest = Boolean(chat?.isNotJoined && chat.isJoinRequest);\n\n return {\n noMenu: false,\n isChannel,\n isRightColumnShown,\n canStartBot,\n canRestartBot,\n canSubscribe,\n canSearch,\n canCall,\n canMute,\n canViewStatistics,\n canLeave,\n canEnterVoiceChat,\n canCreateVoiceChat,\n pendingJoinRequests,\n shouldJoinToSend,\n shouldSendJoinRequest,\n };\n },\n)(HeaderActions));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useRef,\n useEffect,\n useMemo,\n memo,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\ntype OwnProps = {\n count: number;\n index: number;\n};\n\nconst BORDER_MASK_LEVEL = 4;\n\nconst PinnedMessageNavigation: FC<OwnProps> = ({\n count, index,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n const markupParams = useMemo(() => {\n return calculateMarkup(count, index);\n }, [count, index]);\n\n useEffect(() => {\n if (!containerRef.current) {\n return;\n }\n\n const {\n trackHeight,\n trackTranslateY,\n markHeight,\n markTranslateY,\n clipPathId,\n clipPath,\n } = markupParams;\n\n const firstChild = containerRef.current.firstElementChild;\n if (containerRef?.current) {\n const currentElement = containerRef.current;\n const { style } = currentElement;\n style.height = `${trackHeight}px`;\n style.transform = `translateY(-${trackTranslateY}px)`;\n style.clipPath = `url(\"#${clipPathId}\")`;\n const svg = currentElement.querySelector('svg');\n const div = currentElement.querySelector('div');\n const defs = currentElement.querySelector('defs');\n if (!svg) {\n if (firstChild) {\n firstChild.innerHTML = `<svg height=\"0\" width=\"0\"><defs> ${clipPath} </defs></svg>`;\n }\n }\n if (defs) {\n defs.innerHTML = clipPath;\n }\n if (div) {\n div.style.height = `${markHeight}px`;\n div.style.transform = `translateY(${markTranslateY}px)`;\n }\n }\n }, [markupParams]);\n\n if (count === 1) {\n return (\n <div className=\"pinned-message-border\">\n <div\n className=\"pinned-message-border-wrapper-1\"\n ref={containerRef}\n />\n </div>\n );\n }\n\n const {\n trackHeight, trackTranslateY, markHeight, markTranslateY, clipPathId,\n } = markupParams;\n\n return (\n <div className={buildClassName('pinned-message-border', count > BORDER_MASK_LEVEL && 'pinned-message-border-mask')}>\n <div\n className=\"pinned-message-border-wrapper\"\n ref={containerRef}\n style={\n `clip-path: url(\"#${clipPathId}\"); width: 2px;\n height: ${trackHeight}px; transform: translateY(-${trackTranslateY}px);`\n }\n >\n <span />\n <div\n className=\"pinned-message-border-mark\"\n style={`height: ${markHeight}px; transform: translateY(${markTranslateY}px);`}\n />\n </div>\n </div>\n );\n};\n\nfunction calculateMarkup(count: number, index: number) {\n const reverseIndex = count - index - 1;\n const barHeight = getBarHeight(count);\n const markHeight = getMarkHeight(count, reverseIndex);\n const trackHeight = getTrackHeight(count, barHeight);\n\n const clipPathId = `clipPath${count}`;\n const clipPath = getClipPath(clipPathId, barHeight, count);\n\n const markTranslateY = getMarkTranslateY(reverseIndex, barHeight, count);\n const trackTranslateY = getTrackTranslateY(reverseIndex, count, barHeight, trackHeight);\n return {\n markHeight,\n clipPath,\n markTranslateY,\n trackTranslateY,\n trackHeight,\n clipPathId,\n };\n}\n\nfunction getBarHeight(count: number): number {\n let barHeight = 8;\n if (count === 1) {\n barHeight = 36;\n } else if (count === 2) {\n barHeight = 17;\n } else if (count === 3) {\n barHeight = 11;\n } else if (count === 4) {\n barHeight = 7.5;\n } else if (count > 3) {\n barHeight = 7.5;\n }\n\n return barHeight;\n}\n\nfunction getMarkHeight(count: number, index: number) {\n let barHeight = 36;\n if (count === 1) {\n barHeight = 36;\n } else if (count === 2) {\n barHeight = 17;\n } else if (count === 3) {\n barHeight = index === 1 ? 12 : 11;\n } else if (count === 4) {\n barHeight = 7.5;\n } else if (count > 3) {\n barHeight = 7.5;\n }\n\n return barHeight;\n}\n\nfunction getTrackHeight(count: number, barHeight: number) {\n return count <= 3 ? 36 : barHeight * count + 2 * (count - 1);\n}\n\nfunction getClipPath(id: string, barHeight: number, count: number) {\n const radius = 1;\n\n let d = '';\n if (count === 3) {\n d = drawRect(0, 0, 2, barHeight, radius)\n + drawRect(0, 12, 2, barHeight + 1, radius)\n + drawRect(0, 25, 2, barHeight, radius);\n } else {\n for (let i = 0; i < count; i++) {\n d += drawRect(0, (barHeight + 2) * i, 2, barHeight, radius);\n }\n }\n\n return (\n `<clipPath id=\"${id}\">\n <path d=\"${d}\" />\n </clipPath>`\n );\n}\n\nfunction drawRect(x: number, y: number, width: number, height: number, radius: number) {\n return `M${x},${y + radius}a${radius},${radius},0,0,1,\n ${width},0v${height - 2 * radius}a${radius},${radius},0,0,1,${-width},0Z`;\n}\n\nfunction getMarkTranslateY(index: number, barHeight: number, count: number) {\n if (count === 1) {\n return 0;\n } else if (count === 2) {\n return index === 0 ? 0 : barHeight + 2;\n }\n\n if (count === 3) {\n if (index === 0) {\n return 0;\n } else if (index === 1) {\n return 12;\n }\n\n return 25;\n } else {\n return (barHeight + 2) * index;\n }\n}\n\nfunction getTrackTranslateY(index: number, count: number, barHeight: number, trackHeight: number) {\n if (count <= 4) {\n return 0;\n }\n\n if (index <= 1) {\n return 0;\n } else if (index >= count - 2) {\n return trackHeight - 36;\n }\n\n return (barHeight + 4) / 2 + (index - 2) * (barHeight + 2);\n}\n\nexport default memo(PinnedMessageNavigation);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiMessage } from '../../api/types';\n\nimport { getPictogramDimensions } from '../common/helpers/mediaDimensions';\nimport { getMessageMediaHash, getMessageSingleInlineButton } from '../../global/helpers';\nimport { renderMessageSummary } from '../common/helpers/renderMessageText';\nimport buildClassName from '../../util/buildClassName';\nimport { IS_TOUCH_ENV } from '../../util/environment';\n\nimport useMedia from '../../hooks/useMedia';\nimport useThumbnail from '../../hooks/useThumbnail';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\n\nimport RippleEffect from '../ui/RippleEffect';\nimport ConfirmDialog from '../ui/ConfirmDialog';\nimport Button from '../ui/Button';\nimport PinnedMessageNavigation from './PinnedMessageNavigation';\n\ntype OwnProps = {\n message: ApiMessage;\n index: number;\n count: number;\n customTitle?: string;\n className?: string;\n onUnpinMessage?: (id: number) => void;\n onClick?: () => void;\n onAllPinnedClick?: () => void;\n};\n\nconst HeaderPinnedMessage: FC<OwnProps> = ({\n message, count, index, customTitle, className, onUnpinMessage, onClick, onAllPinnedClick,\n}) => {\n const { clickBotInlineButton } = getActions();\n const lang = useLang();\n const mediaThumbnail = useThumbnail(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'pictogram'));\n\n const text = renderMessageSummary(lang, message, Boolean(mediaThumbnail));\n const [isUnpinDialogOpen, openUnpinDialog, closeUnpinDialog] = useFlag();\n\n const handleUnpinMessage = useCallback(() => {\n closeUnpinDialog();\n\n if (onUnpinMessage) {\n onUnpinMessage(message.id);\n }\n }, [closeUnpinDialog, onUnpinMessage, message.id]);\n\n const inlineButton = getMessageSingleInlineButton(message);\n\n const handleInlineButtonClick = useCallback(() => {\n if (inlineButton) {\n clickBotInlineButton({ messageId: message.id, button: inlineButton });\n }\n }, [clickBotInlineButton, inlineButton, message.id]);\n\n const [noHoverColor, markNoHoverColor, unmarkNoHoverColor] = useFlag();\n\n return (\n <div className={buildClassName('HeaderPinnedMessage-wrapper', className)}>\n {count > 1 && (\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n className=\"pin-list-button\"\n ariaLabel={lang('EventLogFilterPinnedMessages')}\n onClick={onAllPinnedClick}\n >\n <i className=\"icon-pin-list\" />\n </Button>\n )}\n {onUnpinMessage && (\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n ariaLabel={lang('UnpinMessageAlertTitle')}\n className=\"unpin-button\"\n onClick={openUnpinDialog}\n >\n <i className=\"icon-close\" />\n </Button>\n )}\n <ConfirmDialog\n isOpen={isUnpinDialogOpen}\n onClose={closeUnpinDialog}\n text=\"Would you like to unpin this message?\"\n confirmLabel=\"Unpin\"\n confirmHandler={handleUnpinMessage}\n />\n <div\n className={buildClassName('HeaderPinnedMessage', noHoverColor && 'no-hover')}\n onClick={onClick}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n <PinnedMessageNavigation\n count={count}\n index={index}\n />\n {mediaThumbnail && renderPictogram(mediaThumbnail, mediaBlobUrl)}\n <div className=\"message-text\">\n <div className=\"title\" dir=\"auto\">\n {customTitle || `${lang('PinnedMessage')} ${index > 0 ? `#${count - index}` : ''}`}\n </div>\n <p dir=\"auto\">{text}</p>\n <RippleEffect />\n </div>\n {inlineButton && (\n <Button\n size=\"tiny\"\n className=\"inline-button\"\n onClick={handleInlineButtonClick}\n shouldStopPropagation\n onMouseEnter={!IS_TOUCH_ENV ? markNoHoverColor : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? unmarkNoHoverColor : undefined}\n >\n {inlineButton.text}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\nfunction renderPictogram(thumbDataUri: string, blobUrl?: string) {\n const { width, height } = getPictogramDimensions();\n\n return (\n <img src={blobUrl || thumbDataUri} width={width} height={height} alt=\"\" />\n );\n}\n\nexport default memo(HeaderPinnedMessage);\n","import { getAverageColor, getColorLuma } from './colors';\n\nconst LUMA_THRESHOLD = 240;\n\nexport function scaleImage(image: string | Blob, ratio: number, outputType: string = 'image/png'): Promise<string> {\n const url = image instanceof Blob ? URL.createObjectURL(image) : image;\n const img = new Image();\n return new Promise((resolve) => {\n img.onload = () => {\n scale(img, img.width * ratio, img.height * ratio, outputType)\n .then((blob) => {\n if (!blob) throw new Error('Image resize failed!');\n return URL.createObjectURL(blob);\n })\n .then(resolve)\n .finally(() => {\n if (image instanceof Blob) {\n URL.revokeObjectURL(url); // Revoke blob url that we created\n }\n });\n };\n img.src = url;\n });\n}\n\nexport function resizeImage(\n image: string | Blob, width: number, height: number, outputType: string = 'image/png',\n): Promise<string> {\n const url = image instanceof Blob ? URL.createObjectURL(image) : image;\n const img = new Image();\n return new Promise((resolve) => {\n img.onload = () => {\n scale(img, width, height, outputType)\n .then((blob) => {\n if (!blob) throw new Error('Image resize failed!');\n return URL.createObjectURL(blob);\n })\n .then(resolve)\n .finally(() => {\n if (image instanceof Blob) {\n URL.revokeObjectURL(url); // Revoke blob url that we created\n }\n });\n };\n img.src = url;\n });\n}\n\nasync function scale(\n img: HTMLImageElement, width: number, height: number, outputType: string = 'image/png',\n): Promise<Blob | null> {\n // Safari does not have built-in resize method with quality control\n if ('createImageBitmap' in window) {\n try {\n const bitmap = await window.createImageBitmap(img,\n { resizeWidth: width, resizeHeight: height, resizeQuality: 'high' });\n if (bitmap.height !== height || bitmap.width !== width) {\n throw new Error('Image bitmap resize not supported!'); // FF93 added support for options, but not resize\n }\n const averageColor = await getAverageColor(img.src);\n const fillColor = getColorLuma(averageColor) < LUMA_THRESHOLD ? '#fff' : '#000';\n return await new Promise((res) => {\n const canvas = document.createElement('canvas');\n canvas.width = bitmap.width;\n canvas.height = bitmap.height;\n const ctx2D = canvas.getContext('2d')!;\n ctx2D.fillStyle = fillColor;\n ctx2D.fillRect(0, 0, canvas.width, canvas.height);\n const ctx = canvas.getContext('bitmaprenderer');\n if (ctx) {\n ctx.transferFromImageBitmap(bitmap);\n } else {\n ctx2D.drawImage(bitmap, 0, 0);\n }\n canvas.toBlob(res, outputType);\n });\n } catch (e) {\n // Fallback. Firefox below 93 does not recognize `createImageBitmap` with 2 parameters\n return steppedScale(img, width, height, undefined, outputType);\n }\n } else {\n return steppedScale(img, width, height, undefined, outputType);\n }\n}\n\nasync function steppedScale(\n img: HTMLImageElement, width: number, height: number, step: number = 0.5, outputType: string = 'image/png',\n): Promise<Blob | null> {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d')!;\n const oc = document.createElement('canvas');\n const octx = oc.getContext('2d')!;\n\n canvas.width = width;\n canvas.height = height;\n\n if (img.width * step > width) { // For performance avoid unnecessary drawing\n const mul = 1 / step;\n let cur = {\n width: Math.floor(img.width * step),\n height: Math.floor(img.height * step),\n };\n\n oc.width = cur.width;\n oc.height = cur.height;\n\n octx.drawImage(img, 0, 0, cur.width, cur.height);\n\n while (cur.width * step > width) {\n cur = {\n width: Math.floor(cur.width * step),\n height: Math.floor(cur.height * step),\n };\n octx.drawImage(oc, 0, 0, cur.width * mul, cur.height * mul, 0, 0, cur.width, cur.height);\n }\n\n ctx.drawImage(oc, 0, 0, cur.width, cur.height, 0, 0, canvas.width, canvas.height);\n } else {\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n }\n\n const averageColor = await getAverageColor(img.src);\n const fillColor = getColorLuma(averageColor) < LUMA_THRESHOLD ? '#fff' : '#000';\n ctx.fillStyle = fillColor;\n ctx.globalCompositeOperation = 'destination-over';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n return new Promise((resolve) => {\n canvas.toBlob(resolve, outputType);\n });\n}\n","import { useMemo } from '../lib/teact/teact';\n\nimport type {\n ApiAudio, ApiChat, ApiMessage, ApiUser, ApiVoice,\n} from '../api/types';\n\nimport {\n getAudioHasCover, getChatAvatarHash, getChatTitle, getMessageContent, getMessageMediaHash, getSenderTitle,\n} from '../global/helpers';\nimport { buildMediaMetadata } from '../util/mediaSession';\nimport { scaleImage, resizeImage } from '../util/imageResize';\nimport { AVATAR_FULL_DIMENSIONS } from '../components/common/helpers/mediaDimensions';\n\nimport useLang from './useLang';\nimport useMedia from './useMedia';\nimport useAsync from './useAsync';\n\nimport telegramLogoPath from '../assets/telegram-logo-filled.svg';\n\nconst LOGO_DIMENSIONS = { width: 200, height: 200 };\nconst MINIMAL_SIZE = 115; // spec says 100, but on Chrome 93 it's not showing\n\n// TODO Add support for video in future\nconst useMessageMediaMetadata = (\n message: ApiMessage, sender?: ApiUser | ApiChat, chat?: ApiChat,\n): MediaMetadata | undefined => {\n const lang = useLang();\n\n const { audio, voice } = getMessageContent(message);\n const title = audio ? (audio.title || audio.fileName) : voice ? 'Voice message' : '';\n const artist = audio?.performer || (sender && getSenderTitle(lang, sender));\n const album = (chat && getChatTitle(lang, chat)) || 'Telegram';\n\n const audioCoverHash = (audio && getAudioHasCover(audio) && getMessageMediaHash(message, 'pictogram'));\n const avatarHash = sender && getChatAvatarHash(sender, 'big');\n const hash = (audio && audioCoverHash) || (voice && avatarHash);\n const media = useMedia(hash);\n\n const size = useMemo(() => {\n return getCoverSize(audio, voice, media);\n }, [audio, media, voice]);\n const { result: url } = useAsync(() => (\n makeGoodArtwork(media, size)\n ), [media, size], telegramLogoPath);\n return useMemo(() => {\n return buildMediaMetadata({\n title,\n artist,\n album,\n artwork: [{ src: url }],\n });\n }, [album, artist, title, url]);\n};\n\nfunction makeGoodArtwork(url?: string, size?: { width: number; height: number }): Promise<string> {\n if (!url) return Promise.resolve(telegramLogoPath);\n if (!size) return resizeImage(url, MINIMAL_SIZE, MINIMAL_SIZE);\n const min = Math.min(size.width, size.height);\n if (min < MINIMAL_SIZE) {\n const ratio = MINIMAL_SIZE / min;\n return scaleImage(url, ratio);\n }\n return Promise.resolve(url);\n}\n\nfunction getCoverSize(audio?: ApiAudio, voice?: ApiVoice, url?: string) {\n if (!url) return LOGO_DIMENSIONS;\n if (audio) {\n if (!audio.thumbnailSizes?.length) return undefined;\n const preferred = audio.thumbnailSizes.find((size) => size.type === 'm');\n return preferred || audio.thumbnailSizes[0]; // Sometimes `m` is not present\n }\n\n if (voice) {\n return AVATAR_FULL_DIMENSIONS;\n }\n\n return undefined;\n}\n\nexport default useMessageMediaMetadata;\n","import React, { useCallback, useEffect, useMemo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { AudioOrigin } from '../../types';\nimport type {\n ApiAudio, ApiChat, ApiMessage, ApiUser,\n} from '../../api/types';\n\nimport { IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../util/environment';\nimport { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../../config';\n\nimport * as mediaLoader from '../../util/mediaLoader';\nimport {\n getMediaDuration, getMessageContent, getMessageMediaHash, getSenderTitle, isMessageLocal,\n} from '../../global/helpers';\nimport { selectChat, selectSender } from '../../global/selectors';\nimport buildClassName from '../../util/buildClassName';\nimport { makeTrackId } from '../../util/audioPlayer';\nimport { clearMediaSession } from '../../util/mediaSession';\nimport windowSize from '../../util/windowSize';\nimport useAudioPlayer from '../../hooks/useAudioPlayer';\nimport useLang from '../../hooks/useLang';\nimport useMessageMediaMetadata from '../../hooks/useMessageMediaMetadata';\nimport renderText from '../common/helpers/renderText';\n\nimport RippleEffect from '../ui/RippleEffect';\nimport Button from '../ui/Button';\nimport RangeSlider from '../ui/RangeSlider';\n\nimport './AudioPlayer.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n origin?: AudioOrigin;\n className?: string;\n noUi?: boolean;\n};\n\ntype StateProps = {\n sender?: ApiChat | ApiUser;\n chat?: ApiChat;\n volume: number;\n playbackRate: number;\n isMuted: boolean;\n};\n\nconst FAST_PLAYBACK_RATE = 1.8;\n\nconst AudioPlayer: FC<OwnProps & StateProps> = ({\n message,\n className,\n noUi,\n sender,\n chat,\n volume,\n playbackRate,\n isMuted,\n}) => {\n const {\n setAudioPlayerVolume,\n setAudioPlayerPlaybackRate,\n setAudioPlayerMuted,\n focusMessage,\n closeAudioPlayer,\n } = getActions();\n\n const lang = useLang();\n const { audio, voice, video } = getMessageContent(message);\n const isVoice = Boolean(voice || video);\n const shouldRenderPlaybackButton = isVoice || (audio?.duration || 0) > PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION;\n const senderName = sender ? getSenderTitle(lang, sender) : undefined;\n const mediaData = mediaLoader.getFromMemory(getMessageMediaHash(message, 'inline')!) as (string | undefined);\n const mediaMetadata = useMessageMediaMetadata(message, sender, chat);\n\n const {\n playPause,\n stop,\n isPlaying,\n requestNextTrack,\n requestPreviousTrack,\n isFirst,\n isLast,\n setVolume,\n toggleMuted,\n setPlaybackRate,\n } = useAudioPlayer(\n makeTrackId(message),\n getMediaDuration(message)!,\n isVoice ? 'voice' : 'audio',\n mediaData,\n undefined,\n mediaMetadata,\n undefined,\n true,\n undefined,\n undefined,\n isMessageLocal(message),\n true,\n );\n\n // Prevent refresh by accidentally rotating device when listening to a voice message\n const isVoicePlaying = isVoice && isPlaying;\n useEffect(() => {\n if (!isVoicePlaying) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isVoicePlaying]);\n\n const handleClick = useCallback(() => {\n focusMessage({ chatId: message.chatId, messageId: message.id });\n }, [focusMessage, message.chatId, message.id]);\n\n const handleClose = useCallback(() => {\n if (isPlaying) {\n playPause();\n }\n closeAudioPlayer();\n clearMediaSession();\n stop();\n }, [closeAudioPlayer, isPlaying, playPause, stop]);\n\n const handleVolumeChange = useCallback((value: number) => {\n setAudioPlayerVolume({ volume: value / 100 });\n\n setVolume(value / 100);\n }, [setAudioPlayerVolume, setVolume]);\n\n const handleVolumeClick = useCallback(() => {\n if (IS_TOUCH_ENV && !IS_IOS) return;\n toggleMuted();\n setAudioPlayerMuted({ isMuted: !isMuted });\n }, [isMuted, setAudioPlayerMuted, toggleMuted]);\n\n const handlePlaybackClick = useCallback(() => {\n if (playbackRate === 1) {\n setPlaybackRate(FAST_PLAYBACK_RATE);\n setAudioPlayerPlaybackRate({ playbackRate: FAST_PLAYBACK_RATE });\n } else {\n setPlaybackRate(1);\n setAudioPlayerPlaybackRate({ playbackRate: 1 });\n }\n }, [playbackRate, setAudioPlayerPlaybackRate, setPlaybackRate]);\n\n const volumeIcon = useMemo(() => {\n if (volume === 0 || isMuted) return 'icon-muted';\n if (volume < 0.3) return 'icon-volume-1';\n if (volume < 0.6) return 'icon-volume-2';\n return 'icon-volume-3';\n }, [volume, isMuted]);\n\n if (noUi) {\n return undefined;\n }\n\n return (\n <div className={buildClassName('AudioPlayer', className)} dir={lang.isRtl ? 'rtl' : undefined}>\n <div className=\"AudioPlayer-content\" onClick={handleClick}>\n {audio ? renderAudio(audio) : renderVoice(lang('AttachAudio'), senderName)}\n <RippleEffect />\n </div>\n\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent\"\n size=\"smaller\"\n className=\"player-button\"\n disabled={isFirst()}\n onClick={requestPreviousTrack}\n ariaLabel=\"Previous track\"\n >\n <i className=\"icon-skip-previous\" />\n </Button>\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent\"\n size=\"smaller\"\n className={buildClassName('toggle-play', 'player-button', isPlaying ? 'pause' : 'play')}\n onClick={playPause}\n ariaLabel={isPlaying ? 'Pause audio' : 'Play audio'}\n >\n <i className=\"icon-play\" />\n <i className=\"icon-pause\" />\n </Button>\n <Button\n round\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n color=\"translucent\"\n size=\"smaller\"\n className=\"player-button\"\n disabled={isLast()}\n onClick={requestNextTrack}\n ariaLabel=\"Next track\"\n >\n <i className=\"icon-skip-next\" />\n </Button>\n\n <Button\n round\n className=\"player-button volume-button\"\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel=\"Volume\"\n noPreventDefault\n >\n <i className={volumeIcon} onClick={handleVolumeClick} />\n {!IS_IOS && (\n <>\n <div className=\"volume-slider-spacer\" />\n <div className=\"volume-slider\">\n <RangeSlider bold value={isMuted ? 0 : volume * 100} onChange={handleVolumeChange} />\n </div>\n </>\n )}\n </Button>\n\n {shouldRenderPlaybackButton && (\n <Button\n round\n className={buildClassName('playback-button', playbackRate !== 1 && 'applied')}\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel=\"Playback Rate\"\n ripple={!IS_SINGLE_COLUMN_LAYOUT}\n onClick={handlePlaybackClick}\n >\n <span className=\"playback-button-inner\">2Х</span>\n </Button>\n )}\n\n <Button\n round\n className=\"player-close\"\n color=\"translucent\"\n size=\"smaller\"\n onClick={handleClose}\n ariaLabel=\"Close player\"\n >\n <i className=\"icon-close\" />\n </Button>\n </div>\n );\n};\n\nfunction renderAudio(audio: ApiAudio) {\n const { title, performer, fileName } = audio;\n\n return (\n <>\n <div className=\"title\" dir=\"auto\">{renderText(title || fileName)}</div>\n {performer && (\n <div className=\"subtitle\" dir=\"auto\">{renderText(performer)}</div>\n )}\n </>\n );\n}\n\nfunction renderVoice(subtitle: string, senderName?: string) {\n return (\n <>\n <div className=\"title\" dir=\"auto\">{senderName && renderText(senderName)}</div>\n <div className=\"subtitle\" dir=\"auto\">{subtitle}</div>\n </>\n );\n}\n\nexport default withGlobal<OwnProps>(\n (global, { message }): StateProps => {\n const sender = selectSender(global, message);\n const chat = selectChat(global, message.chatId);\n const { volume, playbackRate, isMuted } = global.audioPlayer;\n\n return {\n sender,\n chat,\n volume,\n playbackRate,\n isMuted,\n };\n },\n)(AudioPlayer);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiGroupCall, ApiUser } from '../../../api/types';\nimport type { AnimationLevel } from '../../../types';\n\nimport { selectChatGroupCall } from '../../../global/selectors/calls';\nimport buildClassName from '../../../util/buildClassName';\nimport { selectChat } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport Avatar from '../../common/Avatar';\n\nimport './GroupCallTopPane.scss';\n\ntype OwnProps = {\n chatId: string;\n hasPinnedOffset: boolean;\n};\n\ntype StateProps = {\n groupCall?: ApiGroupCall;\n isActive: boolean;\n usersById: Record<string, ApiUser>;\n chatsById: Record<string, ApiChat>;\n animationLevel: AnimationLevel;\n};\n\nconst GroupCallTopPane: FC<OwnProps & StateProps> = ({\n chatId,\n isActive,\n groupCall,\n hasPinnedOffset,\n usersById,\n chatsById,\n animationLevel,\n}) => {\n const {\n joinGroupCall,\n subscribeToGroupCallUpdates,\n } = getActions();\n\n const lang = useLang();\n\n const handleJoinGroupCall = useCallback(() => {\n joinGroupCall({\n chatId,\n });\n }, [joinGroupCall, chatId]);\n\n const participants = groupCall?.participants;\n\n const fetchedParticipants = useMemo(() => {\n if (participants) {\n return Object.values(participants).filter((_, i) => i < 3).map(({ id, isUser }) => {\n if (isUser) {\n if (!usersById[id]) {\n return undefined;\n }\n return { user: usersById[id] };\n } else {\n if (!chatsById[id]) {\n return undefined;\n }\n return { chat: chatsById[id] };\n }\n }).filter(Boolean);\n } else return [];\n }, [chatsById, participants, usersById]);\n\n useEffect(() => {\n if (!groupCall?.id) return undefined;\n if (!isActive && groupCall.isLoaded) return undefined;\n\n subscribeToGroupCallUpdates({\n id: groupCall.id,\n subscribed: true,\n });\n\n return () => {\n subscribeToGroupCallUpdates({\n id: groupCall.id,\n subscribed: false,\n });\n };\n }, [groupCall?.id, groupCall?.isLoaded, isActive, subscribeToGroupCallUpdates]);\n\n if (!groupCall) return undefined;\n\n return (\n <div\n className={buildClassName(\n 'GroupCallTopPane',\n hasPinnedOffset && 'has-pinned-offset',\n !isActive && 'is-hidden',\n )}\n onClick={handleJoinGroupCall}\n >\n <div className=\"info\">\n <span className=\"title\">{lang('VoipGroupVoiceChat')}</span>\n <span className=\"participants\">{lang('Participants', groupCall.participantsCount || 0, 'i')}</span>\n </div>\n <div className=\"avatars\">\n {fetchedParticipants.map((p) => {\n if (!p) return undefined;\n if (p.user) {\n return <Avatar key={p.user.id} user={p.user} animationLevel={animationLevel} />;\n } else {\n return <Avatar key={p.chat.id} chat={p.chat} animationLevel={animationLevel} />;\n }\n })}\n </div>\n <Button round className=\"join\">\n {lang('VoipChatJoin')}\n </Button>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }) => {\n const chat = selectChat(global, chatId)!;\n const groupCall = selectChatGroupCall(global, chatId);\n return {\n groupCall,\n usersById: global.users.byId,\n chatsById: global.chats.byId,\n activeGroupCallId: global.groupCalls.activeGroupCallId,\n isActive: ((!groupCall ? (chat && chat.isCallNotEmpty && chat.isCallActive)\n : (groupCall.participantsCount > 0 && groupCall.isLoaded)))\n && (global.groupCalls.activeGroupCallId !== groupCall?.id),\n animationLevel: global.settings.byKey.animationLevel,\n };\n },\n)(GroupCallTopPane));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useState } from '../../lib/teact/teact';\nimport { withGlobal, getActions } from '../../global';\n\nimport type { ApiChat, ApiChatSettings, ApiUser } from '../../api/types';\n\nimport { selectChat, selectUser } from '../../global/selectors';\nimport {\n getChatTitle, getUserFirstOrLastName, getUserFullName, isChatBasicGroup, isUserId,\n} from '../../global/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\n\nimport Button from '../ui/Button';\nimport ConfirmDialog from '../ui/ConfirmDialog';\nimport Checkbox from '../ui/Checkbox';\n\nimport './ChatReportPanel.scss';\n\ntype OwnProps = {\n chatId: string;\n className?: string;\n settings?: ApiChatSettings;\n};\n\ntype StateProps = {\n currentUserId?: string;\n chat?: ApiChat;\n user?: ApiUser;\n};\n\nconst ChatReportPanel: FC<OwnProps & StateProps> = ({\n chatId, className, chat, user, settings, currentUserId,\n}) => {\n const {\n openAddContactDialog,\n blockContact,\n reportSpam,\n deleteChat,\n leaveChannel,\n deleteChatUser,\n deleteHistory,\n toggleChatArchived,\n hideChatReportPanel,\n } = getActions();\n\n const lang = useLang();\n const [isBlockUserModalOpen, openBlockUserModal, closeBlockUserModal] = useFlag();\n const [shouldReportSpam, setShouldReportSpam] = useState<boolean>(true);\n const [shouldDeleteChat, setShouldDeleteChat] = useState<boolean>(true);\n const { accessHash } = chat || {};\n const {\n isAutoArchived, canReportSpam, canAddContact, canBlockContact,\n } = settings || {};\n const isBasicGroup = chat && isChatBasicGroup(chat);\n\n const handleAddContact = useCallback(() => {\n openAddContactDialog({ userId: chatId });\n if (isAutoArchived) {\n toggleChatArchived({ chatId });\n }\n }, [openAddContactDialog, isAutoArchived, toggleChatArchived, chatId]);\n\n const handleConfirmBlock = useCallback(() => {\n closeBlockUserModal();\n blockContact({ contactId: chatId, accessHash });\n if (canReportSpam && shouldReportSpam) {\n reportSpam({ chatId });\n }\n if (shouldDeleteChat) {\n deleteChat({ chatId });\n }\n }, [\n accessHash, blockContact, closeBlockUserModal, deleteChat, reportSpam, canReportSpam, shouldDeleteChat,\n shouldReportSpam, chatId,\n ]);\n\n const handleCloseReportPanel = useCallback(() => {\n hideChatReportPanel({ chatId });\n }, [chatId, hideChatReportPanel]);\n\n const handleChatReportSpam = useCallback(() => {\n closeBlockUserModal();\n reportSpam({ chatId });\n if (isBasicGroup) {\n deleteChatUser({ chatId, userId: currentUserId });\n deleteHistory({ chatId, shouldDeleteForAll: false });\n } else {\n leaveChannel({ chatId });\n }\n }, [\n chatId, closeBlockUserModal, currentUserId, deleteChatUser, deleteHistory, isBasicGroup, leaveChannel, reportSpam,\n ]);\n\n if (!settings) {\n return undefined;\n }\n\n return (\n <div className={buildClassName('ChatReportPanel', className)} dir={lang.isRtl ? 'rtl' : undefined}>\n {canAddContact && (\n <Button\n isText\n fluid\n size=\"tiny\"\n className=\"UserReportPanel--Button\"\n onClick={handleAddContact}\n >\n {lang('lng_new_contact_add')}\n </Button>\n )}\n {canBlockContact && (\n <Button\n color=\"danger\"\n isText\n fluid\n size=\"tiny\"\n className=\"UserReportPanel--Button\"\n onClick={openBlockUserModal}\n >\n {lang('lng_new_contact_block')}\n </Button>\n )}\n {canReportSpam && !canBlockContact && (\n <Button\n color=\"danger\"\n isText\n fluid\n size=\"tiny\"\n className=\"UserReportPanel--Button\"\n onClick={openBlockUserModal}\n >\n {lang('lng_report_spam_and_leave')}\n </Button>\n )}\n <Button\n round\n ripple\n size=\"tiny\"\n color=\"translucent\"\n onClick={handleCloseReportPanel}\n ariaLabel={lang('Close')}\n >\n <i className=\"icon-close\" />\n </Button>\n <ConfirmDialog\n isOpen={isBlockUserModalOpen}\n onClose={closeBlockUserModal}\n title={lang('BlockUserTitle', user ? getUserFirstOrLastName(user) : getChatTitle(lang, chat!))}\n text={user\n ? lang('UserInfo.BlockConfirmationTitle', getUserFullName(user))\n : lang('Chat.Confirm.ReportSpam.Channel')}\n isButtonsInOneRow\n confirmIsDestructive\n confirmLabel={lang('Block')}\n confirmHandler={user ? handleConfirmBlock : handleChatReportSpam}\n >\n {user && (\n <Checkbox\n label={lang('DeleteThisChat')}\n checked={shouldDeleteChat}\n onCheck={setShouldDeleteChat}\n />\n )}\n {user && canReportSpam && (\n <Checkbox\n label={lang('ReportChat')}\n checked={shouldReportSpam}\n onCheck={setShouldReportSpam}\n />\n )}\n </ConfirmDialog>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => ({\n currentUserId: global.currentUserId,\n chat: selectChat(global, chatId),\n user: isUserId(chatId) ? selectUser(global, chatId) : undefined,\n }),\n)(ChatReportPanel));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\nimport cycleRestrict from '../../util/cycleRestrict';\n\nimport type { GlobalState, MessageListType } from '../../global/types';\nimport type {\n ApiChat, ApiMessage, ApiTypingStatus, ApiUser,\n} from '../../api/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\n\nimport {\n EDITABLE_INPUT_CSS_SELECTOR,\n MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES,\n MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN,\n MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,\n MOBILE_SCREEN_MAX_WIDTH,\n SAFE_SCREEN_WIDTH_FOR_CHAT_INFO,\n SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,\n} from '../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TABLET_COLUMN_LAYOUT } from '../../util/environment';\nimport {\n getChatTitle, getMessageKey, getSenderTitle, isChatChannel, isChatSuperGroup, isUserId,\n} from '../../global/helpers';\nimport {\n selectAllowedMessageActions,\n selectChat,\n selectChatMessage,\n selectChatMessages,\n selectForwardedSender,\n selectIsChatBotNotStarted,\n selectIsChatWithBot,\n selectIsChatWithSelf,\n selectIsInSelectMode,\n selectIsRightColumnShown,\n selectIsUserBlocked,\n selectPinnedIds,\n selectScheduledIds,\n selectThreadInfo,\n selectThreadTopMessageId,\n} from '../../global/selectors';\nimport useEnsureMessage from '../../hooks/useEnsureMessage';\nimport useWindowSize from '../../hooks/useWindowSize';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\nimport useConnectionStatus from '../../hooks/useConnectionStatus';\n\nimport PrivateChatInfo from '../common/PrivateChatInfo';\nimport GroupChatInfo from '../common/GroupChatInfo';\nimport UnreadCounter from '../common/UnreadCounter';\nimport Transition from '../ui/Transition';\nimport Button from '../ui/Button';\nimport HeaderActions from './HeaderActions';\nimport HeaderPinnedMessage from './HeaderPinnedMessage';\nimport AudioPlayer from './AudioPlayer';\nimport GroupCallTopPane from '../calls/group/GroupCallTopPane';\nimport ChatReportPanel from './ChatReportPanel';\n\nimport './MiddleHeader.scss';\n\nconst ANIMATION_DURATION = 350;\nconst BACK_BUTTON_INACTIVE_TIME = 450;\n\ntype OwnProps = {\n chatId: string;\n threadId: number;\n messageListType: MessageListType;\n isReady?: boolean;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n pinnedMessageIds?: number[] | number;\n messagesById?: Record<number, ApiMessage>;\n canUnpin?: boolean;\n topMessageSender?: ApiChat | ApiUser;\n typingStatus?: ApiTypingStatus;\n isSelectModeActive?: boolean;\n isLeftColumnShown?: boolean;\n isRightColumnShown?: boolean;\n audioMessage?: ApiMessage;\n messagesCount?: number;\n isChatWithSelf?: boolean;\n lastSyncTime?: number;\n hasButtonInHeader?: boolean;\n shouldSkipHistoryAnimations?: boolean;\n currentTransitionKey: number;\n connectionState?: GlobalState['connectionState'];\n isSyncing?: GlobalState['isSyncing'];\n};\n\nconst MiddleHeader: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n messageListType,\n isReady,\n pinnedMessageIds,\n messagesById,\n canUnpin,\n topMessageSender,\n typingStatus,\n isSelectModeActive,\n isLeftColumnShown,\n isRightColumnShown,\n audioMessage,\n chat,\n messagesCount,\n isChatWithSelf,\n lastSyncTime,\n hasButtonInHeader,\n shouldSkipHistoryAnimations,\n currentTransitionKey,\n connectionState,\n isSyncing,\n}) => {\n const {\n openChatWithInfo,\n pinMessage,\n focusMessage,\n openChat,\n openPreviousChat,\n loadPinnedMessages,\n toggleLeftColumn,\n exitMessageSelectMode,\n } = getActions();\n\n const lang = useLang();\n const isBackButtonActive = useRef(true);\n\n const [pinnedMessageIndex, setPinnedMessageIndex] = useState(0);\n const pinnedMessageId = Array.isArray(pinnedMessageIds) ? pinnedMessageIds[pinnedMessageIndex] : pinnedMessageIds;\n const pinnedMessage = messagesById && pinnedMessageId ? messagesById[pinnedMessageId] : undefined;\n const pinnedMessagesCount = Array.isArray(pinnedMessageIds)\n ? pinnedMessageIds.length : (pinnedMessageIds ? 1 : undefined);\n const chatTitleLength = chat && getChatTitle(lang, chat).length;\n const topMessageTitle = topMessageSender ? getSenderTitle(lang, topMessageSender) : undefined;\n const { settings } = chat || {};\n\n useEffect(() => {\n if (threadId === MAIN_THREAD_ID && lastSyncTime && isReady) {\n loadPinnedMessages({ chatId });\n }\n }, [chatId, loadPinnedMessages, lastSyncTime, threadId, isReady]);\n\n // Reset pinned index when switching chats and pinning/unpinning\n useEffect(() => {\n setPinnedMessageIndex(0);\n }, [pinnedMessageIds]);\n\n useEnsureMessage(chatId, pinnedMessageId, pinnedMessage);\n\n const { width: windowWidth } = useWindowSize();\n\n const isLeftColumnHideable = windowWidth <= MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN;\n const shouldShowCloseButton = IS_TABLET_COLUMN_LAYOUT && isLeftColumnShown;\n\n // eslint-disable-next-line no-null/no-null\n const componentRef = useRef<HTMLDivElement>(null);\n const shouldAnimateTools = useRef<boolean>(true);\n\n const handleHeaderClick = useCallback(() => {\n openChatWithInfo({ id: chatId });\n }, [openChatWithInfo, chatId]);\n\n const handleUnpinMessage = useCallback((messageId: number) => {\n pinMessage({ chatId, messageId, isUnpin: true });\n }, [pinMessage, chatId]);\n\n const handlePinnedMessageClick = useCallback((): void => {\n if (pinnedMessage) {\n focusMessage({ chatId: pinnedMessage.chatId, threadId, messageId: pinnedMessage.id });\n\n const newIndex = cycleRestrict(pinnedMessagesCount || 1, pinnedMessageIndex + 1);\n setPinnedMessageIndex(newIndex);\n }\n }, [pinnedMessage, focusMessage, threadId, pinnedMessagesCount, pinnedMessageIndex]);\n\n const handleAllPinnedClick = useCallback(() => {\n openChat({ id: chatId, threadId: MAIN_THREAD_ID, type: 'pinned' });\n }, [openChat, chatId]);\n\n const setBackButtonActive = useCallback(() => {\n setTimeout(() => {\n isBackButtonActive.current = true;\n }, BACK_BUTTON_INACTIVE_TIME);\n }, []);\n\n const handleBackClick = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (!isBackButtonActive.current) return;\n\n // Workaround for missing UI when quickly clicking the Back button\n isBackButtonActive.current = false;\n if (IS_SINGLE_COLUMN_LAYOUT) {\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n messageInput?.blur();\n }\n\n if (isSelectModeActive) {\n exitMessageSelectMode();\n setBackButtonActive();\n return;\n }\n\n if (threadId === MAIN_THREAD_ID && messageListType === 'thread' && currentTransitionKey === 0) {\n if (IS_SINGLE_COLUMN_LAYOUT || shouldShowCloseButton) {\n e.stopPropagation(); // Stop propagation to prevent chat re-opening on tablets\n openChat({ id: undefined }, { forceOnHeavyAnimation: true });\n } else {\n toggleLeftColumn();\n }\n\n setBackButtonActive();\n\n return;\n }\n\n openPreviousChat();\n setBackButtonActive();\n }, [\n threadId, messageListType, currentTransitionKey, isSelectModeActive, openPreviousChat, shouldShowCloseButton,\n openChat, toggleLeftColumn, exitMessageSelectMode, setBackButtonActive,\n ]);\n\n const canToolsCollideWithChatInfo = (\n windowWidth >= MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN\n && windowWidth < SAFE_SCREEN_WIDTH_FOR_CHAT_INFO\n ) || (\n windowWidth > MOBILE_SCREEN_MAX_WIDTH\n && windowWidth < MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN\n && (!chatTitleLength || chatTitleLength > 30)\n );\n const shouldUseStackedToolsClass = canToolsCollideWithChatInfo || (\n windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN\n && windowWidth < SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN\n );\n\n const hasChatSettings = Boolean(settings?.canAddContact || settings?.canBlockContact || settings?.canReportSpam);\n const {\n shouldRender: shouldShowChatReportPanel,\n transitionClassNames: chatReportPanelClassNames,\n } = useShowTransition(hasChatSettings);\n const renderingChatSettings = useCurrentOrPrev(hasChatSettings ? settings : undefined, true);\n\n const {\n shouldRender: shouldRenderAudioPlayer,\n transitionClassNames: audioPlayerClassNames,\n } = useShowTransition(Boolean(audioMessage));\n\n const renderingAudioMessage = useCurrentOrPrev(audioMessage, true);\n\n const {\n shouldRender: shouldRenderPinnedMessage,\n transitionClassNames: pinnedMessageClassNames,\n } = useShowTransition(Boolean(pinnedMessage));\n\n const renderingPinnedMessage = useCurrentOrPrev(pinnedMessage, true);\n const renderingPinnedMessagesCount = useCurrentOrPrev(pinnedMessagesCount, true);\n const renderingCanUnpin = useCurrentOrPrev(canUnpin, true);\n const renderingPinnedMessageTitle = useCurrentOrPrev(topMessageTitle);\n\n const canRevealTools = (shouldRenderPinnedMessage && renderingPinnedMessage)\n || (shouldRenderAudioPlayer && renderingAudioMessage);\n\n // Logic for transition to and from custom display of AudioPlayer/PinnedMessage on smaller screens\n useEffect(() => {\n const componentEl = componentRef.current;\n if (!componentEl) {\n return;\n }\n\n if (!shouldUseStackedToolsClass || !canRevealTools) {\n componentEl.classList.remove('tools-stacked', 'animated');\n shouldAnimateTools.current = true;\n return;\n }\n\n if (isRightColumnShown || canToolsCollideWithChatInfo) {\n if (shouldAnimateTools.current) {\n componentEl.classList.add('tools-stacked', 'animated');\n shouldAnimateTools.current = false;\n }\n\n // Remove animation class to prevent it messing up the show transitions\n setTimeout(() => {\n componentEl.classList.remove('animated');\n }, ANIMATION_DURATION);\n } else {\n componentEl.classList.remove('tools-stacked');\n shouldAnimateTools.current = true;\n }\n }, [shouldUseStackedToolsClass, canRevealTools, canToolsCollideWithChatInfo, isRightColumnShown]);\n\n const { connectionStatusText } = useConnectionStatus(lang, connectionState, isSyncing, true);\n\n function renderInfo() {\n return (\n messageListType === 'thread' && threadId === MAIN_THREAD_ID ? (\n renderMainThreadInfo()\n ) : messageListType === 'thread' ? (\n <>\n {renderBackButton()}\n <h3>\n {lang('CommentsCount', messagesCount, 'i')}\n </h3>\n </>\n ) : messageListType === 'pinned' ? (\n <>\n {renderBackButton()}\n <h3>\n {lang('PinnedMessagesCount', messagesCount, 'i')}\n </h3>\n </>\n ) : messageListType === 'scheduled' ? (\n <>\n {renderBackButton()}\n <h3>\n {isChatWithSelf ? lang('Reminders') : lang('messages', messagesCount, 'i')}\n </h3>\n </>\n ) : undefined\n );\n }\n\n function renderMainThreadInfo() {\n return (\n <>\n {(isLeftColumnHideable || currentTransitionKey > 0) && renderBackButton(shouldShowCloseButton, true)}\n <div className=\"chat-info-wrapper\" onClick={handleHeaderClick}>\n {isUserId(chatId) ? (\n <PrivateChatInfo\n userId={chatId}\n typingStatus={typingStatus}\n status={connectionStatusText}\n withDots={Boolean(connectionStatusText)}\n withFullInfo\n withMediaViewer\n withUpdatingStatus\n withVideoAvatar={isReady}\n noRtl\n />\n ) : (\n <GroupChatInfo\n chatId={chatId}\n typingStatus={typingStatus}\n status={connectionStatusText}\n withDots={Boolean(connectionStatusText)}\n withMediaViewer\n withFullInfo\n withUpdatingStatus\n withVideoAvatar={isReady}\n noRtl\n />\n )}\n </div>\n </>\n );\n }\n\n function renderBackButton(asClose = false, withUnreadCounter = false) {\n return (\n <div className=\"back-button\">\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n onClick={handleBackClick}\n ariaLabel={lang(asClose ? 'Close' : 'Back')}\n >\n <div className={buildClassName('animated-close-icon', !asClose && 'state-back')} />\n </Button>\n {withUnreadCounter && <UnreadCounter />}\n </div>\n );\n }\n\n const isAudioPlayerRendered = Boolean(shouldRenderAudioPlayer && renderingAudioMessage);\n const isPinnedMessagesFullWidth = isAudioPlayerRendered\n || (!IS_SINGLE_COLUMN_LAYOUT && hasButtonInHeader && windowWidth < MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES);\n\n return (\n <div className=\"MiddleHeader\" ref={componentRef}>\n <Transition\n name={shouldSkipHistoryAnimations ? 'none' : 'slide-fade'}\n activeKey={currentTransitionKey}\n >\n {renderInfo()}\n </Transition>\n\n <GroupCallTopPane\n hasPinnedOffset={\n (shouldRenderPinnedMessage && Boolean(renderingPinnedMessage))\n || (shouldRenderAudioPlayer && Boolean(renderingAudioMessage))\n }\n chatId={chatId}\n />\n\n {shouldRenderPinnedMessage && renderingPinnedMessage && (\n <HeaderPinnedMessage\n key={chatId}\n message={renderingPinnedMessage}\n count={renderingPinnedMessagesCount || 0}\n index={pinnedMessageIndex}\n customTitle={renderingPinnedMessageTitle}\n className={buildClassName(pinnedMessageClassNames, isPinnedMessagesFullWidth && 'full-width')}\n onUnpinMessage={renderingCanUnpin ? handleUnpinMessage : undefined}\n onClick={handlePinnedMessageClick}\n onAllPinnedClick={handleAllPinnedClick}\n />\n )}\n\n {shouldShowChatReportPanel && (\n <ChatReportPanel\n key={chatId}\n chatId={chatId}\n settings={renderingChatSettings}\n className={chatReportPanelClassNames}\n />\n )}\n\n <div className=\"header-tools\">\n {isAudioPlayerRendered && (\n <AudioPlayer\n key={getMessageKey(renderingAudioMessage!)}\n message={renderingAudioMessage!}\n className={audioPlayerClassNames}\n />\n )}\n <HeaderActions\n chatId={chatId}\n threadId={threadId}\n messageListType={messageListType}\n canExpandActions={!isAudioPlayerRendered}\n />\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId, messageListType }): StateProps => {\n const { isLeftColumnShown, lastSyncTime, shouldSkipHistoryAnimations } = global;\n const chat = selectChat(global, chatId);\n const { typingStatus } = chat || {};\n\n const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;\n const audioMessage = audioChatId && audioMessageId\n ? selectChatMessage(global, audioChatId, audioMessageId)\n : undefined;\n\n let messagesCount: number | undefined;\n if (messageListType === 'pinned') {\n const pinnedIds = selectPinnedIds(global, chatId);\n messagesCount = pinnedIds?.length;\n } else if (messageListType === 'scheduled') {\n const scheduledIds = selectScheduledIds(global, chatId);\n messagesCount = scheduledIds?.length;\n } else if (messageListType === 'thread' && threadId !== MAIN_THREAD_ID) {\n const threadInfo = selectThreadInfo(global, chatId, threadId);\n messagesCount = threadInfo?.messagesCount || 0;\n }\n\n const isMainThread = messageListType === 'thread' && threadId === MAIN_THREAD_ID;\n const isChatWithBot = chat && selectIsChatWithBot(global, chat);\n const canRestartBot = Boolean(isChatWithBot && selectIsUserBlocked(global, chatId));\n const canStartBot = isChatWithBot && !canRestartBot && Boolean(selectIsChatBotNotStarted(global, chatId));\n const canSubscribe = Boolean(\n isMainThread && chat && (isChatChannel(chat) || isChatSuperGroup(chat)) && chat.isNotJoined,\n );\n const shouldSendJoinRequest = Boolean(chat?.isNotJoined && chat.isJoinRequest);\n\n const state: StateProps = {\n typingStatus,\n isLeftColumnShown,\n isRightColumnShown: selectIsRightColumnShown(global),\n isSelectModeActive: selectIsInSelectMode(global),\n audioMessage,\n chat,\n messagesCount,\n isChatWithSelf: selectIsChatWithSelf(global, chatId),\n lastSyncTime,\n shouldSkipHistoryAnimations,\n currentTransitionKey: Math.max(0, global.messages.messageLists.length - 1),\n connectionState: global.connectionState,\n isSyncing: global.isSyncing,\n hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest,\n };\n\n const messagesById = selectChatMessages(global, chatId);\n if (messageListType !== 'thread' || !messagesById) {\n return state;\n }\n\n Object.assign(state, { messagesById });\n\n if (threadId !== MAIN_THREAD_ID) {\n const pinnedMessageId = selectThreadTopMessageId(global, chatId, threadId);\n const message = pinnedMessageId ? selectChatMessage(global, chatId, pinnedMessageId) : undefined;\n const topMessageSender = message ? selectForwardedSender(global, message) : undefined;\n\n return {\n ...state,\n pinnedMessageIds: pinnedMessageId,\n canUnpin: false,\n topMessageSender,\n };\n }\n\n const pinnedMessageIds = selectPinnedIds(global, chatId);\n if (pinnedMessageIds?.length) {\n const firstPinnedMessage = messagesById[pinnedMessageIds[0]];\n const {\n canUnpin,\n } = (firstPinnedMessage && selectAllowedMessageActions(global, firstPinnedMessage, threadId)) || {};\n\n return {\n ...state,\n pinnedMessageIds,\n canUnpin,\n };\n }\n\n return state;\n },\n)(MiddleHeader));\n","import type { ApiMessage } from '../../../api/types';\nimport type { IAlbum } from '../../../types';\n\nimport { getDayStartAt } from '../../../util/dateFormat';\nimport { isActionMessage } from '../../../global/helpers';\n\ntype SenderGroup = (ApiMessage | IAlbum)[];\n\nconst GROUP_INTERVAL_SECONDS = 600; // 10 minutes\n\nexport type MessageDateGroup = {\n originalDate: number;\n datetime: number;\n senderGroups: SenderGroup[];\n};\n\nexport function isAlbum(messageOrAlbum: ApiMessage | IAlbum): messageOrAlbum is IAlbum {\n return 'albumId' in messageOrAlbum;\n}\n\nexport function groupMessages(messages: ApiMessage[], firstUnreadId?: number) {\n let currentSenderGroup: SenderGroup = [];\n let currentDateGroup = {\n originalDate: messages[0].date,\n datetime: getDayStartAt(messages[0].date * 1000),\n senderGroups: [currentSenderGroup],\n };\n let currentAlbum: IAlbum | undefined;\n\n const dateGroups: MessageDateGroup[] = [currentDateGroup];\n\n messages.forEach((message, index) => {\n if (message.isInAlbum) {\n if (!currentAlbum) {\n currentAlbum = {\n albumId: message.groupedId!,\n messages: [message],\n mainMessage: message,\n };\n } else {\n currentAlbum.messages.push(message);\n if (message.content.text) {\n currentAlbum.mainMessage = message;\n }\n }\n } else {\n currentSenderGroup.push(message);\n }\n\n const nextMessage = messages[index + 1];\n\n if (\n currentAlbum\n && (!nextMessage || !nextMessage.groupedId || nextMessage.groupedId !== currentAlbum.albumId)\n ) {\n currentSenderGroup.push(currentAlbum);\n currentAlbum = undefined;\n }\n if (nextMessage) {\n const nextMessageDayStartsAt = getDayStartAt(nextMessage.date * 1000);\n if (currentDateGroup.datetime !== nextMessageDayStartsAt) {\n currentDateGroup = {\n originalDate: nextMessage.date,\n datetime: nextMessageDayStartsAt,\n senderGroups: [],\n };\n dateGroups.push(currentDateGroup);\n\n currentSenderGroup = [];\n currentDateGroup.senderGroups.push(currentSenderGroup);\n } else if (\n nextMessage.id === firstUnreadId\n || message.senderId !== nextMessage.senderId\n || message.isOutgoing !== nextMessage.isOutgoing\n || isActionMessage(message)\n || isActionMessage(nextMessage)\n || (\n message.forwardInfo && nextMessage.forwardInfo\n && (\n message.forwardInfo.senderUserId !== nextMessage.forwardInfo.senderUserId\n || message.forwardInfo.fromChatId !== nextMessage.forwardInfo.fromChatId\n || message.forwardInfo.hiddenUserName !== nextMessage.forwardInfo.hiddenUserName\n )\n )\n || message.inlineButtons\n || nextMessage.inlineButtons\n || (nextMessage.date - message.date) > GROUP_INTERVAL_SECONDS\n ) {\n currentSenderGroup = [];\n currentDateGroup.senderGroups.push(currentSenderGroup);\n }\n }\n });\n\n return dateGroups;\n}\n","import type { RefObject } from 'react';\nimport { getActions } from '../../../global';\n\nimport type { MessageListType } from '../../../global/types';\n\nimport { IS_ANDROID, IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useBackgroundMode from '../../../hooks/useBackgroundMode';\n\nconst INTERSECTION_THROTTLE_FOR_MEDIA = IS_ANDROID ? 1000 : 350;\nconst INTERSECTION_MARGIN_FOR_MEDIA = IS_SINGLE_COLUMN_LAYOUT ? 300 : 500;\nconst INTERSECTION_THROTTLE_FOR_READING = 150;\n\nexport default function useMessageObservers(\n type: MessageListType,\n containerRef: RefObject<HTMLDivElement>,\n memoFirstUnreadIdRef: { current: number | undefined },\n) {\n const { markMessageListRead, markMentionsRead, animateUnreadReaction } = getActions();\n\n const {\n observe: observeIntersectionForMedia,\n } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE_FOR_MEDIA,\n margin: INTERSECTION_MARGIN_FOR_MEDIA,\n });\n\n const {\n observe: observeIntersectionForReading, freeze: freezeForReading, unfreeze: unfreezeForReading,\n } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE_FOR_READING,\n }, (entries) => {\n if (type !== 'thread') {\n return;\n }\n\n let maxId = 0;\n const mentionIds: number[] = [];\n const reactionIds: number[] = [];\n\n entries.forEach((entry) => {\n const { isIntersecting, target } = entry;\n\n if (!isIntersecting) {\n return;\n }\n\n const { dataset } = target as HTMLDivElement;\n\n const messageId = Number(dataset.lastMessageId || dataset.messageId);\n if (messageId > maxId) {\n maxId = messageId;\n }\n\n if (dataset.hasUnreadMention) {\n mentionIds.push(messageId);\n }\n\n if (dataset.hasUnreadReaction) {\n reactionIds.push(messageId);\n }\n });\n\n if (memoFirstUnreadIdRef.current && maxId >= memoFirstUnreadIdRef.current) {\n markMessageListRead({ maxId });\n }\n\n if (mentionIds.length) {\n markMentionsRead({ messageIds: mentionIds });\n }\n\n if (reactionIds.length) {\n animateUnreadReaction({ messageIds: reactionIds });\n }\n });\n\n useBackgroundMode(freezeForReading, unfreezeForReading);\n\n const { observe: observeIntersectionForAnimatedStickers } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE_FOR_MEDIA,\n });\n\n return {\n observeIntersectionForMedia,\n observeIntersectionForReading,\n observeIntersectionForAnimatedStickers,\n };\n}\n","import type { ApiMessage } from '../../../../api/types';\n\nimport { getMessageContent } from '../../../../global/helpers';\n\nexport function isEmojiOnlyMessage(customShape?: boolean | number) {\n return typeof customShape === 'number';\n}\n\nexport function buildContentClassName(\n message: ApiMessage,\n {\n hasReply,\n customShape,\n isLastInGroup,\n asForwarded,\n hasThread,\n forceSenderName,\n hasComments,\n hasActionButton,\n hasReactions,\n isGeoLiveActive,\n withVoiceTranscription,\n }: {\n hasReply?: boolean;\n customShape?: boolean | number;\n isLastInGroup?: boolean;\n asForwarded?: boolean;\n hasThread?: boolean;\n forceSenderName?: boolean;\n hasComments?: boolean;\n hasActionButton?: boolean;\n hasReactions?: boolean;\n isGeoLiveActive?: boolean;\n withVoiceTranscription?: boolean;\n } = {},\n) {\n const {\n text, photo, video, audio, voice, document, poll, webPage, contact, location, invoice,\n } = getMessageContent(message);\n\n const classNames = ['message-content'];\n const isMedia = photo || video || location;\n const hasText = text || location?.type === 'venue' || isGeoLiveActive;\n const isMediaWithNoText = isMedia && !hasText;\n const isViaBot = Boolean(message.viaBotId);\n\n if (isEmojiOnlyMessage(customShape)) {\n classNames.push(`emoji-only emoji-only-${customShape}`);\n } else if (hasText) {\n classNames.push('text');\n }\n\n if (hasActionButton) {\n classNames.push('has-action-button');\n }\n\n if (customShape) {\n classNames.push('custom-shape');\n if (video?.isRound) {\n classNames.push('round');\n }\n\n if (hasComments) {\n classNames.push('has-comments');\n }\n }\n if (isMedia) {\n classNames.push('media');\n } else if (audio) {\n classNames.push('audio');\n } else if (voice) {\n classNames.push('voice');\n if (withVoiceTranscription) {\n classNames.push('with-voice-transcription');\n }\n } else if (document) {\n classNames.push('document');\n } else if (contact) {\n classNames.push('contact');\n } else if (poll) {\n classNames.push('poll');\n } else if (webPage) {\n classNames.push('web-page');\n\n if (webPage.photo || webPage.video) {\n classNames.push('media');\n }\n }\n\n if (invoice) {\n classNames.push('invoice');\n }\n\n if (asForwarded) {\n classNames.push('is-forwarded');\n }\n\n if (hasReply) {\n classNames.push('is-reply');\n }\n\n if (hasThread) {\n classNames.push('has-replies');\n }\n\n if (hasReactions) {\n classNames.push('has-reactions');\n }\n\n if (isViaBot) {\n classNames.push('is-via-bot');\n }\n\n if (forceSenderName) {\n classNames.push('force-sender-name');\n }\n\n if (!customShape) {\n classNames.push('has-shadow');\n\n if (isMedia && hasComments) {\n classNames.push('has-background');\n }\n\n if (hasReply || asForwarded || !isMediaWithNoText || isViaBot || forceSenderName) {\n classNames.push('has-solid-background');\n }\n\n if (isLastInGroup && (photo || (location && !hasText) || !isMediaWithNoText)) {\n classNames.push('has-appendix');\n }\n }\n\n return classNames.join(' ');\n}\n","import type { ApiMessage } from '../../../../api/types';\nimport { calculateInlineImageDimensions, calculateVideoDimensions } from '../../../common/helpers/mediaDimensions';\nimport {\n getMessageText,\n getMessagePhoto,\n getMessageWebPagePhoto,\n isForwardedMessage,\n isOwnMessage,\n getMessageVideo,\n} from '../../../../global/helpers';\n\nconst MIN_MEDIA_WIDTH = 100;\nconst MIN_MEDIA_WIDTH_WITH_COMMENTS = 238;\nconst MIN_MEDIA_WIDTH_WITH_TEXT = 175;\nconst MIN_MEDIA_WIDTH_WITH_TEXT_AND_COMMENTS = 238;\nconst MIN_MEDIA_HEIGHT = 90;\nconst SMALL_IMAGE_THRESHOLD = 12;\n\nexport function getMinMediaWidth(hasText?: boolean, hasCommentButton?: boolean) {\n return hasText\n ? (hasCommentButton ? MIN_MEDIA_WIDTH_WITH_TEXT_AND_COMMENTS : MIN_MEDIA_WIDTH_WITH_TEXT)\n : (hasCommentButton ? MIN_MEDIA_WIDTH_WITH_COMMENTS : MIN_MEDIA_WIDTH);\n}\n\nexport function calculateMediaDimensions(message: ApiMessage, noAvatars?: boolean) {\n const isOwn = isOwnMessage(message);\n const isForwarded = isForwardedMessage(message);\n const photo = getMessagePhoto(message) || getMessageWebPagePhoto(message);\n const video = getMessageVideo(message);\n\n const isWebPagePhoto = Boolean(getMessageWebPagePhoto(message));\n const { width, height } = photo\n ? calculateInlineImageDimensions(photo, isOwn, isForwarded, isWebPagePhoto, noAvatars)\n : calculateVideoDimensions(video!, isOwn, isForwarded, noAvatars);\n\n const hasText = Boolean(getMessageText(message));\n const minMediaWidth = getMinMediaWidth(hasText);\n\n let stretchFactor = 1;\n if (width < minMediaWidth && minMediaWidth - width < SMALL_IMAGE_THRESHOLD) {\n stretchFactor = minMediaWidth / width;\n }\n if (height * stretchFactor < MIN_MEDIA_HEIGHT && MIN_MEDIA_HEIGHT - height * stretchFactor < SMALL_IMAGE_THRESHOLD) {\n stretchFactor = MIN_MEDIA_HEIGHT / height;\n }\n\n const finalWidth = Math.round(width * stretchFactor);\n const finalHeight = Math.round(height * stretchFactor);\n\n return {\n width: finalWidth,\n height: finalHeight,\n isSmall: finalWidth < minMediaWidth || finalHeight < MIN_MEDIA_HEIGHT,\n };\n}\n","/* eslint-disable no-bitwise */\n// Based on\n// https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/ui/grouped_layout.cpp\n// https://github.com/overtake/TelegramSwift/blob/master/Telegram-Mac/GroupedLayout.swift#L83\n\nimport type { IAlbum } from '../../../../types';\nimport type { ApiMessage, ApiDimensions } from '../../../../api/types';\n\nimport { getAvailableWidth, REM } from '../../../common/helpers/mediaDimensions';\nimport { calculateMediaDimensions } from './mediaDimensions';\nimport { clamp } from '../../../../util/math';\n\nexport const AlbumRectPart = {\n None: 0,\n Top: 1,\n Right: 2,\n Bottom: 4,\n Left: 8,\n};\n\ntype IAttempt = {\n lineCounts: number[];\n heights: number[];\n};\nexport type IMediaDimensions = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\ntype IMediaLayout = {\n dimensions: IMediaDimensions;\n sides: number;\n};\ntype ILayoutParams = {\n ratios: number[];\n proportions: string;\n averageRatio: number;\n maxWidth: number;\n minWidth: number;\n maxHeight: number;\n spacing: number;\n};\nexport type IAlbumLayout = {\n layout: IMediaLayout[];\n containerStyle: ApiDimensions;\n};\n\nfunction getRatios(messages: ApiMessage[]) {\n return messages.map(\n (message) => {\n const dimensions = calculateMediaDimensions(message) as ApiDimensions;\n\n return dimensions.width / dimensions.height;\n },\n );\n}\n\nfunction getProportions(ratios: number[]) {\n return ratios.map((ratio) => (ratio > 1.2 ? 'w' : (ratio < 0.8 ? 'n' : 'q'))).join('');\n}\n\nfunction getAverageRatio(ratios: number[]) {\n return ratios.reduce((result, ratio) => ratio + result, 1) / ratios.length;\n}\n\nfunction accumulate(list: number[], initValue: number) {\n return list.reduce((accumulator, item) => accumulator + item, initValue);\n}\n\nfunction cropRatios(ratios: number[], averageRatio: number) {\n return ratios.map((ratio) => {\n return (averageRatio > 1.1 ? clamp(ratio, 1, 2.75) : clamp(ratio, 0.6667, 1));\n });\n}\n\nfunction calculateContainerSize(layout: IMediaLayout[]) {\n const styles: ApiDimensions = { width: 0, height: 0 };\n layout.forEach(({\n dimensions,\n sides,\n }) => {\n if (sides & AlbumRectPart.Right) {\n styles.width = dimensions.width + dimensions.x;\n }\n if (sides & AlbumRectPart.Bottom) {\n styles.height = dimensions.height + dimensions.y;\n }\n });\n\n return styles;\n}\n\nexport function calculateAlbumLayout(\n isOwn: boolean,\n isForwarded: boolean,\n noAvatars: boolean,\n album: IAlbum,\n): IAlbumLayout {\n const spacing = 2;\n const ratios = getRatios(album.messages);\n const proportions = getProportions(ratios);\n const averageRatio = getAverageRatio(ratios);\n const albumCount = ratios.length;\n const forceCalc = ratios.some((ratio) => ratio > 2);\n const maxWidth = getAvailableWidth(isOwn, isForwarded, false, noAvatars) - (isForwarded ? 2.5 : 0) * REM;\n const maxHeight = maxWidth;\n\n let layout;\n\n const params = {\n ratios,\n proportions,\n averageRatio,\n maxWidth,\n minWidth: 100,\n maxHeight,\n spacing,\n };\n\n if (albumCount >= 5 || forceCalc) {\n layout = layoutWithComplexLayouter(params);\n } else if (albumCount === 2) {\n layout = layoutTwo(params);\n } else if (albumCount === 3) {\n layout = layoutThree(params);\n } else {\n layout = layoutFour(params);\n }\n\n return {\n layout,\n containerStyle: calculateContainerSize(layout),\n };\n}\n\nfunction layoutWithComplexLayouter({\n ratios: originalRatios,\n averageRatio,\n maxWidth,\n minWidth,\n spacing,\n maxHeight = (4 * maxWidth) / 3,\n}: ILayoutParams) {\n const ratios = cropRatios(originalRatios, averageRatio);\n const count = originalRatios.length;\n const result = new Array(count);\n const attempts: IAttempt[] = [];\n\n const multiHeight = (offset: number, attemptCount: number) => {\n const attemptRatios = ratios.slice(offset, offset + attemptCount);\n const sum = accumulate(attemptRatios, 0);\n\n return (maxWidth - (attemptCount - 1) * spacing) / sum;\n };\n\n const pushAttempt = (lineCounts: number[]) => {\n const heights: number[] = [];\n let offset = 0;\n lineCounts.forEach((currentCount) => {\n heights.push(multiHeight(offset, currentCount));\n offset += currentCount;\n });\n\n attempts.push({\n lineCounts,\n heights,\n });\n };\n\n for (let first = 1; first !== count; ++first) {\n const second = count - first;\n if (first <= 3 && second <= 3) {\n pushAttempt([first, second]);\n }\n }\n\n for (let first = 1; first !== count - 1; ++first) {\n for (let second = 1; second !== count - first; ++second) {\n const third = count - first - second;\n if (first <= 3 && second <= (averageRatio < 0.85 ? 4 : 3) && third <= 3) {\n pushAttempt([first, second, third]);\n }\n }\n }\n\n for (let first = 1; first !== count - 1; ++first) {\n for (let second = 1; second !== count - first; ++second) {\n for (let third = 1; third !== count - first - second; ++third) {\n const fourth = count - first - second - third;\n if (first <= 3 && second <= 3 && third <= 3 && fourth <= 4) {\n pushAttempt([first, second, third, fourth]);\n }\n }\n }\n }\n\n let optimalAttempt: IAttempt | undefined;\n let optimalDiff = 0;\n for (let i = 0; i < attempts.length; i++) {\n const {\n heights,\n lineCounts,\n } = attempts[i];\n const lineCount = lineCounts.length;\n const totalHeight = accumulate(heights, 0) + spacing * (lineCount - 1);\n const minLineHeight = Math.min(...heights);\n const bad1 = minLineHeight < minWidth ? 1.5 : 1;\n const bad2 = (() => {\n for (let line = 1; line !== lineCount; ++line) {\n if (lineCounts[line - 1] > lineCounts[line]) {\n return 1.5;\n }\n }\n\n return 1;\n })();\n const diff = Math.abs(totalHeight - maxHeight) * bad1 * bad2;\n\n if (!optimalAttempt || diff < optimalDiff) {\n optimalAttempt = attempts[i];\n optimalDiff = diff;\n }\n }\n\n const optimalCounts = optimalAttempt!.lineCounts;\n const optimalHeights = optimalAttempt!.heights;\n const rowCount = optimalCounts.length;\n let index = 0;\n let y = 0;\n for (let row = 0; row !== rowCount; ++row) {\n const colCount = optimalCounts[row];\n const lineHeight = optimalHeights[row];\n const height = Math.round(lineHeight);\n let x = 0;\n\n for (let col = 0; col !== colCount; ++col) {\n const sides = AlbumRectPart.None\n | (row === 0 ? AlbumRectPart.Top : AlbumRectPart.None)\n | (row === rowCount - 1 ? AlbumRectPart.Bottom : AlbumRectPart.None)\n | (col === 0 ? AlbumRectPart.Left : AlbumRectPart.None)\n | (col === colCount - 1 ? AlbumRectPart.Right : AlbumRectPart.None);\n const ratio = ratios[index];\n const width = col === colCount - 1 ? maxWidth - x : Math.round(ratio * lineHeight);\n result[index] = {\n dimensions: {\n x,\n y,\n width,\n height,\n },\n sides,\n };\n x += width + spacing;\n ++index;\n }\n y += height + spacing;\n }\n\n return result;\n}\n\nfunction layoutTwo(params: ILayoutParams) {\n const {\n ratios,\n proportions,\n averageRatio,\n } = params;\n return proportions === 'ww' && averageRatio > 1.4 && ratios[1] - ratios[0] < 0.2\n ? layoutTwoTopBottom(params)\n : proportions === 'ww' || proportions === 'qq'\n ? layoutTwoLeftRightEqual(params)\n : layoutTwoLeftRight(params);\n}\n\nfunction layoutTwoTopBottom(params: ILayoutParams) {\n const {\n ratios,\n maxWidth,\n spacing,\n maxHeight,\n } = params;\n const height = Math.round(Math.min(maxWidth / ratios[0], Math.min(maxWidth / ratios[1], (maxHeight - spacing) / 2)));\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: maxWidth,\n height,\n },\n sides: AlbumRectPart.Left | AlbumRectPart.Top | AlbumRectPart.Right,\n }, {\n dimensions: {\n x: 0,\n y: height + spacing,\n width: maxWidth,\n height,\n },\n sides: AlbumRectPart.Left | AlbumRectPart.Bottom | AlbumRectPart.Right,\n }];\n}\n\nfunction layoutTwoLeftRightEqual(params: ILayoutParams) {\n const {\n ratios,\n maxWidth,\n spacing,\n maxHeight,\n } = params;\n const width = (maxWidth - spacing) / 2;\n const height = Math.round(Math.min(width / ratios[0], Math.min(width / ratios[1], maxHeight)));\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width,\n height,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Left | AlbumRectPart.Bottom,\n }, {\n dimensions: {\n x: width + spacing,\n y: 0,\n width,\n height,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Right | AlbumRectPart.Bottom,\n }];\n}\n\nfunction layoutTwoLeftRight(params: ILayoutParams) {\n const {\n ratios,\n minWidth,\n maxWidth,\n spacing,\n maxHeight,\n } = params;\n const minimalWidth = Math.round(1.5 * minWidth);\n const secondWidth = Math.min(\n Math.round(\n Math.max(\n 0.4 * (maxWidth - spacing),\n (maxWidth - spacing) / ratios[0] / (1 / ratios[0] + 1 / ratios[1]),\n ),\n ),\n maxWidth - spacing - minimalWidth,\n );\n const firstWidth = maxWidth - secondWidth - spacing;\n const height = Math.min(maxHeight, Math.round(Math.min(firstWidth / ratios[0], secondWidth / ratios[1])));\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: firstWidth,\n height,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Left | AlbumRectPart.Bottom,\n }, {\n dimensions: {\n x: firstWidth + spacing,\n y: 0,\n width: secondWidth,\n height,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Right | AlbumRectPart.Bottom,\n }];\n}\n\nfunction layoutThree(params: ILayoutParams) {\n const { proportions } = params;\n\n return proportions[0] === 'n'\n ? layoutThreeLeftAndOther(params)\n : layoutThreeTopAndOther(params);\n}\n\nfunction layoutThreeLeftAndOther(params: ILayoutParams) {\n const {\n maxHeight,\n spacing,\n ratios,\n maxWidth,\n minWidth,\n } = params;\n const firstHeight = maxHeight;\n const thirdHeight = Math.round(\n Math.min(\n (maxHeight - spacing) / 2,\n (ratios[1] * (maxWidth - spacing)) / (ratios[2] + ratios[1]),\n ),\n );\n const secondHeight = firstHeight - thirdHeight - spacing;\n const rightWidth = Math.max(\n minWidth,\n Math.round(\n Math.min(\n (maxWidth - spacing) / 2,\n Math.min(\n thirdHeight * ratios[2],\n secondHeight * ratios[1],\n ),\n ),\n ),\n );\n const leftWidth = Math.min(Math.round(firstHeight * ratios[0]), maxWidth - spacing - rightWidth);\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: leftWidth,\n height: firstHeight,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Left | AlbumRectPart.Bottom,\n }, {\n dimensions: {\n x: leftWidth + spacing,\n y: 0,\n width: rightWidth,\n height: secondHeight,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Right,\n }, {\n dimensions: {\n x: leftWidth + spacing,\n y: secondHeight + spacing,\n width: rightWidth,\n height: thirdHeight,\n },\n sides: AlbumRectPart.Bottom | AlbumRectPart.Right,\n }];\n}\n\nfunction layoutThreeTopAndOther(params: ILayoutParams) {\n const {\n maxWidth,\n ratios,\n maxHeight,\n spacing,\n } = params;\n const firstWidth = maxWidth;\n const firstHeight = Math.round(Math.min(firstWidth / ratios[0], 0.66 * (maxHeight - spacing)));\n const secondWidth = (maxWidth - spacing) / 2;\n const secondHeight = Math.min(\n maxHeight - firstHeight - spacing,\n Math.round(Math.min(\n secondWidth / ratios[1],\n secondWidth / ratios[2],\n )),\n );\n const thirdWidth = firstWidth - secondWidth - spacing;\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: firstWidth,\n height: firstHeight,\n },\n sides: AlbumRectPart.Left | AlbumRectPart.Top | AlbumRectPart.Right,\n }, {\n dimensions: {\n x: 0,\n y: firstHeight + spacing,\n width: secondWidth,\n height: secondHeight,\n },\n sides: AlbumRectPart.Bottom | AlbumRectPart.Left,\n }, {\n dimensions: {\n x: secondWidth + spacing,\n y: firstHeight + spacing,\n width: thirdWidth,\n height: secondHeight,\n },\n sides: AlbumRectPart.Bottom | AlbumRectPart.Right,\n }];\n}\n\nfunction layoutFour(params: ILayoutParams) {\n const { proportions } = params;\n\n return proportions[0] === 'w'\n ? layoutFourTopAndOther(params)\n : layoutFourLeftAndOther(params);\n}\n\nfunction layoutFourTopAndOther({\n maxWidth,\n ratios,\n spacing,\n maxHeight,\n minWidth,\n}: ILayoutParams) {\n const w = maxWidth;\n const h0 = Math.round(Math.min(w / ratios[0], 0.66 * (maxHeight - spacing)));\n const h = Math.round((maxWidth - 2 * spacing) / (ratios[1] + ratios[2] + ratios[3]));\n const w0 = Math.max(minWidth, Math.round(Math.min(0.4 * (maxWidth - 2 * spacing), h * ratios[1])));\n const w2 = Math.round(Math.max(Math.max(minWidth, 0.33 * (maxWidth - 2 * spacing)), h * ratios[3]));\n const w1 = w - w0 - w2 - 2 * spacing;\n const h1 = Math.min(maxHeight - h0 - spacing, h);\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: w,\n height: h0,\n },\n sides: AlbumRectPart.Left | AlbumRectPart.Top | AlbumRectPart.Right,\n }, {\n dimensions: {\n x: 0,\n y: h0 + spacing,\n width: w0,\n height: h1,\n },\n sides: AlbumRectPart.Bottom | AlbumRectPart.Left,\n }, {\n dimensions: {\n x: w0 + spacing,\n y: h0 + spacing,\n width: w1,\n height: h1,\n },\n sides: AlbumRectPart.Bottom,\n }, {\n dimensions: {\n x: w0 + spacing + w1 + spacing,\n y: h0 + spacing,\n width: w2,\n height: h1,\n },\n sides: AlbumRectPart.Right | AlbumRectPart.Bottom,\n }];\n}\n\nfunction layoutFourLeftAndOther({\n maxHeight,\n ratios,\n maxWidth,\n spacing,\n minWidth,\n}: ILayoutParams) {\n const h = maxHeight;\n const w0 = Math.round(Math.min(h * ratios[0], 0.6 * (maxWidth - spacing)));\n const w = Math.round((maxHeight - 2 * spacing) / (1 / ratios[1] + 1 / ratios[2] + 1 / ratios[3]));\n const h0 = Math.round(w / ratios[1]);\n const h1 = Math.round(w / ratios[2]);\n const h2 = h - h0 - h1 - 2 * spacing;\n const w1 = Math.max(minWidth, Math.min(maxWidth - w0 - spacing, w));\n\n return [{\n dimensions: {\n x: 0,\n y: 0,\n width: w0,\n height: h,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Left | AlbumRectPart.Bottom,\n }, {\n dimensions: {\n x: w0 + spacing,\n y: 0,\n width: w1,\n height: h0,\n },\n sides: AlbumRectPart.Top | AlbumRectPart.Right,\n }, {\n dimensions: {\n x: w0 + spacing,\n y: h0 + spacing,\n width: w1,\n height: h1,\n },\n sides: AlbumRectPart.Right,\n }, {\n dimensions: {\n x: w0 + spacing,\n y: h0 + h1 + 2 * spacing,\n width: w1,\n height: h2,\n },\n sides: AlbumRectPart.Bottom | AlbumRectPart.Right,\n }];\n}\n","let element: HTMLSpanElement | undefined;\nlet fontFamily: string | undefined;\nexport default function calculateAuthorWidth(text: string) {\n if (!fontFamily) {\n fontFamily = getComputedStyle(document.documentElement).getPropertyValue('--font-family');\n }\n\n if (!element) {\n element = document.createElement('span');\n // eslint-disable-next-line max-len\n element.style.font = `400 12px ${fontFamily}`;\n element.style.whiteSpace = 'nowrap';\n element.style.position = 'absolute';\n element.style.left = '-999px';\n element.style.opacity = '.01';\n document.body.appendChild(element);\n }\n\n element.innerHTML = text;\n\n return element.offsetWidth;\n}\n","import type { FocusDirection } from '../../../../types';\n\nimport { useLayoutEffect } from '../../../../lib/teact/teact';\nimport fastSmoothScroll from '../../../../util/fastSmoothScroll';\n\n// This is used when the viewport was replaced.\nconst RELOCATED_FOCUS_OFFSET = 1000;\nconst FOCUS_MARGIN = 20;\n\nexport default function useFocusMessage(\n elementRef: { current: HTMLDivElement | null },\n chatId: string,\n isFocused?: boolean,\n focusDirection?: FocusDirection,\n noFocusHighlight?: boolean,\n isResizingContainer?: boolean,\n) {\n useLayoutEffect(() => {\n if (isFocused && elementRef.current) {\n const messagesContainer = elementRef.current.closest<HTMLDivElement>('.MessageList')!;\n\n fastSmoothScroll(\n messagesContainer,\n elementRef.current,\n // `noFocusHighlight` always called from “scroll-to-bottom” buttons\n noFocusHighlight ? 'end' : 'centerOrTop',\n FOCUS_MARGIN,\n focusDirection !== undefined ? RELOCATED_FOCUS_OFFSET : undefined,\n focusDirection,\n undefined,\n isResizingContainer,\n );\n }\n }, [elementRef, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer]);\n}\n","import type { RefObject } from 'react';\nimport type React from '../../../../lib/teact/teact';\nimport { useEffect, useRef } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\n\nimport { IS_ANDROID, IS_TOUCH_ENV } from '../../../../util/environment';\nimport windowSize from '../../../../util/windowSize';\nimport { captureEvents, SwipeDirection } from '../../../../util/captureEvents';\nimport useFlag from '../../../../hooks/useFlag';\nimport { preventMessageInputBlur } from '../../helpers/preventMessageInputBlur';\nimport stopEvent from '../../../../util/stopEvent';\nimport { REM } from '../../../common/helpers/mediaDimensions';\n\nconst ANDROID_KEYBOARD_HIDE_DELAY_MS = 350;\nconst SWIPE_ANIMATION_DURATION = 150;\nconst QUICK_REACTION_DOUBLE_TAP_DELAY = 200;\nconst QUICK_REACTION_AREA_WIDTH = 3 * REM;\nconst QUICK_REACTION_AREA_HEIGHT = Number(REM);\nconst GROUP_MESSAGE_HOVER_ATTRIBUTE = 'data-is-document-group-hover';\n\nexport default function useOuterHandlers(\n selectMessage: (e?: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => void,\n containerRef: RefObject<HTMLDivElement>,\n messageId: number,\n isAlbum: boolean,\n isInSelectMode: boolean,\n canReply: boolean,\n isProtected: boolean,\n onContextMenu: (e: React.MouseEvent) => void,\n handleBeforeContextMenu: (e: React.MouseEvent) => void,\n chatId: string,\n isContextMenuShown: boolean,\n contentRef: RefObject<HTMLDivElement>,\n isOwn: boolean,\n shouldHandleMouseLeave: boolean,\n) {\n const { setReplyingToId, sendDefaultReaction } = getActions();\n\n const [isQuickReactionVisible, markQuickReactionVisible, unmarkQuickReactionVisible] = useFlag();\n const [isSwiped, markSwiped, unmarkSwiped] = useFlag();\n const doubleTapTimeoutRef = useRef<NodeJS.Timeout>();\n\n function handleMouseDown(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n preventMessageInputBlur(e);\n handleBeforeContextMenu(e);\n }\n\n function handleMouseMove(e: React.MouseEvent) {\n const container = contentRef.current;\n if (!container) return;\n\n const { clientX, clientY } = e;\n const {\n x, width, y, height,\n } = container.getBoundingClientRect();\n\n const isVisibleX = Math.abs((isOwn ? (clientX - x) : (x + width - clientX))) < QUICK_REACTION_AREA_WIDTH;\n const isVisibleY = Math.abs(y + height - clientY) < QUICK_REACTION_AREA_HEIGHT;\n if (isVisibleX && isVisibleY) {\n markQuickReactionVisible();\n } else {\n unmarkQuickReactionVisible();\n }\n }\n\n function handleSendQuickReaction(e: React.MouseEvent) {\n const { x, y } = e.currentTarget.getBoundingClientRect();\n sendDefaultReaction({\n chatId,\n messageId,\n x,\n y,\n });\n }\n\n function handleTap(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (IS_ANDROID) {\n const target = e.target as HTMLDivElement;\n if (!target.classList.contains('text-content') && !target.classList.contains('Message')) {\n return;\n }\n\n if (windowSize.getIsKeyboardVisible()) {\n setTimeout(() => {\n onContextMenu(e);\n }, ANDROID_KEYBOARD_HIDE_DELAY_MS);\n } else {\n onContextMenu(e);\n }\n }\n }\n\n function handleDoubleTap(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n const { pageX: x, pageY: y } = e;\n\n sendDefaultReaction({\n chatId,\n messageId,\n x,\n y,\n });\n }\n\n function handleClick(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (isInSelectMode) {\n selectMessage(e);\n return;\n }\n\n if (!IS_TOUCH_ENV) return;\n\n if (doubleTapTimeoutRef.current) {\n clearInterval(doubleTapTimeoutRef.current);\n doubleTapTimeoutRef.current = undefined;\n handleDoubleTap(e);\n return;\n }\n\n doubleTapTimeoutRef.current = setTimeout(() => {\n doubleTapTimeoutRef.current = undefined;\n handleTap(e);\n }, QUICK_REACTION_DOUBLE_TAP_DELAY);\n }\n\n function handleContextMenu(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n if (IS_ANDROID) {\n if ((e.target as HTMLElement).matches('a[href]') || isContextMenuShown) {\n return;\n }\n\n e.preventDefault();\n selectMessage();\n } else {\n onContextMenu(e);\n }\n }\n\n function handleContainerDoubleClick() {\n if (IS_TOUCH_ENV) return;\n\n setReplyingToId({ messageId });\n }\n\n function stopPropagation(e: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n e.stopPropagation();\n }\n\n useEffect(() => {\n if (!IS_TOUCH_ENV || isInSelectMode || !canReply || isContextMenuShown) {\n return undefined;\n }\n\n let startedAt: number | undefined;\n return captureEvents(containerRef.current!, {\n selectorToPreventScroll: '.MessageList',\n excludedClosestSelector: '.no-word-wrap',\n onSwipe: ((e, direction) => {\n if (direction === SwipeDirection.Left) {\n if (!startedAt) {\n startedAt = Date.now();\n }\n\n markSwiped();\n\n return true;\n }\n\n return false;\n }),\n onRelease: () => {\n if (!startedAt) {\n return;\n }\n\n setReplyingToId({ messageId });\n\n setTimeout(unmarkSwiped, Math.max(0, SWIPE_ANIMATION_DURATION - (Date.now() - startedAt)));\n startedAt = undefined;\n },\n });\n }, [\n containerRef, isInSelectMode, messageId, setReplyingToId, markSwiped, unmarkSwiped, canReply, isContextMenuShown,\n ]);\n\n function handleMouseLeave(e: React.MouseEvent<HTMLDivElement>) {\n unmarkQuickReactionVisible();\n if (shouldHandleMouseLeave) handleDocumentGroupMouseLeave(e);\n }\n\n return {\n handleMouseDown: !isInSelectMode ? handleMouseDown : undefined,\n handleClick,\n handleContextMenu: !isInSelectMode ? handleContextMenu : (isProtected ? stopEvent : undefined),\n handleDoubleClick: !isInSelectMode ? handleContainerDoubleClick : undefined,\n handleContentDoubleClick: !IS_TOUCH_ENV ? stopPropagation : undefined,\n handleMouseMove,\n handleSendQuickReaction,\n handleMouseLeave,\n isSwiped,\n isQuickReactionVisible,\n handleDocumentGroupMouseEnter,\n };\n}\n\nfunction handleDocumentGroupMouseEnter(e: React.MouseEvent<HTMLDivElement>) {\n const lastGroupElement = getLastElementInDocumentGroup(e.currentTarget);\n if (lastGroupElement) {\n lastGroupElement.setAttribute(GROUP_MESSAGE_HOVER_ATTRIBUTE, '');\n }\n}\n\nfunction handleDocumentGroupMouseLeave(e: React.MouseEvent<HTMLDivElement>) {\n const lastGroupElement = getLastElementInDocumentGroup(e.currentTarget);\n if (lastGroupElement) {\n lastGroupElement.removeAttribute(GROUP_MESSAGE_HOVER_ATTRIBUTE);\n }\n}\n\nfunction getLastElementInDocumentGroup(element: Element) {\n let current: Element | null = element;\n\n do {\n current = current.nextElementSibling;\n } while (current && !current.classList.contains('last-in-document-group'));\n\n return current;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './ContextMenuContainer';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst ContextMenuContainerAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const ContextMenuContainer = useModuleLoader(Bundles.Extra, 'ContextMenuContainer', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ContextMenuContainer ? <ContextMenuContainer {...props} /> : undefined;\n};\n\nexport default memo(ContextMenuContainerAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useEffect, useMemo, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type {\n ApiUser, ApiMessage, ApiChat, ApiSticker,\n} from '../../api/types';\nimport type { FocusDirection } from '../../types';\n\nimport {\n selectUser,\n selectChatMessage,\n selectIsMessageFocused,\n selectChat,\n} from '../../global/selectors';\nimport { getMessageHtmlId, isChatChannel } from '../../global/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport { renderActionMessageText } from '../common/helpers/renderActionMessageText';\nimport { preventMessageInputBlur } from './helpers/preventMessageInputBlur';\nimport useEnsureMessage from '../../hooks/useEnsureMessage';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting, useOnIntersect } from '../../hooks/useIntersectionObserver';\nimport useFocusMessage from './message/hooks/useFocusMessage';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\nimport useShowTransition from '../../hooks/useShowTransition';\n\nimport ContextMenuContainer from './message/ContextMenuContainer.async';\nimport AnimatedIconFromSticker from '../common/AnimatedIconFromSticker';\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n observeIntersectionForAnimation?: ObserveFn;\n isEmbedded?: boolean;\n appearanceOrder?: number;\n isLastInList?: boolean;\n memoFirstUnreadIdRef?: { current: number | undefined };\n};\n\ntype StateProps = {\n usersById: Record<string, ApiUser>;\n senderUser?: ApiUser;\n senderChat?: ApiChat;\n targetUserIds?: string[];\n targetMessage?: ApiMessage;\n targetChatId?: string;\n isFocused: boolean;\n focusDirection?: FocusDirection;\n noFocusHighlight?: boolean;\n premiumGiftSticker?: ApiSticker;\n};\n\nconst APPEARANCE_DELAY = 10;\n\nconst ActionMessage: FC<OwnProps & StateProps> = ({\n message,\n observeIntersection,\n observeIntersectionForAnimation,\n isEmbedded,\n appearanceOrder = 0,\n isLastInList,\n usersById,\n senderUser,\n senderChat,\n targetUserIds,\n targetMessage,\n targetChatId,\n isFocused,\n focusDirection,\n noFocusHighlight,\n premiumGiftSticker,\n memoFirstUnreadIdRef,\n}) => {\n const { openPremiumModal, requestConfetti } = getActions();\n\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n useOnIntersect(ref, observeIntersection);\n useEnsureMessage(message.chatId, message.replyToMessageId, targetMessage);\n useFocusMessage(ref, message.chatId, isFocused, focusDirection, noFocusHighlight);\n\n const noAppearanceAnimation = appearanceOrder <= 0;\n const [isShown, markShown] = useFlag(noAppearanceAnimation);\n const isGift = Boolean(message.content.action?.text.startsWith('ActionGift'));\n\n useEffect(() => {\n if (noAppearanceAnimation) {\n return;\n }\n\n setTimeout(markShown, appearanceOrder * APPEARANCE_DELAY);\n }, [appearanceOrder, markShown, noAppearanceAnimation]);\n\n const isVisible = useIsIntersecting(ref, observeIntersectionForAnimation);\n\n const shouldShowConfettiRef = useRef((() => {\n const isUnread = memoFirstUnreadIdRef?.current && message.id >= memoFirstUnreadIdRef.current;\n return isGift && !message.isOutgoing && isUnread;\n })());\n\n useEffect(() => {\n if (isVisible && shouldShowConfettiRef.current) {\n shouldShowConfettiRef.current = false;\n requestConfetti();\n }\n }, [isVisible, requestConfetti]);\n\n const { transitionClassNames } = useShowTransition(isShown, undefined, noAppearanceAnimation, false);\n\n const targetUsers = useMemo(() => {\n return targetUserIds\n ? targetUserIds.map((userId) => usersById?.[userId]).filter<ApiUser>(Boolean as any)\n : undefined;\n }, [targetUserIds, usersById]);\n\n const content = renderActionMessageText(\n lang,\n message,\n senderUser,\n senderChat,\n targetUsers,\n targetMessage,\n targetChatId,\n { asTextWithSpoilers: isEmbedded },\n );\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref);\n const isContextMenuShown = contextMenuPosition !== undefined;\n\n const handleMouseDown = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n preventMessageInputBlur(e);\n handleBeforeContextMenu(e);\n };\n\n const handlePremiumGiftClick = () => {\n openPremiumModal({\n isGift: true,\n fromUserId: senderUser?.id,\n toUserId: targetUserIds?.[0],\n monthsAmount: message.content.action?.months || 0,\n });\n };\n\n if (isEmbedded) {\n return <span className=\"embedded-action-message\">{content}</span>;\n }\n\n function renderGift() {\n return (\n <span className=\"action-message-gift\" tabIndex={0} role=\"button\" onClick={handlePremiumGiftClick}>\n <AnimatedIconFromSticker\n key={message.id}\n sticker={premiumGiftSticker}\n play\n noLoop\n nonInteractive\n />\n <strong>{lang('ActionGiftPremiumTitle')}</strong>\n <span>{lang('ActionGiftPremiumSubtitle', lang('Months', message.content.action?.months, 'i'))}</span>\n\n <span className=\"action-message-button\">{lang('ActionGiftPremiumView')}</span>\n </span>\n );\n }\n\n const className = buildClassName(\n 'ActionMessage message-list-item',\n isFocused && !noFocusHighlight && 'focused',\n isGift && 'premium-gift',\n isContextMenuShown && 'has-menu-open',\n isLastInList && 'last-in-list',\n transitionClassNames,\n );\n\n return (\n <div\n ref={ref}\n id={getMessageHtmlId(message.id)}\n className={className}\n data-message-id={message.id}\n onMouseDown={handleMouseDown}\n onContextMenu={handleContextMenu}\n >\n <span>{content}</span>\n {isGift && renderGift()}\n {contextMenuPosition && (\n <ContextMenuContainer\n isOpen={isContextMenuOpen}\n anchor={contextMenuPosition}\n message={message}\n messageListType=\"thread\"\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { message }): StateProps => {\n const { byId: usersById } = global.users;\n const userId = message.senderId;\n const { targetUserIds, targetChatId } = message.content.action || {};\n const targetMessageId = message.replyToMessageId;\n const targetMessage = targetMessageId\n ? selectChatMessage(global, message.chatId, targetMessageId)\n : undefined;\n\n const isFocused = selectIsMessageFocused(global, message);\n const { direction: focusDirection, noHighlight: noFocusHighlight } = (isFocused && global.focusedMessage) || {};\n\n const chat = selectChat(global, message.chatId);\n const isChat = chat && (isChatChannel(chat) || userId === message.chatId);\n const senderUser = !isChat && userId ? selectUser(global, userId) : undefined;\n const senderChat = isChat ? chat : undefined;\n const premiumGiftSticker = global.premiumGifts?.stickers?.[0];\n\n return {\n usersById,\n senderUser,\n senderChat,\n targetChatId,\n targetUserIds,\n targetMessage,\n isFocused,\n premiumGiftSticker,\n ...(isFocused && { focusDirection, noFocusHighlight }),\n };\n },\n)(ActionMessage));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useRef } from '../../lib/teact/teact';\n\nimport type { ApiUser, ApiMessage, ApiChat } from '../../api/types';\n\nimport {\n getMessageMediaHash,\n isActionMessage,\n getSenderTitle,\n getMessageRoundVideo,\n getUserColorKey,\n} from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport { getPictogramDimensions } from './helpers/mediaDimensions';\nimport buildClassName from '../../util/buildClassName';\nimport { renderMessageSummary } from './helpers/renderMessageText';\n\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useThumbnail from '../../hooks/useThumbnail';\nimport useLang from '../../hooks/useLang';\n\nimport ActionMessage from '../middle/ActionMessage';\n\nimport './EmbeddedMessage.scss';\n\ntype OwnProps = {\n observeIntersection?: ObserveFn;\n className?: string;\n message?: ApiMessage;\n sender?: ApiUser | ApiChat;\n title?: string;\n customText?: string;\n noUserColors?: boolean;\n isProtected?: boolean;\n hasContextMenu?: boolean;\n onClick: NoneToVoidFunction;\n};\n\nconst NBSP = '\\u00A0';\n\nconst EmbeddedMessage: FC<OwnProps> = ({\n className,\n message,\n sender,\n title,\n customText,\n isProtected,\n noUserColors,\n hasContextMenu,\n observeIntersection,\n onClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const mediaBlobUrl = useMedia(message && getMessageMediaHash(message, 'pictogram'), !isIntersecting);\n const mediaThumbnail = useThumbnail(message);\n const isRoundVideo = Boolean(message && getMessageRoundVideo(message));\n\n const lang = useLang();\n\n const senderTitle = sender ? getSenderTitle(lang, sender) : message?.forwardInfo?.hiddenUserName;\n\n return (\n <div\n ref={ref}\n className={buildClassName(\n 'EmbeddedMessage',\n className,\n sender && !noUserColors && `color-${getUserColorKey(sender)}`,\n )}\n onClick={message ? onClick : undefined}\n >\n {mediaThumbnail && renderPictogram(mediaThumbnail, mediaBlobUrl, isRoundVideo, isProtected)}\n <div className=\"message-text\">\n <p dir=\"auto\">\n {!message ? (\n customText || NBSP\n ) : isActionMessage(message) ? (\n <ActionMessage message={message} isEmbedded />\n ) : (\n renderMessageSummary(lang, message, Boolean(mediaThumbnail))\n )}\n </p>\n <div className=\"message-title\" dir=\"auto\">{renderText(senderTitle || title || NBSP)}</div>\n </div>\n {hasContextMenu && <i className=\"embedded-more icon-more\" />}\n </div>\n );\n};\n\nfunction renderPictogram(\n thumbDataUri: string,\n blobUrl?: string,\n isRoundVideo?: boolean,\n isProtected?: boolean,\n) {\n const { width, height } = getPictogramDimensions();\n\n return (\n <>\n <img\n src={blobUrl || thumbDataUri}\n width={width}\n height={height}\n alt=\"\"\n className={isRoundVideo ? 'round' : ''}\n draggable={!isProtected}\n />\n {isProtected && <span className=\"protector\" />}\n </>\n );\n}\n\nexport default EmbeddedMessage;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ActiveReaction } from '../../../global/types';\nimport type { ApiAvailableReaction } from '../../../api/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport useMedia from '../../../hooks/useMedia';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\nimport './ReactionAnimatedEmoji.scss';\n\ntype OwnProps = {\n reaction: string;\n activeReaction?: ActiveReaction;\n isInMeta?: boolean;\n availableReactions?: ApiAvailableReaction[];\n};\n\nconst CENTER_ICON_SIZE = 30;\nconst EFFECT_SIZE = 100;\n\nconst ReactionAnimatedEmoji: FC<OwnProps> = ({\n reaction,\n activeReaction,\n isInMeta,\n availableReactions,\n}) => {\n const { stopActiveReaction } = getActions();\n\n const availableReaction = availableReactions?.find((r) => r.reaction === reaction);\n const centerIconId = availableReaction?.centerIcon?.id;\n const effectId = availableReaction?.aroundAnimation?.id;\n const mediaDataCenterIcon = useMedia(`sticker${centerIconId}`, !centerIconId);\n const mediaDataEffect = useMedia(`sticker${effectId}`, !effectId);\n\n const shouldPlay = Boolean(activeReaction?.reaction === reaction && mediaDataCenterIcon && mediaDataEffect);\n const {\n shouldRender: shouldRenderAnimation,\n transitionClassNames: animationClassNames,\n } = useShowTransition(shouldPlay, undefined, true, 'slow');\n\n const handleEnded = useCallback(() => {\n stopActiveReaction({ messageId: activeReaction?.messageId, reaction });\n }, [activeReaction?.messageId, reaction, stopActiveReaction]);\n\n const [isAnimationLoaded, markAnimationLoaded, unmarkAnimationLoaded] = useFlag();\n const shouldRenderStatic = !shouldPlay || !isAnimationLoaded;\n\n const className = buildClassName(\n 'ReactionAnimatedEmoji',\n isInMeta && 'in-meta',\n shouldRenderAnimation && 'is-animating',\n );\n\n return (\n <div className={className}>\n {shouldRenderStatic && <ReactionStaticEmoji reaction={reaction} />}\n {shouldRenderAnimation && (\n <>\n <AnimatedSticker\n key={centerIconId}\n className={animationClassNames}\n size={CENTER_ICON_SIZE}\n tgsUrl={mediaDataCenterIcon}\n play\n noLoop\n forceOnHeavyAnimation\n onLoad={markAnimationLoaded}\n onEnded={unmarkAnimationLoaded}\n />\n <AnimatedSticker\n key={effectId}\n className={buildClassName('effect', animationClassNames)}\n size={EFFECT_SIZE}\n tgsUrl={mediaDataEffect}\n play\n noLoop\n forceOnHeavyAnimation\n onEnded={handleEnded}\n />\n </>\n )}\n </div>\n );\n};\n\nexport default memo(ReactionAnimatedEmoji);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../../lib/teact/teact';\n\nimport type { ApiAvailableReaction, ApiMessage, ApiMessageOutgoingStatus } from '../../../api/types';\nimport type { ActiveReaction } from '../../../global/types';\n\nimport { formatDateTimeToString, formatTime } from '../../../util/dateFormat';\nimport { formatIntegerCompact } from '../../../util/textFormat';\n\nimport renderText from '../../common/helpers/renderText';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport buildClassName from '../../../util/buildClassName';\n\nimport MessageOutgoingStatus from '../../common/MessageOutgoingStatus';\nimport ReactionAnimatedEmoji from './ReactionAnimatedEmoji';\n\nimport './MessageMeta.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n reactionMessage?: ApiMessage;\n withReactions?: boolean;\n withReactionOffset?: boolean;\n outgoingStatus?: ApiMessageOutgoingStatus;\n signature?: string;\n onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n activeReaction?: ActiveReaction;\n availableReactions?: ApiAvailableReaction[];\n};\n\nconst MessageMeta: FC<OwnProps> = ({\n message, outgoingStatus, signature, onClick, withReactions,\n activeReaction, withReactionOffset, availableReactions,\n reactionMessage,\n}) => {\n const lang = useLang();\n const [isActivated, markActivated] = useFlag();\n\n const reactions = withReactions && reactionMessage?.reactions?.results.filter((l) => l.count > 0);\n\n const title = useMemo(() => {\n if (!isActivated) return undefined;\n const createDateTime = formatDateTimeToString(message.date * 1000, lang.code);\n const editDateTime = message.isEdited && formatDateTimeToString(message.editDate! * 1000, lang.code);\n const forwardedDateTime = message.forwardInfo && formatDateTimeToString(message.forwardInfo.date * 1000, lang.code);\n\n let text = createDateTime;\n if (editDateTime) {\n text += '\\n';\n text += lang('lng_edited_date').replace('{date}', editDateTime);\n }\n if (forwardedDateTime) {\n text += '\\n';\n text += lang('lng_forwarded_date').replace('{date}', forwardedDateTime);\n }\n\n return text;\n }, [isActivated, lang, message]);\n\n return (\n <span\n className={buildClassName('MessageMeta', withReactionOffset && 'reactions-offset')}\n dir={lang.isRtl ? 'rtl' : 'ltr'}\n onClick={onClick}\n >\n {reactions && reactions.map((l) => (\n <ReactionAnimatedEmoji\n activeReaction={activeReaction}\n reaction={l.reaction}\n isInMeta\n availableReactions={availableReactions}\n />\n ))}\n {Boolean(message.views) && (\n <>\n <span className=\"message-views\">\n {formatIntegerCompact(message.views!)}\n </span>\n <i className=\"icon-channelviews\" />\n </>\n )}\n {signature && (\n <span className=\"message-signature\">{renderText(signature)}</span>\n )}\n <span className=\"message-time\" title={title} onMouseEnter={markActivated}>\n {message.isEdited && `${lang('EditedMessage')} `}\n {formatTime(lang, message.date * 1000)}\n </span>\n {outgoingStatus && (\n <MessageOutgoingStatus status={outgoingStatus} />\n )}\n </span>\n );\n};\n\nexport default memo(MessageMeta);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback, useEffect, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\n\nimport { getStickerDimensions } from '../../common/helpers/mediaDimensions';\nimport { getMessageMediaFormat, getMessageMediaHash } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\nimport safePlay from '../../../util/safePlay';\nimport { IS_WEBM_SUPPORTED } from '../../../util/environment';\nimport { getActions } from '../../../global';\n\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMedia from '../../../hooks/useMedia';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport useFlag from '../../../hooks/useFlag';\nimport useThumbnail from '../../../hooks/useThumbnail';\nimport useLang from '../../../hooks/useLang';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\n\nimport './Sticker.scss';\n\n// eslint-disable-next-line max-len\n// https://github.com/telegramdesktop/tdesktop/blob/master/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp#L42\nconst EFFECT_SIZE_MULTIPLIER = 1 + 0.245 * 2;\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection: ObserveFn;\n observeIntersectionForPlaying: ObserveFn;\n shouldLoop?: boolean;\n lastSyncTime?: number;\n shouldPlayEffect?: boolean;\n onPlayEffect?: VoidFunction;\n onStopEffect?: VoidFunction;\n};\n\nconst Sticker: FC<OwnProps> = ({\n message, observeIntersection, observeIntersectionForPlaying, shouldLoop, lastSyncTime,\n shouldPlayEffect, onPlayEffect, onStopEffect,\n}) => {\n const { showNotification, openStickerSet } = getActions();\n\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const sticker = message.content.sticker!;\n const {\n isLottie, stickerSetInfo, isVideo, hasEffect,\n } = sticker;\n const canDisplayVideo = IS_WEBM_SUPPORTED;\n const isMemojiSticker = 'isMissing' in stickerSetInfo;\n\n const [isPlayingEffect, startPlayingEffect, stopPlayingEffect] = useFlag();\n const shouldLoad = useIsIntersecting(ref, observeIntersection);\n const shouldPlay = useIsIntersecting(ref, observeIntersectionForPlaying);\n\n const mediaHash = sticker.isPreloadedGlobally ? `sticker${sticker.id}` : getMessageMediaHash(message, 'inline')!;\n const mediaHashEffect = `sticker${sticker.id}?size=f`;\n\n const previewMediaHash = isVideo && !canDisplayVideo && (\n sticker.isPreloadedGlobally ? `sticker${sticker.id}?size=m` : getMessageMediaHash(message, 'pictogram'));\n const previewBlobUrl = useMedia(previewMediaHash);\n const thumbDataUri = useThumbnail(sticker);\n const previewUrl = previewBlobUrl || thumbDataUri;\n\n const mediaData = useMedia(\n mediaHash,\n !shouldLoad,\n getMessageMediaFormat(message, 'inline'),\n lastSyncTime,\n );\n\n const effectBlobUrl = useMedia(\n mediaHashEffect,\n !shouldLoad || !hasEffect,\n ApiMediaFormat.BlobUrl,\n lastSyncTime,\n );\n\n const isMediaLoaded = Boolean(mediaData);\n const [isLottieLoaded, markLottieLoaded] = useFlag(isMediaLoaded);\n const isMediaReady = isLottie ? isLottieLoaded : isMediaLoaded;\n const transitionClassNames = useMediaTransition(isMediaReady);\n\n const { width, height } = getStickerDimensions(sticker);\n const thumbClassName = buildClassName('thumbnail', !thumbDataUri && 'empty');\n\n const stickerClassName = buildClassName(\n 'Sticker media-inner',\n isMemojiSticker && 'inactive',\n hasEffect && !message.isOutgoing && 'reversed',\n );\n\n const handleEffectEnded = useCallback(() => {\n stopPlayingEffect();\n onStopEffect?.();\n }, [onStopEffect, stopPlayingEffect]);\n\n useEffect(() => {\n if (!isVideo || !ref.current) return;\n const video = ref.current.querySelector('video');\n if (!video) return;\n if (shouldPlay) {\n safePlay(video);\n } else {\n video.pause();\n }\n }, [isVideo, shouldPlay]);\n\n useEffect(() => {\n if (hasEffect && shouldPlay && shouldPlayEffect) {\n startPlayingEffect();\n onPlayEffect?.();\n }\n }, [hasEffect, shouldPlayEffect, onPlayEffect, shouldPlay, startPlayingEffect]);\n\n const openModal = useCallback(() => {\n openStickerSet({\n stickerSetInfo: sticker.stickerSetInfo,\n });\n }, [openStickerSet, sticker]);\n\n const handleClick = useCallback(() => {\n if (hasEffect) {\n if (isPlayingEffect) {\n showNotification({\n message: lang('PremiumStickerTooltip'),\n action: openModal,\n actionText: lang('ViewAction'),\n });\n return;\n } else {\n startPlayingEffect();\n onPlayEffect?.();\n return;\n }\n }\n openModal();\n }, [hasEffect, isPlayingEffect, lang, onPlayEffect, openModal, showNotification, startPlayingEffect]);\n\n return (\n <div ref={ref} className={stickerClassName} onClick={!isMemojiSticker ? handleClick : undefined}>\n {(!isMediaReady || (isVideo && !canDisplayVideo)) && (\n <img\n src={previewUrl}\n width={width}\n height={height}\n alt=\"\"\n className={thumbClassName}\n />\n )}\n {!isLottie && !isVideo && (\n <img\n src={mediaData as string}\n width={width}\n height={height}\n alt=\"\"\n className={buildClassName('full-media', transitionClassNames)}\n />\n )}\n {isVideo && canDisplayVideo && isMediaReady && (\n <video\n src={mediaData as string}\n width={width}\n height={height}\n autoPlay={shouldPlay}\n playsInline\n disablePictureInPicture\n loop={shouldLoop}\n muted\n />\n )}\n {isLottie && isMediaLoaded && (\n <AnimatedSticker\n key={mediaHash}\n className={buildClassName('full-media', transitionClassNames)}\n tgsUrl={mediaData}\n size={width}\n play={shouldPlay}\n noLoop={!shouldLoop}\n onLoad={markLottieLoaded}\n />\n )}\n {hasEffect && shouldLoad && isPlayingEffect && (\n <AnimatedSticker\n key={mediaHashEffect}\n className=\"effect-sticker\"\n tgsUrl={effectBlobUrl}\n size={width * EFFECT_SIZE_MULTIPLIER}\n play\n isLowPriority\n noLoop\n onEnded={handleEffectEnded}\n />\n )}\n </div>\n );\n};\n\nexport default Sticker;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiSticker } from '../../../api/types';\nimport type { ActiveEmojiInteraction } from '../../../global/types';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\n\nimport { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets';\nimport { LIKE_STICKER_ID } from '../../common/helpers/mediaDimensions';\nimport {\n selectAnimatedEmoji,\n selectAnimatedEmojiEffect,\n selectAnimatedEmojiSound,\n selectLocalAnimatedEmoji,\n selectLocalAnimatedEmojiEffect,\n} from '../../../global/selectors';\nimport buildClassName from '../../../util/buildClassName';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useAnimatedEmoji from '../../common/hooks/useAnimatedEmoji';\n\nimport AnimatedIconFromSticker from '../../common/AnimatedIconFromSticker';\nimport AnimatedIconWithPreview from '../../common/AnimatedIconWithPreview';\n\nimport './AnimatedEmoji.scss';\n\ntype OwnProps = {\n emoji: string;\n withEffects: boolean;\n isOwn?: boolean;\n observeIntersection?: ObserveFn;\n size?: 'large' | 'medium' | 'small';\n lastSyncTime?: number;\n forceLoadPreview?: boolean;\n messageId?: number;\n chatId?: string;\n activeEmojiInteractions?: ActiveEmojiInteraction[];\n};\n\ninterface StateProps {\n sticker?: ApiSticker;\n effect?: ApiSticker;\n localSticker?: keyof typeof LOCAL_TGS_URLS;\n localEffect?: string;\n soundId?: string;\n}\n\nconst QUALITY = 1;\n\nconst AnimatedEmoji: FC<OwnProps & StateProps> = ({\n isOwn,\n observeIntersection,\n lastSyncTime,\n forceLoadPreview,\n messageId,\n chatId,\n activeEmojiInteractions,\n sticker,\n effect,\n localSticker,\n localEffect,\n soundId,\n}) => {\n const {\n ref,\n size,\n style,\n handleClick,\n } = useAnimatedEmoji(chatId, messageId, soundId, activeEmojiInteractions, isOwn, localEffect, effect?.emoji);\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n return localSticker ? (\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS[localSticker]}\n size={size}\n quality={QUALITY}\n play={isIntersecting}\n forceOnHeavyAnimation\n ref={ref}\n className=\"AnimatedEmoji media-inner\"\n style={style}\n onClick={handleClick}\n />\n ) : (\n <AnimatedIconFromSticker\n sticker={sticker}\n size={size}\n quality={QUALITY}\n noLoad={!isIntersecting}\n forcePreview={forceLoadPreview}\n lastSyncTime={lastSyncTime}\n play={isIntersecting}\n forceOnHeavyAnimation\n ref={ref}\n className={buildClassName('AnimatedEmoji media-inner', sticker?.id === LIKE_STICKER_ID && 'like-sticker-thumb')}\n style={style}\n onClick={handleClick}\n />\n );\n};\n\nexport default memo(withGlobal<OwnProps>((global, { emoji, withEffects }) => {\n const localSticker = selectLocalAnimatedEmoji(global, emoji);\n\n return {\n sticker: selectAnimatedEmoji(global, emoji),\n effect: withEffects ? selectAnimatedEmojiEffect(global, emoji) : undefined,\n soundId: selectAnimatedEmojiSound(global, emoji),\n localSticker,\n localEffect: localSticker && withEffects ? selectLocalAnimatedEmojiEffect(localSticker) : undefined,\n };\n})(AnimatedEmoji));\n","import {\n useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport safePlay from '../../../util/safePlay';\nimport { getActions } from '../../../global';\nimport useMedia from '../../../hooks/useMedia';\nimport type { ActiveEmojiInteraction } from '../../../global/types';\nimport { selectLocalAnimatedEmojiEffectByName } from '../../../global/selectors';\n\nconst SIZE = 104;\nconst INTERACTION_BUNCH_TIME = 1000;\nconst MS_DIVIDER = 1000;\nconst TIME_DEFAULT = 0;\n\nexport default function useAnimatedEmoji(\n chatId?: string,\n messageId?: number,\n soundId?: string,\n activeEmojiInteractions?: ActiveEmojiInteraction[],\n isOwn?: boolean,\n localEffect?: string,\n emoji?: string,\n) {\n const {\n interactWithAnimatedEmoji, sendEmojiInteraction, sendWatchingEmojiInteraction,\n } = getActions();\n\n const hasEffect = localEffect || emoji;\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line no-null/no-null\n const audioRef = useRef<HTMLAudioElement | undefined>(null);\n\n const soundMediaData = useMedia(soundId ? `document${soundId}` : undefined, !soundId);\n\n const style = `width: ${SIZE}px; height: ${SIZE}px;`;\n\n const interactions = useRef<number[] | undefined>(undefined);\n const startedInteractions = useRef<number | undefined>(undefined);\n const sendInteractionBunch = useCallback(() => {\n const container = ref.current;\n\n if (!container) return;\n\n sendEmojiInteraction({\n chatId,\n messageId,\n localEffect,\n emoji,\n interactions: interactions.current,\n });\n startedInteractions.current = undefined;\n interactions.current = undefined;\n }, [sendEmojiInteraction, chatId, messageId, localEffect, emoji]);\n\n const play = useCallback(() => {\n const audio = audioRef.current;\n if (soundMediaData) {\n if (audio) {\n audio.pause();\n audio.remove();\n }\n audioRef.current = new Audio();\n audioRef.current.src = soundMediaData;\n safePlay(audioRef.current);\n audioRef.current.addEventListener('ended', () => {\n audioRef.current = undefined;\n }, { once: true });\n }\n }, [soundMediaData]);\n\n const handleClick = useCallback(() => {\n play();\n\n const container = ref.current;\n\n if (!hasEffect || !container || !messageId || !chatId) {\n return;\n }\n\n const { x, y } = container.getBoundingClientRect();\n\n interactWithAnimatedEmoji({\n localEffect,\n emoji,\n x,\n y,\n startSize: SIZE,\n isReversed: !isOwn,\n });\n\n if (!interactions.current) {\n interactions.current = [];\n startedInteractions.current = performance.now();\n setTimeout(sendInteractionBunch, INTERACTION_BUNCH_TIME);\n }\n\n interactions.current.push(startedInteractions.current\n ? (performance.now() - startedInteractions.current) / MS_DIVIDER\n : TIME_DEFAULT);\n }, [\n chatId, emoji, hasEffect, interactWithAnimatedEmoji, isOwn,\n localEffect, messageId, play, sendInteractionBunch,\n ]);\n\n // Set an end anchor for remote activated interaction\n useEffect(() => {\n const container = ref.current;\n\n if (!container || !activeEmojiInteractions) return;\n\n activeEmojiInteractions.forEach(({\n id,\n startSize,\n messageId: interactionMessageId,\n }) => {\n if (startSize || messageId !== interactionMessageId) {\n return;\n }\n\n const { x, y } = container.getBoundingClientRect();\n\n sendWatchingEmojiInteraction({\n id,\n chatId,\n emoticon: localEffect ? selectLocalAnimatedEmojiEffectByName(localEffect) : emoji,\n startSize: SIZE,\n x,\n y,\n isReversed: !isOwn,\n });\n play();\n });\n }, [\n activeEmojiInteractions, chatId, emoji, isOwn, localEffect, messageId, play, sendWatchingEmojiInteraction,\n ]);\n\n return {\n ref,\n size: SIZE,\n style,\n handleClick,\n };\n}\n","import type { ApiMessage } from '../../../../api/types';\n\nimport { IS_CANVAS_FILTER_SUPPORTED, IS_SINGLE_COLUMN_LAYOUT } from '../../../../util/environment';\nimport { getMessageMediaThumbDataUri } from '../../../../global/helpers';\nimport useCanvasBlur from '../../../../hooks/useCanvasBlur';\n\nexport default function useBlurredMediaThumbRef(message: ApiMessage, fullMediaData?: string) {\n return useCanvasBlur(\n getMessageMediaThumbDataUri(message),\n Boolean(fullMediaData),\n IS_SINGLE_COLUMN_LAYOUT && !IS_CANVAS_FILTER_SUPPORTED,\n );\n}\n","import type { ISettings } from '../../../../types';\n\nconst SELECTED_APPENDIX_COLORS = {\n dark: {\n outgoing: 'rgb(135,116,225)',\n incoming: 'rgb(33,33,33)',\n },\n light: {\n outgoing: 'rgb(238,255,222)',\n incoming: 'rgb(255,255,255)',\n },\n};\n\nexport default function getCustomAppendixBg(\n src: string, isOwn: boolean, inSelectMode?: boolean, isSelected?: boolean, theme?: ISettings['theme'],\n) {\n if (isSelected) {\n return Promise.resolve(SELECTED_APPENDIX_COLORS[theme || 'light'][isOwn ? 'outgoing' : 'incoming']);\n }\n return getAppendixColorFromImage(src, isOwn);\n}\n\nasync function getAppendixColorFromImage(src: string, isOwn: boolean) {\n const img = new Image();\n img.src = src;\n img.crossOrigin = 'anonymous';\n\n if (!img.width) {\n await new Promise((resolve) => {\n img.onload = resolve;\n });\n }\n\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d')!;\n\n canvas.width = img.width;\n canvas.height = img.height;\n\n ctx.drawImage(img, 0, 0, img.width, img.height);\n\n const x = isOwn ? img.width - 1 : 0;\n const y = img.height - 1;\n\n const pixel = Array.from(ctx.getImageData(x, y, 1, 1).data);\n return `rgba(${pixel.join(',')})`;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback, useLayoutEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../../api/types';\nimport type { ISettings } from '../../../types';\nimport type { IMediaDimensions } from './helpers/calculateAlbumLayout';\n\nimport { CUSTOM_APPENDIX_ATTRIBUTE } from '../../../config';\nimport {\n getMessagePhoto,\n getMessageWebPagePhoto,\n getMessageMediaHash,\n getMediaTransferState,\n isOwnMessage,\n getMessageMediaFormat,\n} from '../../../global/helpers';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport buildClassName from '../../../util/buildClassName';\nimport getCustomAppendixBg from './helpers/getCustomAppendixBg';\nimport { calculateMediaDimensions } from './helpers/mediaDimensions';\n\nimport ProgressSpinner from '../../ui/ProgressSpinner';\n\nexport type OwnProps = {\n id?: string;\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n noAvatars?: boolean;\n canAutoLoad?: boolean;\n isInSelectMode?: boolean;\n isSelected?: boolean;\n uploadProgress?: number;\n size?: 'inline' | 'pictogram';\n shouldAffectAppendix?: boolean;\n dimensions?: IMediaDimensions & { isSmall?: boolean };\n nonInteractive?: boolean;\n isDownloading: boolean;\n isProtected?: boolean;\n withAspectRatio?: boolean;\n theme: ISettings['theme'];\n onClick?: (id: number) => void;\n onCancelUpload?: (message: ApiMessage) => void;\n};\n\nconst Photo: FC<OwnProps> = ({\n id,\n message,\n observeIntersection,\n noAvatars,\n canAutoLoad,\n isInSelectMode,\n isSelected,\n uploadProgress,\n size = 'inline',\n dimensions,\n nonInteractive,\n shouldAffectAppendix,\n isDownloading,\n isProtected,\n withAspectRatio,\n theme,\n onClick,\n onCancelUpload,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const photo = (getMessagePhoto(message) || getMessageWebPagePhoto(message))!;\n const localBlobUrl = photo.blobUrl;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const [isLoadAllowed, setIsLoadAllowed] = useState(canAutoLoad);\n const shouldLoad = isLoadAllowed && isIntersecting;\n const {\n mediaData, loadProgress,\n } = useMediaWithLoadProgress(getMessageMediaHash(message, size), !shouldLoad);\n const fullMediaData = localBlobUrl || mediaData;\n const thumbRef = useBlurredMediaThumbRef(message, fullMediaData);\n\n const {\n loadProgress: downloadProgress,\n } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'download'), !isDownloading, getMessageMediaFormat(message, 'download'),\n );\n\n const {\n isUploading, isTransferring, transferProgress,\n } = getMediaTransferState(\n message,\n uploadProgress || (isDownloading ? downloadProgress : loadProgress),\n shouldLoad && !fullMediaData,\n );\n const wasLoadDisabled = usePrevious(isLoadAllowed) === false;\n\n const transitionClassNames = useMediaTransition(fullMediaData);\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring, undefined, wasLoadDisabled, 'slow');\n const {\n shouldRender: shouldRenderDownloadButton,\n transitionClassNames: downloadButtonClassNames,\n } = useShowTransition(!fullMediaData && !isLoadAllowed);\n\n const handleClick = useCallback(() => {\n if (isUploading) {\n if (onCancelUpload) {\n onCancelUpload(message);\n }\n } else if (!fullMediaData) {\n setIsLoadAllowed((isAllowed) => !isAllowed);\n } else if (onClick) {\n onClick(message.id);\n }\n }, [fullMediaData, isUploading, message, onCancelUpload, onClick]);\n\n const isOwn = isOwnMessage(message);\n useLayoutEffect(() => {\n if (!shouldAffectAppendix) {\n return;\n }\n\n const contentEl = ref.current!.closest<HTMLDivElement>('.message-content')!;\n\n if (fullMediaData) {\n getCustomAppendixBg(fullMediaData, isOwn, isInSelectMode, isSelected, theme).then((appendixBg) => {\n contentEl.style.setProperty('--appendix-bg', appendixBg);\n contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');\n });\n } else {\n contentEl.classList.add('has-appendix-thumb');\n }\n }, [fullMediaData, isOwn, shouldAffectAppendix, isInSelectMode, isSelected, theme]);\n\n const { width, height, isSmall } = dimensions || calculateMediaDimensions(message, noAvatars);\n\n const className = buildClassName(\n 'media-inner',\n !isUploading && !nonInteractive && 'interactive',\n isSmall && 'small-image',\n width === height && 'square-image',\n );\n\n const aspectRatio = withAspectRatio ? `aspect-ratio: ${(width / height).toFixed(3)}/ 1` : '';\n const style = dimensions\n ? `width: ${width}px; height: ${height}px; left: ${dimensions.x}px; top: ${dimensions.y}px;${aspectRatio}`\n : '';\n\n return (\n <div\n id={id}\n ref={ref}\n className={className}\n style={style}\n onClick={isUploading ? undefined : handleClick}\n >\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n style={`width: ${width}px; height: ${height}px;${aspectRatio}`}\n />\n <img\n src={fullMediaData}\n className={`full-media ${transitionClassNames}`}\n width={width}\n height={height}\n alt=\"\"\n draggable={!isProtected}\n />\n {isProtected && <span className=\"protector\" />}\n {shouldRenderSpinner && !shouldRenderDownloadButton && (\n <div className={`media-loading ${spinnerClassNames}`}>\n <ProgressSpinner progress={transferProgress} onClick={isUploading ? handleClick : undefined} />\n </div>\n )}\n {shouldRenderDownloadButton && <i className={buildClassName('icon-download', downloadButtonClassNames)} />}\n {isTransferring && (\n <span className=\"message-transfer-progress\">{Math.round(transferProgress * 100)}%</span>\n )}\n </div>\n );\n};\n\nexport default Photo;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback, useRef, useState } from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiMessage } from '../../../api/types';\nimport type { IMediaDimensions } from './helpers/calculateAlbumLayout';\n\nimport { formatMediaDuration } from '../../../util/dateFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport { calculateVideoDimensions } from '../../common/helpers/mediaDimensions';\nimport {\n getMediaTransferState,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageVideo,\n getMessageWebPageVideo,\n isForwardedMessage,\n isOwnMessage,\n} from '../../../global/helpers';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress';\nimport useMedia from '../../../hooks/useMedia';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useBuffering from '../../../hooks/useBuffering';\nimport useVideoCleanup from '../../../hooks/useVideoCleanup';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport useVideoAutoPause from './hooks/useVideoAutoPause';\nimport useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef';\n\nimport ProgressSpinner from '../../ui/ProgressSpinner';\n\nexport type OwnProps = {\n id?: string;\n message: ApiMessage;\n observeIntersection: ObserveFn;\n noAvatars?: boolean;\n canAutoLoad?: boolean;\n canAutoPlay?: boolean;\n uploadProgress?: number;\n dimensions?: IMediaDimensions;\n lastSyncTime?: number;\n isDownloading: boolean;\n isProtected?: boolean;\n withAspectRatio?: boolean;\n onClick?: (id: number) => void;\n onCancelUpload?: (message: ApiMessage) => void;\n};\n\nconst Video: FC<OwnProps> = ({\n id,\n message,\n observeIntersection,\n noAvatars,\n canAutoLoad,\n canAutoPlay,\n uploadProgress,\n lastSyncTime,\n dimensions,\n onClick,\n onCancelUpload,\n isDownloading,\n isProtected,\n withAspectRatio,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef<HTMLVideoElement>(null);\n\n const video = (getMessageVideo(message) || getMessageWebPageVideo(message))!;\n const localBlobUrl = video.blobUrl;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const [isLoadAllowed, setIsLoadAllowed] = useState(canAutoLoad);\n const shouldLoad = Boolean(isLoadAllowed && isIntersecting && lastSyncTime);\n const [isPlayAllowed, setIsPlayAllowed] = useState(canAutoPlay);\n\n const previewBlobUrl = useMedia(\n getMessageMediaHash(message, 'pictogram'),\n !(isIntersecting && lastSyncTime),\n getMessageMediaFormat(message, 'pictogram'),\n lastSyncTime,\n );\n const previewClassNames = useMediaTransition(previewBlobUrl);\n\n const { mediaData, loadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'inline'),\n !shouldLoad,\n getMessageMediaFormat(message, 'inline'),\n lastSyncTime,\n );\n const fullMediaData = localBlobUrl || mediaData;\n const isInline = Boolean(isIntersecting && fullMediaData);\n // Thumbnail is always rendered so we can only disable blur if we have preview\n const thumbRef = useBlurredMediaThumbRef(message, previewBlobUrl);\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'download'),\n !isDownloading,\n getMessageMediaFormat(message, 'download'),\n lastSyncTime,\n );\n\n const { isBuffered, bufferingHandlers } = useBuffering(!canAutoLoad);\n const { isUploading, isTransferring, transferProgress } = getMediaTransferState(\n message,\n uploadProgress || (isDownloading ? downloadProgress : loadProgress),\n (shouldLoad && !isBuffered) || isDownloading,\n );\n const wasLoadDisabled = usePrevious(isLoadAllowed) === false;\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring, undefined, wasLoadDisabled);\n const {\n shouldRender: shouldRenderPlayButton,\n transitionClassNames: playButtonClassNames,\n } = useShowTransition(isLoadAllowed && !isPlayAllowed && !shouldRenderSpinner);\n\n const [playProgress, setPlayProgress] = useState<number>(0);\n const handleTimeUpdate = useCallback((e: React.SyntheticEvent<HTMLVideoElement>) => {\n setPlayProgress(Math.max(0, e.currentTarget.currentTime - 1));\n }, []);\n\n const duration = (videoRef.current?.duration) || video.duration || 0;\n\n const isOwn = isOwnMessage(message);\n const isForwarded = isForwardedMessage(message);\n const { width, height } = dimensions || calculateVideoDimensions(video, isOwn, isForwarded, noAvatars);\n\n useVideoAutoPause(videoRef, isInline);\n useVideoCleanup(videoRef, [isInline]);\n\n const handleClick = useCallback(() => {\n if (isUploading) {\n if (onCancelUpload) {\n onCancelUpload(message);\n }\n } else if (isDownloading) {\n getActions().cancelMessageMediaDownload({ message });\n } else if (!fullMediaData) {\n setIsLoadAllowed((isAllowed) => !isAllowed);\n } else if (fullMediaData && !isPlayAllowed) {\n setIsPlayAllowed(true);\n videoRef.current!.play();\n } else if (onClick) {\n onClick(message.id);\n }\n }, [isUploading, isDownloading, fullMediaData, isPlayAllowed, onClick, onCancelUpload, message]);\n\n const className = buildClassName('media-inner dark', !isUploading && 'interactive');\n const aspectRatio = withAspectRatio ? `aspect-ratio: ${(width / height).toFixed(3)}/ 1` : '';\n const style = dimensions\n ? `width: ${width}px; height: ${height}px; left: ${dimensions.x}px; top: ${dimensions.y}px;${aspectRatio}`\n : '';\n return (\n <div\n ref={ref}\n id={id}\n className={className}\n style={style}\n onClick={isUploading ? undefined : handleClick}\n >\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n style={`width: ${width}px; height: ${height}px;${aspectRatio}`}\n />\n <img\n src={previewBlobUrl}\n className={buildClassName('thumbnail', previewClassNames)}\n style={`width: ${width}px; height: ${height}px;${aspectRatio}`}\n alt=\"\"\n draggable={!isProtected}\n />\n {isInline && (\n <video\n ref={videoRef}\n className=\"full-media\"\n width={width}\n height={height}\n autoPlay={isPlayAllowed}\n muted\n loop\n playsInline\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n draggable={!isProtected}\n onTimeUpdate={handleTimeUpdate}\n style={aspectRatio}\n >\n <source src={fullMediaData} />\n </video>\n )}\n {isProtected && <span className=\"protector\" />}\n {shouldRenderPlayButton && <i className={buildClassName('icon-large-play', playButtonClassNames)} />}\n {shouldRenderSpinner && (\n <div className={buildClassName('media-loading', spinnerClassNames)}>\n <ProgressSpinner progress={transferProgress} onClick={handleClick} />\n </div>\n )}\n {!isLoadAllowed && (\n <i className=\"icon-download\" />\n )}\n {isTransferring ? (\n <span className=\"message-transfer-progress\">\n {(isUploading || isDownloading) ? `${Math.round(transferProgress * 100)}%` : '...'}\n </span>\n ) : (\n <div className=\"message-media-duration\">\n {video.isGif ? 'GIF' : formatMediaDuration(Math.max(duration - playProgress, 0))}\n </div>\n )}\n </div>\n );\n};\n\nexport default Video;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiUser, ApiContact, ApiCountryCode } from '../../../api/types';\nimport type { AnimationLevel } from '../../../types';\n\nimport { selectUser } from '../../../global/selectors';\nimport { formatPhoneNumberWithCode } from '../../../util/phoneNumber';\nimport buildClassName from '../../../util/buildClassName';\n\nimport Avatar from '../../common/Avatar';\n\nimport './Contact.scss';\n\ntype OwnProps = {\n contact: ApiContact;\n};\n\ntype StateProps = {\n user?: ApiUser;\n phoneCodeList: ApiCountryCode[];\n animationLevel: AnimationLevel;\n};\n\nconst UNREGISTERED_CONTACT_ID = '0';\n\nconst Contact: FC<OwnProps & StateProps> = ({\n contact, user, phoneCodeList, animationLevel,\n}) => {\n const { openChat } = getActions();\n\n const {\n firstName,\n lastName,\n phoneNumber,\n userId,\n } = contact;\n const isRegistered = userId !== UNREGISTERED_CONTACT_ID;\n\n const handleClick = useCallback(() => {\n openChat({ id: userId });\n }, [openChat, userId]);\n\n return (\n <div\n className={buildClassName('Contact', isRegistered && 'interactive')}\n onClick={isRegistered ? handleClick : undefined}\n >\n <Avatar size=\"large\" user={user} text={firstName || lastName} animationLevel={animationLevel} withVideo />\n <div className=\"contact-info\">\n <div className=\"contact-name\">{firstName} {lastName}</div>\n <div className=\"contact-phone\">{formatPhoneNumberWithCode(phoneCodeList, phoneNumber)}</div>\n </div>\n </div>\n );\n};\n\nexport default withGlobal<OwnProps>(\n (global, { contact }): StateProps => {\n const { countryList: { phoneCodes: phoneCodeList } } = global;\n return {\n user: selectUser(global, contact.userId),\n phoneCodeList,\n animationLevel: global.settings.byKey.animationLevel,\n };\n },\n)(Contact);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useState, useEffect, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiPollAnswer, ApiPollResult } from '../../../api/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport renderText from '../../common/helpers/renderText';\n\nimport './PollOption.scss';\n\ntype OwnProps = {\n answer: ApiPollAnswer;\n voteResults?: ApiPollResult[];\n totalVoters?: number;\n maxVotersCount?: number;\n correctResults: string[];\n shouldAnimate: boolean;\n};\n\nconst PollOption: FC<OwnProps> = ({\n answer,\n voteResults,\n totalVoters,\n maxVotersCount,\n correctResults,\n shouldAnimate,\n}) => {\n const result = voteResults && voteResults.find((r) => r.option === answer.option);\n const correctAnswer = correctResults.length === 0 || correctResults.indexOf(answer.option) !== -1;\n const showIcon = (correctResults.length > 0 && correctAnswer) || (result?.isChosen);\n const answerPercent = result ? getPercentage(result.votersCount, totalVoters || 0) : 0;\n const [finalPercent, setFinalPercent] = useState(shouldAnimate ? 0 : answerPercent);\n // eslint-disable-next-line no-null/no-null\n const lineRef = useRef<HTMLDivElement>(null);\n const lineWidth = result ? getPercentage(result.votersCount, maxVotersCount || 0) : 0;\n const isAnimationDoesNotStart = finalPercent !== answerPercent;\n\n useEffect(() => {\n if (shouldAnimate) {\n setFinalPercent(answerPercent);\n }\n }, [shouldAnimate, answerPercent]);\n\n useEffect(() => {\n const lineEl = lineRef.current;\n\n if (lineEl && shouldAnimate) {\n const svgEl = lineEl.firstElementChild;\n\n const style = isAnimationDoesNotStart ? '' : 'stroke-dasharray: 100% 200%; stroke-dashoffset: -44';\n if (!svgEl) {\n lineEl.innerHTML = `\n <svg class=\"poll-line\" xmlns=\"http://www.w3.org/2000/svg\" style=\"${style}\">\n <path d=\"M4.47 5.33v13.6a9 9 0 009 9h13\"/>\n </svg>`;\n } else {\n svgEl.setAttribute('style', style);\n }\n }\n }, [isAnimationDoesNotStart, shouldAnimate]);\n\n if (!voteResults || !result) {\n return undefined;\n }\n\n const lineStyle = `width: ${lineWidth}%; transform:scaleX(${isAnimationDoesNotStart ? 0 : 1})`;\n\n return (\n <div className=\"PollOption\" dir=\"ltr\">\n <div className={`poll-option-share ${answerPercent === '100' ? 'limit-width' : ''}`}>\n {answerPercent}%\n {showIcon && (\n <span className={buildClassName(\n 'poll-option-chosen',\n !correctAnswer && 'wrong',\n shouldAnimate && 'animate',\n )}\n >\n <i className={correctAnswer ? 'icon-check' : 'icon-close'} />\n </span>\n )}\n </div>\n <div className=\"poll-option-right\">\n <div className=\"poll-option-text\" dir=\"auto\">\n {renderText(answer.text)}\n </div>\n <div className={buildClassName('poll-option-answer', showIcon && !correctAnswer && 'wrong')}>\n <div className=\"poll-option-corner\" ref={lineRef} />\n <div\n className=\"poll-option-line\"\n style={lineStyle}\n />\n </div>\n </div>\n </div>\n );\n};\n\nfunction getPercentage(value: number, total: number) {\n return total > 0 ? ((value / total) * 100).toFixed() : 0;\n}\n\nexport default PollOption;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback,\n useEffect,\n useState,\n memo,\n useMemo,\n useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type {\n ApiMessage, ApiPoll, ApiUser, ApiPollAnswer,\n} from '../../../api/types';\n\nimport renderText from '../../common/helpers/renderText';\nimport { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities';\nimport { formatMediaDuration } from '../../../util/dateFormat';\nimport type { LangFn } from '../../../hooks/useLang';\nimport useLang from '../../../hooks/useLang';\n\nimport CheckboxGroup from '../../ui/CheckboxGroup';\nimport RadioGroup from '../../ui/RadioGroup';\nimport Avatar from '../../common/Avatar';\nimport Button from '../../ui/Button';\nimport Notification from '../../ui/Notification';\nimport PollOption from './PollOption';\n\nimport './Poll.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n poll: ApiPoll;\n onSendVote: (options: string[]) => void;\n};\n\ntype StateProps = {\n recentVoterIds?: number[];\n usersById: Record<string, ApiUser>;\n serverTimeOffset: number;\n};\n\nconst SOLUTION_CONTAINER_ID = '#middle-column-portals';\nconst SOLUTION_DURATION = 5000;\nconst NBSP = '\\u00A0';\n\nconst Poll: FC<OwnProps & StateProps> = ({\n message,\n poll,\n recentVoterIds,\n usersById,\n onSendVote,\n serverTimeOffset,\n}) => {\n const { loadMessage, openPollResults, requestConfetti } = getActions();\n\n const { id: messageId, chatId } = message;\n const { summary, results } = poll;\n const [isSubmitting, setIsSubmitting] = useState<boolean>(false);\n const [chosenOptions, setChosenOptions] = useState<string[]>([]);\n const [isSolutionShown, setIsSolutionShown] = useState<boolean>(false);\n const [wasSubmitted, setWasSubmitted] = useState<boolean>(false);\n const [closePeriod, setClosePeriod] = useState<number>(\n !summary.closed && summary.closeDate && summary.closeDate > 0\n ? Math.min(summary.closeDate - Math.floor(Date.now() / 1000) + serverTimeOffset, summary.closePeriod!)\n : 0,\n );\n // eslint-disable-next-line no-null/no-null\n const countdownRef = useRef<HTMLDivElement>(null);\n const { results: voteResults, totalVoters } = results;\n const hasVoted = voteResults && voteResults.some((r) => r.isChosen);\n const canVote = !summary.closed && !hasVoted;\n const canViewResult = !canVote && summary.isPublic && Number(results.totalVoters) > 0;\n const isMultiple = canVote && summary.multipleChoice;\n const maxVotersCount = voteResults ? Math.max(...voteResults.map((r) => r.votersCount)) : totalVoters;\n const correctResults = voteResults ? voteResults.reduce((answers: string[], r) => {\n if (r.isCorrect) {\n answers.push(r.option);\n }\n\n return answers;\n }, []) : [];\n const answers = summary.answers.map((a) => ({\n label: a.text,\n value: a.option,\n hidden: Boolean(summary.quiz && summary.closePeriod && closePeriod <= 0),\n }));\n\n useEffect(() => {\n const chosen = poll.results.results?.find((result) => result.isChosen);\n if (isSubmitting && chosen) {\n if (chosen.isCorrect) {\n requestConfetti();\n }\n setIsSubmitting(false);\n }\n }, [isSubmitting, poll.results.results, requestConfetti]);\n\n useEffect(() => {\n if (closePeriod > 0) {\n setTimeout(() => setClosePeriod(closePeriod - 1), 1000);\n }\n\n const countdownEl = countdownRef.current;\n\n if (countdownEl) {\n const circumference = 6 * 2 * Math.PI;\n const svgEl = countdownEl.lastElementChild;\n const timerEl = countdownEl.firstElementChild;\n if (closePeriod <= 5) {\n countdownEl.classList.add('hurry-up');\n }\n\n if (!svgEl || !timerEl) {\n countdownEl.innerHTML = `\n <span>${formatMediaDuration(closePeriod)}</span>\n <svg width=\"16px\" height=\"16px\">\n <circle cx=\"8\" cy=\"8\" r=\"6\" class=\"poll-countdown-progress\" transform=\"rotate(-90, 8, 8)\"\n stroke-dasharray=\"${circumference} ${circumference}\"\n stroke-dashoffset=\"0\"\n />\n </svg>`;\n } else {\n const strokeDashOffset = ((summary.closePeriod! - closePeriod) / summary.closePeriod!) * circumference;\n timerEl.textContent = formatMediaDuration(closePeriod);\n (svgEl.firstElementChild as SVGElement).setAttribute('stroke-dashoffset', `-${strokeDashOffset}`);\n }\n }\n }, [closePeriod, summary.closePeriod]);\n\n useEffect(() => {\n if (summary.quiz && (closePeriod <= 0 || (hasVoted && !summary.closed))) {\n loadMessage({ chatId, messageId });\n }\n }, [chatId, closePeriod, hasVoted, loadMessage, messageId, summary.closed, summary.quiz]);\n\n // If the client time is not synchronized, the poll must be updated after the closePeriod time has expired.\n useEffect(() => {\n let timer: number | undefined;\n\n if (summary.quiz && !summary.closed && summary.closePeriod && summary.closePeriod > 0) {\n timer = window.setTimeout(() => {\n loadMessage({ chatId, messageId });\n }, summary.closePeriod * 1000);\n }\n\n return () => {\n if (timer) {\n window.clearTimeout(timer);\n }\n };\n }, [canVote, chatId, loadMessage, messageId, summary.closePeriod, summary.closed, summary.quiz]);\n\n const recentVoters = useMemo(() => {\n return recentVoterIds ? recentVoterIds.reduce((result: ApiUser[], id) => {\n const user = usersById[id];\n if (user) {\n result.push(user);\n }\n\n return result;\n }, []) : [];\n }, [usersById, recentVoterIds]);\n\n const handleRadioChange = useCallback(\n (option: string) => {\n setChosenOptions([option]);\n setIsSubmitting(true);\n setWasSubmitted(true);\n onSendVote([option]);\n }, [onSendVote],\n );\n\n const handleCheckboxChange = useCallback(\n (options: string[]) => {\n setChosenOptions(options);\n }, [],\n );\n\n const handleVoteClick = useCallback(\n () => {\n setIsSubmitting(true);\n setWasSubmitted(true);\n onSendVote(chosenOptions);\n }, [onSendVote, chosenOptions],\n );\n\n const handleViewResultsClick = useCallback(\n () => {\n openPollResults({ chatId, messageId });\n }, [chatId, messageId, openPollResults],\n );\n\n const handleSolutionShow = useCallback(() => {\n setIsSolutionShown(true);\n }, []);\n\n const handleSolutionHide = useCallback(() => {\n setIsSolutionShown(false);\n setWasSubmitted(false);\n }, []);\n\n // Show the solution to quiz if the answer was incorrect\n useEffect(() => {\n if (wasSubmitted && hasVoted && summary.quiz && results.results && poll.results.solution) {\n const correctResult = results.results.find((r) => r.isChosen && r.isCorrect);\n if (!correctResult) {\n setIsSolutionShown(true);\n }\n }\n }, [hasVoted, wasSubmitted, results.results, summary.quiz, poll.results.solution]);\n\n const lang = useLang();\n\n function renderResultOption(answer: ApiPollAnswer) {\n return (\n <PollOption\n key={answer.option}\n shouldAnimate={wasSubmitted || !canVote}\n answer={answer}\n voteResults={voteResults}\n totalVoters={totalVoters}\n maxVotersCount={maxVotersCount}\n correctResults={correctResults}\n />\n );\n }\n\n function renderRecentVoters() {\n return (\n recentVoters.length > 0 && (\n <div className=\"poll-recent-voters\">\n {recentVoters.map((user) => (\n <Avatar\n size=\"micro\"\n user={user}\n />\n ))}\n </div>\n )\n );\n }\n\n function renderSolution() {\n return (\n isSolutionShown && poll.results.solution && (\n <Notification\n message={renderTextWithEntities(poll.results.solution, poll.results.solutionEntities)}\n duration={SOLUTION_DURATION}\n onDismiss={handleSolutionHide}\n containerId={SOLUTION_CONTAINER_ID}\n />\n )\n );\n }\n\n return (\n <div className=\"Poll\" dir={lang.isRtl ? 'auto' : 'ltr'}>\n {renderSolution()}\n <div className=\"poll-question\">{renderText(summary.question, ['emoji', 'br'])}</div>\n <div className=\"poll-type\">\n {lang(getPollTypeString(summary))}\n {renderRecentVoters()}\n {closePeriod > 0 && canVote && <div ref={countdownRef} className=\"poll-countdown\" />}\n {summary.quiz && poll.results.solution && !canVote && (\n <Button\n round\n size=\"tiny\"\n color=\"translucent\"\n className=\"poll-quiz-help\"\n disabled={isSolutionShown}\n onClick={handleSolutionShow}\n ariaLabel=\"Show Solution\"\n >\n <i className=\"icon-lamp\" />\n </Button>\n )}\n </div>\n {canVote && (\n <div className=\"poll-answers\" onClick={stopPropagation}>\n {isMultiple\n ? (\n <CheckboxGroup\n options={answers}\n onChange={handleCheckboxChange}\n disabled={message.isScheduled || isSubmitting}\n loadingOptions={isSubmitting ? chosenOptions : undefined}\n round\n />\n )\n : (\n <RadioGroup\n name={`poll-${messageId}`}\n options={answers}\n onChange={handleRadioChange}\n disabled={message.isScheduled || isSubmitting}\n loadingOption={isSubmitting ? chosenOptions[0] : undefined}\n />\n )}\n </div>\n )}\n {!canVote && (\n <div className=\"poll-results\">\n {summary.answers.map(renderResultOption)}\n </div>\n )}\n {!canViewResult && !isMultiple && (\n <div className=\"poll-voters-count\">{getReadableVotersCount(lang, summary.quiz, results.totalVoters)}</div>\n )}\n {isMultiple && (\n <Button\n isText\n disabled={chosenOptions.length === 0}\n size=\"tiny\"\n onClick={handleVoteClick}\n >\n {lang('PollSubmitVotes')}\n </Button>\n )}\n {canViewResult && (\n <Button\n isText\n size=\"tiny\"\n onClick={handleViewResultsClick}\n >\n {lang('PollViewResults')}\n </Button>\n )}\n </div>\n );\n};\n\nfunction getPollTypeString(summary: ApiPoll['summary']) {\n // When we just created the poll, some properties don't exist.\n if (typeof summary.isPublic === 'undefined') {\n return NBSP;\n }\n\n if (summary.closed) {\n return 'FinalResults';\n }\n\n if (summary.quiz) {\n return summary.isPublic ? 'QuizPoll' : 'AnonymousQuizPoll';\n }\n\n return summary.isPublic ? 'PublicPoll' : 'AnonymousPoll';\n}\n\nfunction getReadableVotersCount(lang: LangFn, isQuiz: true | undefined, count?: number) {\n if (!count) {\n return lang(isQuiz ? 'Chat.Quiz.TotalVotesEmpty' : 'Chat.Poll.TotalVotesResultEmpty');\n }\n\n return lang(isQuiz ? 'Answer' : 'Vote', count, 'i');\n}\n\nfunction stopPropagation(e: React.MouseEvent<HTMLDivElement>) {\n e.stopPropagation();\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { poll }) => {\n const { recentVoterIds } = poll.results;\n const { serverTimeOffset, users: { byId: usersById } } = global;\n if (!recentVoterIds || recentVoterIds.length === 0) {\n return {};\n }\n\n return {\n recentVoterIds,\n usersById,\n serverTimeOffset,\n };\n },\n)(Poll));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../../api/types';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport type { ISettings } from '../../../types';\n\nimport { getMessageWebPage } from '../../../global/helpers';\nimport { calculateMediaDimensions } from './helpers/mediaDimensions';\nimport renderText from '../../common/helpers/renderText';\nimport trimText from '../../../util/trimText';\nimport buildClassName from '../../../util/buildClassName';\n\nimport SafeLink from '../../common/SafeLink';\nimport Photo from './Photo';\nimport Video from './Video';\n\nimport './WebPage.scss';\n\nconst MAX_TEXT_LENGTH = 170; // symbols\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n noAvatars?: boolean;\n canAutoLoad?: boolean;\n canAutoPlay?: boolean;\n inPreview?: boolean;\n lastSyncTime?: number;\n isDownloading?: boolean;\n isProtected?: boolean;\n theme: ISettings['theme'];\n onMediaClick?: () => void;\n onCancelMediaTransfer?: () => void;\n};\n\nconst WebPage: FC<OwnProps> = ({\n message,\n observeIntersection,\n noAvatars,\n canAutoLoad,\n canAutoPlay,\n inPreview,\n lastSyncTime,\n isDownloading = false,\n isProtected,\n theme,\n onMediaClick,\n onCancelMediaTransfer,\n}) => {\n const webPage = getMessageWebPage(message);\n\n const handleMediaClick = useCallback(() => {\n onMediaClick!();\n }, [onMediaClick]);\n\n if (!webPage) {\n return undefined;\n }\n\n const {\n siteName,\n url,\n displayUrl,\n title,\n description,\n photo,\n video,\n } = webPage;\n const truncatedDescription = trimText(description, MAX_TEXT_LENGTH);\n const isArticle = Boolean(truncatedDescription || title || siteName);\n let isSquarePhoto = false;\n if (isArticle && webPage?.photo && !webPage.video) {\n const { width, height } = calculateMediaDimensions(message);\n isSquarePhoto = width === height;\n }\n const isMediaInteractive = (photo || video) && onMediaClick && !isSquarePhoto;\n\n const className = buildClassName(\n 'WebPage',\n inPreview && 'in-preview',\n isSquarePhoto && 'with-square-photo',\n !photo && !video && !inPreview && 'without-media',\n video && 'with-video',\n !isArticle && 'no-article',\n );\n\n return (\n <div\n className={className}\n data-initial={(siteName || displayUrl)[0]}\n dir=\"auto\"\n >\n {photo && !video && (\n <Photo\n message={message}\n observeIntersection={observeIntersection}\n noAvatars={noAvatars}\n canAutoLoad={canAutoLoad}\n size={isSquarePhoto ? 'pictogram' : 'inline'}\n nonInteractive={!isMediaInteractive}\n onClick={isMediaInteractive ? handleMediaClick : undefined}\n onCancelUpload={onCancelMediaTransfer}\n isDownloading={isDownloading}\n isProtected={isProtected}\n withAspectRatio\n theme={theme}\n />\n )}\n {isArticle && (\n <div className=\"WebPage-text\">\n <SafeLink className=\"site-name\" url={url} text={siteName || displayUrl} />\n {!inPreview && title && (\n <p className=\"site-title\">{renderText(title)}</p>\n )}\n {truncatedDescription && (\n <p className=\"site-description\">{renderText(truncatedDescription, ['emoji', 'br'])}</p>\n )}\n </div>\n )}\n {!inPreview && video && (\n <Video\n message={message}\n observeIntersection={observeIntersection!}\n noAvatars={noAvatars}\n canAutoLoad={canAutoLoad}\n canAutoPlay={canAutoPlay}\n lastSyncTime={lastSyncTime}\n onClick={isMediaInteractive ? handleMediaClick : undefined}\n onCancelUpload={onCancelMediaTransfer}\n isDownloading={isDownloading}\n isProtected={isProtected}\n withAspectRatio\n />\n )}\n </div>\n );\n};\n\nexport default memo(WebPage);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useLayoutEffect, useRef } from '../../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../../api/types';\nimport type { ISettings } from '../../../types';\n\nimport { CUSTOM_APPENDIX_ATTRIBUTE } from '../../../config';\nimport { getMessageInvoice, getWebDocumentHash } from '../../../global/helpers';\nimport { formatCurrency } from '../../../util/formatCurrency';\nimport renderText from '../../common/helpers/renderText';\nimport getCustomAppendixBg from './helpers/getCustomAppendixBg';\n\nimport useLang from '../../../hooks/useLang';\nimport useMedia from '../../../hooks/useMedia';\n\nimport Skeleton from '../../ui/Skeleton';\n\nimport './Invoice.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n shouldAffectAppendix?: boolean;\n isInSelectMode?: boolean;\n isSelected?: boolean;\n theme: ISettings['theme'];\n};\n\nconst Invoice: FC<OwnProps> = ({\n message,\n shouldAffectAppendix,\n isInSelectMode,\n isSelected,\n theme,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n const invoice = getMessageInvoice(message);\n\n const {\n title,\n text,\n amount,\n currency,\n isTest,\n photo,\n } = invoice!;\n\n const photoUrl = useMedia(getWebDocumentHash(photo));\n\n useLayoutEffect(() => {\n if (!shouldAffectAppendix) {\n return;\n }\n\n const contentEl = ref.current!.closest<HTMLDivElement>('.message-content')!;\n\n if (photoUrl) {\n getCustomAppendixBg(photoUrl, false, isInSelectMode, isSelected, theme).then((appendixBg) => {\n contentEl.style.setProperty('--appendix-bg', appendixBg);\n contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');\n });\n }\n }, [shouldAffectAppendix, photoUrl, isInSelectMode, isSelected, theme]);\n\n return (\n <div\n ref={ref}\n className=\"Invoice\"\n >\n {title && (\n <p className=\"title\">{renderText(title)}</p>\n )}\n {text && (\n <div>{renderText(text, ['emoji', 'br'])}</div>\n )}\n <div className={`description ${photo ? 'has-image' : ''}`}>\n {photoUrl && (\n <img\n className=\"invoice-image\"\n src={photoUrl}\n alt=\"\"\n crossOrigin=\"anonymous\"\n />\n )}\n {!photoUrl && photo && (\n <Skeleton width={photo.dimensions?.width} height={photo.dimensions?.height} forceAspectRatio />\n )}\n <p className=\"description-text\">\n {formatCurrency(amount, currency, lang.code)}\n {isTest && <span>{lang('PaymentTestInvoice')}</span>}\n </p>\n </div>\n </div>\n );\n};\n\nexport default memo(Invoice);\n","const PROVIDER = 'http://maps.google.com/maps';\n\n// eslint-disable-next-line max-len\n// https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L82\nconst VENUE_COLORS = new Map(Object.entries({\n 'building/medical': '#43b3f4',\n 'building/gym': '#43b3f4',\n 'education/cafeteria': '#f7943f',\n 'travel/bedandbreakfast': '#9987ff',\n 'travel/hotel': '#9987ff',\n 'travel/hostel': '#9987ff',\n 'travel/resort': '#9987ff',\n 'travel/hotel_bar': '#e56dd6',\n arts_entertainment: '#e56dd6',\n building: '#6e81b2',\n education: '#a57348',\n event: '#959595',\n food: '#f7943f',\n home: '#00aeef',\n nightlife: '#e56dd6',\n parks_outdoors: '#6cc039',\n shops: '#ffb300',\n travel: '#1c9fff',\n work: '#ad7854',\n}));\n\nconst RANDOM_COLORS = [\n '#e56cd5', '#f89440', '#9986ff', '#44b3f5', '#6dc139', '#ff5d5a', '#f87aad', '#6e82b3', '#f5ba21',\n];\n\nexport function prepareMapUrl(lat: number, long: number, zoom: number) {\n return `${PROVIDER}/place/${lat}+${long}/@${lat},${long},${zoom}z`;\n}\n\nexport function getMetersPerPixel(lat: number, zoom: number) {\n // https://groups.google.com/g/google-maps-js-api-v3/c/hDRO4oHVSeM/m/osOYQYXg2oUJ\n return (156543.03392 * Math.cos(lat * (Math.PI / 180))) / 2 ** zoom;\n}\n\nexport function getVenueIconUrl(type?: string) {\n if (!type) return '';\n return `https://ss3.4sqi.net/img/categories_v2/${type}_88.png`;\n}\n\n// eslint-disable-next-line max-len\n// https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L104\nexport function getVenueColor(type?: string) {\n if (!type) return '#008df2';\n return VENUE_COLORS.get(type)\n || VENUE_COLORS.get(type.split('/')[0])\n || RANDOM_COLORS[stringToNumber(type) % RANDOM_COLORS.length];\n}\n\nfunction stringToNumber(str: string) {\n return str.split('').reduce((prevHash, currVal) => (\n // eslint-disable-next-line no-bitwise\n (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0), 0);\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { ApiChat, ApiMessage, ApiUser } from '../../../api/types';\nimport type { ISettings } from '../../../types';\n\nimport { CUSTOM_APPENDIX_ATTRIBUTE } from '../../../config';\nimport {\n getMessageLocation,\n buildStaticMapHash,\n isGeoLiveExpired,\n isOwnMessage,\n isUserId,\n} from '../../../global/helpers';\nimport useMedia from '../../../hooks/useMedia';\nimport getCustomAppendixBg from './helpers/getCustomAppendixBg';\nimport { formatCountdownShort, formatLastUpdated } from '../../../util/dateFormat';\nimport useLang from '../../../hooks/useLang';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\nimport useTimeout from '../../../hooks/useTimeout';\nimport {\n getMetersPerPixel, getVenueColor, getVenueIconUrl, prepareMapUrl,\n} from '../../../util/map';\nimport buildClassName from '../../../util/buildClassName';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useInterval from '../../../hooks/useInterval';\nimport { getServerTime } from '../../../util/serverTime';\n\nimport Avatar from '../../common/Avatar';\nimport Skeleton from '../../ui/Skeleton';\n\nimport mapPin from '../../../assets/map-pin.svg';\nimport './Location.scss';\n\nconst MOVE_THRESHOLD = 0.0001; // ~11m\nconst DEFAULT_MAP_CONFIG = {\n width: 400,\n height: 300,\n zoom: 16,\n scale: 2,\n};\n\n// eslint-disable-next-line max-len\nconst SVG_PIN = { __html: '<svg version=\"1.1\" class=\"round-pin\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 64 64\" style=\"enable-background:new 0 0 64 64;\" xml:space=\"preserve\"><g><circle cx=\"32\" cy=\"32\" r=\"24.5\"/><path d=\"M32,8c13.23,0,24,10.77,24,24S45.23,56,32,56S8,45.23,8,32S18.77,8,32,8 M32,7C18.19,7,7,18.19,7,32s11.19,25,25,25 s25-11.19,25-25S45.81,7,32,7L32,7z\"/></g><g><polygon points=\"29.38,57.67 27.4,56.08 30.42,54.42 32,51.54 33.58,54.42 36.6,56.08 34.69,57.61 32,60.73\"/><path d=\"M32,52.58l1.07,1.95l0.14,0.26l0.26,0.14l2.24,1.22l-1.33,1.06l-0.07,0.06l-0.06,0.07L32,59.96l-2.24-2.61l-0.06-0.07 l-0.07-0.06l-1.33-1.06l2.24-1.22l0.26-0.14l0.14-0.26L32,52.58 M32,50.5l-1.94,3.56L26.5,56l2.5,2l3,3.5l3-3.5l2.5-2l-3.56-1.94 L32,50.5L32,50.5z\"/></g></svg>' };\n\ntype OwnProps = {\n message: ApiMessage;\n peer?: ApiUser | ApiChat;\n lastSyncTime?: number;\n isInSelectMode?: boolean;\n isSelected?: boolean;\n theme: ISettings['theme'];\n serverTimeOffset: number;\n};\n\nconst Location: FC<OwnProps> = ({\n message,\n peer,\n lastSyncTime,\n isInSelectMode,\n isSelected,\n theme,\n serverTimeOffset,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const countdownRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n const forceUpdate = useForceUpdate();\n\n const location = getMessageLocation(message)!;\n const { type, geo } = location;\n\n const serverTime = getServerTime(serverTimeOffset);\n const isExpired = isGeoLiveExpired(message, serverTime);\n const secondsBeforeEnd = (type === 'geoLive' && !isExpired) ? message.date + location.period - serverTime\n : undefined;\n\n const [point, setPoint] = useState(geo);\n\n const shouldRenderText = type === 'venue' || (type === 'geoLive' && !isExpired);\n const {\n width, height, zoom, scale,\n } = DEFAULT_MAP_CONFIG;\n\n const mediaHash = Boolean(lastSyncTime) && buildStaticMapHash(point, width, height, zoom, scale);\n const mediaBlobUrl = useMedia(mediaHash);\n const prevMediaBlobUrl = usePrevious(mediaBlobUrl);\n const mapBlobUrl = mediaBlobUrl || prevMediaBlobUrl;\n\n const isPeerUser = peer && isUserId(peer.id);\n const avatarUser = (peer && isPeerUser) ? peer as ApiUser : undefined;\n const avatarChat = (peer && !isPeerUser) ? peer as ApiChat : undefined;\n\n const isOwn = isOwnMessage(message);\n\n const accuracyRadiusPx = useMemo(() => {\n if (type !== 'geoLive' || !point.accuracyRadius) {\n return 0;\n }\n\n const { lat, accuracyRadius } = point;\n return accuracyRadius / getMetersPerPixel(lat, zoom);\n }, [type, point, zoom]);\n\n const handleClick = () => {\n const url = prepareMapUrl(point.lat, point.long, zoom);\n window.open(url, '_blank', 'noopener')?.focus();\n };\n\n const updateCountdown = useCallback((countdownEl: HTMLDivElement) => {\n if (type !== 'geoLive') return;\n const radius = 12;\n const circumference = radius * 2 * Math.PI;\n const svgEl = countdownEl.lastElementChild;\n const timerEl = countdownEl.firstElementChild as SVGElement;\n\n const timeLeft = message.date + location.period - getServerTime(serverTimeOffset);\n const strokeDashOffset = (1 - timeLeft / location.period) * circumference;\n const text = formatCountdownShort(lang, timeLeft * 1000);\n\n if (!svgEl || !timerEl) {\n countdownEl.innerHTML = `\n <span class=\"geo-countdown-text\">${text}</span>\n <svg width=\"32px\" height=\"32px\">\n <circle cx=\"16\" cy=\"16\" r=\"${radius}\" class=\"geo-countdown-progress\" transform=\"rotate(-90, 16, 16)\"\n stroke-dasharray=\"${circumference} ${circumference}\"\n stroke-dashoffset=\"-${strokeDashOffset}\"\n />\n </svg>`;\n } else {\n timerEl.textContent = text;\n svgEl.firstElementChild!.setAttribute('stroke-dashoffset', `-${strokeDashOffset}`);\n }\n }, [type, message.date, location, serverTimeOffset, lang]);\n\n useLayoutEffect(() => {\n if (countdownRef.current) {\n updateCountdown(countdownRef.current);\n }\n }, [updateCountdown]);\n\n useLayoutEffect(() => {\n if (shouldRenderText) return;\n const contentEl = ref.current!.closest<HTMLDivElement>('.message-content')!;\n if (mapBlobUrl) {\n getCustomAppendixBg(mapBlobUrl, isOwn, isInSelectMode, isSelected, theme).then((appendixBg) => {\n contentEl.style.setProperty('--appendix-bg', appendixBg);\n contentEl.classList.add('has-appendix-thumb');\n contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');\n });\n }\n }, [isOwn, isInSelectMode, isSelected, theme, mapBlobUrl, shouldRenderText]);\n\n useEffect(() => {\n // Prevent map refetching for slight location changes\n if (Math.abs(geo.lat - point.lat) < MOVE_THRESHOLD && Math.abs(geo.long - point.long) < MOVE_THRESHOLD) {\n if (point.accuracyRadius !== geo.accuracyRadius) {\n setPoint({\n ...point,\n accuracyRadius: geo.accuracyRadius,\n });\n }\n return;\n }\n setPoint(geo);\n }, [geo, point]);\n\n useTimeout(() => {\n forceUpdate();\n }, !isExpired ? (secondsBeforeEnd || 0) * 1000 : undefined);\n\n useInterval(() => {\n const countdownEl = countdownRef.current;\n\n if (countdownEl) {\n updateCountdown(countdownEl);\n }\n }, secondsBeforeEnd ? 1000 : undefined);\n\n function renderInfo() {\n if (!shouldRenderText) return undefined;\n if (type === 'venue') {\n return (\n <div className=\"location-info\">\n <div className=\"location-info-title\">\n {location.title}\n </div>\n <div className=\"location-info-subtitle\">\n {location.address}\n </div>\n </div>\n );\n }\n if (type === 'geoLive') {\n return (\n <div className=\"location-info\">\n <div className=\"location-info-title\">{lang('AttachLiveLocation')}</div>\n <div className=\"location-info-subtitle\">\n {formatLastUpdated(lang, serverTime, message.editDate)}\n </div>\n {!isExpired && <div className=\"geo-countdown\" ref={countdownRef} />}\n </div>\n );\n }\n return undefined;\n }\n\n function renderMap() {\n if (!mapBlobUrl) return <Skeleton width={width} height={height} />;\n return (\n <img\n className=\"full-media map\"\n src={mapBlobUrl}\n alt=\"Location on a map\"\n width={DEFAULT_MAP_CONFIG.width}\n height={DEFAULT_MAP_CONFIG.height}\n />\n );\n }\n\n function renderPin() {\n const pinClassName = buildClassName(\n 'pin',\n type,\n isExpired && 'expired',\n );\n if (type === 'geoLive') {\n return (\n <div className={pinClassName} dangerouslySetInnerHTML={SVG_PIN}>\n <Avatar chat={avatarChat} user={avatarUser} className=\"location-avatar\" />\n {location.heading !== undefined && (\n <div className=\"direction\" style={`--direction: ${location.heading}deg`} />\n )}\n </div>\n );\n }\n\n if (type === 'venue') {\n const color = getVenueColor(location.venueType);\n const icon = getVenueIconUrl(location.venueType);\n return (\n <div className={pinClassName} dangerouslySetInnerHTML={SVG_PIN} style={`--pin-color: ${color}`}>\n <img src={icon} className=\"venue-icon\" alt=\"\" />\n </div>\n );\n }\n\n return (\n <img className={pinClassName} src={mapPin} alt=\"\" />\n );\n }\n\n function renderOverlay() {\n if (!mapBlobUrl) return undefined;\n\n return (\n <>\n {Boolean(accuracyRadiusPx) && !isExpired && (\n <div\n className=\"location-accuracy\"\n style={`width: ${accuracyRadiusPx * 2}px; height: ${accuracyRadiusPx * 2}px`}\n />\n )}\n {renderPin()}\n </>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"Location media-inner interactive\"\n onClick={handleClick}\n >\n <div className=\"map-wrapper\">\n {renderMap()}\n {renderOverlay()}\n </div>\n {renderInfo()}\n </div>\n );\n};\n\nexport default memo(Location);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../../api/types';\n\nimport { getActions } from '../../../global';\nimport { getGamePreviewPhotoHash, getGamePreviewVideoHash, getMessageText } from '../../../global/helpers';\n\nimport useMedia from '../../../hooks/useMedia';\n\nimport Skeleton from '../../ui/Skeleton';\n\nimport './Game.scss';\n\nconst DEFAULT_PREVIEW_DIMENSIONS = {\n width: 480,\n height: 270,\n};\n\ntype OwnProps = {\n message: ApiMessage;\n canAutoLoadMedia?: boolean;\n lastSyncTime?: number;\n};\n\nconst Game: FC<OwnProps> = ({\n message,\n canAutoLoadMedia,\n lastSyncTime,\n}) => {\n const { clickBotInlineButton } = getActions();\n const game = message.content.game!;\n const {\n title, description,\n } = game;\n\n const photoHash = Boolean(lastSyncTime) && getGamePreviewPhotoHash(game);\n const videoHash = Boolean(lastSyncTime) && getGamePreviewVideoHash(game);\n const photoBlobUrl = useMedia(photoHash, !canAutoLoadMedia);\n const videoBlobUrl = useMedia(videoHash, !canAutoLoadMedia);\n\n const handleGameClick = () => {\n clickBotInlineButton({\n messageId: message.id,\n button: message.inlineButtons![0][0],\n });\n };\n\n return (\n <div className=\"Game\">\n <div\n className=\"preview\"\n style={`width: ${DEFAULT_PREVIEW_DIMENSIONS.width}px; height: ${DEFAULT_PREVIEW_DIMENSIONS.height}px`}\n onClick={handleGameClick}\n >\n {!photoBlobUrl && !videoBlobUrl && (\n <Skeleton className=\"skeleton preview-content\" />\n )}\n {photoBlobUrl && (\n <img\n className=\"preview-content\"\n src={photoBlobUrl}\n alt={title}\n />\n )}\n {videoBlobUrl && (\n <video\n className=\"preview-content\"\n playsInline\n muted\n disablePictureInPicture\n autoPlay\n loop\n src={videoBlobUrl}\n />\n )}\n </div>\n <div className=\"title\">{title}</div>\n {!getMessageText(message) && <div className=\"description\">{description}</div>}\n </div>\n );\n};\n\nexport default memo(Game);\n","import type { MouseEvent as ReactMouseEvent } from 'react';\nimport type { FC } from '../../../../lib/teact/teact';\nimport React, {\n useCallback,\n useMemo,\n memo,\n} from '../../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../../global';\n\nimport type { OwnProps as PhotoProps } from '../Photo';\nimport type { OwnProps as VideoProps } from '../Video';\n\nimport buildClassName from '../../../../util/buildClassName';\nimport {\n selectIsInSelectMode,\n selectIsMessageSelected,\n} from '../../../../global/selectors';\n\ntype OwnProps =\n PhotoProps\n & VideoProps;\n\ntype StateProps = {\n isInSelectMode?: boolean;\n isSelected?: boolean;\n};\n\nexport default function withSelectControl(WrappedComponent: FC) {\n const ComponentWithSelectControl: FC<OwnProps & StateProps> = (props) => {\n const {\n isInSelectMode,\n isSelected,\n message,\n dimensions,\n } = props;\n const { toggleMessageSelection } = getActions();\n\n const handleMessageSelect = useCallback((e: ReactMouseEvent<HTMLDivElement, MouseEvent>) => {\n e.stopPropagation();\n toggleMessageSelection({ messageId: message.id, withShift: e?.shiftKey });\n }, [toggleMessageSelection, message]);\n\n const newProps = useMemo(() => {\n const { dimensions: dims, onClick } = props;\n return {\n ...props,\n isInSelectMode,\n isSelected,\n dimensions: {\n ...dims,\n x: 0,\n y: 0,\n },\n onClick: isInSelectMode ? undefined : onClick,\n };\n }, [props, isInSelectMode, isSelected]);\n\n return (\n <div\n className={buildClassName('album-item-select-wrapper', isSelected && 'is-selected')}\n style={dimensions ? `left: ${dimensions.x}px; top: ${dimensions.y}px;` : ''}\n onClick={isInSelectMode ? handleMessageSelect : undefined}\n >\n {isInSelectMode && (\n <div className=\"message-select-control\">\n {isSelected && (\n <i className=\"icon-select\" />\n )}\n </div>\n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <WrappedComponent {...newProps} />\n </div>\n );\n };\n\n return memo(withGlobal<OwnProps>(\n (global, ownProps) => {\n const { message } = ownProps;\n return {\n isInSelectMode: selectIsInSelectMode(global),\n isSelected: selectIsMessageSelected(global, message.id),\n };\n },\n )(ComponentWithSelectControl));\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { useCallback } from '../../../lib/teact/teact';\n\nimport type { GlobalState } from '../../../global/types';\nimport type { ApiMessage } from '../../../api/types';\nimport type { IAlbum, ISettings } from '../../../types';\nimport type { IAlbumLayout } from './helpers/calculateAlbumLayout';\nimport { AlbumRectPart } from './helpers/calculateAlbumLayout';\n\nimport { getMessageContent, getMessageHtmlId, getMessageOriginalId } from '../../../global/helpers';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\nimport withSelectControl from './hocs/withSelectControl';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport {\n selectActiveDownloadIds,\n selectCanAutoLoadMedia,\n selectCanAutoPlayMedia,\n selectTheme,\n} from '../../../global/selectors';\n\nimport Photo from './Photo';\nimport Video from './Video';\n\nimport './Album.scss';\n\nconst PhotoWithSelect = withSelectControl(Photo);\nconst VideoWithSelect = withSelectControl(Video);\n\ntype OwnProps = {\n album: IAlbum;\n observeIntersection: ObserveFn;\n hasCustomAppendix?: boolean;\n lastSyncTime?: number;\n isOwn: boolean;\n isProtected?: boolean;\n albumLayout: IAlbumLayout;\n onMediaClick: (messageId: number) => void;\n};\n\ntype StateProps = {\n theme: ISettings['theme'];\n uploadsById: GlobalState['fileUploads']['byMessageLocalId'];\n activeDownloadIds: number[];\n};\n\nconst Album: FC<OwnProps & StateProps> = ({\n album,\n observeIntersection,\n hasCustomAppendix,\n lastSyncTime,\n isOwn,\n isProtected,\n albumLayout,\n onMediaClick,\n uploadsById,\n activeDownloadIds,\n theme,\n}) => {\n const { cancelSendingMessage } = getActions();\n\n const mediaCount = album.messages.length;\n\n const handleCancelUpload = useCallback((message: ApiMessage) => {\n cancelSendingMessage({ chatId: message.chatId, messageId: message.id });\n }, [cancelSendingMessage]);\n\n function renderAlbumMessage(message: ApiMessage, index: number) {\n const { photo, video } = getMessageContent(message);\n const fileUpload = uploadsById[getMessageOriginalId(message)];\n const uploadProgress = fileUpload?.progress;\n const { dimensions, sides } = albumLayout.layout[index];\n\n // Ignoring global updates is a known drawback here\n const canAutoLoad = selectCanAutoLoadMedia(getGlobal(), message);\n const canAutoPlay = selectCanAutoPlayMedia(getGlobal(), message);\n\n if (photo) {\n const shouldAffectAppendix = hasCustomAppendix && (\n // eslint-disable-next-line no-bitwise\n (isOwn ? index === mediaCount - 1 : Boolean(sides & AlbumRectPart.Left && sides & AlbumRectPart.Bottom))\n );\n\n return (\n <PhotoWithSelect\n id={`album-media-${getMessageHtmlId(message.id)}`}\n message={message}\n observeIntersection={observeIntersection}\n canAutoLoad={canAutoLoad}\n shouldAffectAppendix={shouldAffectAppendix}\n uploadProgress={uploadProgress}\n dimensions={dimensions}\n isProtected={isProtected}\n onClick={onMediaClick}\n onCancelUpload={handleCancelUpload}\n isDownloading={activeDownloadIds.includes(message.id)}\n theme={theme}\n />\n );\n } else if (video) {\n return (\n <VideoWithSelect\n id={`album-media-${getMessageHtmlId(message.id)}`}\n message={message}\n observeIntersection={observeIntersection}\n canAutoLoad={canAutoLoad}\n canAutoPlay={canAutoPlay}\n uploadProgress={uploadProgress}\n lastSyncTime={lastSyncTime}\n dimensions={dimensions}\n isProtected={isProtected}\n onClick={onMediaClick}\n onCancelUpload={handleCancelUpload}\n isDownloading={activeDownloadIds.includes(message.id)}\n theme={theme}\n />\n );\n }\n\n return undefined;\n }\n\n const { width: containerWidth, height: containerHeight } = albumLayout.containerStyle;\n\n return (\n <div\n className=\"Album\"\n style={`width: ${containerWidth}px; height: ${containerHeight}px;`}\n >\n {album.messages.map(renderAlbumMessage)}\n </div>\n );\n};\n\nexport default withGlobal<OwnProps>(\n (global, { album }): StateProps => {\n const { chatId } = album.mainMessage;\n const theme = selectTheme(global);\n const activeDownloadIds = selectActiveDownloadIds(global, chatId);\n return {\n theme,\n uploadsById: global.fileUploads.byMessageLocalId,\n activeDownloadIds,\n };\n },\n)(Album);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n useCallback,\n useEffect,\n useRef,\n useState,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiMessage } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\n\nimport { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions';\nimport { getMessageMediaFormat, getMessageMediaHash } from '../../../global/helpers';\nimport { formatMediaDuration } from '../../../util/dateFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport { stopCurrentAudio } from '../../../util/audioPlayer';\nimport safePlay from '../../../util/safePlay';\nimport { fastRaf } from '../../../util/schedulers';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../../hooks/useIntersectionObserver';\nimport useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useMediaTransition from '../../../hooks/useMediaTransition';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useBuffering from '../../../hooks/useBuffering';\nimport useVideoCleanup from '../../../hooks/useVideoCleanup';\nimport useVideoAutoPause from './hooks/useVideoAutoPause';\nimport useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef';\n\nimport ProgressSpinner from '../../ui/ProgressSpinner';\n\nimport './RoundVideo.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection: ObserveFn;\n canAutoLoad?: boolean;\n lastSyncTime?: number;\n isDownloading?: boolean;\n};\n\nlet stopPrevious: NoneToVoidFunction;\n\nconst RoundVideo: FC<OwnProps> = ({\n message,\n observeIntersection,\n canAutoLoad,\n lastSyncTime,\n isDownloading,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const playingProgressRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const playerRef = useRef<HTMLVideoElement>(null);\n\n const video = message.content.video!;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const [isLoadAllowed, setIsLoadAllowed] = useState(canAutoLoad);\n const shouldLoad = Boolean(isLoadAllowed && isIntersecting && lastSyncTime);\n const { mediaData, loadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'inline'),\n !shouldLoad,\n getMessageMediaFormat(message, 'inline'),\n lastSyncTime,\n );\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'download'),\n !isDownloading,\n ApiMediaFormat.BlobUrl,\n lastSyncTime,\n );\n const thumbRef = useBlurredMediaThumbRef(message, mediaData);\n\n const { isBuffered, bufferingHandlers } = useBuffering();\n const isTransferring = (isLoadAllowed && !isBuffered) || isDownloading;\n const wasLoadDisabled = usePrevious(isLoadAllowed) === false;\n\n const transitionClassNames = useMediaTransition(mediaData);\n const {\n shouldRender: shouldSpinnerRender,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring || !isBuffered, undefined, wasLoadDisabled);\n\n const [isActivated, setIsActivated] = useState<boolean>(false);\n const [progress, setProgress] = useState<number>(0);\n\n useEffect(() => {\n if (!isActivated) {\n return;\n }\n\n const svgCenter = ROUND_VIDEO_DIMENSIONS_PX / 2;\n const svgMargin = 6;\n const circumference = (svgCenter - svgMargin) * 2 * Math.PI;\n const strokeDashOffset = circumference - progress * circumference;\n\n const playerEl = playerRef.current!;\n const playingProgressEl = playingProgressRef.current!;\n const svgEl = playingProgressEl.firstElementChild;\n\n if (!svgEl) {\n playingProgressEl.innerHTML = `\n <svg width=\"${ROUND_VIDEO_DIMENSIONS_PX}px\" height=\"${ROUND_VIDEO_DIMENSIONS_PX}px\">\n <circle cx=\"${svgCenter}\" cy=\"${svgCenter}\" r=\"${svgCenter - svgMargin}\" class=\"progress-circle\"\n transform=\"rotate(-90, ${svgCenter}, ${svgCenter})\"\n stroke-dasharray=\"${circumference} ${circumference}\"\n stroke-dashoffset=\"${circumference}\"\n />\n </svg>`;\n } else {\n (svgEl.firstElementChild as SVGElement).setAttribute('stroke-dashoffset', strokeDashOffset.toString());\n }\n\n setProgress(playerEl.currentTime / playerEl.duration);\n }, [isActivated, progress]);\n\n const shouldPlay = Boolean(mediaData && isIntersecting);\n\n const stopPlaying = useCallback(() => {\n if (!playerRef.current) {\n return;\n }\n\n setIsActivated(false);\n setProgress(0);\n safePlay(playerRef.current);\n\n fastRaf(() => {\n playingProgressRef.current!.innerHTML = '';\n });\n }, []);\n\n const capturePlaying = useCallback(() => {\n stopPrevious?.();\n stopPrevious = stopPlaying;\n }, [stopPlaying]);\n\n useEffect(() => {\n if (!playerRef.current) {\n return;\n }\n\n if (shouldPlay) {\n safePlay(playerRef.current);\n } else {\n playerRef.current.pause();\n }\n }, [shouldPlay]);\n\n useVideoAutoPause(playerRef, shouldPlay);\n useVideoCleanup(playerRef, [mediaData]);\n\n const handleClick = useCallback(() => {\n if (!mediaData) {\n setIsLoadAllowed((isAllowed) => !isAllowed);\n\n return;\n }\n\n if (isDownloading) {\n getActions().cancelMessageMediaDownload({ message });\n return;\n }\n\n const playerEl = playerRef.current!;\n if (isActivated) {\n if (playerEl.paused) {\n safePlay(playerEl);\n stopCurrentAudio();\n } else {\n playerEl.pause();\n }\n } else {\n capturePlaying();\n // Pause is a workaround for iOS Safari – otherwise it stops video after several frames\n playerEl.pause();\n playerEl.currentTime = 0;\n safePlay(playerEl);\n stopCurrentAudio();\n\n setIsActivated(true);\n }\n }, [capturePlaying, isActivated, isDownloading, mediaData, message]);\n\n const handleTimeUpdate = useCallback((e: React.UIEvent<HTMLVideoElement>) => {\n const playerEl = e.currentTarget;\n\n setProgress(playerEl.currentTime / playerEl.duration);\n }, []);\n\n const videoClassName = buildClassName('full-media', transitionClassNames);\n\n return (\n <div\n ref={ref}\n className=\"RoundVideo media-inner\"\n onClick={handleClick}\n >\n <div className=\"thumbnail-wrapper\">\n <canvas\n ref={thumbRef}\n className=\"thumbnail\"\n style={`width: ${ROUND_VIDEO_DIMENSIONS_PX}px; height: ${ROUND_VIDEO_DIMENSIONS_PX}px`}\n />\n </div>\n {mediaData && (\n <div className=\"video-wrapper\">\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <video\n ref={playerRef}\n className={videoClassName}\n width={ROUND_VIDEO_DIMENSIONS_PX}\n height={ROUND_VIDEO_DIMENSIONS_PX}\n autoPlay\n disablePictureInPicture\n muted={!isActivated}\n loop={!isActivated}\n playsInline\n onEnded={isActivated ? stopPlaying : undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...bufferingHandlers}\n onTimeUpdate={isActivated ? handleTimeUpdate : undefined}\n >\n <source src={mediaData} />\n </video>\n </div>\n )}\n <div className=\"progress\" ref={playingProgressRef} />\n {shouldSpinnerRender && (\n <div className={`media-loading ${spinnerClassNames}`}>\n <ProgressSpinner progress={isDownloading ? downloadProgress : loadProgress} />\n </div>\n )}\n {!mediaData && !isLoadAllowed && (\n <i className=\"icon-download\" />\n )}\n <div className=\"message-media-duration\">\n {isActivated ? formatMediaDuration(playerRef.current!.currentTime) : formatMediaDuration(video.duration)}\n {(!isActivated || playerRef.current!.paused) && <i className=\"icon-muted\" />}\n </div>\n </div>\n );\n};\n\nexport default RoundVideo;\n","import React from '../../../lib/teact/teact';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiKeyboardButton, ApiMessage } from '../../../api/types';\n\nimport { RE_TME_LINK } from '../../../config';\nimport renderText from '../../common/helpers/renderText';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\n\nimport './InlineButtons.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n onClick: ({ messageId, button }: { messageId: number; button: ApiKeyboardButton }) => void;\n};\n\nconst InlineButtons: FC<OwnProps> = ({ message, onClick }) => {\n const lang = useLang();\n\n const renderIcon = (button: ApiKeyboardButton) => {\n const { type } = button;\n switch (type) {\n case 'url': {\n if (!RE_TME_LINK.test(button.url)) {\n return <i className=\"icon-arrow-right\" />;\n }\n break;\n }\n case 'urlAuth':\n return <i className=\"icon-arrow-right\" />;\n case 'buy':\n case 'receipt':\n return <i className=\"icon-cart\" />;\n case 'switchBotInline':\n return <i className=\"icon-share-filled\" />;\n case 'webView':\n case 'simpleWebView':\n return <i className=\"icon-webapp\" />;\n }\n return undefined;\n };\n\n return (\n <div className=\"InlineButtons\">\n {message.inlineButtons!.map((row) => (\n <div className=\"row\">\n {row.map((button) => (\n <Button\n size=\"tiny\"\n ripple\n disabled={button.type === 'unsupported'}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => onClick({ messageId: message.id, button })}\n >\n <span className=\"inline-button-text\">{renderText(lang(button.text))}</span>\n {renderIcon(button)}\n </Button>\n ))}\n </div>\n ))}\n </div>\n );\n};\n\nexport default InlineButtons;\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, getGlobal } from '../../../global';\n\nimport type {\n ApiChat, ApiThreadInfo, ApiUser,\n} from '../../../api/types';\n\nimport { isUserId } from '../../../global/helpers';\nimport { formatIntegerCompact } from '../../../util/textFormat';\nimport buildClassName from '../../../util/buildClassName';\nimport useLang from '../../../hooks/useLang';\n\nimport Avatar from '../../common/Avatar';\n\nimport './CommentButton.scss';\n\ntype OwnProps = {\n threadInfo: ApiThreadInfo;\n disabled?: boolean;\n};\n\nconst CommentButton: FC<OwnProps> = ({\n threadInfo,\n disabled,\n}) => {\n const { openChat } = getActions();\n\n const lang = useLang();\n const {\n threadId, chatId, messagesCount, lastMessageId, lastReadInboxMessageId, recentReplierIds,\n } = threadInfo;\n\n const handleClick = useCallback(() => {\n openChat({ id: chatId, threadId });\n }, [openChat, chatId, threadId]);\n\n const recentRepliers = useMemo(() => {\n if (!recentReplierIds?.length) {\n return undefined;\n }\n\n // No need for expensive global updates on chats and users, so we avoid them\n const { users: { byId: usersById }, chats: { byId: chatsById } } = getGlobal();\n\n return recentReplierIds.map((peerId) => {\n return isUserId(peerId) ? usersById[peerId] : chatsById[peerId];\n }).filter(Boolean);\n }, [recentReplierIds]);\n\n if (messagesCount === undefined) {\n return undefined;\n }\n\n function renderRecentRepliers() {\n return (\n recentRepliers && recentRepliers.length > 0 && (\n <div className=\"recent-repliers\" dir={lang.isRtl ? 'rtl' : 'ltr'}>\n {recentRepliers.map((user) => (\n <Avatar\n key={user.id}\n size=\"small\"\n user={isUserId(user.id) ? user as ApiUser : undefined}\n chat={!isUserId(user.id) ? user as ApiChat : undefined}\n />\n ))}\n </div>\n )\n );\n }\n\n const hasUnread = Boolean(lastReadInboxMessageId && lastMessageId && lastReadInboxMessageId < lastMessageId);\n\n return (\n <div\n data-cnt={formatIntegerCompact(messagesCount)}\n className={buildClassName('CommentButton', hasUnread && 'has-unread', disabled && 'disabled')}\n dir={lang.isRtl ? 'rtl' : 'ltr'}\n onClick={handleClick}\n >\n <i className=\"icon-comments-sticker\" />\n {(!recentRepliers || recentRepliers.length === 0) && <i className=\"icon-comments\" />}\n {renderRecentRepliers()}\n <div className=\"label\" dir=\"auto\">\n {messagesCount ? lang('Comments', messagesCount, 'i') : lang('LeaveAComment')}\n </div>\n <i className=\"icon-next\" />\n </div>\n );\n};\n\nexport default memo(CommentButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions, getGlobal } from '../../../global';\n\nimport type {\n ApiAvailableReaction, ApiMessage, ApiReactionCount, ApiUser,\n} from '../../../api/types';\nimport type { ActiveReaction } from '../../../global/types';\n\nimport buildClassName from '../../../util/buildClassName';\nimport { formatIntegerCompact } from '../../../util/textFormat';\n\nimport Button from '../../ui/Button';\nimport Avatar from '../../common/Avatar';\nimport ReactionAnimatedEmoji from './ReactionAnimatedEmoji';\n\nimport './Reactions.scss';\n\nconst MAX_REACTORS_AVATARS = 3;\n\nconst ReactionButton: FC<{\n reaction: ApiReactionCount;\n message: ApiMessage;\n activeReaction?: ActiveReaction;\n availableReactions?: ApiAvailableReaction[];\n}> = ({\n reaction,\n message,\n activeReaction,\n availableReactions,\n}) => {\n const { sendReaction } = getActions();\n\n const { recentReactions } = message.reactions!;\n\n const recentReactors = useMemo(() => {\n if (!recentReactions || reaction.count > MAX_REACTORS_AVATARS) {\n return undefined;\n }\n\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n return recentReactions\n .filter((recentReaction) => recentReaction.reaction === reaction.reaction)\n .map((recentReaction) => usersById[recentReaction.userId])\n .filter(Boolean) as ApiUser[];\n }, [reaction, recentReactions]);\n\n const handleClick = useCallback(() => {\n sendReaction({\n reaction: reaction.isChosen ? undefined : reaction.reaction,\n chatId: message.chatId,\n messageId: message.id,\n });\n }, [message, reaction, sendReaction]);\n\n return (\n <Button\n className={buildClassName(reaction.isChosen && 'chosen')}\n size=\"tiny\"\n onClick={handleClick}\n >\n <ReactionAnimatedEmoji\n activeReaction={activeReaction}\n reaction={reaction.reaction}\n availableReactions={availableReactions}\n />\n {recentReactors?.length ? (\n <div className=\"avatars\">\n {recentReactors.map((user) => <Avatar user={user} size=\"micro\" />)}\n </div>\n ) : formatIntegerCompact(reaction.count)}\n </Button>\n );\n};\n\nexport default memo(ReactionButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type { ApiAvailableReaction, ApiMessage } from '../../../api/types';\nimport type { ActiveReaction } from '../../../global/types';\n\nimport buildClassName from '../../../util/buildClassName';\n\nimport ReactionButton from './ReactionButton';\n\nimport './Reactions.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n isOutside?: boolean;\n activeReaction?: ActiveReaction;\n availableReactions?: ApiAvailableReaction[];\n metaChildren?: React.ReactNode;\n};\n\nconst Reactions: FC<OwnProps> = ({\n message,\n isOutside,\n activeReaction,\n availableReactions,\n metaChildren,\n}) => {\n return (\n <div className={buildClassName('Reactions', isOutside && 'is-outside')}>\n {message.reactions!.results.map((reaction) => (\n <ReactionButton\n key={reaction.reaction}\n reaction={reaction}\n message={message}\n activeReaction={activeReaction}\n availableReactions={availableReactions}\n />\n ))}\n {metaChildren}\n </div>\n );\n};\n\nexport default memo(Reactions);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useMemo } from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { ApiMessage, PhoneCallAction } from '../../../api/types';\n\nimport useLang from '../../../hooks/useLang';\nimport buildClassName from '../../../util/buildClassName';\nimport { formatTimeDuration, formatTime } from '../../../util/dateFormat';\nimport { ARE_CALLS_SUPPORTED } from '../../../util/environment';\n\nimport Button from '../../ui/Button';\n\nimport styles from './MessagePhoneCall.module.scss';\n\ntype OwnProps = {\n phoneCall: PhoneCallAction;\n message: ApiMessage;\n chatId: string;\n};\n\nconst MessagePhoneCall: FC<OwnProps> = ({\n phoneCall,\n message,\n chatId,\n}) => {\n const { requestCall } = getActions();\n\n const lang = useLang();\n const { isOutgoing, isVideo, reason } = phoneCall;\n const isMissed = reason === 'missed';\n const isCancelled = reason === 'busy' && !isOutgoing;\n\n const handleCall = useCallback(() => {\n requestCall({ isVideo, userId: chatId });\n }, [chatId, isVideo, requestCall]);\n\n const reasonText = useMemo(() => {\n if (isVideo) {\n if (isCancelled) return 'CallMessageVideoIncomingDeclined';\n if (isMissed) return isOutgoing ? 'CallMessageVideoOutgoingMissed' : 'CallMessageVideoIncomingMissed';\n\n return isOutgoing ? 'CallMessageVideoOutgoing' : 'CallMessageVideoIncoming';\n } else {\n if (isCancelled) return 'CallMessageIncomingDeclined';\n if (isMissed) return isOutgoing ? 'CallMessageOutgoingMissed' : 'CallMessageIncomingMissed';\n\n return isOutgoing ? 'CallMessageOutgoing' : 'CallMessageIncoming';\n }\n }, [isCancelled, isMissed, isOutgoing, isVideo]);\n\n const duration = useMemo(() => {\n return phoneCall.duration ? formatTimeDuration(lang, phoneCall.duration) : undefined;\n }, [lang, phoneCall.duration]);\n\n const timeFormatted = formatTime(lang, message.date * 1000);\n return (\n <div className={styles.root}>\n <Button\n size=\"smaller\"\n color=\"translucent\"\n round\n ripple\n onClick={handleCall}\n className={styles.button}\n disabled={!ARE_CALLS_SUPPORTED}\n ariaLabel={lang(isOutgoing ? 'CallAgain' : 'CallBack')}\n >\n <i className={isVideo ? 'icon-video-outlined' : 'icon-phone'} />\n </Button>\n <div className={styles.info}>\n <div className={styles.reason}>{lang(reasonText)}</div>\n <div className={styles.meta}>\n <i\n className={buildClassName(\n 'icon-arrow-right', styles.arrow, isMissed && styles.missed, !isOutgoing && styles.incoming,\n )}\n />\n <span className={styles.duration}>\n {duration ? lang('CallMessageWithDuration', [timeFormatted, duration]) : timeFormatted}\n </span>\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(MessagePhoneCall);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"vDeypQzM845_JE14qGId\",\"button\":\"OtJi45yywgt1n_y6VPkE\",\"info\":\"_0BG8sziTJQ_NYrsspMg\",\"reason\":\"LWVSvxVjeEyHPBrCb2sD\",\"arrow\":\"wrUkWet7enyh9L1iPKvA\",\"incoming\":\"e0Vhbj8gfzQn1zJQoFLK\",\"missed\":\"V5tKkKZpcY5yq_f5nO8l\",\"meta\":\"nuIsoCP15iD4ETadJ44R\",\"duration\":\"TJ2lYkLxYUie3A0JqtMR\"};","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ActiveEmojiInteraction, ActiveReaction, MessageListType } from '../../../global/types';\nimport type {\n ApiMessage,\n ApiMessageOutgoingStatus,\n ApiUser,\n ApiChat,\n ApiThreadInfo,\n ApiAvailableReaction,\n} from '../../../api/types';\nimport type {\n AnimationLevel, FocusDirection, IAlbum, ISettings,\n} from '../../../types';\nimport {\n AudioOrigin,\n} from '../../../types';\n\nimport { IS_ANDROID, IS_TOUCH_ENV } from '../../../util/environment';\nimport {\n selectChat,\n selectChatMessage,\n selectUploadProgress,\n selectIsChatWithSelf,\n selectOutgoingStatus,\n selectUser,\n selectIsMessageFocused,\n selectCurrentTextSearch,\n selectIsInSelectMode,\n selectIsMessageSelected,\n selectIsDocumentGroupSelected,\n selectSender,\n selectForwardedSender,\n selectThreadTopMessageId,\n selectCanAutoLoadMedia,\n selectCanAutoPlayMedia,\n selectShouldLoopStickers,\n selectTheme,\n selectAllowedMessageActions,\n selectIsDownloading,\n selectThreadInfo,\n selectMessageIdsByGroupId,\n selectIsMessageProtected,\n selectDefaultReaction,\n selectReplySender,\n selectAnimatedEmoji,\n selectLocalAnimatedEmoji,\n selectIsCurrentUserPremium,\n} from '../../../global/selectors';\nimport {\n getMessageContent,\n isOwnMessage,\n isReplyMessage,\n isAnonymousOwnMessage,\n isMessageLocal,\n isUserId,\n isChatWithRepliesBot,\n getMessageCustomShape,\n isChatChannel,\n getMessageSingleEmoji,\n getSenderTitle,\n getUserColorKey,\n areReactionsEmpty,\n getMessageHtmlId,\n isGeoLiveExpired,\n} from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\nimport useEnsureMessage from '../../../hooks/useEnsureMessage';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\nimport { renderMessageText } from '../../common/helpers/renderMessageText';\nimport { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions';\nimport { buildContentClassName, isEmojiOnlyMessage } from './helpers/buildContentClassName';\nimport { getMinMediaWidth, calculateMediaDimensions } from './helpers/mediaDimensions';\nimport { calculateAlbumLayout } from './helpers/calculateAlbumLayout';\nimport renderText from '../../common/helpers/renderText';\nimport calculateAuthorWidth from './helpers/calculateAuthorWidth';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport { useOnIntersect } from '../../../hooks/useIntersectionObserver';\nimport useLang from '../../../hooks/useLang';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useFlag from '../../../hooks/useFlag';\nimport useFocusMessage from './hooks/useFocusMessage';\nimport useOuterHandlers from './hooks/useOuterHandlers';\nimport useInnerHandlers from './hooks/useInnerHandlers';\nimport { getServerTime } from '../../../util/serverTime';\nimport { isElementInViewport } from '../../../util/isElementInViewport';\n\nimport Button from '../../ui/Button';\nimport Avatar from '../../common/Avatar';\nimport EmbeddedMessage from '../../common/EmbeddedMessage';\nimport Document from '../../common/Document';\nimport Audio from '../../common/Audio';\nimport MessageMeta from './MessageMeta';\nimport ContextMenuContainer from './ContextMenuContainer.async';\nimport Sticker from './Sticker';\nimport AnimatedEmoji from './AnimatedEmoji';\nimport Photo from './Photo';\nimport Video from './Video';\nimport Contact from './Contact';\nimport Poll from './Poll';\nimport WebPage from './WebPage';\nimport Invoice from './Invoice';\nimport Location from './Location';\nimport Game from './Game';\nimport Album from './Album';\nimport RoundVideo from './RoundVideo';\nimport InlineButtons from './InlineButtons';\nimport CommentButton from './CommentButton';\nimport Reactions from './Reactions';\nimport ReactionStaticEmoji from '../../common/ReactionStaticEmoji';\nimport MessagePhoneCall from './MessagePhoneCall';\nimport PremiumIcon from '../../common/PremiumIcon';\nimport DotAnimation from '../../common/DotAnimation';\n\nimport './Message.scss';\n\ntype MessagePositionProperties = {\n isFirstInGroup: boolean;\n isLastInGroup: boolean;\n isFirstInDocumentGroup: boolean;\n isLastInDocumentGroup: boolean;\n isLastInList: boolean;\n};\n\ntype OwnProps =\n {\n message: ApiMessage;\n observeIntersectionForBottom: ObserveFn;\n observeIntersectionForMedia: ObserveFn;\n observeIntersectionForAnimatedStickers: ObserveFn;\n album?: IAlbum;\n noAvatars?: boolean;\n withAvatar?: boolean;\n withSenderName?: boolean;\n areReactionsInMeta?: boolean;\n threadId: number;\n messageListType: MessageListType;\n noComments: boolean;\n appearanceOrder: number;\n memoFirstUnreadIdRef: { current: number | undefined };\n }\n & MessagePositionProperties;\n\ntype StateProps = {\n theme: ISettings['theme'];\n forceSenderName?: boolean;\n chatUsername?: string;\n sender?: ApiUser | ApiChat;\n canShowSender: boolean;\n originSender?: ApiUser | ApiChat;\n botSender?: ApiUser;\n isThreadTop?: boolean;\n shouldHideReply?: boolean;\n replyMessage?: ApiMessage;\n replyMessageSender?: ApiUser | ApiChat;\n outgoingStatus?: ApiMessageOutgoingStatus;\n uploadProgress?: number;\n isInDocumentGroup: boolean;\n isProtected?: boolean;\n isFocused?: boolean;\n focusDirection?: FocusDirection;\n noFocusHighlight?: boolean;\n isResizingContainer?: boolean;\n isForwarding?: boolean;\n isChatWithSelf?: boolean;\n isRepliesChat?: boolean;\n isChannel?: boolean;\n canReply?: boolean;\n lastSyncTime?: number;\n serverTimeOffset: number;\n highlight?: string;\n animatedEmoji?: string;\n isInSelectMode?: boolean;\n isSelected?: boolean;\n isGroupSelected?: boolean;\n isDownloading: boolean;\n threadId?: number;\n isPinnedList?: boolean;\n canAutoLoadMedia?: boolean;\n canAutoPlayMedia?: boolean;\n shouldLoopStickers?: boolean;\n autoLoadFileMaxSizeMb: number;\n threadInfo?: ApiThreadInfo;\n reactionMessage?: ApiMessage;\n availableReactions?: ApiAvailableReaction[];\n defaultReaction?: string;\n activeReaction?: ActiveReaction;\n activeEmojiInteractions?: ActiveEmojiInteraction[];\n hasUnreadReaction?: boolean;\n isTranscribing?: boolean;\n transcribedText?: string;\n isTranscriptionError?: boolean;\n isPremium: boolean;\n animationLevel: AnimationLevel;\n};\n\ntype MetaPosition =\n 'in-text'\n | 'standalone'\n | 'none';\ntype ReactionsPosition =\n 'inside'\n | 'outside'\n | 'in-meta'\n | 'none';\n\nconst NBSP = '\\u00A0';\n// eslint-disable-next-line max-len\nconst APPENDIX_OWN = { __html: '<svg width=\"9\" height=\"20\" xmlns=\"http://www.w3.org/2000/svg\"><defs><filter x=\"-50%\" y=\"-14.7%\" width=\"200%\" height=\"141.2%\" filterUnits=\"objectBoundingBox\" id=\"a\"><feOffset dy=\"1\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"/><feGaussianBlur stdDeviation=\"1\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"/><feColorMatrix values=\"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0\" in=\"shadowBlurOuter1\"/></filter></defs><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z\" fill=\"#000\" filter=\"url(#a)\"/><path d=\"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z\" fill=\"#EEFFDE\" class=\"corner\"/></g></svg>' };\n// eslint-disable-next-line max-len\nconst APPENDIX_NOT_OWN = { __html: '<svg width=\"9\" height=\"20\" xmlns=\"http://www.w3.org/2000/svg\"><defs><filter x=\"-50%\" y=\"-14.7%\" width=\"200%\" height=\"141.2%\" filterUnits=\"objectBoundingBox\" id=\"a\"><feOffset dy=\"1\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"/><feGaussianBlur stdDeviation=\"1\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"/><feColorMatrix values=\"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0\" in=\"shadowBlurOuter1\"/></filter></defs><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z\" fill=\"#000\" filter=\"url(#a)\"/><path d=\"M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z\" fill=\"#FFF\" class=\"corner\"/></g></svg>' };\nconst APPEARANCE_DELAY = 10;\nconst NO_MEDIA_CORNERS_THRESHOLD = 18;\n\nconst Message: FC<OwnProps & StateProps> = ({\n message,\n chatUsername,\n observeIntersectionForBottom,\n observeIntersectionForMedia,\n observeIntersectionForAnimatedStickers,\n album,\n noAvatars,\n withAvatar,\n withSenderName,\n areReactionsInMeta,\n noComments,\n appearanceOrder,\n isFirstInGroup,\n isPremium,\n isLastInGroup,\n isFirstInDocumentGroup,\n isLastInDocumentGroup,\n isTranscribing,\n transcribedText,\n isLastInList,\n theme,\n forceSenderName,\n sender,\n canShowSender,\n originSender,\n botSender,\n isThreadTop,\n shouldHideReply,\n replyMessage,\n replyMessageSender,\n outgoingStatus,\n uploadProgress,\n isInDocumentGroup,\n isProtected,\n isFocused,\n focusDirection,\n noFocusHighlight,\n isResizingContainer,\n isForwarding,\n isChatWithSelf,\n isRepliesChat,\n isChannel,\n canReply,\n lastSyncTime,\n serverTimeOffset,\n highlight,\n animatedEmoji,\n isInSelectMode,\n isSelected,\n isGroupSelected,\n threadId,\n reactionMessage,\n availableReactions,\n defaultReaction,\n activeReaction,\n activeEmojiInteractions,\n messageListType,\n isPinnedList,\n isDownloading,\n canAutoLoadMedia,\n canAutoPlayMedia,\n shouldLoopStickers,\n autoLoadFileMaxSizeMb,\n threadInfo,\n hasUnreadReaction,\n memoFirstUnreadIdRef,\n animationLevel,\n}) => {\n const {\n toggleMessageSelection,\n clickBotInlineButton,\n disableContextMenuHint,\n animateUnreadReaction,\n focusLastMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const bottomMarkerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const contentRef = useRef<HTMLDivElement>(null);\n\n const lang = useLang();\n\n const [isTranscriptionHidden, setTranscriptionHidden] = useState(false);\n const [hasActiveStickerEffect, startStickerEffect, stopStickerEffect] = useFlag();\n\n useOnIntersect(bottomMarkerRef, observeIntersectionForBottom);\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu: onContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref, IS_TOUCH_ENV && isInSelectMode, true, IS_ANDROID);\n\n useEffect(() => {\n if (isContextMenuOpen) {\n disableContextMenuHint();\n }\n }, [isContextMenuOpen, disableContextMenuHint]);\n\n const noAppearanceAnimation = appearanceOrder <= 0;\n const [isShown, markShown] = useFlag(noAppearanceAnimation);\n useEffect(() => {\n if (noAppearanceAnimation) {\n return;\n }\n\n setTimeout(markShown, appearanceOrder * APPEARANCE_DELAY);\n }, [appearanceOrder, markShown, noAppearanceAnimation]);\n const { transitionClassNames } = useShowTransition(isShown, undefined, noAppearanceAnimation, false);\n\n const {\n id: messageId, chatId, forwardInfo, viaBotId, isTranscriptionError,\n } = message;\n\n const isLocal = isMessageLocal(message);\n const isOwn = isOwnMessage(message);\n const isScheduled = messageListType === 'scheduled' || message.isScheduled;\n const hasReply = isReplyMessage(message) && !shouldHideReply;\n const hasThread = Boolean(threadInfo) && messageListType === 'thread';\n const customShape = getMessageCustomShape(message);\n const hasAnimatedEmoji = animatedEmoji;\n const hasReactions = reactionMessage?.reactions && !areReactionsEmpty(reactionMessage.reactions);\n const asForwarded = (\n forwardInfo\n && (!isChatWithSelf || isScheduled)\n && !isRepliesChat\n && !forwardInfo.isLinkedChannelPost\n && !customShape\n );\n const isAlbum = Boolean(album) && album!.messages.length > 1\n && !album?.messages.some((msg) => Object.keys(msg.content).length === 0);\n const isInDocumentGroupNotFirst = isInDocumentGroup && !isFirstInDocumentGroup;\n const isInDocumentGroupNotLast = isInDocumentGroup && !isLastInDocumentGroup;\n const isContextMenuShown = contextMenuPosition !== undefined;\n const canShowActionButton = (\n !(isContextMenuShown || isInSelectMode || isForwarding)\n && !isInDocumentGroupNotLast\n );\n const canForward = isChannel && !isScheduled && !isProtected;\n const canFocus = Boolean(isPinnedList\n || (forwardInfo\n && (forwardInfo.isChannelPost || (isChatWithSelf && !isOwn) || isRepliesChat)\n && forwardInfo.fromMessageId\n ));\n\n const selectMessage = useCallback((e?: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => {\n toggleMessageSelection({\n messageId,\n groupedId,\n ...(e?.shiftKey && { withShift: true }),\n ...(isAlbum && { childMessageIds: album!.messages.map(({ id }) => id) }),\n });\n }, [toggleMessageSelection, messageId, isAlbum, album]);\n\n const messageSender = canShowSender ? sender : undefined;\n const withVoiceTranscription = Boolean(!isTranscriptionHidden && (isTranscriptionError || transcribedText));\n\n const avatarPeer = forwardInfo && (isChatWithSelf || isRepliesChat || !messageSender) ? originSender : messageSender;\n const senderPeer = forwardInfo ? originSender : messageSender;\n\n const {\n handleMouseDown,\n handleClick,\n handleContextMenu,\n handleDoubleClick,\n handleContentDoubleClick,\n handleMouseMove,\n handleSendQuickReaction,\n handleMouseLeave,\n isSwiped,\n isQuickReactionVisible,\n handleDocumentGroupMouseEnter,\n } = useOuterHandlers(\n selectMessage,\n ref,\n messageId,\n isAlbum,\n Boolean(isInSelectMode),\n Boolean(canReply),\n Boolean(isProtected),\n onContextMenu,\n handleBeforeContextMenu,\n chatId,\n isContextMenuShown,\n contentRef,\n isOwn,\n isInDocumentGroupNotLast,\n );\n\n const {\n handleAvatarClick,\n handleSenderClick,\n handleViaBotClick,\n handleReplyClick,\n handleMediaClick,\n handleAudioPlay,\n handleAlbumMediaClick,\n handleMetaClick,\n handleReadMedia,\n handleCancelUpload,\n handleVoteSend,\n handleGroupForward,\n handleForward,\n handleFocus,\n handleFocusForwarded,\n handleDocumentGroupSelectAll,\n } = useInnerHandlers(\n lang,\n selectMessage,\n message,\n chatId,\n threadId,\n isInDocumentGroup,\n asForwarded,\n isScheduled,\n isRepliesChat,\n album,\n avatarPeer,\n senderPeer,\n botSender,\n );\n\n useEffect(() => {\n if (!isLastInList) {\n return;\n }\n\n if (withVoiceTranscription && transcribedText) {\n focusLastMessage();\n }\n }, [focusLastMessage, isLastInList, transcribedText, withVoiceTranscription]);\n\n const containerClassName = buildClassName(\n 'Message message-list-item',\n isFirstInGroup && 'first-in-group',\n isProtected && 'is-protected',\n isLastInGroup && 'last-in-group',\n isFirstInDocumentGroup && 'first-in-document-group',\n isLastInDocumentGroup && 'last-in-document-group',\n isLastInList && 'last-in-list',\n isOwn && 'own',\n Boolean(message.views) && 'has-views',\n message.isEdited && 'was-edited',\n hasReply && 'has-reply',\n isContextMenuShown && 'has-menu-open',\n isFocused && !noFocusHighlight && 'focused',\n isForwarding && 'is-forwarding',\n message.isDeleting && 'is-deleting',\n isInDocumentGroup && 'is-in-document-group',\n isAlbum && 'is-album',\n message.hasUnreadMention && 'has-unread-mention',\n isSelected && 'is-selected',\n isInSelectMode && 'is-in-selection-mode',\n isThreadTop && 'is-thread-top',\n Boolean(message.inlineButtons) && 'has-inline-buttons',\n isSwiped && 'is-swiped',\n transitionClassNames,\n (Boolean(activeReaction) || hasActiveStickerEffect) && 'has-active-reaction',\n );\n\n const {\n text, photo, video, audio, voice, document, sticker, contact, poll, webPage, invoice, location, action, game,\n } = getMessageContent(message);\n\n const { phoneCall } = action || {};\n\n const withCommentButton = threadInfo && !isInDocumentGroupNotLast && messageListType === 'thread' && !noComments;\n const withQuickReactionButton = !IS_TOUCH_ENV && !phoneCall && !isInSelectMode && defaultReaction\n && !isInDocumentGroupNotLast;\n\n const contentClassName = buildContentClassName(message, {\n hasReply,\n customShape,\n isLastInGroup,\n asForwarded,\n hasThread,\n forceSenderName,\n hasComments: threadInfo && threadInfo?.messagesCount > 0,\n hasActionButton: canForward || canFocus,\n hasReactions,\n isGeoLiveActive: location?.type === 'geoLive' && !isGeoLiveExpired(message, getServerTime(serverTimeOffset)),\n withVoiceTranscription,\n });\n\n const withAppendix = contentClassName.includes('has-appendix');\n const textParts = renderMessageText(\n message,\n highlight,\n isEmojiOnlyMessage(customShape),\n undefined,\n undefined,\n isProtected,\n observeIntersectionForAnimatedStickers,\n );\n\n let metaPosition!: MetaPosition;\n if (phoneCall) {\n metaPosition = 'none';\n } else if (isInDocumentGroupNotLast) {\n metaPosition = 'none';\n } else if (textParts && !hasAnimatedEmoji && !webPage) {\n metaPosition = 'in-text';\n } else {\n metaPosition = 'standalone';\n }\n\n let reactionsPosition!: ReactionsPosition;\n if (areReactionsInMeta) {\n reactionsPosition = 'in-meta';\n } else if (hasReactions) {\n if (customShape || ((photo || video || hasAnimatedEmoji) && !textParts)) {\n reactionsPosition = 'outside';\n } else if (asForwarded) {\n metaPosition = 'standalone';\n reactionsPosition = 'inside';\n } else {\n reactionsPosition = 'inside';\n }\n } else {\n reactionsPosition = 'none';\n }\n\n useEnsureMessage(\n isRepliesChat && message.replyToChatId ? message.replyToChatId : chatId,\n hasReply ? message.replyToMessageId : undefined,\n replyMessage,\n message.id,\n );\n useFocusMessage(ref, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer);\n\n useEffect(() => {\n const bottomMarker = bottomMarkerRef.current;\n if (hasUnreadReaction && bottomMarker && isElementInViewport(bottomMarker)) {\n animateUnreadReaction({ messageIds: [messageId] });\n }\n }, [hasUnreadReaction, messageId, animateUnreadReaction]);\n\n let style = '';\n let calculatedWidth;\n let noMediaCorners = false;\n const albumLayout = useMemo(() => {\n return isAlbum ? calculateAlbumLayout(isOwn, Boolean(asForwarded), Boolean(noAvatars), album!) : undefined;\n }, [isAlbum, isOwn, asForwarded, noAvatars, album]);\n\n const extraPadding = asForwarded ? 28 : 0;\n if (!isAlbum && (photo || video)) {\n let width: number | undefined;\n if (photo) {\n width = calculateMediaDimensions(message, noAvatars).width;\n } else if (video) {\n if (video.isRound) {\n width = ROUND_VIDEO_DIMENSIONS_PX;\n } else {\n width = calculateMediaDimensions(message, noAvatars).width;\n }\n }\n\n if (width) {\n calculatedWidth = Math.max(getMinMediaWidth(Boolean(text), withCommentButton), width);\n if (calculatedWidth - width > NO_MEDIA_CORNERS_THRESHOLD) {\n noMediaCorners = true;\n }\n }\n } else if (albumLayout) {\n calculatedWidth = Math.max(getMinMediaWidth(Boolean(text), withCommentButton), albumLayout.containerStyle.width);\n if (calculatedWidth - albumLayout.containerStyle.width > NO_MEDIA_CORNERS_THRESHOLD) {\n noMediaCorners = true;\n }\n }\n\n if (calculatedWidth) {\n style = `width: ${calculatedWidth + extraPadding}px`;\n }\n\n const signature = (isChannel && message.adminTitle) || (!asForwarded && forwardInfo?.adminTitle) || undefined;\n const metaSafeAuthorWidth = useMemo(() => {\n return signature ? calculateAuthorWidth(signature) : undefined;\n }, [signature]);\n\n function renderAvatar() {\n const isAvatarPeerUser = avatarPeer && isUserId(avatarPeer.id);\n const avatarUser = (avatarPeer && isAvatarPeerUser) ? avatarPeer as ApiUser : undefined;\n const avatarChat = (avatarPeer && !isAvatarPeerUser) ? avatarPeer as ApiChat : undefined;\n const hiddenName = (!avatarPeer && forwardInfo) ? forwardInfo.hiddenUserName : undefined;\n const isAvatarPremium = avatarUser?.isPremium;\n\n return (\n <>\n <Avatar\n size=\"small\"\n user={avatarUser}\n chat={avatarChat}\n text={hiddenName}\n lastSyncTime={lastSyncTime}\n onClick={(avatarUser || avatarChat) ? handleAvatarClick : undefined}\n observeIntersection={observeIntersectionForMedia}\n animationLevel={animationLevel}\n withVideo\n />\n {isAvatarPremium && <PremiumIcon className=\"chat-avatar-premium\" />}\n </>\n );\n }\n\n function renderReactionsAndMeta() {\n const meta = (\n <MessageMeta\n message={message}\n reactionMessage={reactionMessage}\n outgoingStatus={outgoingStatus}\n signature={signature}\n withReactions={reactionsPosition === 'in-meta'}\n withReactionOffset={reactionsPosition === 'inside'}\n availableReactions={availableReactions}\n activeReaction={activeReaction}\n onClick={handleMetaClick}\n />\n );\n\n if (reactionsPosition !== 'inside') {\n return meta;\n }\n\n return (\n <Reactions\n activeReaction={activeReaction}\n message={reactionMessage!}\n metaChildren={meta}\n availableReactions={availableReactions}\n />\n );\n }\n\n function renderContent() {\n const className = buildClassName(\n 'content-inner',\n asForwarded && 'forwarded-message',\n hasReply && 'reply-message',\n noMediaCorners && 'no-media-corners',\n );\n const hasCustomAppendix = isLastInGroup && !textParts && !asForwarded && !hasThread;\n const textContentClass = buildClassName(\n 'text-content',\n metaPosition === 'in-text' && 'with-meta',\n outgoingStatus && 'with-outgoing-icon',\n );\n\n return (\n <div className={className} onDoubleClick={handleContentDoubleClick} dir=\"auto\">\n {renderSenderName()}\n {hasReply && (\n <EmbeddedMessage\n message={replyMessage}\n noUserColors={isOwn}\n isProtected={isProtected}\n sender={replyMessageSender}\n observeIntersection={observeIntersectionForMedia}\n onClick={handleReplyClick}\n />\n )}\n {sticker && (\n <Sticker\n message={message}\n observeIntersection={observeIntersectionForMedia}\n observeIntersectionForPlaying={observeIntersectionForAnimatedStickers}\n shouldLoop={shouldLoopStickers}\n lastSyncTime={lastSyncTime}\n shouldPlayEffect={(\n sticker.hasEffect && ((\n memoFirstUnreadIdRef.current && messageId >= memoFirstUnreadIdRef.current\n ) || isLocal)\n ) || undefined}\n onPlayEffect={startStickerEffect}\n onStopEffect={stopStickerEffect}\n />\n )}\n {animatedEmoji && (\n <AnimatedEmoji\n emoji={animatedEmoji}\n withEffects={isUserId(chatId)}\n isOwn={isOwn}\n observeIntersection={observeIntersectionForMedia}\n lastSyncTime={lastSyncTime}\n forceLoadPreview={isLocal}\n messageId={messageId}\n chatId={chatId}\n activeEmojiInteractions={activeEmojiInteractions}\n />\n )}\n {isAlbum && (\n <Album\n album={album!}\n albumLayout={albumLayout!}\n observeIntersection={observeIntersectionForMedia}\n isOwn={isOwn}\n isProtected={isProtected}\n hasCustomAppendix={hasCustomAppendix}\n lastSyncTime={lastSyncTime}\n onMediaClick={handleAlbumMediaClick}\n />\n )}\n {phoneCall && (\n <MessagePhoneCall\n message={message}\n phoneCall={phoneCall}\n chatId={chatId}\n />\n )}\n {!isAlbum && photo && (\n <Photo\n message={message}\n observeIntersection={observeIntersectionForMedia}\n noAvatars={noAvatars}\n canAutoLoad={canAutoLoadMedia}\n uploadProgress={uploadProgress}\n shouldAffectAppendix={hasCustomAppendix}\n onClick={handleMediaClick}\n onCancelUpload={handleCancelUpload}\n isDownloading={isDownloading}\n isProtected={isProtected}\n theme={theme}\n />\n )}\n {!isAlbum && video && video.isRound && (\n <RoundVideo\n message={message}\n observeIntersection={observeIntersectionForMedia}\n canAutoLoad={canAutoLoadMedia}\n lastSyncTime={lastSyncTime}\n isDownloading={isDownloading}\n />\n )}\n {!isAlbum && video && !video.isRound && (\n <Video\n message={message}\n observeIntersection={observeIntersectionForMedia}\n noAvatars={noAvatars}\n canAutoLoad={canAutoLoadMedia}\n canAutoPlay={canAutoPlayMedia}\n uploadProgress={uploadProgress}\n lastSyncTime={lastSyncTime}\n onClick={handleMediaClick}\n onCancelUpload={handleCancelUpload}\n isDownloading={isDownloading}\n isProtected={isProtected}\n />\n )}\n {(audio || voice) && (\n <Audio\n theme={theme}\n message={message}\n origin={AudioOrigin.Inline}\n uploadProgress={uploadProgress}\n lastSyncTime={lastSyncTime}\n isSelectable={isInDocumentGroup}\n isSelected={isSelected}\n noAvatars={noAvatars}\n onPlay={handleAudioPlay}\n onReadMedia={voice && (!isOwn || isChatWithSelf) ? handleReadMedia : undefined}\n onCancelUpload={handleCancelUpload}\n isDownloading={isDownloading}\n isTranscribing={isTranscribing}\n isTranscriptionHidden={isTranscriptionHidden}\n isTranscribed={Boolean(transcribedText)}\n isTranscriptionError={isTranscriptionError}\n canDownload={!isProtected}\n onHideTranscription={setTranscriptionHidden}\n canTranscribe={isPremium}\n />\n )}\n {document && (\n <Document\n message={message}\n observeIntersection={observeIntersectionForMedia}\n canAutoLoad={canAutoLoadMedia}\n autoLoadFileMaxSizeMb={autoLoadFileMaxSizeMb}\n uploadProgress={uploadProgress}\n isSelectable={isInDocumentGroup}\n isSelected={isSelected}\n onMediaClick={handleMediaClick}\n onCancelUpload={handleCancelUpload}\n isDownloading={isDownloading}\n />\n )}\n {contact && (\n <Contact contact={contact} />\n )}\n {poll && (\n <Poll message={message} poll={poll} onSendVote={handleVoteSend} />\n )}\n {game && (\n <Game\n message={message}\n canAutoLoadMedia={canAutoLoadMedia}\n lastSyncTime={lastSyncTime}\n />\n )}\n\n {withVoiceTranscription && (\n <p\n className={buildClassName(\n 'transcription',\n !isTranscriptionHidden && isTranscriptionError && 'transcription-error',\n )}\n dir=\"auto\"\n >\n {(isTranscriptionError ? lang('NoWordsRecognized') : (\n isTranscribing && transcribedText ? <DotAnimation content={transcribedText} /> : transcribedText\n ))}\n </p>\n )}\n\n {!hasAnimatedEmoji && textParts && (\n <p className={textContentClass} dir=\"auto\">\n {textParts}\n {metaPosition === 'in-text' && renderReactionsAndMeta()}\n </p>\n )}\n\n {webPage && (\n <WebPage\n message={message}\n observeIntersection={observeIntersectionForMedia}\n noAvatars={noAvatars}\n canAutoLoad={canAutoLoadMedia}\n canAutoPlay={canAutoPlayMedia}\n lastSyncTime={lastSyncTime}\n onMediaClick={handleMediaClick}\n onCancelMediaTransfer={handleCancelUpload}\n isDownloading={isDownloading}\n isProtected={isProtected}\n theme={theme}\n />\n )}\n {invoice && (\n <Invoice\n message={message}\n shouldAffectAppendix={hasCustomAppendix}\n isInSelectMode={isInSelectMode}\n isSelected={isSelected}\n theme={theme}\n />\n )}\n {location && (\n <Location\n message={message}\n lastSyncTime={lastSyncTime}\n isInSelectMode={isInSelectMode}\n isSelected={isSelected}\n theme={theme}\n peer={sender}\n serverTimeOffset={serverTimeOffset}\n />\n )}\n </div>\n );\n }\n\n function renderSenderName() {\n const media = photo || video || location;\n const shouldRender = !(customShape && !viaBotId) && (\n (withSenderName && !media) || asForwarded || viaBotId || forceSenderName\n ) && !isInDocumentGroupNotFirst && !(hasReply && customShape);\n\n if (!shouldRender) {\n return undefined;\n }\n\n let senderTitle;\n let senderColor;\n if (senderPeer && !(customShape && viaBotId)) {\n senderTitle = getSenderTitle(lang, senderPeer);\n\n if (!asForwarded) {\n senderColor = `color-${getUserColorKey(senderPeer)}`;\n }\n } else if (forwardInfo?.hiddenUserName) {\n senderTitle = forwardInfo.hiddenUserName;\n }\n\n return (\n <div className=\"message-title\" dir=\"ltr\">\n {senderTitle ? (\n <span\n className={buildClassName('interactive', senderColor)}\n onClick={handleSenderClick}\n dir=\"auto\"\n >\n {renderText(senderTitle)}\n </span>\n ) : !botSender ? (\n NBSP\n ) : undefined}\n {botSender && (\n <>\n <span className=\"via\">{lang('ViaBot')}</span>\n <span\n className=\"interactive\"\n onClick={handleViaBotClick}\n >\n {renderText(`@${botSender.username}`)}\n </span>\n </>\n )}\n {forwardInfo?.isLinkedChannelPost ? (\n <span className=\"admin-title\" dir=\"auto\">{lang('DiscussChannel')}</span>\n ) : message.adminTitle && !isChannel ? (\n <span className=\"admin-title\" dir=\"auto\">{message.adminTitle}</span>\n ) : undefined}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n id={getMessageHtmlId(message.id)}\n className={containerClassName}\n style={metaSafeAuthorWidth ? `--meta-safe-author-width: ${metaSafeAuthorWidth}px` : undefined}\n data-message-id={messageId}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n onDoubleClick={handleDoubleClick}\n onMouseEnter={isInDocumentGroupNotLast ? handleDocumentGroupMouseEnter : undefined}\n onMouseMove={withQuickReactionButton ? handleMouseMove : undefined}\n onMouseLeave={(withQuickReactionButton || isInDocumentGroupNotLast) ? handleMouseLeave : undefined}\n >\n <div\n ref={bottomMarkerRef}\n className=\"bottom-marker\"\n data-message-id={messageId}\n data-last-message-id={album ? album.messages[album.messages.length - 1].id : undefined}\n data-has-unread-mention={message.hasUnreadMention || undefined}\n data-has-unread-reaction={hasUnreadReaction || undefined}\n />\n {!isInDocumentGroup && (\n <div className=\"message-select-control\">\n {isSelected && <i className=\"icon-select\" />}\n </div>\n )}\n {isLastInDocumentGroup && (\n <div\n className={buildClassName('message-select-control group-select', isGroupSelected && 'is-selected')}\n onClick={handleDocumentGroupSelectAll}\n >\n {isGroupSelected && (\n <i className=\"icon-select\" />\n )}\n </div>\n )}\n {withAvatar && renderAvatar()}\n <div\n className={buildClassName('message-content-wrapper', contentClassName.includes('text') && 'can-select-text')}\n >\n <div\n ref={contentRef}\n className={contentClassName}\n style={style}\n dir=\"auto\"\n >\n {asForwarded && !isInDocumentGroupNotFirst && (\n <div className=\"message-title\">{lang('ForwardedMessage')}</div>\n )}\n {renderContent()}\n {!isInDocumentGroupNotLast && metaPosition === 'standalone' && renderReactionsAndMeta()}\n {canShowActionButton && canForward ? (\n <Button\n className=\"message-action-button\"\n color=\"translucent-white\"\n round\n size=\"tiny\"\n ariaLabel={lang('lng_context_forward_msg')}\n onClick={isLastInDocumentGroup ? handleGroupForward : handleForward}\n >\n <i className=\"icon-share-filled\" />\n </Button>\n ) : canShowActionButton && canFocus ? (\n <Button\n className=\"message-action-button\"\n color=\"translucent-white\"\n round\n size=\"tiny\"\n ariaLabel=\"Focus message\"\n onClick={isPinnedList ? handleFocus : handleFocusForwarded}\n >\n <i className=\"icon-arrow-right\" />\n </Button>\n ) : undefined}\n {withCommentButton && <CommentButton threadInfo={threadInfo!} disabled={noComments} />}\n {withAppendix && (\n <div className=\"svg-appendix\" dangerouslySetInnerHTML={isOwn ? APPENDIX_OWN : APPENDIX_NOT_OWN} />\n )}\n {withQuickReactionButton && (\n <div\n className={buildClassName('quick-reaction', isQuickReactionVisible && !activeReaction && 'visible')}\n onClick={handleSendQuickReaction}\n >\n <ReactionStaticEmoji reaction={defaultReaction!} />\n </div>\n )}\n </div>\n {message.inlineButtons && (\n <InlineButtons message={message} onClick={clickBotInlineButton} />\n )}\n {reactionsPosition === 'outside' && (\n <Reactions\n message={reactionMessage!}\n isOutside\n activeReaction={activeReaction}\n availableReactions={availableReactions}\n />\n )}\n </div>\n {contextMenuPosition && (\n <ContextMenuContainer\n isOpen={isContextMenuOpen}\n anchor={contextMenuPosition}\n message={message}\n album={album}\n chatUsername={chatUsername}\n messageListType={messageListType}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, ownProps): StateProps => {\n const {\n focusedMessage, forwardMessages, lastSyncTime, serverTimeOffset,\n } = global;\n const {\n message, album, withSenderName, withAvatar, threadId, messageListType, isLastInDocumentGroup,\n } = ownProps;\n const {\n id, chatId, viaBotId, replyToChatId, replyToMessageId, isOutgoing, threadInfo, forwardInfo, transcriptionId,\n } = message;\n\n const chat = selectChat(global, chatId);\n const isChatWithSelf = selectIsChatWithSelf(global, chatId);\n const isRepliesChat = isChatWithRepliesBot(chatId);\n const isChannel = chat && isChatChannel(chat);\n const chatUsername = chat?.username;\n\n const forceSenderName = !isChatWithSelf && isAnonymousOwnMessage(message);\n const canShowSender = withSenderName || withAvatar || forceSenderName;\n const sender = selectSender(global, message);\n const originSender = selectForwardedSender(global, message);\n const botSender = viaBotId ? selectUser(global, viaBotId) : undefined;\n\n const threadTopMessageId = threadId ? selectThreadTopMessageId(global, chatId, threadId) : undefined;\n const isThreadTop = message.id === threadTopMessageId;\n\n const shouldHideReply = replyToMessageId === threadTopMessageId;\n const replyMessage = replyToMessageId && !shouldHideReply\n ? selectChatMessage(global, isRepliesChat && replyToChatId ? replyToChatId : chatId, replyToMessageId)\n : undefined;\n const replyMessageSender = replyMessage && selectReplySender(global, replyMessage, Boolean(forwardInfo));\n\n const uploadProgress = selectUploadProgress(global, message);\n const isFocused = messageListType === 'thread' && (\n album\n ? album.messages.some((m) => selectIsMessageFocused(global, m))\n : selectIsMessageFocused(global, message)\n );\n\n const {\n direction: focusDirection, noHighlight: noFocusHighlight, isResizingContainer,\n } = (isFocused && focusedMessage) || {};\n\n const isForwarding = forwardMessages.messageIds && forwardMessages.messageIds.includes(id);\n\n const { query: highlight } = selectCurrentTextSearch(global) || {};\n\n const singleEmoji = getMessageSingleEmoji(message);\n const animatedEmoji = singleEmoji && (\n selectAnimatedEmoji(global, singleEmoji) || selectLocalAnimatedEmoji(global, singleEmoji)\n ) ? singleEmoji : undefined;\n\n let isSelected: boolean;\n if (album?.messages) {\n isSelected = album.messages.every(({ id: messageId }) => selectIsMessageSelected(global, messageId));\n } else {\n isSelected = selectIsMessageSelected(global, id);\n }\n\n const { canReply } = (messageListType === 'thread' && selectAllowedMessageActions(global, message, threadId)) || {};\n const isDownloading = selectIsDownloading(global, message);\n const actualThreadInfo = threadInfo\n ? selectThreadInfo(global, threadInfo.chatId, threadInfo.threadId) || threadInfo\n : undefined;\n\n const isInDocumentGroup = Boolean(message.groupedId) && !message.isInAlbum;\n const documentGroupFirstMessageId = isInDocumentGroup\n ? selectMessageIdsByGroupId(global, chatId, message.groupedId!)![0]\n : undefined;\n const reactionMessage = isInDocumentGroup ? (\n isLastInDocumentGroup ? selectChatMessage(global, chatId, documentGroupFirstMessageId!) : undefined\n ) : message;\n\n const hasUnreadReaction = chat?.unreadReactions?.includes(message.id);\n\n return {\n theme: selectTheme(global),\n chatUsername,\n forceSenderName,\n sender,\n canShowSender,\n originSender,\n botSender,\n shouldHideReply,\n isThreadTop,\n replyMessage,\n replyMessageSender,\n isInDocumentGroup,\n isProtected: selectIsMessageProtected(global, message),\n isFocused,\n isForwarding,\n reactionMessage,\n isChatWithSelf,\n isRepliesChat,\n isChannel,\n canReply,\n lastSyncTime,\n serverTimeOffset,\n highlight,\n animatedEmoji,\n isInSelectMode: selectIsInSelectMode(global),\n isSelected,\n isGroupSelected: (\n Boolean(message.groupedId)\n && !message.isInAlbum\n && selectIsDocumentGroupSelected(global, chatId, message.groupedId)\n ),\n threadId,\n isDownloading,\n isPinnedList: messageListType === 'pinned',\n canAutoLoadMedia: selectCanAutoLoadMedia(global, message),\n canAutoPlayMedia: selectCanAutoPlayMedia(global, message),\n autoLoadFileMaxSizeMb: global.settings.byKey.autoLoadFileMaxSizeMb,\n shouldLoopStickers: selectShouldLoopStickers(global),\n threadInfo: actualThreadInfo,\n availableReactions: global.availableReactions,\n defaultReaction: isMessageLocal(message) ? undefined : selectDefaultReaction(global, chatId),\n activeReaction: reactionMessage && global.activeReactions[reactionMessage.id],\n activeEmojiInteractions: global.activeEmojiInteractions,\n ...(isOutgoing && { outgoingStatus: selectOutgoingStatus(global, message, messageListType === 'scheduled') }),\n ...(typeof uploadProgress === 'number' && { uploadProgress }),\n ...(isFocused && { focusDirection, noFocusHighlight, isResizingContainer }),\n hasUnreadReaction,\n isTranscribing: transcriptionId !== undefined && global.transcriptions[transcriptionId]?.isPending,\n transcribedText: transcriptionId !== undefined ? global.transcriptions[transcriptionId]?.text : undefined,\n isPremium: selectIsCurrentUserPremium(global),\n animationLevel: global.settings.byKey.animationLevel,\n };\n },\n)(Message));\n","import type React from '../../../../lib/teact/teact';\nimport { useCallback } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\n\nimport type { IAlbum } from '../../../../types';\nimport { MediaViewerOrigin } from '../../../../types';\nimport type { ApiChat, ApiMessage, ApiUser } from '../../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../../api/types';\nimport type { LangFn } from '../../../../hooks/useLang';\n\nexport default function useInnerHandlers(\n lang: LangFn,\n selectMessage: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => void,\n message: ApiMessage,\n chatId: string,\n threadId: number,\n isInDocumentGroup: boolean,\n asForwarded?: boolean,\n isScheduled?: boolean,\n isChatWithRepliesBot?: boolean,\n album?: IAlbum,\n avatarPeer?: ApiUser | ApiChat,\n senderPeer?: ApiUser | ApiChat,\n botSender?: ApiUser,\n) {\n const {\n openChat, showNotification, focusMessage, openMediaViewer, openAudioPlayer,\n markMessagesRead, cancelSendingMessage, sendPollVote, openForwardMenu, focusMessageInComments,\n } = getActions();\n\n const {\n id: messageId, forwardInfo, replyToMessageId, replyToChatId, replyToTopMessageId, groupedId,\n } = message;\n\n const handleAvatarClick = useCallback(() => {\n if (!avatarPeer) {\n return;\n }\n\n openChat({ id: avatarPeer.id });\n }, [avatarPeer, openChat]);\n\n const handleSenderClick = useCallback(() => {\n if (!senderPeer) {\n showNotification({ message: lang('HidAccount') });\n\n return;\n }\n\n if (asForwarded && forwardInfo?.channelPostId) {\n focusMessage({ chatId: senderPeer.id, messageId: forwardInfo.channelPostId });\n } else {\n openChat({ id: senderPeer.id });\n }\n }, [\n asForwarded, focusMessage, forwardInfo, lang, openChat, senderPeer, showNotification,\n ]);\n\n const handleViaBotClick = useCallback(() => {\n if (!botSender) {\n return;\n }\n\n openChat({ id: botSender.id });\n }, [botSender, openChat]);\n\n const handleReplyClick = useCallback((): void => {\n focusMessage({\n chatId: isChatWithRepliesBot && replyToChatId ? replyToChatId : chatId,\n threadId,\n messageId: replyToMessageId,\n replyMessageId: isChatWithRepliesBot && replyToChatId ? undefined : messageId,\n });\n }, [focusMessage, isChatWithRepliesBot, replyToChatId, chatId, threadId, replyToMessageId, messageId]);\n\n const handleMediaClick = useCallback((): void => {\n openMediaViewer({\n chatId,\n threadId,\n mediaId: messageId,\n origin: isScheduled ? MediaViewerOrigin.ScheduledInline : MediaViewerOrigin.Inline,\n });\n }, [chatId, threadId, messageId, openMediaViewer, isScheduled]);\n\n const handleAudioPlay = useCallback((): void => {\n openAudioPlayer({ chatId, messageId });\n }, [chatId, messageId, openAudioPlayer]);\n\n const handleAlbumMediaClick = useCallback((albumMessageId: number): void => {\n openMediaViewer({\n chatId,\n threadId,\n mediaId: albumMessageId,\n origin: isScheduled ? MediaViewerOrigin.ScheduledAlbum : MediaViewerOrigin.Album,\n });\n }, [chatId, threadId, openMediaViewer, isScheduled]);\n\n const handleReadMedia = useCallback((): void => {\n markMessagesRead({ messageIds: [messageId] });\n }, [messageId, markMessagesRead]);\n\n const handleCancelUpload = useCallback(() => {\n cancelSendingMessage({ chatId, messageId });\n }, [cancelSendingMessage, chatId, messageId]);\n\n const handleVoteSend = useCallback((options: string[]) => {\n sendPollVote({ chatId, messageId, options });\n }, [chatId, messageId, sendPollVote]);\n\n const handleGroupForward = useCallback(() => {\n openForwardMenu({ fromChatId: chatId, groupedId });\n }, [openForwardMenu, chatId, groupedId]);\n\n const handleForward = useCallback(() => {\n if (album && album.messages) {\n const messageIds = album.messages.map(({ id }) => id);\n openForwardMenu({ fromChatId: chatId, messageIds });\n } else {\n openForwardMenu({ fromChatId: chatId, messageIds: [messageId] });\n }\n }, [album, openForwardMenu, chatId, messageId]);\n\n const handleFocus = useCallback(() => {\n focusMessage({\n chatId, threadId: MAIN_THREAD_ID, messageId,\n });\n }, [focusMessage, chatId, messageId]);\n\n const handleFocusForwarded = useCallback(() => {\n if (isInDocumentGroup) {\n focusMessage({\n chatId: forwardInfo!.fromChatId, groupedId, groupedChatId: chatId,\n });\n return;\n }\n\n if (isChatWithRepliesBot && replyToChatId) {\n focusMessageInComments({\n chatId: replyToChatId,\n threadId: replyToTopMessageId,\n messageId: forwardInfo!.fromMessageId,\n });\n } else {\n focusMessage({\n chatId: forwardInfo!.fromChatId, messageId: forwardInfo!.fromMessageId,\n });\n }\n }, [\n isInDocumentGroup, isChatWithRepliesBot, replyToChatId, focusMessage, forwardInfo, groupedId, chatId,\n focusMessageInComments, replyToTopMessageId,\n ]);\n\n const selectWithGroupedId = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n e.stopPropagation();\n\n selectMessage(e, groupedId);\n }, [selectMessage, groupedId]);\n\n return {\n handleAvatarClick,\n handleSenderClick,\n handleViaBotClick,\n handleReplyClick,\n handleMediaClick,\n handleAudioPlay,\n handleAlbumMediaClick,\n handleMetaClick: selectWithGroupedId,\n handleReadMedia,\n handleCancelUpload,\n handleVoteSend,\n handleGroupForward,\n handleForward,\n handleFocus,\n handleFocusForwarded,\n handleDocumentGroupSelectAll: selectWithGroupedId,\n };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './AboutAdsModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst AboutAdsModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const AboutAdsModal = useModuleLoader(Bundles.Extra, 'AboutAdsModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return AboutAdsModal ? <AboutAdsModal {...props} /> : undefined;\n};\n\nexport default memo(AboutAdsModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './SponsoredMessageContextMenuContainer';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst SponsoredMessageContextMenuContainerAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const SponsoredMessageContextMenuContainer = useModuleLoader(\n Bundles.Extra, 'SponsoredMessageContextMenuContainer', !isOpen,\n );\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return SponsoredMessageContextMenuContainer ? <SponsoredMessageContextMenuContainer {...props} /> : undefined;\n};\n\nexport default memo(SponsoredMessageContextMenuContainerAsync);\n","import type { RefObject } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiChat, ApiSponsoredMessage, ApiUser } from '../../../api/types';\n\nimport { IS_ANDROID, IS_TOUCH_ENV } from '../../../util/environment';\nimport { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities';\nimport { selectChat, selectSponsoredMessage, selectUser } from '../../../global/selectors';\nimport { getChatTitle, getUserFullName } from '../../../global/helpers';\nimport renderText from '../../common/helpers/renderText';\nimport { preventMessageInputBlur } from '../helpers/preventMessageInputBlur';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\n\nimport Button from '../../ui/Button';\nimport AboutAdsModal from '../../common/AboutAdsModal.async';\nimport SponsoredMessageContextMenuContainer from './SponsoredMessageContextMenuContainer.async';\n\nimport './SponsoredMessage.scss';\n\ntype OwnProps = {\n chatId: string;\n containerRef: RefObject<HTMLDivElement>;\n};\n\ntype StateProps = {\n message?: ApiSponsoredMessage;\n bot?: ApiUser;\n channel?: ApiChat;\n};\n\nconst INTERSECTION_DEBOUNCE_MS = 200;\n\nconst SponsoredMessage: FC<OwnProps & StateProps> = ({\n chatId,\n message,\n containerRef,\n bot,\n channel,\n}) => {\n const {\n viewSponsoredMessage,\n openChat,\n openChatByInvite,\n startBot,\n focusMessage,\n } = getActions();\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const contentRef = useRef<HTMLDivElement>(null);\n const shouldObserve = Boolean(message);\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({\n rootRef: containerRef,\n debounceMs: INTERSECTION_DEBOUNCE_MS,\n threshold: 1,\n });\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref, IS_TOUCH_ENV, true, IS_ANDROID);\n const [isAboutAdsModalOpen, openAboutAdsModal, closeAboutAdsModal] = useFlag(false);\n\n useEffect(() => {\n return shouldObserve ? observeIntersection(contentRef.current!, (target) => {\n if (target.isIntersecting) {\n viewSponsoredMessage({ chatId });\n }\n }) : undefined;\n }, [chatId, shouldObserve, observeIntersection, viewSponsoredMessage]);\n\n const handleMouseDown = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n preventMessageInputBlur(e);\n handleBeforeContextMenu(e);\n };\n\n const handleClick = useCallback(() => {\n if (!message) return;\n if (message.chatInviteHash) {\n openChatByInvite({ hash: message.chatInviteHash });\n } else if (message.channelPostId) {\n focusMessage({ chatId: message.chatId, messageId: message.channelPostId });\n } else {\n openChat({ id: message.chatId });\n\n if (message.startParam) {\n startBot({\n botId: message.chatId!,\n param: message.startParam,\n });\n }\n }\n }, [focusMessage, message, openChat, openChatByInvite, startBot]);\n\n if (!message) {\n return undefined;\n }\n\n return (\n <div\n ref={ref}\n key=\"sponsored-message\"\n className=\"SponsoredMessage Message open\"\n onMouseDown={handleMouseDown}\n onContextMenu={handleContextMenu}\n >\n <div className=\"message-content has-shadow has-solid-background\" dir=\"auto\">\n <div className=\"content-inner\" dir=\"auto\">\n <div className=\"message-title\" dir=\"ltr\">\n {bot && renderText(getUserFullName(bot) || '')}\n {channel && renderText(message.chatInviteTitle || getChatTitle(lang, channel, bot) || '')}\n </div>\n\n <p className=\"text-content with-meta\" dir=\"auto\" ref={contentRef}>\n <span className=\"text-content-inner\" dir=\"auto\">\n {renderTextWithEntities(message.text.text, message.text.entities)}\n </span>\n\n <span className=\"MessageMeta\" dir=\"ltr\">\n <span className=\"message-signature\">\n {message.isRecommended ? lang('Message.RecommendedLabel') : lang('SponsoredMessage')}\n </span>\n </span>\n </p>\n\n <Button color=\"secondary\" size=\"tiny\" ripple onClick={handleClick} className=\"SponsoredMessage__button\">\n {lang(message.isBot\n ? 'Conversation.ViewBot'\n : (message.channelPostId ? 'Conversation.ViewPost' : 'Conversation.ViewChannel'))}\n </Button>\n </div>\n </div>\n {contextMenuPosition && (\n <SponsoredMessageContextMenuContainer\n isOpen={isContextMenuOpen}\n anchor={contextMenuPosition}\n message={message!}\n onAboutAds={openAboutAdsModal}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n />\n )}\n <AboutAdsModal\n isOpen={isAboutAdsModalOpen}\n onClose={closeAboutAdsModal}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const message = selectSponsoredMessage(global, chatId);\n const { chatId: fromChatId, isBot } = message || {};\n\n return {\n message,\n bot: fromChatId && isBot ? selectUser(global, fromChatId) : undefined,\n channel: !isBot && fromChatId ? selectChat(global, fromChatId) : undefined,\n };\n },\n)(SponsoredMessage));\n","import type { RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { MessageListType } from '../../global/types';\n\nimport { SCHEDULED_WHEN_ONLINE } from '../../config';\nimport buildClassName from '../../util/buildClassName';\nimport { compact } from '../../util/iteratees';\nimport { formatHumanDate } from '../../util/dateFormat';\nimport {\n getMessageHtmlId, getMessageOriginalId, isActionMessage, isOwnMessage, isServiceNotificationMessage,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport type { MessageDateGroup } from './helpers/groupMessages';\nimport { isAlbum } from './helpers/groupMessages';\nimport { preventMessageInputBlur } from './helpers/preventMessageInputBlur';\nimport useScrollHooks from './hooks/useScrollHooks';\nimport useMessageObservers from './hooks/useMessageObservers';\n\nimport Message from './message/Message';\nimport SponsoredMessage from './message/SponsoredMessage';\nimport ActionMessage from './ActionMessage';\nimport { getActions } from '../../global';\n\ninterface OwnProps {\n isCurrentUserPremium?: boolean;\n chatId: string;\n messageIds: number[];\n messageGroups: MessageDateGroup[];\n isViewportNewest: boolean;\n isUnread: boolean;\n withUsers: boolean;\n noAvatars: boolean;\n containerRef: RefObject<HTMLDivElement>;\n anchorIdRef: { current: string | undefined };\n memoUnreadDividerBeforeIdRef: { current: number | undefined };\n memoFirstUnreadIdRef: { current: number | undefined };\n threadId: number;\n type: MessageListType;\n isReady: boolean;\n areReactionsInMeta: boolean;\n isScrollingRef: { current: boolean | undefined };\n isScrollPatchNeededRef: { current: boolean | undefined };\n threadTopMessageId: number | undefined;\n hasLinkedChat: boolean | undefined;\n isSchedule: boolean;\n noAppearanceAnimation: boolean;\n onFabToggle: AnyToVoidFunction;\n onNotchToggle: AnyToVoidFunction;\n}\n\nconst UNREAD_DIVIDER_CLASS = 'unread-divider';\n\nconst MessageListContent: FC<OwnProps> = ({\n isCurrentUserPremium,\n chatId,\n messageIds,\n messageGroups,\n isViewportNewest,\n isUnread,\n withUsers,\n areReactionsInMeta,\n noAvatars,\n containerRef,\n anchorIdRef,\n memoUnreadDividerBeforeIdRef,\n memoFirstUnreadIdRef,\n threadId,\n type,\n isReady,\n isScrollingRef,\n isScrollPatchNeededRef,\n threadTopMessageId,\n hasLinkedChat,\n isSchedule,\n noAppearanceAnimation,\n onFabToggle,\n onNotchToggle,\n}) => {\n const { openHistoryCalendar } = getActions();\n\n const {\n observeIntersectionForMedia,\n observeIntersectionForReading,\n observeIntersectionForAnimatedStickers,\n } = useMessageObservers(type, containerRef, memoFirstUnreadIdRef);\n\n const {\n backwardsTriggerRef,\n forwardsTriggerRef,\n fabTriggerRef,\n } = useScrollHooks(\n type,\n containerRef,\n messageIds,\n isViewportNewest,\n isUnread,\n onFabToggle,\n onNotchToggle,\n isReady,\n isScrollingRef,\n isScrollPatchNeededRef,\n );\n\n const lang = useLang();\n\n const unreadDivider = (\n <div className={buildClassName(UNREAD_DIVIDER_CLASS, 'local-action-message')} key=\"unread-messages\">\n <span>{lang('UnreadMessages')}</span>\n </div>\n );\n\n const messageCountToAnimate = noAppearanceAnimation ? 0 : messageGroups.reduce((acc, messageGroup) => {\n return acc + messageGroup.senderGroups.flat().length;\n }, 0);\n let appearanceIndex = 0;\n\n const dateGroups = messageGroups.map((\n dateGroup: MessageDateGroup,\n dateGroupIndex: number,\n dateGroupsArray: MessageDateGroup[],\n ) => {\n const senderGroups = dateGroup.senderGroups.map((\n senderGroup,\n senderGroupIndex,\n senderGroupsArray,\n ) => {\n if (\n senderGroup.length === 1\n && !isAlbum(senderGroup[0])\n && isActionMessage(senderGroup[0])\n && !senderGroup[0].content.action?.phoneCall\n ) {\n const message = senderGroup[0]!;\n const isLastInList = (\n senderGroupIndex === senderGroupsArray.length - 1\n && dateGroupIndex === dateGroupsArray.length - 1\n );\n\n return compact([\n message.id === memoUnreadDividerBeforeIdRef.current && unreadDivider,\n <ActionMessage\n key={message.id}\n message={message}\n observeIntersection={observeIntersectionForReading}\n observeIntersectionForAnimation={observeIntersectionForAnimatedStickers}\n memoFirstUnreadIdRef={memoFirstUnreadIdRef}\n appearanceOrder={messageCountToAnimate - ++appearanceIndex}\n isLastInList={isLastInList}\n />,\n ]);\n }\n\n let currentDocumentGroupId: string | undefined;\n\n return senderGroup.map((\n messageOrAlbum,\n messageIndex,\n ) => {\n const message = isAlbum(messageOrAlbum) ? messageOrAlbum.mainMessage : messageOrAlbum;\n const album = isAlbum(messageOrAlbum) ? messageOrAlbum : undefined;\n const isOwn = isOwnMessage(message);\n const isMessageAlbum = isAlbum(messageOrAlbum);\n const nextMessage = senderGroup[messageIndex + 1];\n\n if (message.previousLocalId && anchorIdRef.current === getMessageHtmlId(message.previousLocalId)) {\n anchorIdRef.current = getMessageHtmlId(message.id);\n }\n\n const documentGroupId = !isMessageAlbum && message.groupedId ? message.groupedId : undefined;\n const nextDocumentGroupId = nextMessage && !isAlbum(nextMessage) ? nextMessage.groupedId : undefined;\n\n const position = {\n isFirstInGroup: messageIndex === 0,\n isLastInGroup: messageIndex === senderGroup.length - 1,\n isFirstInDocumentGroup: Boolean(documentGroupId && documentGroupId !== currentDocumentGroupId),\n isLastInDocumentGroup: Boolean(documentGroupId && documentGroupId !== nextDocumentGroupId),\n isLastInList: (\n messageIndex === senderGroup.length - 1\n && senderGroupIndex === senderGroupsArray.length - 1\n && dateGroupIndex === dateGroupsArray.length - 1\n ),\n };\n\n currentDocumentGroupId = documentGroupId;\n\n const originalId = getMessageOriginalId(message);\n // Service notifications saved in cache in previous versions may share the same `previousLocalId`\n const key = isServiceNotificationMessage(message) ? `${message.date}_${originalId}` : originalId;\n\n return compact([\n message.id === memoUnreadDividerBeforeIdRef.current && unreadDivider,\n <Message\n key={key}\n message={message}\n observeIntersectionForBottom={observeIntersectionForReading}\n observeIntersectionForMedia={observeIntersectionForMedia}\n observeIntersectionForAnimatedStickers={observeIntersectionForAnimatedStickers}\n album={album}\n noAvatars={noAvatars}\n withAvatar={position.isLastInGroup && withUsers && !isOwn && !(message.id === threadTopMessageId)}\n withSenderName={position.isFirstInGroup && withUsers && !isOwn}\n areReactionsInMeta={areReactionsInMeta}\n threadId={threadId}\n messageListType={type}\n noComments={hasLinkedChat === false}\n appearanceOrder={messageCountToAnimate - ++appearanceIndex}\n isFirstInGroup={position.isFirstInGroup}\n isLastInGroup={position.isLastInGroup}\n isFirstInDocumentGroup={position.isFirstInDocumentGroup}\n isLastInDocumentGroup={position.isLastInDocumentGroup}\n isLastInList={position.isLastInList}\n memoFirstUnreadIdRef={memoFirstUnreadIdRef}\n />,\n message.id === threadTopMessageId && (\n <div className=\"local-action-message\" key=\"discussion-started\">\n <span>{lang('DiscussionStarted')}</span>\n </div>\n ),\n ]);\n }).flat();\n });\n\n return (\n <div\n className=\"message-date-group\"\n key={dateGroup.datetime}\n onMouseDown={preventMessageInputBlur}\n teactFastList\n >\n <div\n className={buildClassName('sticky-date', !isSchedule && 'interactive')}\n key=\"date-header\"\n onMouseDown={preventMessageInputBlur}\n onClick={!isSchedule ? () => openHistoryCalendar({ selectedAt: dateGroup.datetime }) : undefined}\n >\n <span dir=\"auto\">\n {isSchedule && dateGroup.originalDate === SCHEDULED_WHEN_ONLINE && (\n lang('MessageScheduledUntilOnline')\n )}\n {isSchedule && dateGroup.originalDate !== SCHEDULED_WHEN_ONLINE && (\n lang('MessageScheduledOn', formatHumanDate(lang, dateGroup.datetime, undefined, true))\n )}\n {!isSchedule && formatHumanDate(lang, dateGroup.datetime)}\n </span>\n </div>\n {senderGroups.flat()}\n </div>\n );\n });\n\n return (\n <div className=\"messages-container\" teactFastList>\n <div ref={backwardsTriggerRef} key=\"backwards-trigger\" className=\"backwards-trigger\" />\n {dateGroups.flat()}\n {!isCurrentUserPremium && isViewportNewest && (\n <SponsoredMessage key={chatId} chatId={chatId} containerRef={containerRef} />\n )}\n <div\n ref={forwardsTriggerRef}\n key=\"forwards-trigger\"\n className=\"forwards-trigger\"\n />\n <div\n ref={fabTriggerRef}\n key=\"fab-trigger\"\n className=\"fab-trigger\"\n />\n </div>\n );\n};\n\nexport default memo(MessageListContent);\n","import type { RefObject } from 'react';\nimport { getActions } from '../../../global';\nimport { useMemo, useRef } from '../../../lib/teact/teact';\n\nimport { LoadMoreDirection } from '../../../types';\nimport type { MessageListType } from '../../../global/types';\n\nimport { LOCAL_MESSAGE_MIN_ID, MESSAGE_LIST_SLICE } from '../../../config';\nimport { IS_SCROLL_PATCH_NEEDED, MESSAGE_LIST_SENSITIVE_AREA } from '../../../util/environment';\nimport { debounce } from '../../../util/schedulers';\nimport { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver';\nimport useOnChange from '../../../hooks/useOnChange';\n\nconst FAB_THRESHOLD = 50;\nconst NOTCH_THRESHOLD = 1; // Notch has zero height so we at least need a 1px margin to intersect\nconst TOOLS_FREEZE_TIMEOUT = 250; // Approximate message sending animation duration\n\nexport default function useScrollHooks(\n type: MessageListType,\n containerRef: RefObject<HTMLDivElement>,\n messageIds: number[],\n isViewportNewest: boolean,\n isUnread: boolean,\n onFabToggle: AnyToVoidFunction,\n onNotchToggle: AnyToVoidFunction,\n isReady: boolean,\n isScrollingRef: { current: boolean | undefined },\n isScrollPatchNeededRef: { current: boolean | undefined },\n) {\n const { loadViewportMessages } = getActions();\n\n const [loadMoreBackwards, loadMoreForwards] = useMemo(\n () => (type === 'thread' ? [\n debounce(() => loadViewportMessages({ direction: LoadMoreDirection.Backwards }), 1000, true, false),\n debounce(() => loadViewportMessages({ direction: LoadMoreDirection.Forwards }), 1000, true, false),\n ] : []),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [loadViewportMessages, messageIds],\n );\n\n // eslint-disable-next-line no-null/no-null\n const backwardsTriggerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const forwardsTriggerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const fabTriggerRef = useRef<HTMLDivElement>(null);\n\n function toggleScrollTools() {\n if (!isReady) return;\n\n if (!messageIds || !messageIds.length) {\n onFabToggle(false);\n onNotchToggle(false);\n return;\n }\n\n if (!isViewportNewest) {\n onFabToggle(true);\n onNotchToggle(true);\n return;\n }\n\n if (!containerRef.current) {\n return;\n }\n\n const { offsetHeight, scrollHeight, scrollTop } = containerRef.current;\n const scrollBottom = Math.round(scrollHeight - scrollTop - offsetHeight);\n const isNearBottom = scrollBottom <= FAB_THRESHOLD;\n const isAtBottom = scrollBottom <= NOTCH_THRESHOLD;\n\n onFabToggle(isUnread ? !isAtBottom : !isNearBottom);\n onNotchToggle(!isAtBottom);\n }\n\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({\n rootRef: containerRef,\n margin: MESSAGE_LIST_SENSITIVE_AREA,\n }, (entries) => {\n if (!loadMoreForwards || !loadMoreBackwards) {\n return;\n }\n\n // Loading history while sending a message can return the same message and cause ambiguity\n const isFirstMessageLocal = messageIds[0] > LOCAL_MESSAGE_MIN_ID;\n if (isFirstMessageLocal) {\n return;\n }\n\n const triggerEntry = entries.find(({ isIntersecting }) => isIntersecting);\n if (!triggerEntry) {\n return;\n }\n\n const { target } = triggerEntry;\n\n if (target.className === 'backwards-trigger') {\n if (\n IS_SCROLL_PATCH_NEEDED && isScrollingRef.current && messageIds.length <= MESSAGE_LIST_SLICE\n ) {\n isScrollPatchNeededRef.current = true;\n }\n\n loadMoreBackwards();\n } else if (target.className === 'forwards-trigger') {\n loadMoreForwards();\n }\n });\n\n useOnIntersect(backwardsTriggerRef, observeIntersection);\n useOnIntersect(forwardsTriggerRef, observeIntersection);\n\n const {\n observe: observeIntersectionForFab,\n freeze: freezeForFab,\n unfreeze: unfreezeForFab,\n } = useIntersectionObserver({\n rootRef: containerRef,\n margin: FAB_THRESHOLD * 2,\n }, toggleScrollTools);\n\n useOnIntersect(fabTriggerRef, observeIntersectionForFab);\n\n const {\n observe: observeIntersectionForNotch,\n freeze: freezeForNotch,\n unfreeze: unfreezeForNotch,\n } = useIntersectionObserver({\n rootRef: containerRef,\n margin: NOTCH_THRESHOLD,\n }, toggleScrollTools);\n\n useOnIntersect(fabTriggerRef, observeIntersectionForNotch);\n\n useOnChange(() => {\n if (isReady) {\n toggleScrollTools();\n }\n }, [isReady]);\n\n // Workaround for FAB and notch flickering with tall incoming message\n useOnChange(() => {\n freezeForFab();\n freezeForNotch();\n\n setTimeout(() => {\n unfreezeForNotch();\n unfreezeForFab();\n }, TOOLS_FREEZE_TIMEOUT);\n }, [messageIds]);\n\n return { backwardsTriggerRef, forwardsTriggerRef, fabTriggerRef };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiSticker, ApiUpdateConnectionStateType } from '../../api/types';\n\nimport { selectChat } from '../../global/selectors';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport useLang from '../../hooks/useLang';\nimport { getUserIdDividend } from '../../global/helpers';\n\nimport StickerButton from '../common/StickerButton';\n\nimport './ContactGreeting.scss';\n\ntype OwnProps = {\n userId: string;\n};\n\ntype StateProps = {\n sticker?: ApiSticker;\n lastUnreadMessageId?: number;\n connectionState?: ApiUpdateConnectionStateType;\n};\n\nconst INTERSECTION_DEBOUNCE_MS = 200;\n\nconst ContactGreeting: FC<OwnProps & StateProps> = ({\n sticker,\n connectionState,\n lastUnreadMessageId,\n}) => {\n const {\n loadGreetingStickers,\n sendMessage,\n markMessageListRead,\n } = getActions();\n\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n const {\n observe: observeIntersection,\n } = useIntersectionObserver({\n rootRef: containerRef,\n debounceMs: INTERSECTION_DEBOUNCE_MS,\n });\n useEffect(() => {\n if (sticker || connectionState !== 'connectionStateReady') {\n return;\n }\n\n loadGreetingStickers();\n }, [connectionState, loadGreetingStickers, sticker]);\n\n useEffect(() => {\n if (connectionState === 'connectionStateReady' && lastUnreadMessageId) {\n markMessageListRead({ maxId: lastUnreadMessageId });\n }\n }, [connectionState, markMessageListRead, lastUnreadMessageId]);\n\n const handleStickerSelect = useCallback((selectedSticker: ApiSticker) => {\n selectedSticker = {\n ...selectedSticker,\n isPreloadedGlobally: true,\n };\n sendMessage({ sticker: selectedSticker });\n }, [sendMessage]);\n\n return (\n <div className=\"ContactGreeting\" ref={containerRef}>\n <div className=\"wrapper\">\n <p className=\"title\" dir=\"auto\">{lang('Conversation.EmptyPlaceholder')}</p>\n <p className=\"description\" dir=\"auto\">{lang('Conversation.GreetingText')}</p>\n\n <div className=\"sticker\">\n {sticker && (\n <StickerButton\n sticker={sticker}\n onClick={handleStickerSelect}\n clickArg={sticker}\n observeIntersection={observeIntersection}\n size={160}\n className=\"large\"\n noContextMenu\n isCurrentUserPremium\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { userId }): StateProps => {\n const { stickers } = global.stickers.greeting;\n const dividend = getUserIdDividend(userId) + getUserIdDividend(global.currentUserId!);\n const sticker = stickers?.length ? stickers[dividend % stickers.length] : undefined;\n const chat = selectChat(global, userId);\n if (!chat) {\n return {};\n }\n\n return {\n sticker,\n lastUnreadMessageId: chat.lastMessage && chat.lastMessage.id !== chat.lastReadInboxMessageId\n ? chat.lastMessage.id\n : undefined,\n connectionState: global.connectionState,\n };\n },\n)(ContactGreeting));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { MessageListType } from '../../global/types';\n\nimport type { LangFn } from '../../hooks/useLang';\nimport useLang from '../../hooks/useLang';\n\nimport './NoMessages.scss';\n\ntype OwnProps = {\n chatId: string;\n isChatWithSelf?: boolean;\n type: MessageListType;\n isGroupChatJustCreated?: boolean;\n};\n\nconst NoMessages: FC<OwnProps> = ({\n isChatWithSelf, type, isGroupChatJustCreated,\n}) => {\n const lang = useLang();\n\n if (type === 'scheduled') {\n return renderScheduled(lang);\n }\n\n if (isChatWithSelf) {\n return renderSavedMessages(lang);\n }\n\n if (isGroupChatJustCreated) {\n return renderGroup(lang);\n }\n\n return (\n <div className=\"empty\"><span>{lang('NoMessages')}</span></div>\n );\n};\n\nfunction renderScheduled(lang: LangFn) {\n return (\n <div className=\"empty\"><span>{lang('ScheduledMessages.EmptyPlaceholder')}</span></div>\n );\n}\n\nfunction renderSavedMessages(lang: LangFn) {\n return (\n <div className=\"NoMessages\">\n <div className=\"wrapper\">\n <i className=\"icon icon-cloud-download\" />\n <h3 className=\"title\">{lang('Conversation.CloudStorageInfo.Title')}</h3>\n <ul className=\"description\">\n <li>{lang('Conversation.ClousStorageInfo.Description1')}</li>\n <li>{lang('Conversation.ClousStorageInfo.Description2')}</li>\n <li>{lang('Conversation.ClousStorageInfo.Description3')}</li>\n <li>{lang('Conversation.ClousStorageInfo.Description4')}</li>\n </ul>\n </div>\n </div>\n );\n}\n\nfunction renderGroup(lang: LangFn) {\n return (\n <div className=\"NoMessages\">\n <div className=\"wrapper\" dir={lang.isRtl ? 'rtl' : undefined}>\n <h3 className=\"title\">{lang('EmptyGroupInfo.Title')}</h3>\n <p className=\"description\">{lang('EmptyGroupInfo.Subtitle')}</p>\n <ul className=\"list-checkmarks\">\n <li>{lang('EmptyGroupInfo.Line1')}</li>\n <li>{lang('EmptyGroupInfo.Line2')}</li>\n <li>{lang('EmptyGroupInfo.Line3')}</li>\n <li>{lang('EmptyGroupInfo.Line4')}</li>\n </ul>\n </div>\n </div>\n );\n}\n\nexport default memo(NoMessages);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useMemo, useRef, useState,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { ApiBotInfo, ApiMessage, ApiRestrictionReason } from '../../api/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\nimport type { MessageListType } from '../../global/types';\nimport type { AnimationLevel } from '../../types';\nimport { LoadMoreDirection } from '../../types';\n\nimport { ANIMATION_END_DELAY, LOCAL_MESSAGE_MIN_ID, MESSAGE_LIST_SLICE } from '../../config';\nimport {\n selectChatMessages,\n selectIsViewportNewest,\n selectFirstUnreadId,\n selectFocusedMessageId,\n selectChat,\n selectIsInSelectMode,\n selectIsChatWithSelf,\n selectChatBot,\n selectIsChatBotNotStarted,\n selectScrollOffset,\n selectThreadTopMessageId,\n selectFirstMessageId,\n selectScheduledMessages,\n selectCurrentMessageIds,\n selectIsCurrentUserPremium,\n} from '../../global/selectors';\nimport {\n isChatChannel,\n isUserId,\n isChatWithRepliesBot,\n isChatGroup,\n getBotCoverMediaHash,\n getDocumentMediaHash,\n getVideoDimensions,\n getPhotoFullDimensions,\n} from '../../global/helpers';\nimport { orderBy } from '../../util/iteratees';\nimport { DPR } from '../../util/environment';\nimport { fastRaf, debounce, onTickEnd } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport { groupMessages } from './helpers/groupMessages';\nimport { preventMessageInputBlur } from './helpers/preventMessageInputBlur';\nimport resetScroll, { patchChromiumScroll } from '../../util/resetScroll';\nimport fastSmoothScroll, { isAnimatingScroll } from '../../util/fastSmoothScroll';\nimport renderText from '../common/helpers/renderText';\n\nimport useOnChange from '../../hooks/useOnChange';\nimport useStickyDates from './hooks/useStickyDates';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\nimport useLang from '../../hooks/useLang';\nimport useWindowSize from '../../hooks/useWindowSize';\nimport useInterval from '../../hooks/useInterval';\nimport useNativeCopySelectedMessages from '../../hooks/useNativeCopySelectedMessages';\nimport useMedia from '../../hooks/useMedia';\nimport useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps';\nimport useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps';\n\nimport Loading from '../ui/Loading';\nimport MessageListContent from './MessageListContent';\nimport ContactGreeting from './ContactGreeting';\nimport NoMessages from './NoMessages';\nimport Skeleton from '../ui/Skeleton';\n\nimport './MessageList.scss';\n\ntype OwnProps = {\n chatId: string;\n threadId: number;\n type: MessageListType;\n canPost: boolean;\n isReady: boolean;\n onFabToggle: (shouldShow: boolean) => void;\n onNotchToggle: (shouldShow: boolean) => void;\n hasTools?: boolean;\n withBottomShift?: boolean;\n};\n\ntype StateProps = {\n isCurrentUserPremium?: boolean;\n isChatLoaded?: boolean;\n isChannelChat?: boolean;\n isGroupChat?: boolean;\n isChatWithSelf?: boolean;\n isRepliesChat?: boolean;\n isCreator?: boolean;\n isBot?: boolean;\n messageIds?: number[];\n messagesById?: Record<number, ApiMessage>;\n firstUnreadId?: number;\n isViewportNewest?: boolean;\n isRestricted?: boolean;\n restrictionReason?: ApiRestrictionReason;\n focusingId?: number;\n isSelectModeActive?: boolean;\n animationLevel?: AnimationLevel;\n lastMessage?: ApiMessage;\n isLoadingBotInfo?: boolean;\n botInfo?: ApiBotInfo;\n threadTopMessageId?: number;\n threadFirstMessageId?: number;\n hasLinkedChat?: boolean;\n lastSyncTime?: number;\n};\n\nconst MESSAGE_REACTIONS_POLLING_INTERVAL = 15 * 1000;\nconst BOTTOM_THRESHOLD = 50;\nconst UNREAD_DIVIDER_TOP = 10;\nconst UNREAD_DIVIDER_TOP_WITH_TOOLS = 60;\nconst SCROLL_DEBOUNCE = 200;\nconst MESSAGE_ANIMATION_DURATION = 500;\nconst BOTTOM_FOCUS_MARGIN = 20;\nconst SELECT_MODE_ANIMATION_DURATION = 200;\nconst UNREAD_DIVIDER_CLASS = 'unread-divider';\n\nconst runDebouncedForScroll = debounce((cb) => cb(), SCROLL_DEBOUNCE, false);\n\nconst MessageList: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n type,\n hasTools,\n onFabToggle,\n onNotchToggle,\n isCurrentUserPremium,\n isChatLoaded,\n isChannelChat,\n isGroupChat,\n canPost,\n isReady,\n isChatWithSelf,\n isRepliesChat,\n isCreator,\n isBot,\n messageIds,\n messagesById,\n firstUnreadId,\n isViewportNewest,\n threadFirstMessageId,\n isRestricted,\n restrictionReason,\n focusingId,\n isSelectModeActive,\n lastMessage,\n isLoadingBotInfo,\n botInfo,\n threadTopMessageId,\n hasLinkedChat,\n lastSyncTime,\n withBottomShift,\n}) => {\n const {\n loadViewportMessages, setScrollOffset, loadSponsoredMessages, loadMessageReactions, copyMessagesByIds,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n\n // We update local cached `scrollOffsetRef` when opening chat.\n // Then we update global version every second on scrolling.\n const scrollOffsetRef = useRef<number>((type === 'thread' && selectScrollOffset(getGlobal(), chatId, threadId)) || 0);\n const anchorIdRef = useRef<string>();\n const anchorTopRef = useRef<number>();\n const listItemElementsRef = useRef<HTMLDivElement[]>();\n const memoFirstUnreadIdRef = useRef<number>();\n const memoUnreadDividerBeforeIdRef = useRef<number | undefined>();\n const memoFocusingIdRef = useRef<number>();\n const isScrollTopJustUpdatedRef = useRef(false);\n const shouldAnimateAppearanceRef = useRef(Boolean(lastMessage));\n\n const [containerHeight, setContainerHeight] = useState<number | undefined>();\n\n const botInfoPhotoUrl = useMedia(botInfo?.photo ? getBotCoverMediaHash(botInfo.photo) : undefined);\n const botInfoGifUrl = useMedia(botInfo?.gif ? getDocumentMediaHash(botInfo.gif) : undefined);\n const botInfoDimensions = botInfo?.photo ? getPhotoFullDimensions(botInfo.photo) : botInfo?.gif\n ? getVideoDimensions(botInfo.gif) : undefined;\n const botInfoRealDimensions = botInfoDimensions && {\n width: botInfoDimensions.width / DPR,\n height: botInfoDimensions.height / DPR,\n };\n\n const areMessagesLoaded = Boolean(messageIds);\n\n useOnChange(() => {\n // We only need it first time when message list appears\n if (areMessagesLoaded) {\n onTickEnd(() => {\n shouldAnimateAppearanceRef.current = false;\n });\n }\n }, [areMessagesLoaded]);\n\n // Updated every time (to be used from intersection callback closure)\n useOnChange(() => {\n memoFirstUnreadIdRef.current = firstUnreadId;\n }, [firstUnreadId]);\n\n useOnChange(() => {\n if (!isCurrentUserPremium && isChannelChat && isReady && lastSyncTime) {\n loadSponsoredMessages({ chatId });\n }\n }, [isCurrentUserPremium, chatId, isReady, isChannelChat, lastSyncTime]);\n\n // Updated only once when messages are loaded (as we want the unread divider to keep its position)\n useOnChange(() => {\n if (areMessagesLoaded) {\n memoUnreadDividerBeforeIdRef.current = memoFirstUnreadIdRef.current;\n }\n }, [areMessagesLoaded]);\n\n useOnChange(() => {\n memoFocusingIdRef.current = focusingId;\n }, [focusingId]);\n\n useNativeCopySelectedMessages(copyMessagesByIds);\n\n const messageGroups = useMemo(() => {\n if (!messageIds || !messagesById) {\n return undefined;\n }\n\n const viewportIds = threadTopMessageId && (!messageIds[0] || threadFirstMessageId === messageIds[0])\n ? [threadTopMessageId, ...messageIds]\n : messageIds;\n\n if (!viewportIds.length) {\n return undefined;\n }\n\n const listedMessages = viewportIds.map((id) => messagesById[id]).filter(Boolean);\n return groupMessages(orderBy(listedMessages, ['date', 'id']), memoUnreadDividerBeforeIdRef.current);\n }, [messageIds, messagesById, threadFirstMessageId, threadTopMessageId]);\n\n useInterval(() => {\n if (!messageIds || !messagesById) {\n return;\n }\n const ids = messageIds.filter((l) => messagesById[l]?.reactions);\n\n if (!ids.length) return;\n\n loadMessageReactions({ chatId, ids });\n }, MESSAGE_REACTIONS_POLLING_INTERVAL);\n\n const loadMoreAround = useMemo(() => {\n if (type !== 'thread') {\n return undefined;\n }\n\n return debounce(() => loadViewportMessages({ direction: LoadMoreDirection.Around }), 1000, true, false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loadViewportMessages, messageIds]);\n\n const { isScrolled, updateStickyDates } = useStickyDates();\n\n const isScrollingRef = useRef<boolean>();\n const isScrollPatchNeededRef = useRef<boolean>();\n\n const handleScroll = useCallback(() => {\n if (isScrollTopJustUpdatedRef.current) {\n isScrollTopJustUpdatedRef.current = false;\n return;\n }\n\n isScrollingRef.current = true;\n\n const container = containerRef.current!;\n\n if (!memoFocusingIdRef.current) {\n updateStickyDates(container, hasTools);\n }\n\n runDebouncedForScroll(() => {\n isScrollingRef.current = false;\n\n fastRaf(() => {\n if (!container.parentElement) {\n return;\n }\n\n scrollOffsetRef.current = container.scrollHeight - container.scrollTop;\n\n if (type === 'thread') {\n setScrollOffset({ chatId, threadId, scrollOffset: scrollOffsetRef.current });\n }\n });\n });\n }, [updateStickyDates, hasTools, type, setScrollOffset, chatId, threadId]);\n\n // Container resize observer (caused by Composer reply/webpage panels)\n useEffect(() => {\n if (!('ResizeObserver' in window) || process.env.APP_ENV === 'perf') {\n return undefined;\n }\n\n const observer = new ResizeObserver(([entry]) => {\n // During animation\n if (!(entry.target as HTMLDivElement).offsetParent) {\n return;\n }\n\n setContainerHeight(entry.contentRect.height);\n });\n\n observer.observe(containerRef.current!);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // Memorize height for scroll animation\n const { height: windowHeight } = useWindowSize();\n\n useEffect(() => {\n containerRef.current!.dataset.normalHeight = String(containerRef.current!.offsetHeight);\n }, [windowHeight, canPost]);\n\n // Initial message loading\n useEffect(() => {\n if (!loadMoreAround || !isChatLoaded || isRestricted || focusingId) {\n return;\n }\n\n // Loading history while sending a message can return the same message and cause ambiguity\n const isLastMessageLocal = messageIds && messageIds[messageIds.length - 1] > LOCAL_MESSAGE_MIN_ID;\n if (isLastMessageLocal) {\n return;\n }\n\n const container = containerRef.current!;\n\n if (!messageIds || (\n messageIds.length < MESSAGE_LIST_SLICE / 2\n && (container.firstElementChild as HTMLDivElement).clientHeight <= container.offsetHeight\n )) {\n loadMoreAround();\n }\n }, [isChatLoaded, messageIds, loadMoreAround, focusingId, isRestricted]);\n\n // Remember scroll position before repositioning it\n useOnChange(() => {\n if (!messageIds || !listItemElementsRef.current) {\n return;\n }\n\n const preservedItemElements = listItemElementsRef.current\n .filter((element) => messageIds.includes(Number(element.dataset.messageId)));\n\n // We avoid the very first item as it may be a partly-loaded album\n // and also because it may be removed when messages limit is reached\n const anchor = preservedItemElements[1] || preservedItemElements[0];\n if (!anchor) {\n return;\n }\n\n anchorIdRef.current = anchor.id;\n anchorTopRef.current = anchor.getBoundingClientRect().top;\n // This should match deps for `useLayoutEffectWithPrevDeps` below\n }, [messageIds, isViewportNewest, containerHeight, hasTools]);\n\n // Handles updated message list, takes care of scroll repositioning\n useLayoutEffectWithPrevDeps(([\n prevMessageIds, prevIsViewportNewest, prevContainerHeight,\n ]) => {\n const container = containerRef.current!;\n listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item'));\n\n const hasLastMessageChanged = (\n messageIds && prevMessageIds && messageIds[messageIds.length - 1] !== prevMessageIds[prevMessageIds.length - 1]\n );\n const hasViewportShifted = (\n messageIds?.[0] !== prevMessageIds?.[0] && messageIds?.length === (MESSAGE_LIST_SLICE / 2 + 1)\n );\n const wasMessageAdded = hasLastMessageChanged && !hasViewportShifted;\n const isAlreadyFocusing = messageIds && memoFocusingIdRef.current === messageIds[messageIds.length - 1];\n\n // Add extra height when few messages to allow smooth scroll animation. Uses assumption that `parentElement`\n // is a Transition slide and its CSS class can not be reset in a declarative way.\n const shouldForceScroll = (\n isViewportNewest\n && wasMessageAdded\n && (messageIds && messageIds.length < MESSAGE_LIST_SLICE / 2)\n && !container.parentElement!.classList.contains('force-messages-scroll')\n && (container.firstElementChild as HTMLDivElement)!.clientHeight <= container.offsetHeight * 2\n );\n\n if (shouldForceScroll) {\n container.parentElement!.classList.add('force-messages-scroll');\n\n setTimeout(() => {\n if (container.parentElement) {\n container.parentElement.classList.remove('force-messages-scroll');\n }\n }, MESSAGE_ANIMATION_DURATION);\n }\n\n const { scrollTop, scrollHeight, offsetHeight } = container;\n const scrollOffset = scrollOffsetRef.current;\n const lastItemElement = listItemElementsRef.current[listItemElementsRef.current.length - 1];\n\n let bottomOffset = scrollOffset - (prevContainerHeight || offsetHeight);\n if (wasMessageAdded) {\n // If two new messages come at once (e.g. when bot responds) then the first message will update `scrollOffset`\n // right away (before animation) which creates inconsistency until the animation completes. To work around that,\n // we calculate `isAtBottom` with a \"buffer\" of the latest message height (this is approximate).\n const lastItemHeight = lastItemElement ? lastItemElement.offsetHeight : 0;\n bottomOffset -= lastItemHeight;\n }\n const isAtBottom = isViewportNewest && prevIsViewportNewest && bottomOffset <= BOTTOM_THRESHOLD;\n\n let newScrollTop!: number;\n\n if (wasMessageAdded && isAtBottom && !isAlreadyFocusing) {\n if (lastItemElement) {\n fastRaf(() => {\n fastSmoothScroll(\n container,\n lastItemElement,\n 'end',\n BOTTOM_FOCUS_MARGIN,\n );\n });\n }\n\n newScrollTop = scrollHeight - offsetHeight;\n scrollOffsetRef.current = Math.max(Math.ceil(scrollHeight - newScrollTop), offsetHeight);\n\n // Scroll still needs to be restored after container resize\n if (!shouldForceScroll) {\n return;\n }\n }\n\n if (process.env.APP_ENV === 'perf') {\n // eslint-disable-next-line no-console\n console.time('scrollTop');\n }\n\n const isResized = prevContainerHeight !== undefined && prevContainerHeight !== containerHeight;\n const anchor = anchorIdRef.current && container.querySelector(`#${anchorIdRef.current}`);\n const unreadDivider = (\n !anchor\n && memoUnreadDividerBeforeIdRef.current\n && container.querySelector<HTMLDivElement>(`.${UNREAD_DIVIDER_CLASS}`)\n );\n\n if (isAtBottom && isResized) {\n if (isAnimatingScroll()) {\n return;\n }\n\n newScrollTop = scrollHeight - offsetHeight;\n } else if (anchor) {\n if (isScrollPatchNeededRef.current) {\n isScrollPatchNeededRef.current = false;\n patchChromiumScroll(container);\n }\n\n const newAnchorTop = anchor.getBoundingClientRect().top;\n newScrollTop = scrollTop + (newAnchorTop - (anchorTopRef.current || 0));\n } else if (unreadDivider) {\n newScrollTop = Math.min(\n unreadDivider.offsetTop - (hasTools ? UNREAD_DIVIDER_TOP_WITH_TOOLS : UNREAD_DIVIDER_TOP),\n scrollHeight - scrollOffset,\n );\n } else {\n newScrollTop = scrollHeight - scrollOffset;\n }\n\n resetScroll(container, Math.ceil(newScrollTop));\n\n if (!memoFocusingIdRef.current) {\n isScrollTopJustUpdatedRef.current = true;\n fastRaf(() => {\n isScrollTopJustUpdatedRef.current = false;\n });\n }\n\n scrollOffsetRef.current = Math.max(Math.ceil(scrollHeight - newScrollTop), offsetHeight);\n\n if (process.env.APP_ENV === 'perf') {\n // eslint-disable-next-line no-console\n console.timeEnd('scrollTop');\n }\n // This should match deps for `useOnChange` above\n }, [messageIds, isViewportNewest, containerHeight, hasTools] as const);\n\n useEffectWithPrevDeps(([prevIsSelectModeActive]) => {\n if (prevIsSelectModeActive !== undefined) {\n dispatchHeavyAnimationEvent(SELECT_MODE_ANIMATION_DURATION + ANIMATION_END_DELAY);\n }\n }, [isSelectModeActive]);\n\n const lang = useLang();\n\n const isPrivate = Boolean(chatId && isUserId(chatId));\n const withUsers = Boolean((!isPrivate && !isChannelChat) || isChatWithSelf || isRepliesChat);\n const noAvatars = Boolean(!withUsers || isChannelChat);\n const shouldRenderGreeting = isUserId(chatId) && !isChatWithSelf && !isBot\n && (\n (\n !messageGroups && !lastMessage && messageIds\n // Used to avoid flickering when deleting a greeting that has just been sent\n && (!listItemElementsRef.current || listItemElementsRef.current.length === 0)\n )\n || (messageIds?.length === 1 && messagesById?.[messageIds[0]]?.content.action?.type === 'contactSignUp')\n || (lastMessage?.content?.action?.type === 'contactSignUp')\n );\n\n const isGroupChatJustCreated = isGroupChat && isCreator\n && messageIds?.length === 1 && messagesById?.[messageIds[0]]?.content.action?.type === 'chatCreate';\n\n const isBotInfoEmpty = botInfo && !botInfo.description;\n\n const className = buildClassName(\n 'MessageList custom-scroll',\n noAvatars && 'no-avatars',\n !canPost && 'no-composer',\n type === 'pinned' && 'type-pinned',\n withBottomShift && 'with-bottom-shift',\n isSelectModeActive && 'select-mode-active',\n isScrolled && 'scrolled',\n !isReady && 'is-animating',\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n onScroll={handleScroll}\n onMouseDown={preventMessageInputBlur}\n >\n {isRestricted ? (\n <div className=\"empty\">\n <span>\n {restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`}\n </span>\n </div>\n ) : botInfo ? (\n <div className=\"empty\">\n {isLoadingBotInfo && <span>{lang('Loading')}</span>}\n {isBotInfoEmpty && <span>{lang('NoMessages')}</span>}\n {botInfo && (\n <div\n className=\"bot-info\"\n style={botInfoRealDimensions && (\n `width: ${botInfoRealDimensions.width}px`\n )}\n >\n {botInfoPhotoUrl && (\n <img\n src={botInfoPhotoUrl}\n width={botInfoRealDimensions?.width}\n height={botInfoRealDimensions?.height}\n alt=\"Bot info\"\n />\n )}\n {botInfoGifUrl && (\n <video\n src={botInfoGifUrl}\n loop\n autoPlay\n disablePictureInPicture\n muted\n playsInline\n />\n )}\n {botInfoDimensions && !botInfoPhotoUrl && !botInfoGifUrl && (\n <Skeleton\n width={botInfoRealDimensions?.width}\n height={botInfoRealDimensions?.height}\n />\n )}\n {botInfo.description && (\n <div className=\"bot-info-description\">\n <p className=\"bot-info-title\">{lang('BotInfoTitle')}</p>\n {renderText(botInfo.description, ['br', 'emoji', 'links'])}\n </div>\n )}\n </div>\n )}\n </div>\n ) : shouldRenderGreeting ? (\n <ContactGreeting userId={chatId} />\n ) : messageIds && (!messageGroups || isGroupChatJustCreated) ? (\n <NoMessages\n chatId={chatId}\n type={type}\n isChatWithSelf={isChatWithSelf}\n isGroupChatJustCreated={isGroupChatJustCreated}\n />\n ) : ((messageIds && messageGroups) || lastMessage) ? (\n <MessageListContent\n isCurrentUserPremium={isCurrentUserPremium}\n chatId={chatId}\n messageIds={messageIds || [lastMessage!.id]}\n messageGroups={messageGroups || groupMessages([lastMessage!])}\n isViewportNewest={Boolean(isViewportNewest)}\n isUnread={Boolean(firstUnreadId)}\n withUsers={withUsers}\n areReactionsInMeta={isPrivate}\n noAvatars={noAvatars}\n containerRef={containerRef}\n anchorIdRef={anchorIdRef}\n memoUnreadDividerBeforeIdRef={memoUnreadDividerBeforeIdRef}\n memoFirstUnreadIdRef={memoFirstUnreadIdRef}\n threadId={threadId}\n type={type}\n isReady={isReady}\n isScrollingRef={isScrollingRef}\n isScrollPatchNeededRef={isScrollPatchNeededRef}\n threadTopMessageId={threadTopMessageId}\n hasLinkedChat={hasLinkedChat}\n isSchedule={messageGroups ? type === 'scheduled' : false}\n noAppearanceAnimation={!messageGroups || !shouldAnimateAppearanceRef.current}\n onFabToggle={onFabToggle}\n onNotchToggle={onNotchToggle}\n />\n ) : (\n <Loading color=\"white\" backgroundColor=\"dark\" />\n )}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId, type }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat) {\n return {};\n }\n\n const messageIds = selectCurrentMessageIds(global, chatId, threadId, type);\n const messagesById = type === 'scheduled'\n ? selectScheduledMessages(global, chatId)\n : selectChatMessages(global, chatId);\n const threadTopMessageId = selectThreadTopMessageId(global, chatId, threadId);\n\n if (\n threadId !== MAIN_THREAD_ID\n && !(messagesById && threadTopMessageId && messagesById[threadTopMessageId])\n ) {\n return {};\n }\n\n const { isRestricted, restrictionReason, lastMessage } = chat;\n const focusingId = selectFocusedMessageId(global, chatId);\n\n const withLastMessageWhenPreloading = (\n threadId === MAIN_THREAD_ID\n && !messageIds && !chat.unreadCount && !focusingId && lastMessage && !lastMessage.groupedId\n );\n\n const chatBot = selectChatBot(global, chatId)!;\n let isLoadingBotInfo = false;\n let botInfo;\n if (selectIsChatBotNotStarted(global, chatId)) {\n if (chatBot.fullInfo) {\n botInfo = chatBot.fullInfo.botInfo;\n } else {\n isLoadingBotInfo = true;\n }\n }\n\n return {\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\n isChatLoaded: true,\n isRestricted,\n restrictionReason,\n isChannelChat: isChatChannel(chat),\n isGroupChat: isChatGroup(chat),\n isCreator: chat.isCreator,\n isChatWithSelf: selectIsChatWithSelf(global, chatId),\n isRepliesChat: isChatWithRepliesBot(chatId),\n isBot: Boolean(chatBot),\n messageIds,\n messagesById,\n firstUnreadId: selectFirstUnreadId(global, chatId, threadId),\n isViewportNewest: type !== 'thread' || selectIsViewportNewest(global, chatId, threadId),\n threadFirstMessageId: selectFirstMessageId(global, chatId, threadId),\n focusingId,\n isSelectModeActive: selectIsInSelectMode(global),\n isLoadingBotInfo,\n botInfo,\n threadTopMessageId,\n hasLinkedChat: chat.fullInfo && ('linkedChatId' in chat.fullInfo)\n ? Boolean(chat.fullInfo.linkedChatId)\n : undefined,\n lastSyncTime: global.lastSyncTime,\n ...(withLastMessageWhenPreloading && { lastMessage }),\n };\n },\n)(MessageList));\n","import { useHotkeys } from './useHotkeys';\nimport getMessageIdsForSelectedText from '../util/getMessageIdsForSelectedText';\n\nconst useNativeCopySelectedMessages = (copyMessagesByIds: ({ messageIds }: { messageIds?: number[] }) => void) => {\n function handleCopy(e: KeyboardEvent) {\n const messageIds = getMessageIdsForSelectedText();\n\n if (messageIds && messageIds.length > 0) {\n e.preventDefault();\n copyMessagesByIds({ messageIds });\n }\n }\n\n useHotkeys({ 'Mod+C': handleCopy });\n};\n\nexport default useNativeCopySelectedMessages;\n","import { useCallback } from '../../../lib/teact/teact';\n\nimport { fastRaf } from '../../../util/schedulers';\nimport useRunDebounced from '../../../hooks/useRunDebounced';\nimport useFlag from '../../../hooks/useFlag';\n\nconst DEBOUNCE = 1000;\nconst STICKY_TOP = 10;\nconst STICKY_TOP_WITH_TOOLS = 60;\n\nexport default function useStickyDates() {\n // For some reason we can not synchronously hide a sticky element (from `useLayoutEffect`) when chat opens\n // so we will add `position: sticky` only after first scroll. There would be no animation on the first show though.\n const [isScrolled, markIsScrolled] = useFlag(false);\n\n const runDebounced = useRunDebounced(DEBOUNCE, true);\n\n const updateStickyDates = useCallback((container: HTMLDivElement, hasTools?: boolean) => {\n markIsScrolled();\n\n if (!document.body.classList.contains('is-scrolling-messages')) {\n fastRaf(() => {\n document.body.classList.add('is-scrolling-messages');\n });\n }\n\n runDebounced(() => {\n fastRaf(() => {\n const currentStuck = document.querySelector('.stuck');\n if (currentStuck) {\n currentStuck.classList.remove('stuck');\n }\n\n const stuckDateEl = findStuckDate(container, hasTools);\n if (stuckDateEl) {\n stuckDateEl.classList.add('stuck');\n }\n\n document.body.classList.remove('is-scrolling-messages');\n });\n });\n }, [markIsScrolled, runDebounced]);\n\n return {\n isScrolled,\n updateStickyDates,\n };\n}\n\nfunction findStuckDate(container: HTMLElement, hasTools?: boolean) {\n const allElements = container.querySelectorAll<HTMLDivElement>('.sticky-date');\n const containerTop = container.scrollTop;\n\n return Array.from(allElements).find((el) => {\n const { offsetTop, offsetHeight } = el;\n const top = offsetTop - containerTop;\n return -offsetHeight <= top && top <= (hasTools ? STICKY_TOP_WITH_TOOLS : STICKY_TOP);\n });\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useRef } from '../../lib/teact/teact';\n\nimport { formatIntegerCompact } from '../../util/textFormat';\nimport useLang from '../../hooks/useLang';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport buildClassName from '../../util/buildClassName';\n\nimport Menu from '../ui/Menu';\nimport Button from '../ui/Button';\nimport MenuItem from '../ui/MenuItem';\n\nimport styles from './ScrollDownButton.module.scss';\n\ntype OwnProps = {\n icon: string;\n ariaLabelLang: string;\n unreadCount?: number;\n onClick: VoidFunction;\n onReadAll?: VoidFunction;\n className?: string;\n};\n\nconst ScrollDownButton: FC<OwnProps> = ({\n icon,\n ariaLabelLang,\n unreadCount,\n onClick,\n onReadAll,\n className,\n}) => {\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n const {\n isContextMenuOpen,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n } = useContextMenuHandlers(ref, !onReadAll);\n\n return (\n <div className={buildClassName(styles.root, className)} ref={ref}>\n <Button\n color=\"secondary\"\n round\n className={styles.button}\n onClick={onClick}\n onContextMenu={handleContextMenu}\n ariaLabel={lang(ariaLabelLang)}\n >\n <i className={buildClassName(styles.icon, `icon-${icon}`)} />\n </Button>\n {Boolean(unreadCount) && <div className={styles.unreadCount}>{formatIntegerCompact(unreadCount)}</div>}\n {onReadAll && (\n <Menu\n isOpen={isContextMenuOpen}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n autoClose\n positionX=\"right\"\n positionY=\"bottom\"\n >\n <MenuItem icon=\"readchats\" onClick={onReadAll}>{lang('MarkAllAsRead')}</MenuItem>\n </Menu>\n )}\n </div>\n );\n};\n\nexport default memo(ScrollDownButton);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"KboxtoWkfx23zfklH_Zg\",\"button\":\"sgkkv3bmIMAZS9G9BHUz\",\"icon\":\"AafG9_xBi_2eJ_bFNnNg\",\"unread-count\":\"yKN1kQ3YXf4SHHIBcotS\",\"unreadCount\":\"yKN1kQ3YXf4SHHIBcotS\"};","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useRef, useEffect,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { MessageListType } from '../../global/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\n\nimport { selectChat, selectCurrentMessageList } from '../../global/selectors';\nimport buildClassName from '../../util/buildClassName';\nimport fastSmoothScroll from '../../util/fastSmoothScroll';\n\nimport ScrollDownButton from './ScrollDownButton';\n\nimport styles from './FloatingActionButtons.module.scss';\n\ntype OwnProps = {\n isShown: boolean;\n canPost?: boolean;\n withExtraShift?: boolean;\n};\n\ntype StateProps = {\n chatId?: string;\n messageListType?: MessageListType;\n unreadCount?: number;\n reactionsCount?: number;\n mentionsCount?: number;\n};\n\nconst FOCUS_MARGIN = 20;\n\nconst FloatingActionButtons: FC<OwnProps & StateProps> = ({\n isShown,\n canPost,\n messageListType,\n chatId,\n unreadCount,\n reactionsCount,\n mentionsCount,\n withExtraShift,\n}) => {\n const {\n focusNextReply, focusNextReaction, focusNextMention, fetchUnreadReactions,\n readAllMentions, readAllReactions, fetchUnreadMentions,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const elementRef = useRef<HTMLDivElement>(null);\n\n const hasUnreadReactions = Boolean(reactionsCount);\n const hasUnreadMentions = Boolean(mentionsCount);\n\n useEffect(() => {\n if (hasUnreadReactions && chatId) {\n fetchUnreadReactions({ chatId });\n }\n }, [chatId, fetchUnreadReactions, hasUnreadReactions]);\n\n useEffect(() => {\n if (hasUnreadMentions && chatId) {\n fetchUnreadMentions({ chatId });\n }\n }, [chatId, fetchUnreadMentions, hasUnreadMentions]);\n\n const handleClick = useCallback(() => {\n if (!isShown) {\n return;\n }\n\n if (messageListType === 'thread') {\n focusNextReply();\n } else {\n const messagesContainer = elementRef.current!.parentElement!.querySelector<HTMLDivElement>('.MessageList')!;\n const messageElements = messagesContainer.querySelectorAll<HTMLDivElement>('.message-list-item');\n const lastMessageElement = messageElements[messageElements.length - 1];\n if (!lastMessageElement) {\n return;\n }\n\n fastSmoothScroll(messagesContainer, lastMessageElement, 'end', FOCUS_MARGIN);\n }\n }, [isShown, messageListType, focusNextReply]);\n\n const fabClassName = buildClassName(\n styles.root,\n (isShown || Boolean(reactionsCount) || Boolean(mentionsCount)) && styles.revealed,\n (Boolean(reactionsCount) || Boolean(mentionsCount)) && !isShown && styles.onlyReactions,\n !canPost && styles.noComposer,\n !withExtraShift && styles.noExtraShift,\n );\n\n return (\n <div ref={elementRef} className={fabClassName}>\n {hasUnreadReactions && (\n <ScrollDownButton\n icon=\"heart-outline\"\n ariaLabelLang=\"AccDescrReactionMentionDown\"\n onClick={focusNextReaction}\n onReadAll={readAllReactions}\n unreadCount={reactionsCount}\n />\n )}\n {hasUnreadMentions && (\n <ScrollDownButton\n icon=\"mention\"\n ariaLabelLang=\"AccDescrMentionDown\"\n onClick={focusNextMention}\n onReadAll={readAllMentions}\n unreadCount={mentionsCount}\n />\n )}\n\n <ScrollDownButton\n icon=\"arrow-down\"\n ariaLabelLang=\"AccDescrPageDown\"\n onClick={handleClick}\n unreadCount={unreadCount}\n className={styles.unread}\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const currentMessageList = selectCurrentMessageList(global);\n if (!currentMessageList) {\n return {};\n }\n\n const { chatId, threadId, type: messageListType } = currentMessageList;\n const chat = selectChat(global, chatId);\n\n const shouldShowCount = chat && threadId === MAIN_THREAD_ID && messageListType === 'thread';\n\n return {\n messageListType,\n chatId,\n reactionsCount: shouldShowCount ? chat.unreadReactionsCount : undefined,\n mentionsCount: shouldShowCount ? chat.unreadMentionsCount : undefined,\n unreadCount: shouldShowCount ? chat.unreadCount : undefined,\n };\n },\n)(FloatingActionButtons));\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"quM3aP53TOfurCEOYgOE\",\"unread\":\"Hoi4yrJrfBHTmvB8TPce\",\"revealed\":\"Gutr8PrNAFFTnrIdgK_l\",\"no-composer\":\"r7RXnwv5TF4Cf2V0d5Mf\",\"noComposer\":\"r7RXnwv5TF4Cf2V0d5Mf\",\"no-extra-shift\":\"S98OqutuQVCNVHgTrKv4\",\"noExtraShift\":\"S98OqutuQVCNVHgTrKv4\",\"only-reactions\":\"bHOz3QboabL0RvHuj3ku\",\"onlyReactions\":\"bHOz3QboabL0RvHuj3ku\",\"is-symbol-menu-open\":\"yjxHiwr4SKNxYCGaxUua\",\"isSymbolMenuOpen\":\"yjxHiwr4SKNxYCGaxUua\"};","import type { ApiAttachment } from '../../../../api/types';\nimport {\n SUPPORTED_AUDIO_CONTENT_TYPES,\n SUPPORTED_IMAGE_CONTENT_TYPES,\n SUPPORTED_VIDEO_CONTENT_TYPES,\n} from '../../../../config';\nimport { parseAudioMetadata } from '../../../../util/audio';\nimport {\n preloadImage,\n preloadVideo,\n createPosterForVideo,\n fetchBlob,\n} from '../../../../util/files';\nimport { scaleImage } from '../../../../util/imageResize';\n\nconst MAX_QUICK_IMG_SIZE = 1280; // px\nconst FILE_EXT_REGEX = /\\.[^/.]+$/;\n\nexport default async function buildAttachment(\n filename: string, blob: Blob, isQuick: boolean, options?: Partial<ApiAttachment>,\n): Promise<ApiAttachment> {\n const blobUrl = URL.createObjectURL(blob);\n const { type: mimeType, size } = blob;\n let quick;\n let audio;\n let previewBlobUrl;\n\n if (SUPPORTED_IMAGE_CONTENT_TYPES.has(mimeType)) {\n if (isQuick) {\n const img = await preloadImage(blobUrl);\n const { width, height } = img;\n const shouldShrink = width > MAX_QUICK_IMG_SIZE || height > MAX_QUICK_IMG_SIZE;\n\n if (shouldShrink || mimeType !== 'image/jpeg') {\n const resizedUrl = await scaleImage(\n blobUrl, shouldShrink ? MAX_QUICK_IMG_SIZE / Math.max(width, height) : 1, 'image/jpeg',\n );\n URL.revokeObjectURL(blobUrl);\n const newBlob = await fetchBlob(resizedUrl);\n return buildAttachment(filename, newBlob, true, options);\n }\n\n if (mimeType === 'image/jpeg') {\n filename = filename.replace(FILE_EXT_REGEX, '.jpg');\n }\n\n quick = { width, height };\n } else {\n previewBlobUrl = blobUrl;\n }\n } else if (SUPPORTED_VIDEO_CONTENT_TYPES.has(mimeType)) {\n const { videoWidth: width, videoHeight: height, duration } = await preloadVideo(blobUrl);\n quick = { width, height, duration };\n\n previewBlobUrl = await createPosterForVideo(blobUrl);\n } else if (SUPPORTED_AUDIO_CONTENT_TYPES.has(mimeType)) {\n const {\n duration, title, performer, coverUrl,\n } = await parseAudioMetadata(blobUrl);\n audio = {\n duration: duration || 0,\n title,\n performer,\n };\n previewBlobUrl = coverUrl;\n }\n\n return {\n blobUrl,\n filename,\n mimeType,\n size,\n quick,\n audio,\n previewBlobUrl,\n ...options,\n };\n}\n","type AudioMetadata = {\n title?: string;\n performer?: string;\n duration?: number;\n coverUrl?: string;\n};\n\nexport async function parseAudioMetadata(url: string): Promise<AudioMetadata> {\n const { fetchFromUrl, selectCover } = await import('../lib/music-metadata-browser');\n const metadata = await fetchFromUrl(url);\n const { common: { title, artist, picture }, format: { duration } } = metadata;\n\n const cover = selectCover(picture);\n const coverUrl = cover ? `data:${cover.format};base64,${cover.data.toString('base64')}` : undefined;\n\n return {\n title,\n performer: artist,\n duration,\n coverUrl,\n };\n}\n","export function insertHtmlInSelection(html: string) {\n const selection = window.getSelection();\n\n if (selection?.getRangeAt && selection.rangeCount) {\n const range = selection.getRangeAt(0);\n range.deleteContents();\n\n const fragment = range.createContextualFragment(html);\n const lastInsertedNode = fragment.lastChild;\n range.insertNode(fragment);\n if (lastInsertedNode) {\n range.setStartAfter(lastInsertedNode);\n range.setEndAfter(lastInsertedNode);\n } else {\n range.collapse(false);\n }\n selection.removeAllRanges();\n selection.addRange(range);\n }\n}\n","import { IS_IOS } from '../../../../util/environment';\n\nlet resetInput: HTMLInputElement;\n\nif (IS_IOS) {\n resetInput = document.createElement('input');\n resetInput.classList.add('for-ios-autocapitalization-fix');\n document.body.appendChild(resetInput);\n}\n\n// https://stackoverflow.com/a/55652503\nexport default function applyIosAutoCapitalizationFix(inputEl: HTMLElement) {\n resetInput.focus();\n inputEl.focus();\n}\n","import type { IOpusRecorder } from 'opus-recorder';\n\nexport type Result = { blob: Blob; duration: number; waveform: number[] };\n\nconst encoderPath = new URL('opus-recorder/dist/encoderWorker.min', import.meta.url).href;\nconst MIN_RECORDING_TIME = 1000;\nconst POLYFILL_OPTIONS = { encoderPath, reuseWorker: true };\nconst BLOB_PARAMS = { type: 'audio/ogg' };\nconst FFT_SIZE = 64;\nconst MIN_VOLUME = 0.1;\n\nlet opusRecorderPromise: Promise<{ default: IOpusRecorder }>;\nlet OpusRecorder: IOpusRecorder;\nlet mediaRecorder: IOpusRecorder;\n\nexport async function init() {\n if (!opusRecorderPromise) {\n opusRecorderPromise = import('opus-recorder');\n OpusRecorder = (await opusRecorderPromise).default;\n mediaRecorder = new OpusRecorder(POLYFILL_OPTIONS);\n }\n\n return opusRecorderPromise;\n}\n\nexport async function start(analyzerCallback: Function) {\n await startMediaRecorder();\n\n const startedAt = Date.now();\n let pausedAt: number;\n const chunks: Uint8Array[] = [];\n const waveform: number[] = [];\n\n mediaRecorder.ondataavailable = (typedArray) => {\n chunks.push(typedArray);\n };\n\n const releaseAnalyzer = subscribeToAnalyzer(mediaRecorder, (volume: number) => {\n waveform.push(volume * 255);\n analyzerCallback(volume);\n });\n\n return {\n stop: () => new Promise<Result>((resolve, reject) => {\n mediaRecorder.onstop = () => {\n resolve({\n blob: new Blob(chunks, BLOB_PARAMS),\n duration: Math.round(((pausedAt || Date.now()) - startedAt) / 1000),\n waveform,\n });\n };\n mediaRecorder.onerror = reject;\n\n const delayStop = Math.max(0, startedAt + MIN_RECORDING_TIME - Date.now());\n setTimeout(() => {\n mediaRecorder.stop();\n releaseAnalyzer();\n }, delayStop);\n }),\n pause: () => {\n const delayStop = Math.max(0, startedAt + MIN_RECORDING_TIME - Date.now());\n setTimeout(() => {\n mediaRecorder.pause();\n pausedAt = Date.now();\n releaseAnalyzer();\n }, delayStop);\n },\n };\n}\n\nasync function startMediaRecorder() {\n await init();\n await mediaRecorder.start();\n}\n\nfunction subscribeToAnalyzer(recorder: IOpusRecorder, cb: Function) {\n const source = recorder.sourceNode;\n const analyser = source.context.createAnalyser();\n analyser.fftSize = FFT_SIZE;\n source.connect(analyser);\n\n const dataLength = analyser.frequencyBinCount;\n const dataArray = new Uint8Array(dataLength);\n let isDestroyed = false;\n\n function tick() {\n if (isDestroyed) {\n return;\n }\n\n analyser.getByteFrequencyData(dataArray);\n\n const sum = dataArray.reduce((acc, current) => acc + current, 0);\n const mean = (sum / dataLength);\n const volume = mean / 255;\n\n cb(volume < MIN_VOLUME ? 0 : volume);\n\n requestAnimationFrame(tick);\n }\n\n tick();\n\n return () => {\n isDestroyed = true;\n };\n}\n","import type { StateHookSetter } from '../../../../lib/teact/teact';\nimport { useEffect } from '../../../../lib/teact/teact';\nimport type { ApiAttachment, ApiMessage } from '../../../../api/types';\n\nimport buildAttachment from '../helpers/buildAttachment';\nimport { EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID } from '../../../../config';\nimport getFilesFromDataTransferItems from '../helpers/getFilesFromDataTransferItems';\n\nconst CLIPBOARD_ACCEPTED_TYPES = ['image/png', 'image/jpeg', 'image/gif'];\nconst MAX_MESSAGE_LENGTH = 4096;\n\nconst useClipboardPaste = (\n isActive: boolean,\n insertTextAndUpdateCursor: (text: string, inputId?: string) => void,\n setAttachments: StateHookSetter<ApiAttachment[]>,\n editedMessage: ApiMessage | undefined,\n) => {\n useEffect(() => {\n if (!isActive) {\n return undefined;\n }\n\n async function handlePaste(e: ClipboardEvent) {\n if (!e.clipboardData) {\n return;\n }\n\n const input = document.activeElement;\n if (input && ![EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID].includes(input.id)) {\n return;\n }\n\n const pastedText = e.clipboardData.getData('text').substring(0, MAX_MESSAGE_LENGTH);\n const { items } = e.clipboardData;\n let files: File[] = [];\n\n e.preventDefault();\n if (items.length > 0) {\n files = await getFilesFromDataTransferItems(items);\n }\n\n if (files.length === 0 && !pastedText) {\n return;\n }\n\n if (files.length > 0 && !editedMessage) {\n const newAttachments = await Promise.all(files.map((file) => {\n return buildAttachment(file.name, file, files.length === 1 && CLIPBOARD_ACCEPTED_TYPES.includes(file.type));\n }));\n setAttachments((attachments) => attachments.concat(newAttachments));\n }\n\n if (pastedText) {\n insertTextAndUpdateCursor(pastedText, input?.id);\n }\n }\n\n document.addEventListener('paste', handlePaste, false);\n\n return () => {\n document.removeEventListener('paste', handlePaste, false);\n };\n }, [insertTextAndUpdateCursor, editedMessage, setAttachments, isActive]);\n};\n\nexport default useClipboardPaste;\n","import { useCallback, useEffect, useMemo } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\n\nimport type { ApiFormattedText, ApiMessage } from '../../../../api/types';\n\nimport { DRAFT_DEBOUNCE, EDITABLE_INPUT_CSS_SELECTOR } from '../../../../config';\nimport usePrevious from '../../../../hooks/usePrevious';\nimport { debounce } from '../../../../util/schedulers';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport parseMessageInput from '../../../../util/parseMessageInput';\nimport useBackgroundMode from '../../../../hooks/useBackgroundMode';\nimport useBeforeUnload from '../../../../hooks/useBeforeUnload';\nimport { IS_TOUCH_ENV } from '../../../../util/environment';\nimport { getTextWithEntitiesAsHtml } from '../../../common/helpers/renderTextWithEntities';\n\n// Used to avoid running debounced callbacks when chat changes.\nlet currentChatId: string | undefined;\nlet currentThreadId: number | undefined;\n\nconst useDraft = (\n draft: ApiFormattedText | undefined,\n chatId: string,\n threadId: number,\n htmlRef: { current: string },\n setHtml: (html: string) => void,\n editedMessage: ApiMessage | undefined,\n) => {\n const { saveDraft, clearDraft } = getActions();\n\n const updateDraft = useCallback((draftChatId: string, draftThreadId: number) => {\n const currentHtml = htmlRef.current;\n if (currentHtml === undefined || editedMessage) return;\n if (currentHtml.length) {\n saveDraft({ chatId: draftChatId, threadId: draftThreadId, draft: parseMessageInput(currentHtml!) });\n } else {\n clearDraft({ chatId: draftChatId, threadId: draftThreadId });\n }\n }, [clearDraft, editedMessage, htmlRef, saveDraft]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const runDebouncedForSaveDraft = useMemo(() => debounce((cb) => cb(), DRAFT_DEBOUNCE, false), [chatId]);\n\n const prevChatId = usePrevious(chatId);\n const prevThreadId = usePrevious(threadId);\n\n // Save draft on chat change\n useEffect(() => {\n currentChatId = chatId;\n currentThreadId = threadId;\n\n return () => {\n currentChatId = undefined;\n currentThreadId = undefined;\n\n updateDraft(chatId, threadId);\n };\n }, [chatId, threadId, updateDraft]);\n\n // Restore draft on chat change\n useEffect(() => {\n if (chatId === prevChatId && threadId === prevThreadId) {\n return;\n }\n\n if (editedMessage || !draft) {\n return;\n }\n\n setHtml(getTextWithEntitiesAsHtml(draft));\n\n if (!IS_TOUCH_ENV) {\n requestAnimationFrame(() => {\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n if (messageInput) {\n focusEditableElement(messageInput, true);\n }\n });\n }\n }, [chatId, threadId, draft, setHtml, updateDraft, prevChatId, prevThreadId, editedMessage]);\n\n const html = htmlRef.current;\n // Update draft when input changes\n const prevHtml = usePrevious(html);\n useEffect(() => {\n if (!chatId || !threadId || prevChatId !== chatId || prevThreadId !== threadId || prevHtml === html) {\n return;\n }\n\n if (html.length) {\n runDebouncedForSaveDraft(() => {\n if (currentChatId !== chatId || currentThreadId !== threadId) {\n return;\n }\n\n updateDraft(chatId, threadId);\n });\n } else {\n updateDraft(chatId, threadId);\n }\n }, [chatId, html, prevChatId, prevHtml, prevThreadId, runDebouncedForSaveDraft, threadId, updateDraft]);\n\n const handleBlur = useCallback(() => {\n if (chatId && threadId) {\n updateDraft(chatId, threadId);\n }\n }, [chatId, threadId, updateDraft]);\n\n useBackgroundMode(handleBlur);\n useBeforeUnload(handleBlur);\n};\n\nexport default useDraft;\n","import { useCallback, useRef, useState } from '../lib/teact/teact';\n\nimport useRunDebounced from './useRunDebounced';\nimport useOnChange from './useOnChange';\nimport useHeavyAnimationCheck, { isHeavyAnimating } from './useHeavyAnimationCheck';\nimport useForceUpdate from './useForceUpdate';\n\nexport default function useDebouncedMemo<R extends any, D extends any[]>(\n resolverFn: () => R, ms: number, dependencies: D,\n): R | undefined {\n const [value, setValue] = useState<R>();\n const { isFrozen, updateWhenUnfrozen } = useHeavyAnimationFreeze();\n const runDebounced = useRunDebounced(ms, true);\n\n useOnChange(() => {\n if (isFrozen) {\n updateWhenUnfrozen();\n return;\n }\n\n runDebounced(() => {\n setValue(resolverFn());\n });\n }, [...dependencies, isFrozen]);\n\n return value;\n}\n\nfunction useHeavyAnimationFreeze() {\n const isPending = useRef(false);\n\n const updateWhenUnfrozen = useCallback(() => {\n isPending.current = true;\n }, []);\n\n const forceUpdate = useForceUpdate();\n const handleUnfreeze = useCallback(() => {\n if (!isPending.current) {\n return;\n }\n\n isPending.current = false;\n forceUpdate();\n }, [forceUpdate]);\n useHeavyAnimationCheck(noop, handleUnfreeze);\n\n return {\n isFrozen: isHeavyAnimating(),\n updateWhenUnfrozen,\n };\n}\n\nfunction noop() {\n}\n","import { useCallback, useEffect } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\nimport type { InlineBotSettings } from '../../../../types';\nimport useFlag from '../../../../hooks/useFlag';\nimport usePrevious from '../../../../hooks/usePrevious';\nimport useDebouncedMemo from '../../../../hooks/useDebouncedMemo';\n\nconst DEBOUNCE_MS = 300;\nconst INLINE_BOT_QUERY_REGEXP = /^@([a-z0-9_]{1,32})[\\u00A0\\u0020]+(.*)/i;\nconst HAS_NEW_LINE = /^@([a-z0-9_]{1,32})[\\u00A0\\u0020]+\\n{2,}/i;\nconst MEMO_NO_RESULT = {\n username: '',\n query: '',\n canShowHelp: false,\n usernameLowered: '',\n};\n\nconst tempEl = document.createElement('div');\n\nexport default function useInlineBotTooltip(\n isAllowed: boolean,\n chatId: string,\n html: string,\n inlineBots?: Record<string, false | InlineBotSettings>,\n) {\n const { queryInlineBot, resetInlineBot } = getActions();\n\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const {\n username, query, canShowHelp, usernameLowered,\n } = useDebouncedMemo(() => parseBotQuery(html), DEBOUNCE_MS, [html]) || {};\n const prevQuery = usePrevious(query);\n const prevUsername = usePrevious(username);\n const inlineBotData = usernameLowered ? inlineBots?.[usernameLowered] : undefined;\n const {\n id: botId,\n switchPm,\n offset,\n results,\n isGallery,\n help,\n } = inlineBotData || {};\n\n useEffect(() => {\n if (prevQuery !== query) {\n unmarkIsOpen();\n }\n }, [prevQuery, query, unmarkIsOpen]);\n\n useEffect(() => {\n if (isAllowed && usernameLowered && chatId) {\n queryInlineBot({ chatId, username: usernameLowered, query });\n }\n }, [query, isAllowed, queryInlineBot, chatId, usernameLowered]);\n\n const loadMore = useCallback(() => {\n queryInlineBot({\n chatId, username: usernameLowered, query, offset,\n });\n }, [offset, chatId, query, queryInlineBot, usernameLowered]);\n\n useEffect(() => {\n if (isAllowed && botId && (switchPm || (results?.length))) {\n markIsOpen();\n } else {\n unmarkIsOpen();\n }\n }, [botId, isAllowed, markIsOpen, results, switchPm, unmarkIsOpen]);\n\n if (prevUsername !== username) {\n resetInlineBot({ username: prevUsername });\n }\n\n return {\n isOpen,\n id: botId,\n isGallery,\n switchPm,\n results,\n closeTooltip: unmarkIsOpen,\n help: canShowHelp && help ? `@${username} ${help}` : undefined,\n loadMore,\n };\n}\n\nfunction parseBotQuery(html: string) {\n const text = getPlainText(html);\n const result = text.match(INLINE_BOT_QUERY_REGEXP);\n if (!result) {\n return MEMO_NO_RESULT;\n }\n\n return {\n username: result[1],\n query: result[2],\n canShowHelp: result[2] === '' && !text.match(HAS_NEW_LINE),\n usernameLowered: result[1].toLowerCase(),\n };\n}\n\nfunction getPlainText(html: string) {\n tempEl.innerHTML = html.replace(/<br>/g, '\\n');\n\n return tempEl.innerText;\n}\n","import {\n useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\n\nimport type { ApiBotCommand } from '../../../../api/types';\n\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\nimport { throttle } from '../../../../util/schedulers';\nimport useFlag from '../../../../hooks/useFlag';\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\nconst RE_COMMAND = /^[\\w@]{1,32}\\s?/i;\n\nexport default function useBotCommandTooltip(\n isAllowed: boolean,\n html: string,\n botCommands?: ApiBotCommand[] | false,\n chatBotCommands?: ApiBotCommand[],\n) {\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const [filteredBotCommands, setFilteredBotCommands] = useState<ApiBotCommand[] | undefined>();\n\n const getFilteredCommands = useCallback((filter) => {\n if (!botCommands && !chatBotCommands) {\n setFilteredBotCommands(undefined);\n\n return;\n }\n\n runThrottled(() => {\n const nextFilteredBotCommands = (botCommands || chatBotCommands || [])\n .filter(({ command }) => !filter || command.includes(filter));\n setFilteredBotCommands(\n nextFilteredBotCommands && nextFilteredBotCommands.length ? nextFilteredBotCommands : undefined,\n );\n });\n }, [botCommands, chatBotCommands]);\n\n useEffect(() => {\n if (!isAllowed || !html.length) {\n setFilteredBotCommands(undefined);\n return;\n }\n\n const shouldShowCommands = html.startsWith('/');\n\n if (shouldShowCommands) {\n const filter = prepareForRegExp(html.substr(1)).match(RE_COMMAND);\n getFilteredCommands(filter ? filter[0] : '');\n } else {\n setFilteredBotCommands(undefined);\n }\n }, [getFilteredCommands, html, isAllowed, unmarkIsOpen]);\n\n useEffect(() => {\n if (filteredBotCommands && filteredBotCommands.length && html.length > 0) {\n markIsOpen();\n } else {\n unmarkIsOpen();\n }\n }, [filteredBotCommands, html.length, markIsOpen, unmarkIsOpen]);\n\n return {\n isOpen,\n close: unmarkIsOpen,\n filteredBotCommands,\n };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './DeleteMessageModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst DeleteMessageModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const DeleteMessageModal = useModuleLoader(Bundles.Extra, 'DeleteMessageModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return DeleteMessageModal ? <DeleteMessageModal {...props} /> : undefined;\n};\n\nexport default memo(DeleteMessageModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useRef, useCallback, memo } from '../../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\n\nimport type { OwnProps as ButtonProps } from './Button';\nimport Button from './Button';\n\ntype OwnProps = {\n onActivate: NoneToVoidFunction;\n} & Omit<ButtonProps, (\n 'onClick' | 'onMouseDown' |\n 'onMouseEnter' | 'onMouseLeave' |\n 'onFocus'\n)>;\n\nconst BUTTON_ACTIVATE_DELAY = 200;\nlet openTimeout: number | undefined;\nlet isFirstTimeActivation = true;\n\nconst ResponsiveHoverButton: FC<OwnProps> = ({ onActivate, ...buttonProps }) => {\n const isMouseInside = useRef(false);\n\n const handleMouseEnter = useCallback(() => {\n isMouseInside.current = true;\n\n // This is used to counter additional delay caused by asynchronous module loading\n if (isFirstTimeActivation) {\n isFirstTimeActivation = false;\n onActivate();\n return;\n }\n\n if (openTimeout) {\n clearTimeout(openTimeout);\n openTimeout = undefined;\n }\n openTimeout = window.setTimeout(() => {\n if (isMouseInside.current) {\n onActivate();\n }\n }, BUTTON_ACTIVATE_DELAY);\n }, [onActivate]);\n\n const handleMouseLeave = useCallback(() => {\n isMouseInside.current = false;\n }, []);\n\n return (\n <Button\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...buttonProps}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n onClick={onActivate}\n />\n );\n};\n\nexport default memo(ResponsiveHoverButton);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"JDpb9xn3FmOzR6pVNK6n\",\"compact\":\"kq_1N12wqP7sbQ3EhVqO\",\"image\":\"Bo8mxv82IZ6uf0lrclLq\"};","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../../lib/teact/teact';\n\nimport type { ISettings } from '../../../types';\nimport type { ApiDocument } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\n\nimport { IS_COMPACT_MENU } from '../../../util/environment';\nimport useMedia from '../../../hooks/useMedia';\nimport { getDocumentMediaHash } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\n\nimport styles from './AttachmentMenuBotIcon.module.scss';\n\ntype OwnProps = {\n icon: ApiDocument;\n theme: ISettings['theme'];\n};\n\nconst ADDITIONAL_STROKE_WIDTH = '0.5px';\nconst DARK_THEME_COLOR = 'rgb(170, 170, 170)';\nconst LIGHT_THEME_COLOR = 'rgb(112, 117, 121)';\nconst COLOR_REPLACE_PATTERN = /#fff/gi;\n\nconst AttachmentMenuBotIcon: FC<OwnProps> = ({\n icon, theme,\n}) => {\n const mediaData = useMedia(getDocumentMediaHash(icon), false, ApiMediaFormat.Text);\n\n const iconSvg = useMemo(() => {\n if (!mediaData) return '';\n const color = theme === 'dark' ? DARK_THEME_COLOR : LIGHT_THEME_COLOR;\n\n const mediaDataWithReplacedColors = mediaData.replace(COLOR_REPLACE_PATTERN, color);\n const doc = new DOMParser().parseFromString(mediaDataWithReplacedColors, 'image/svg+xml');\n doc.querySelectorAll('path').forEach((l) => {\n l.style.stroke = color;\n l.style.strokeWidth = ADDITIONAL_STROKE_WIDTH;\n });\n\n return `data:image/svg+xml;utf8,${doc.documentElement.outerHTML}`;\n }, [mediaData, theme]);\n\n return (\n <i className={buildClassName(styles.root, IS_COMPACT_MENU && styles.compact)}>\n <img src={iconSvg} alt=\"\" className={buildClassName(styles.image, IS_COMPACT_MENU && styles.compact)} />\n </i>\n );\n};\n\nexport default memo(AttachmentMenuBotIcon);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useMemo, useState,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { IAnchorPosition, ISettings } from '../../../types';\nimport type { ApiAttachMenuBot } from '../../../api/types';\n\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\n\nimport Portal from '../../ui/Portal';\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\nimport AttachmentMenuBotIcon from './AttachmentMenuBotIcon';\n\ntype OwnProps = {\n bot: ApiAttachMenuBot;\n theme: ISettings['theme'];\n chatId: string;\n onMenuOpened: VoidFunction;\n onMenuClosed: VoidFunction;\n};\n\nconst AttachmentMenuBotItem: FC<OwnProps> = ({\n bot,\n theme,\n chatId,\n onMenuOpened,\n onMenuClosed,\n}) => {\n const { callAttachMenuBot, toggleBotInAttachMenu } = getActions();\n\n const lang = useLang();\n\n const icon = useMemo(() => {\n return bot.icons.find(({ name }) => name === 'default_static')?.document;\n }, [bot.icons]);\n\n const [isMenuOpen, openMenu, closeMenu] = useFlag();\n const [menuPosition, setMenuPosition] = useState<IAnchorPosition | undefined>(undefined);\n\n const handleContextMenu = useCallback((e: React.UIEvent) => {\n e.preventDefault();\n const rect = e.currentTarget.getBoundingClientRect();\n setMenuPosition({ x: rect.right, y: rect.bottom });\n onMenuOpened();\n openMenu();\n }, [onMenuOpened, openMenu]);\n\n const handleCloseMenu = useCallback(() => {\n closeMenu();\n onMenuClosed();\n }, [closeMenu, onMenuClosed]);\n\n const handleCloseAnimationEnd = useCallback(() => {\n setMenuPosition(undefined);\n }, []);\n\n const handleRemoveBot = useCallback(() => {\n toggleBotInAttachMenu({\n botId: bot.id,\n isEnabled: false,\n });\n }, [bot.id, toggleBotInAttachMenu]);\n\n return (\n <MenuItem\n key={bot.id}\n customIcon={icon && <AttachmentMenuBotIcon icon={icon} theme={theme} />}\n icon={!icon ? 'bots' : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => callAttachMenuBot({\n botId: bot.id,\n chatId,\n })}\n onContextMenu={handleContextMenu}\n >\n {bot.shortName}\n {menuPosition && (\n <Portal>\n <Menu\n isOpen={isMenuOpen}\n positionX=\"right\"\n style={`left: ${menuPosition.x}px;top: ${menuPosition.y}px;`}\n className=\"bot-attach-context-menu\"\n autoClose\n onClose={handleCloseMenu}\n onCloseAnimationEnd={handleCloseAnimationEnd}\n >\n <MenuItem icon=\"stop\" destructive onClick={handleRemoveBot}>{lang('WebApp.RemoveBot')}</MenuItem>\n </Menu>\n </Portal>\n )}\n\n </MenuItem>\n );\n};\n\nexport default memo(AttachmentMenuBotItem);\n","import React, {\n memo, useMemo, useCallback, useEffect,\n} from '../../../lib/teact/teact';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { GlobalState } from '../../../global/types';\nimport type { ApiAttachMenuPeerType } from '../../../api/types';\nimport type { ISettings } from '../../../types';\n\nimport { CONTENT_TYPES_WITH_PREVIEW } from '../../../config';\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { openSystemFilesDialog } from '../../../util/systemFilesDialog';\n\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useLang from '../../../hooks/useLang';\nimport useFlag from '../../../hooks/useFlag';\n\nimport ResponsiveHoverButton from '../../ui/ResponsiveHoverButton';\nimport Menu from '../../ui/Menu';\nimport MenuItem from '../../ui/MenuItem';\nimport AttachmentMenuBotItem from './AttachmentMenuBotItem';\n\nimport './AttachMenu.scss';\n\nexport type OwnProps = {\n chatId: string;\n isButtonVisible: boolean;\n canAttachMedia: boolean;\n canAttachPolls: boolean;\n isScheduled?: boolean;\n attachMenuBots: GlobalState['attachMenu']['bots'];\n peerType?: ApiAttachMenuPeerType;\n onFileSelect: (files: File[], isQuick: boolean) => void;\n onPollCreate: () => void;\n theme: ISettings['theme'];\n};\n\nconst AttachMenu: FC<OwnProps> = ({\n chatId,\n isButtonVisible,\n canAttachMedia,\n canAttachPolls,\n attachMenuBots,\n peerType,\n isScheduled,\n onFileSelect,\n onPollCreate,\n theme,\n}) => {\n const [isAttachMenuOpen, openAttachMenu, closeAttachMenu] = useFlag();\n const [handleMouseEnter, handleMouseLeave, markMouseInside] = useMouseInside(isAttachMenuOpen, closeAttachMenu);\n\n const [isAttachmentBotMenuOpen, markAttachmentBotMenuOpen, unmarkAttachmentBotMenuOpen] = useFlag();\n useEffect(() => {\n if (isAttachMenuOpen) {\n markMouseInside();\n }\n }, [isAttachMenuOpen, markMouseInside]);\n\n const handleToggleAttachMenu = useCallback(() => {\n if (isAttachMenuOpen) {\n closeAttachMenu();\n } else {\n openAttachMenu();\n }\n }, [isAttachMenuOpen, openAttachMenu, closeAttachMenu]);\n\n const handleFileSelect = useCallback((e: Event, isQuick: boolean) => {\n const { files } = e.target as HTMLInputElement;\n\n if (files && files.length > 0) {\n onFileSelect(Array.from(files), isQuick);\n }\n }, [onFileSelect]);\n\n const handleQuickSelect = useCallback(() => {\n openSystemFilesDialog(\n Array.from(CONTENT_TYPES_WITH_PREVIEW).join(','),\n (e) => handleFileSelect(e, true),\n );\n }, [handleFileSelect]);\n\n const handleDocumentSelect = useCallback(() => {\n openSystemFilesDialog('*', (e) => handleFileSelect(e, false));\n }, [handleFileSelect]);\n\n const bots = useMemo(() => {\n return Object.values(attachMenuBots).filter((bot) => {\n if (!peerType) return false;\n if (peerType === 'bot' && bot.id === chatId && bot.peerTypes.includes('self')) {\n return true;\n }\n return bot.peerTypes.includes(peerType);\n });\n }, [attachMenuBots, chatId, peerType]);\n\n const lang = useLang();\n\n if (!isButtonVisible) {\n return undefined;\n }\n\n return (\n <div className=\"AttachMenu\">\n <ResponsiveHoverButton\n id=\"attach-menu-button\"\n className={isAttachMenuOpen ? 'AttachMenu--button activated' : 'AttachMenu--button'}\n round\n color=\"translucent\"\n onActivate={handleToggleAttachMenu}\n ariaLabel=\"Add an attachment\"\n ariaControls=\"attach-menu-controls\"\n hasPopup\n >\n <i className=\"icon-attach\" />\n </ResponsiveHoverButton>\n <Menu\n id=\"attach-menu-controls\"\n isOpen={isAttachMenuOpen || isAttachmentBotMenuOpen}\n autoClose\n positionX=\"right\"\n positionY=\"bottom\"\n onClose={closeAttachMenu}\n className=\"AttachMenu--menu fluid\"\n onCloseAnimationEnd={closeAttachMenu}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCloseOnBackdrop={!IS_TOUCH_ENV}\n ariaLabelledBy=\"attach-menu-button\"\n >\n {/*\n ** Using ternary operator here causes some attributes from first clause\n ** transferring to the fragment content in the second clause\n */}\n {!canAttachMedia && (\n <MenuItem className=\"media-disabled\" disabled>Posting media content is not allowed in this group.</MenuItem>\n )}\n {canAttachMedia && (\n <>\n <MenuItem icon=\"photo\" onClick={handleQuickSelect}>{lang('AttachmentMenu.PhotoOrVideo')}</MenuItem>\n <MenuItem icon=\"document\" onClick={handleDocumentSelect}>{lang('AttachDocument')}</MenuItem>\n </>\n )}\n {canAttachPolls && (\n <MenuItem icon=\"poll\" onClick={onPollCreate}>{lang('Poll')}</MenuItem>\n )}\n\n {canAttachMedia && !isScheduled && bots.map((bot) => (\n <AttachmentMenuBotItem\n bot={bot}\n chatId={chatId}\n theme={theme}\n onMenuOpened={markAttachmentBotMenuOpen}\n onMenuClosed={unmarkAttachmentBotMenuOpen}\n />\n ))}\n </Menu>\n </div>\n );\n};\n\nexport default memo(AttachMenu);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './SymbolMenu';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst SymbolMenuAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const SymbolMenu = useModuleLoader(Bundles.Extra, 'SymbolMenu', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return SymbolMenu ? <SymbolMenu {...props} /> : undefined;\n};\n\nexport default memo(SymbolMenuAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './InlineBotTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst InlineBotTooltipAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const InlineBotTooltip = useModuleLoader(Bundles.Extra, 'InlineBotTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return InlineBotTooltip ? <InlineBotTooltip {...props} /> : undefined;\n};\n\nexport default memo(InlineBotTooltipAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './MentionTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst MentionTooltipAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const MentionTooltip = useModuleLoader(Bundles.Extra, 'MentionTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return MentionTooltip ? <MentionTooltip {...props} /> : undefined;\n};\n\nexport default memo(MentionTooltipAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './StickerTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst StickerTooltipAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const StickerTooltip = useModuleLoader(Bundles.Extra, 'StickerTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return StickerTooltip ? <StickerTooltip {...props} /> : undefined;\n};\n\nexport default memo(StickerTooltipAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './BotCommandTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst BotCommandTooltipAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const BotCommandTooltip = useModuleLoader(Bundles.Extra, 'BotCommandTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return BotCommandTooltip ? <BotCommandTooltip {...props} /> : undefined;\n};\n\nexport default memo(BotCommandTooltipAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiMessage } from '../../../api/types';\n\nimport { IS_TOUCH_ENV } from '../../../util/environment';\nimport { selectChatMessage, selectCurrentMessageList } from '../../../global/selectors';\nimport useMouseInside from '../../../hooks/useMouseInside';\nimport useFlag from '../../../hooks/useFlag';\n\nimport Menu from '../../ui/Menu';\nimport Button from '../../ui/Button';\n\nimport './BotKeyboardMenu.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n messageId: number;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n message?: ApiMessage;\n};\n\nconst BotKeyboardMenu: FC<OwnProps & StateProps> = ({\n isOpen, message, onClose,\n}) => {\n const { clickBotInlineButton } = getActions();\n\n const [handleMouseEnter, handleMouseLeave] = useMouseInside(isOpen, onClose);\n const { isKeyboardSingleUse } = message || {};\n const [forceOpen, markForceOpen, unmarkForceOpen] = useFlag(true);\n\n const handleClose = useCallback(() => {\n unmarkForceOpen();\n onClose();\n }, [onClose, unmarkForceOpen]);\n\n useEffect(() => {\n markForceOpen();\n }, [markForceOpen, message?.keyboardButtons]);\n\n if (!message || !message.keyboardButtons) {\n return undefined;\n }\n\n return (\n <Menu\n isOpen={isOpen || forceOpen}\n autoClose={isKeyboardSingleUse}\n positionX=\"right\"\n positionY=\"bottom\"\n onClose={handleClose}\n className=\"BotKeyboardMenu\"\n onCloseAnimationEnd={handleClose}\n onMouseEnter={!IS_TOUCH_ENV ? handleMouseEnter : undefined}\n onMouseLeave={!IS_TOUCH_ENV ? handleMouseLeave : undefined}\n noCompact\n >\n <div className=\"content\">\n {message.keyboardButtons.map((row) => (\n <div className=\"row\">\n {row.map((button) => (\n <Button\n ripple\n disabled={button.type === 'unsupported'}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => clickBotInlineButton({ messageId: message.id, button })}\n >\n {button.text}\n </Button>\n ))}\n </div>\n ))}\n </div>\n </Menu>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { messageId }): StateProps => {\n const { chatId } = selectCurrentMessageList(global) || {};\n if (!chatId) {\n return {};\n }\n\n return { message: selectChatMessage(global, chatId, messageId) };\n },\n)(BotKeyboardMenu));\n","import React, {\n memo, useCallback, useEffect, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { ApiChat, ApiMessage, ApiUser } from '../../../api/types';\nimport { ApiMessageEntityTypes } from '../../../api/types';\n\nimport {\n selectChat,\n selectChatMessage,\n selectSender,\n selectForwardedSender,\n selectUser,\n selectCurrentMessageList,\n selectReplyingToId,\n selectEditingId,\n selectEditingScheduledId,\n selectEditingMessage,\n selectIsChatWithSelf,\n selectIsCurrentUserPremium,\n} from '../../../global/selectors';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport buildClassName from '../../../util/buildClassName';\nimport { isUserId } from '../../../global/helpers';\n\nimport useAsyncRendering from '../../right/hooks/useAsyncRendering';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useLang from '../../../hooks/useLang';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\nimport useContextMenuPosition from '../../../hooks/useContextMenuPosition';\n\nimport Button from '../../ui/Button';\nimport EmbeddedMessage from '../../common/EmbeddedMessage';\nimport MenuItem from '../../ui/MenuItem';\nimport Menu from '../../ui/Menu';\nimport MenuSeparator from '../../ui/MenuSeparator';\n\nimport './ComposerEmbeddedMessage.scss';\n\ntype StateProps = {\n replyingToId?: number;\n editingId?: number;\n message?: ApiMessage;\n sender?: ApiUser | ApiChat;\n shouldAnimate?: boolean;\n forwardedMessagesCount?: number;\n noAuthors?: boolean;\n noCaptions?: boolean;\n forwardsHaveCaptions?: boolean;\n isCurrentUserPremium?: boolean;\n};\n\ntype OwnProps = {\n onClear?: () => void;\n};\n\nconst FORWARD_RENDERING_DELAY = 300;\n\nconst ComposerEmbeddedMessage: FC<OwnProps & StateProps> = ({\n replyingToId,\n editingId,\n message,\n sender,\n shouldAnimate,\n forwardedMessagesCount,\n noAuthors,\n noCaptions,\n forwardsHaveCaptions,\n isCurrentUserPremium,\n onClear,\n}) => {\n const {\n setReplyingToId,\n setEditingId,\n focusMessage,\n changeForwardRecipient,\n setForwardNoAuthors,\n setForwardNoCaptions,\n exitForwardMode,\n } = getActions();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n const lang = useLang();\n\n const isForwarding = Boolean(forwardedMessagesCount);\n const isShown = Boolean(\n ((replyingToId || editingId) && message)\n || (sender && forwardedMessagesCount),\n );\n const canAnimate = useAsyncRendering(\n [forwardedMessagesCount],\n forwardedMessagesCount ? FORWARD_RENDERING_DELAY : undefined,\n );\n\n const {\n shouldRender, transitionClassNames,\n } = useShowTransition(canAnimate && isShown, undefined, !shouldAnimate, undefined, !shouldAnimate);\n\n const clearEmbedded = useCallback(() => {\n if (replyingToId) {\n setReplyingToId({ messageId: undefined });\n } else if (editingId) {\n setEditingId({ messageId: undefined });\n } else if (forwardedMessagesCount) {\n exitForwardMode();\n }\n onClear?.();\n }, [replyingToId, editingId, forwardedMessagesCount, onClear, setReplyingToId, setEditingId, exitForwardMode]);\n\n useEffect(() => (isShown ? captureEscKeyListener(clearEmbedded) : undefined), [isShown, clearEmbedded]);\n\n const handleMessageClick = useCallback((): void => {\n if (isForwarding) return;\n focusMessage({ chatId: message!.chatId, messageId: message!.id });\n }, [focusMessage, isForwarding, message]);\n\n const handleClearClick = useCallback((e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {\n e.stopPropagation();\n clearEmbedded();\n }, [clearEmbedded]);\n\n const handleChangeRecipientClick = useCallback(() => {\n changeForwardRecipient();\n }, [changeForwardRecipient]);\n\n const {\n isContextMenuOpen, contextMenuPosition, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref);\n\n const getTriggerElement = useCallback(() => ref.current, []);\n const getRootElement = useCallback(() => ref.current!, []);\n const getMenuElement = useCallback(() => ref.current!.querySelector('.forward-context-menu .bubble'), []);\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n const className = buildClassName('ComposerEmbeddedMessage', transitionClassNames);\n\n const leftIcon = useMemo(() => {\n if (replyingToId) {\n return 'icon-reply';\n }\n if (editingId) {\n return 'icon-edit';\n }\n if (isForwarding) {\n return 'icon-forward';\n }\n\n return undefined;\n }, [editingId, isForwarding, replyingToId]);\n\n const customText = forwardedMessagesCount && forwardedMessagesCount > 1\n ? lang('ForwardedMessageCount', forwardedMessagesCount)\n : undefined;\n\n const strippedMessage = useMemo(() => {\n const textEntities = message?.content.text?.entities;\n if (!message || !isForwarding || !textEntities?.length || !noAuthors || isCurrentUserPremium) return message;\n\n const filteredEntities = textEntities.filter((entity) => entity.type !== ApiMessageEntityTypes.CustomEmoji);\n return {\n ...message,\n content: {\n ...message.content,\n text: {\n text: message.content.text!.text,\n entities: filteredEntities,\n },\n },\n };\n }, [isCurrentUserPremium, isForwarding, message, noAuthors]);\n\n if (!shouldRender) {\n return undefined;\n }\n\n return (\n <div className={className} ref={ref} onContextMenu={handleContextMenu} onClick={handleContextMenu}>\n <div>\n <div className=\"embedded-left-icon\">\n <i className={leftIcon} />\n </div>\n <EmbeddedMessage\n className=\"inside-input\"\n message={strippedMessage}\n sender={!noAuthors ? sender : undefined}\n customText={customText}\n title={editingId ? lang('EditMessage') : noAuthors ? lang('HiddenSendersNameDescription') : undefined}\n onClick={handleMessageClick}\n hasContextMenu={isForwarding}\n />\n <Button\n className=\"embedded-cancel\"\n round\n faded\n color=\"translucent\"\n ariaLabel={lang('Cancel')}\n onClick={handleClearClick}\n >\n <i className=\"icon-close\" />\n </Button>\n {isForwarding && (\n <Menu\n isOpen={isContextMenuOpen}\n transformOriginX={transformOriginX}\n transformOriginY={transformOriginY}\n positionX={positionX}\n positionY={positionY}\n style={menuStyle}\n className=\"forward-context-menu\"\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n >\n <MenuItem\n icon={!noAuthors ? 'message-succeeded' : undefined}\n customIcon={noAuthors ? <i className=\"icon-placeholder\" /> : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setForwardNoAuthors(false)}\n >\n {lang(forwardedMessagesCount > 1 ? 'ShowSenderNames' : 'ShowSendersName')}\n </MenuItem>\n <MenuItem\n icon={noAuthors ? 'message-succeeded' : undefined}\n customIcon={!noAuthors ? <i className=\"icon-placeholder\" /> : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setForwardNoAuthors(true)}\n >\n {lang(forwardedMessagesCount > 1 ? 'HideSenderNames' : 'HideSendersName')}\n </MenuItem>\n {forwardsHaveCaptions && (\n <>\n <MenuSeparator />\n <MenuItem\n icon={!noCaptions ? 'message-succeeded' : undefined}\n customIcon={noCaptions ? <i className=\"icon-placeholder\" /> : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setForwardNoCaptions(false)}\n >\n {lang(forwardedMessagesCount > 1 ? 'Conversation.ForwardOptions.ShowCaption' : 'ShowCaption')}\n </MenuItem>\n <MenuItem\n icon={noCaptions ? 'message-succeeded' : undefined}\n customIcon={!noCaptions ? <i className=\"icon-placeholder\" /> : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => setForwardNoCaptions(true)}\n >\n {lang(forwardedMessagesCount > 1 ? 'Conversation.ForwardOptions.HideCaption' : 'HideCaption')}\n </MenuItem>\n </>\n )}\n <MenuSeparator />\n <MenuItem icon=\"replace\" onClick={handleChangeRecipientClick}>\n {lang('ChangeRecipient')}\n </MenuItem>\n </Menu>\n )}\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n const { chatId, threadId, type: messageListType } = selectCurrentMessageList(global) || {};\n if (!chatId || !threadId || !messageListType) {\n return {};\n }\n\n const {\n forwardMessages: {\n fromChatId, toChatId, messageIds: forwardMessageIds, noAuthors, noCaptions,\n },\n } = global;\n\n const replyingToId = selectReplyingToId(global, chatId, threadId);\n const editingId = messageListType === 'scheduled'\n ? selectEditingScheduledId(global, chatId)\n : selectEditingId(global, chatId, threadId);\n const shouldAnimate = global.settings.byKey.animationLevel >= 1;\n const isForwarding = toChatId === chatId;\n const forwardedMessages = forwardMessageIds?.map((id) => selectChatMessage(global, fromChatId!, id)!);\n\n let message: ApiMessage | undefined;\n if (replyingToId) {\n message = selectChatMessage(global, chatId, replyingToId);\n } else if (editingId) {\n message = selectEditingMessage(global, chatId, threadId, messageListType);\n } else if (isForwarding && forwardMessageIds!.length === 1) {\n message = forwardedMessages?.[0];\n }\n\n let sender: ApiChat | ApiUser | undefined;\n if (replyingToId && message) {\n const { forwardInfo } = message;\n const isChatWithSelf = selectIsChatWithSelf(global, chatId);\n if (forwardInfo && (forwardInfo.isChannelPost || isChatWithSelf)) {\n sender = selectForwardedSender(global, message);\n }\n\n if (!sender && !forwardInfo?.hiddenUserName) {\n sender = selectSender(global, message);\n }\n } else if (isForwarding) {\n if (message) {\n sender = selectForwardedSender(global, message);\n if (!sender) {\n sender = selectSender(global, message);\n }\n }\n if (!sender) {\n sender = isUserId(fromChatId!) ? selectUser(global, fromChatId!) : selectChat(global, fromChatId!);\n }\n }\n\n const forwardsHaveCaptions = forwardedMessages?.some((forward) => (\n forward?.content.text && Object.keys(forward.content).length > 1\n ));\n\n return {\n replyingToId,\n editingId,\n message,\n sender,\n shouldAnimate,\n forwardedMessagesCount: isForwarding ? forwardMessageIds!.length : undefined,\n noAuthors,\n noCaptions,\n forwardsHaveCaptions,\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\n };\n },\n)(ComposerEmbeddedMessage));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './AttachmentModal';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst AttachmentModalAsync: FC<OwnProps> = (props) => {\n const { attachments } = props;\n const AttachmentModal = useModuleLoader(Bundles.Extra, 'AttachmentModal', !attachments.length);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return AttachmentModal ? <AttachmentModal {...props} /> : undefined;\n};\n\nexport default memo(AttachmentModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './BotCommandMenu';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst BotCommandMenuAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const BotCommandMenu = useModuleLoader(Bundles.Extra, 'BotCommandMenu', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return BotCommandMenu ? <BotCommandMenu {...props} /> : undefined;\n};\n\nexport default memo(BotCommandMenuAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './PollModal';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst PollModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const PollModal = useModuleLoader(Bundles.Extra, 'PollModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return PollModal ? <PollModal {...props} /> : undefined;\n};\n\nexport default memo(PollModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './DropArea';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst DropAreaAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const DropArea = useModuleLoader(Bundles.Extra, 'DropArea', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return DropArea ? <DropArea {...props} /> : undefined;\n};\n\nexport default memo(DropAreaAsync);\nexport { DropAreaState } from './DropArea';\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { ApiMessage, ApiMessageEntityTextUrl, ApiWebPage } from '../../../api/types';\nimport { ApiMessageEntityTypes } from '../../../api/types';\nimport type { ISettings } from '../../../types';\n\nimport { RE_LINK_TEMPLATE } from '../../../config';\nimport { selectNoWebPage, selectTheme } from '../../../global/selectors';\nimport parseMessageInput from '../../../util/parseMessageInput';\nimport useOnChange from '../../../hooks/useOnChange';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useCurrentOrPrev from '../../../hooks/useCurrentOrPrev';\nimport useDebouncedMemo from '../../../hooks/useDebouncedMemo';\nimport buildClassName from '../../../util/buildClassName';\n\nimport WebPage from '../message/WebPage';\nimport Button from '../../ui/Button';\n\nimport './WebPagePreview.scss';\n\ntype OwnProps = {\n chatId: string;\n threadId: number;\n messageText: string;\n disabled?: boolean;\n};\n\ntype StateProps = {\n webPagePreview?: ApiWebPage;\n noWebPage?: boolean;\n theme: ISettings['theme'];\n};\n\nconst DEBOUNCE_MS = 300;\nconst RE_LINK = new RegExp(RE_LINK_TEMPLATE, 'i');\n\nconst WebPagePreview: FC<OwnProps & StateProps> = ({\n chatId,\n threadId,\n messageText,\n disabled,\n webPagePreview,\n noWebPage,\n theme,\n}) => {\n const {\n loadWebPagePreview,\n clearWebPagePreview,\n toggleMessageWebPage,\n } = getActions();\n\n const link = useDebouncedMemo(() => {\n const { text, entities } = parseMessageInput(messageText);\n\n const linkEntity = entities?.find((entity): entity is ApiMessageEntityTextUrl => (\n entity.type === ApiMessageEntityTypes.TextUrl\n ));\n if (linkEntity) {\n return linkEntity.url;\n }\n\n const textMatch = text.match(RE_LINK);\n if (textMatch) {\n return textMatch[0];\n }\n\n return undefined;\n }, DEBOUNCE_MS, [messageText]);\n\n useEffect(() => {\n if (link) {\n loadWebPagePreview({ text: link });\n } else {\n clearWebPagePreview();\n toggleMessageWebPage({ chatId, threadId });\n }\n }, [chatId, toggleMessageWebPage, clearWebPagePreview, link, loadWebPagePreview, threadId]);\n\n useOnChange(() => {\n clearWebPagePreview();\n toggleMessageWebPage({ chatId, threadId });\n }, [chatId]);\n\n const isShown = Boolean(webPagePreview && messageText.length && !noWebPage && !disabled);\n const { shouldRender, transitionClassNames } = useShowTransition(isShown);\n\n const renderingWebPage = useCurrentOrPrev(webPagePreview, true);\n\n const handleClearWebpagePreview = useCallback(() => {\n toggleMessageWebPage({ chatId, threadId, noWebPage: true });\n }, [chatId, threadId, toggleMessageWebPage]);\n\n if (!shouldRender || !renderingWebPage) {\n return undefined;\n }\n\n // TODO Refactor so `WebPage` can be used without message\n const { photo, ...webPageWithoutPhoto } = renderingWebPage;\n const messageStub = {\n content: {\n webPage: webPageWithoutPhoto,\n },\n } as ApiMessage;\n\n return (\n <div className={buildClassName('WebPagePreview', transitionClassNames)}>\n <div>\n <div className=\"WebPagePreview-left-icon\">\n <i className=\"icon-link\" />\n </div>\n <WebPage message={messageStub} inPreview theme={theme} />\n <Button\n className=\"WebPagePreview-clear\"\n round\n faded\n color=\"translucent\"\n ariaLabel=\"Clear Webpage Preview\"\n onClick={handleClearWebpagePreview}\n >\n <i className=\"icon-close\" />\n </Button>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId }): StateProps => {\n const noWebPage = selectNoWebPage(global, chatId, threadId);\n return {\n theme: selectTheme(global),\n webPagePreview: global.webPagePreview,\n noWebPage,\n };\n },\n)(WebPagePreview));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './SendAsMenu';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst SendAsMenuAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const SendAsMenu = useModuleLoader(Bundles.Extra, 'SendAsMenu', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return SendAsMenu ? <SendAsMenu {...props} /> : undefined;\n};\n\nexport default memo(SendAsMenuAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useEffect, useRef } from '../../../lib/teact/teact';\n\nimport buildClassName from '../../../util/buildClassName';\n\nimport Button from '../../ui/Button';\n\ntype OwnProps = {\n isOpen?: boolean;\n onClick: VoidFunction;\n text: string;\n isDisabled?: boolean;\n};\n\nconst BotMenuButton: FC<OwnProps> = ({\n isOpen,\n onClick,\n text,\n isDisabled,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const textRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const textEl = textRef.current;\n if (!textEl) return;\n\n const width = textEl.scrollWidth + 1; // Make width slightly bigger prevent ellipsis in some cases\n\n const composerEl = textEl.closest('.Composer') as HTMLElement;\n composerEl.style.setProperty('--bot-menu-text-width', `${width}px`);\n }, [isOpen, text]);\n\n useEffect(() => {\n const textEl = textRef.current;\n if (!textEl) return undefined;\n\n const composerEl = textEl.closest('.Composer') as HTMLElement;\n\n return () => {\n composerEl.style.removeProperty('--bot-menu-text-width');\n };\n }, []);\n\n return (\n <Button\n className={buildClassName('bot-menu', isOpen && 'open')}\n round\n color=\"translucent\"\n disabled={isDisabled}\n onClick={onClick}\n ariaLabel=\"Open bot command keyboard\"\n >\n <i className={buildClassName('bot-menu-icon', 'icon-webapp', isOpen && 'open')} />\n <span ref={textRef} className=\"bot-menu-text\">{text}</span>\n </Button>\n );\n};\n\nexport default memo(BotMenuButton);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { GlobalState, MessageListType } from '../../../global/types';\nimport type {\n ApiAttachment,\n ApiBotInlineResult,\n ApiBotInlineMediaResult,\n ApiSticker,\n ApiVideo,\n ApiNewPoll,\n ApiMessage,\n ApiFormattedText,\n ApiChat,\n ApiChatMember,\n ApiUser,\n ApiBotCommand,\n ApiBotMenuButton,\n ApiAttachMenuPeerType,\n} from '../../../api/types';\nimport {\n MAIN_THREAD_ID,\n} from '../../../api/types';\nimport type { InlineBotSettings, ISettings } from '../../../types';\n\nimport {\n BASE_EMOJI_KEYWORD_LANG,\n EDITABLE_INPUT_ID,\n REPLIES_USER_ID,\n SEND_MESSAGE_ACTION_INTERVAL,\n EDITABLE_INPUT_CSS_SELECTOR, MAX_UPLOAD_FILEPART_SIZE,\n} from '../../../config';\nimport { IS_VOICE_RECORDING_SUPPORTED, IS_SINGLE_COLUMN_LAYOUT, IS_IOS } from '../../../util/environment';\nimport { MEMO_EMPTY_ARRAY } from '../../../util/memo';\nimport {\n selectChat,\n selectIsRightColumnShown,\n selectIsInSelectMode,\n selectNewestMessageWithBotKeyboardButtons,\n selectDraft,\n selectScheduledIds,\n selectEditingMessage,\n selectIsChatWithSelf,\n selectChatBot,\n selectChatMessage,\n selectUser,\n selectCanScheduleUntilOnline,\n selectEditingScheduledDraft,\n selectEditingDraft,\n selectRequestedText,\n selectTheme,\n selectCurrentMessageList,\n selectIsCurrentUserPremium,\n selectAttachMenuPeerType,\n} from '../../../global/selectors';\nimport {\n getAllowedAttachmentOptions,\n getChatSlowModeOptions,\n isChatAdmin,\n isChatSuperGroup,\n isChatChannel,\n} from '../../../global/helpers';\nimport { formatMediaDuration, formatVoiceRecordDuration } from '../../../util/dateFormat';\nimport focusEditableElement from '../../../util/focusEditableElement';\nimport parseMessageInput from '../../../util/parseMessageInput';\nimport buildAttachment from './helpers/buildAttachment';\nimport renderText from '../../common/helpers/renderText';\nimport { insertHtmlInSelection } from '../../../util/selection';\nimport deleteLastCharacterOutsideSelection from '../../../util/deleteLastCharacterOutsideSelection';\nimport buildClassName from '../../../util/buildClassName';\nimport windowSize from '../../../util/windowSize';\nimport { isSelectionInsideInput } from './helpers/selection';\nimport applyIosAutoCapitalizationFix from './helpers/applyIosAutoCapitalizationFix';\nimport { getServerTime } from '../../../util/serverTime';\nimport { selectCurrentLimit } from '../../../global/selectors/limits';\n\nimport useFlag from '../../../hooks/useFlag';\nimport usePrevious from '../../../hooks/usePrevious';\nimport useStickerTooltip from './hooks/useStickerTooltip';\nimport useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';\nimport useLang from '../../../hooks/useLang';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\nimport useInterval from '../../../hooks/useInterval';\nimport useOnChange from '../../../hooks/useOnChange';\nimport { useStateRef } from '../../../hooks/useStateRef';\nimport useVoiceRecording from './hooks/useVoiceRecording';\nimport useClipboardPaste from './hooks/useClipboardPaste';\nimport useDraft from './hooks/useDraft';\nimport useEditing from './hooks/useEditing';\nimport useEmojiTooltip from './hooks/useEmojiTooltip';\nimport useMentionTooltip from './hooks/useMentionTooltip';\nimport useInlineBotTooltip from './hooks/useInlineBotTooltip';\nimport useBotCommandTooltip from './hooks/useBotCommandTooltip';\nimport useSchedule from '../../../hooks/useSchedule';\n\nimport DeleteMessageModal from '../../common/DeleteMessageModal.async';\nimport Button from '../../ui/Button';\nimport ResponsiveHoverButton from '../../ui/ResponsiveHoverButton';\nimport Spinner from '../../ui/Spinner';\nimport AttachMenu from './AttachMenu';\nimport Avatar from '../../common/Avatar';\nimport SymbolMenu from './SymbolMenu.async';\nimport InlineBotTooltip from './InlineBotTooltip.async';\nimport MentionTooltip from './MentionTooltip.async';\nimport CustomSendMenu from './CustomSendMenu.async';\nimport StickerTooltip from './StickerTooltip.async';\nimport EmojiTooltip from './EmojiTooltip.async';\nimport BotCommandTooltip from './BotCommandTooltip.async';\nimport BotKeyboardMenu from './BotKeyboardMenu';\nimport MessageInput from './MessageInput';\nimport ComposerEmbeddedMessage from './ComposerEmbeddedMessage';\nimport AttachmentModal from './AttachmentModal.async';\nimport BotCommandMenu from './BotCommandMenu.async';\nimport PollModal from './PollModal.async';\nimport DropArea, { DropAreaState } from './DropArea.async';\nimport WebPagePreview from './WebPagePreview';\nimport SendAsMenu from './SendAsMenu.async';\nimport BotMenuButton from './BotMenuButton';\n\nimport './Composer.scss';\n\ntype OwnProps = {\n chatId: string;\n threadId: number;\n messageListType: MessageListType;\n dropAreaState: string;\n isReady: boolean;\n onDropHide: NoneToVoidFunction;\n};\n\ntype StateProps =\n {\n editingMessage?: ApiMessage;\n chat?: ApiChat;\n draft?: ApiFormattedText;\n isChatWithBot?: boolean;\n isChatWithSelf?: boolean;\n isChannel?: boolean;\n isForCurrentMessageList: boolean;\n isRightColumnShown?: boolean;\n isSelectModeActive?: boolean;\n isForwarding?: boolean;\n pollModal: GlobalState['pollModal'];\n botKeyboardMessageId?: number;\n botKeyboardPlaceholder?: string;\n withScheduledButton?: boolean;\n shouldSchedule?: boolean;\n canScheduleUntilOnline?: boolean;\n stickersForEmoji?: ApiSticker[];\n groupChatMembers?: ApiChatMember[];\n currentUserId?: string;\n recentEmojis: string[];\n lastSyncTime?: number;\n contentToBeScheduled?: GlobalState['messages']['contentToBeScheduled'];\n shouldSuggestStickers?: boolean;\n baseEmojiKeywords?: Record<string, string[]>;\n emojiKeywords?: Record<string, string[]>;\n topInlineBotIds?: string[];\n isInlineBotLoading: boolean;\n inlineBots?: Record<string, false | InlineBotSettings>;\n botCommands?: ApiBotCommand[] | false;\n botMenuButton?: ApiBotMenuButton;\n chatBotCommands?: ApiBotCommand[];\n sendAsUser?: ApiUser;\n sendAsChat?: ApiChat;\n sendAsId?: string;\n editingDraft?: ApiFormattedText;\n requestedText?: string;\n attachMenuBots: GlobalState['attachMenu']['bots'];\n attachMenuPeerType?: ApiAttachMenuPeerType;\n theme: ISettings['theme'];\n fileSizeLimit: number;\n captionLimit: number;\n isCurrentUserPremium?: boolean;\n canSendVoiceByPrivacy?: boolean;\n }\n & Pick<GlobalState, 'connectionState'>;\n\nenum MainButtonState {\n Send = 'send',\n Record = 'record',\n Edit = 'edit',\n Schedule = 'schedule',\n}\n\ntype ScheduledMessageArgs = GlobalState['messages']['contentToBeScheduled'] | {\n id: string; queryId: string; isSilent?: boolean;\n};\n\nconst VOICE_RECORDING_FILENAME = 'wonderful-voice-message.ogg';\n// When voice recording is active, composer placeholder will hide to prevent overlapping\nconst SCREEN_WIDTH_TO_HIDE_PLACEHOLDER = 600; // px\n\nconst MOBILE_KEYBOARD_HIDE_DELAY_MS = 100;\nconst SELECT_MODE_TRANSITION_MS = 200;\nconst MESSAGE_MAX_LENGTH = 4096;\nconst SENDING_ANIMATION_DURATION = 350;\n// eslint-disable-next-line max-len\nconst APPENDIX = '<svg width=\"9\" height=\"20\" xmlns=\"http://www.w3.org/2000/svg\"><defs><filter x=\"-50%\" y=\"-14.7%\" width=\"200%\" height=\"141.2%\" filterUnits=\"objectBoundingBox\" id=\"a\"><feOffset dy=\"1\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"/><feGaussianBlur stdDeviation=\"1\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"/><feColorMatrix values=\"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0\" in=\"shadowBlurOuter1\"/></filter></defs><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z\" fill=\"#000\" filter=\"url(#a)\"/><path d=\"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z\" fill=\"#FFF\" class=\"corner\"/></g></svg>';\n\nconst Composer: FC<OwnProps & StateProps> = ({\n dropAreaState,\n shouldSchedule,\n canScheduleUntilOnline,\n isReady,\n onDropHide,\n editingMessage,\n chatId,\n threadId,\n messageListType,\n draft,\n chat,\n isForCurrentMessageList,\n isCurrentUserPremium,\n canSendVoiceByPrivacy,\n connectionState,\n isChatWithBot,\n isChatWithSelf,\n isChannel,\n fileSizeLimit,\n isRightColumnShown,\n isSelectModeActive,\n isForwarding,\n pollModal,\n botKeyboardMessageId,\n botKeyboardPlaceholder,\n withScheduledButton,\n stickersForEmoji,\n groupChatMembers,\n topInlineBotIds,\n currentUserId,\n captionLimit,\n lastSyncTime,\n contentToBeScheduled,\n shouldSuggestStickers,\n baseEmojiKeywords,\n emojiKeywords,\n recentEmojis,\n inlineBots,\n isInlineBotLoading,\n botCommands,\n chatBotCommands,\n sendAsUser,\n sendAsChat,\n sendAsId,\n editingDraft,\n requestedText,\n botMenuButton,\n attachMenuBots,\n attachMenuPeerType,\n theme,\n}) => {\n const {\n sendMessage,\n clearDraft,\n showDialog,\n setStickerSearchQuery,\n setGifSearchQuery,\n forwardMessages,\n openPollModal,\n closePollModal,\n loadScheduledHistory,\n openChat,\n addRecentEmoji,\n sendInlineBotResult,\n loadSendAs,\n loadFullChat,\n resetOpenChatWithText,\n callAttachMenuBot,\n openLimitReachedModal,\n showNotification,\n } = getActions();\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const appendixRef = useRef<HTMLDivElement>(null);\n const [html, setHtml] = useState<string>('');\n const htmlRef = useStateRef(html);\n const lastMessageSendTimeSeconds = useRef<number>();\n const prevDropAreaState = usePrevious(dropAreaState);\n const { width: windowWidth } = windowSize.get();\n const sendAsIds = chat?.sendAsIds;\n const canShowSendAs = sendAsIds && (sendAsIds.length > 1 || !sendAsIds.includes(currentUserId!));\n // Prevent Symbol Menu from closing when calendar is open\n const [isSymbolMenuForced, forceShowSymbolMenu, cancelForceShowSymbolMenu] = useFlag();\n const sendMessageAction = useSendMessageAction(chatId, threadId);\n\n const handleScheduleCancel = useCallback(() => {\n cancelForceShowSymbolMenu();\n }, [cancelForceShowSymbolMenu]);\n const [requestCalendar, calendar] = useSchedule(canScheduleUntilOnline, handleScheduleCancel);\n\n useEffect(() => {\n lastMessageSendTimeSeconds.current = undefined;\n }, [chatId]);\n\n useEffect(() => {\n if (chatId && lastSyncTime && threadId === MAIN_THREAD_ID && isReady) {\n loadScheduledHistory({ chatId });\n }\n }, [isReady, chatId, loadScheduledHistory, lastSyncTime, threadId]);\n\n useEffect(() => {\n if (chatId && chat && lastSyncTime && !sendAsIds && isReady && isChatSuperGroup(chat)) {\n loadSendAs({ chatId });\n }\n }, [chat, chatId, isReady, lastSyncTime, loadSendAs, sendAsIds]);\n\n useEffect(() => {\n if (chatId && chat && lastSyncTime && !chat.fullInfo && isReady && isChatSuperGroup(chat)) {\n loadFullChat({ chatId });\n }\n }, [chat, chatId, isReady, lastSyncTime, loadFullChat]);\n\n const shouldAnimateSendAsButtonRef = useRef(false);\n useOnChange(([prevChatId, prevSendAsIds]) => {\n // We only animate send-as button if `sendAsIds` was missing when opening the chat\n shouldAnimateSendAsButtonRef.current = Boolean(chatId === prevChatId && sendAsIds && !prevSendAsIds);\n }, [chatId, sendAsIds]);\n\n useLayoutEffect(() => {\n if (!appendixRef.current) return;\n\n appendixRef.current.innerHTML = APPENDIX;\n }, []);\n\n const [attachments, setAttachments] = useState<ApiAttachment[]>([]);\n\n const [isBotKeyboardOpen, openBotKeyboard, closeBotKeyboard] = useFlag();\n const [isBotCommandMenuOpen, openBotCommandMenu, closeBotCommandMenu] = useFlag();\n const [isSymbolMenuOpen, openSymbolMenu, closeSymbolMenu] = useFlag();\n const [isSendAsMenuOpen, openSendAsMenu, closeSendAsMenu] = useFlag();\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isSymbolMenuLoaded, onSymbolMenuLoadingComplete] = useFlag();\n const [isHoverDisabled, disableHover, enableHover] = useFlag();\n\n const handleSetAttachments = useCallback(\n (newValue: ApiAttachment[] | ((current: ApiAttachment[]) => ApiAttachment[])) => {\n const newAttachments = typeof newValue === 'function' ? newValue(attachments) : newValue;\n if (newAttachments && newAttachments.some((l) => l.size > fileSizeLimit)) {\n openLimitReachedModal({\n limit: 'uploadMaxFileparts',\n });\n } else {\n setAttachments(newAttachments);\n }\n }, [attachments, fileSizeLimit, openLimitReachedModal],\n );\n\n const {\n startRecordingVoice,\n stopRecordingVoice,\n pauseRecordingVoice,\n activeVoiceRecording,\n currentRecordTime,\n recordButtonRef: mainButtonRef,\n startRecordTimeRef,\n } = useVoiceRecording();\n\n useInterval(() => {\n sendMessageAction({ type: 'recordAudio' });\n }, activeVoiceRecording && SEND_MESSAGE_ACTION_INTERVAL);\n\n useEffect(() => {\n if (!activeVoiceRecording) {\n sendMessageAction({ type: 'cancel' });\n }\n }, [activeVoiceRecording, sendMessageAction]);\n\n useEffect(() => {\n if (!html || editingMessage) return;\n sendMessageAction({ type: 'typing' });\n }, [editingMessage, html, sendMessageAction]);\n\n const mainButtonState = editingMessage ? MainButtonState.Edit\n : (!IS_VOICE_RECORDING_SUPPORTED || activeVoiceRecording || (html && !attachments.length) || isForwarding)\n ? (shouldSchedule ? MainButtonState.Schedule : MainButtonState.Send)\n : MainButtonState.Record;\n const canShowCustomSendMenu = !shouldSchedule;\n\n const {\n isMentionTooltipOpen, closeMentionTooltip, insertMention, mentionFilteredUsers,\n } = useMentionTooltip(\n !attachments.length,\n htmlRef,\n setHtml,\n undefined,\n groupChatMembers,\n topInlineBotIds,\n currentUserId,\n );\n\n const {\n isOpen: isInlineBotTooltipOpen,\n id: inlineBotId,\n isGallery: isInlineBotTooltipGallery,\n switchPm: inlineBotSwitchPm,\n results: inlineBotResults,\n closeTooltip: closeInlineBotTooltip,\n help: inlineBotHelp,\n loadMore: loadMoreForInlineBot,\n } = useInlineBotTooltip(\n Boolean(!attachments.length && lastSyncTime),\n chatId,\n html,\n inlineBots,\n );\n\n const {\n isOpen: isBotCommandTooltipOpen,\n close: closeBotCommandTooltip,\n filteredBotCommands: botTooltipCommands,\n } = useBotCommandTooltip(\n Boolean((botCommands && botCommands.length) || (chatBotCommands && chatBotCommands.length)),\n html,\n botCommands,\n chatBotCommands,\n );\n\n const {\n isContextMenuOpen: isCustomSendMenuOpen,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n } = useContextMenuHandlers(mainButtonRef, !(mainButtonState === MainButtonState.Send && canShowCustomSendMenu));\n\n const {\n canSendStickers, canSendGifs, canAttachMedia, canAttachPolls, canAttachEmbedLinks,\n } = useMemo(() => getAllowedAttachmentOptions(chat, isChatWithBot), [chat, isChatWithBot]);\n\n const isAdmin = chat && isChatAdmin(chat);\n const slowMode = getChatSlowModeOptions(chat);\n\n const { isStickerTooltipOpen, closeStickerTooltip } = useStickerTooltip(\n Boolean(shouldSuggestStickers && canSendStickers && !attachments.length),\n html,\n stickersForEmoji,\n !isReady,\n );\n const {\n isEmojiTooltipOpen, closeEmojiTooltip, filteredEmojis, insertEmoji,\n } = useEmojiTooltip(\n Boolean(shouldSuggestStickers && canSendStickers && !attachments.length),\n htmlRef,\n recentEmojis,\n undefined,\n setHtml,\n baseEmojiKeywords,\n emojiKeywords,\n !isReady,\n );\n\n const insertHtmlAndUpdateCursor = useCallback((newHtml: string, inputId: string = EDITABLE_INPUT_ID) => {\n const selection = window.getSelection()!;\n let messageInput: HTMLDivElement;\n if (inputId === EDITABLE_INPUT_ID) {\n messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR)!;\n } else {\n messageInput = document.getElementById(inputId) as HTMLDivElement;\n }\n\n if (selection.rangeCount) {\n const selectionRange = selection.getRangeAt(0);\n if (isSelectionInsideInput(selectionRange, inputId)) {\n insertHtmlInSelection(newHtml);\n messageInput.dispatchEvent(new Event('input', { bubbles: true }));\n return;\n }\n }\n\n setHtml(`${htmlRef.current!}${newHtml}`);\n\n // If selection is outside of input, set cursor at the end of input\n requestAnimationFrame(() => {\n focusEditableElement(messageInput);\n });\n }, [htmlRef]);\n\n const insertTextAndUpdateCursor = useCallback((text: string, inputId: string = EDITABLE_INPUT_ID) => {\n const newHtml = renderText(text, ['escape_html', 'emoji_html', 'br_html'])\n .join('')\n .replace(/\\u200b+/g, '\\u200b');\n insertHtmlAndUpdateCursor(newHtml, inputId);\n }, [insertHtmlAndUpdateCursor]);\n\n const removeSymbol = useCallback(() => {\n const selection = window.getSelection()!;\n\n if (selection.rangeCount) {\n const selectionRange = selection.getRangeAt(0);\n if (isSelectionInsideInput(selectionRange, EDITABLE_INPUT_ID)) {\n document.execCommand('delete', false);\n return;\n }\n }\n\n setHtml(deleteLastCharacterOutsideSelection(htmlRef.current!));\n }, [htmlRef]);\n\n const resetComposer = useCallback((shouldPreserveInput = false) => {\n if (!shouldPreserveInput) {\n setHtml('');\n }\n setAttachments(MEMO_EMPTY_ARRAY);\n closeStickerTooltip();\n closeMentionTooltip();\n closeEmojiTooltip();\n\n if (IS_SINGLE_COLUMN_LAYOUT) {\n // @optimization\n setTimeout(() => closeSymbolMenu(), SENDING_ANIMATION_DURATION);\n } else {\n closeSymbolMenu();\n }\n }, [closeStickerTooltip, closeMentionTooltip, closeEmojiTooltip, closeSymbolMenu]);\n\n // Handle chat change (ref is used to avoid redundant effect calls)\n const stopRecordingVoiceRef = useRef<typeof stopRecordingVoice>();\n stopRecordingVoiceRef.current = stopRecordingVoice;\n useEffect(() => {\n return () => {\n stopRecordingVoiceRef.current!();\n resetComposer();\n };\n }, [chatId, resetComposer, stopRecordingVoiceRef]);\n\n const [handleEditComplete, handleEditCancel] = useEditing(\n htmlRef,\n setHtml,\n editingMessage,\n resetComposer,\n openDeleteModal,\n chatId,\n threadId,\n messageListType,\n draft,\n editingDraft,\n );\n useDraft(draft, chatId, threadId, htmlRef, setHtml, editingMessage);\n useClipboardPaste(isForCurrentMessageList, insertTextAndUpdateCursor, handleSetAttachments, editingMessage);\n\n const handleEmbeddedClear = useCallback(() => {\n if (editingMessage) {\n handleEditCancel();\n }\n }, [editingMessage, handleEditCancel]);\n\n const handleFileSelect = useCallback(async (files: File[], isQuick: boolean) => {\n handleSetAttachments(await Promise.all(files.map((file) => buildAttachment(file.name, file, isQuick))));\n }, [handleSetAttachments]);\n\n const handleAppendFiles = useCallback(async (files: File[], isQuick: boolean) => {\n handleSetAttachments([\n ...attachments,\n ...await Promise.all(files.map((file) => buildAttachment(file.name, file, isQuick))),\n ]);\n }, [attachments, handleSetAttachments]);\n\n const handleClearAttachment = useCallback(() => {\n setAttachments(MEMO_EMPTY_ARRAY);\n }, []);\n\n const handleSend = useCallback(async (isSilent = false, scheduledAt?: number) => {\n if (connectionState !== 'connectionStateReady') {\n return;\n }\n\n let currentAttachments = attachments;\n\n if (activeVoiceRecording) {\n const record = await stopRecordingVoice();\n if (record) {\n const { blob, duration, waveform } = record;\n currentAttachments = [await buildAttachment(\n VOICE_RECORDING_FILENAME,\n blob,\n false,\n { voice: { duration, waveform } },\n )];\n }\n }\n\n const { text, entities } = parseMessageInput(htmlRef.current!);\n\n if (!currentAttachments.length && !text && !isForwarding) {\n return;\n }\n\n // No need to subscribe on updates in `mapStateToProps`\n const { serverTimeOffset } = getGlobal();\n\n const maxLength = currentAttachments.length ? captionLimit : MESSAGE_MAX_LENGTH;\n if (text?.length > maxLength) {\n const extraLength = text.length - maxLength;\n showDialog({\n data: {\n message: 'MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS',\n textParams: {\n '{EXTRA_CHARS_COUNT}': extraLength,\n '{PLURAL_S}': extraLength > 1 ? 's' : '',\n },\n hasErrorKey: true,\n },\n });\n\n return;\n }\n\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n\n if (currentAttachments.length || text) {\n if (slowMode && !isAdmin) {\n const nowSeconds = getServerTime(serverTimeOffset);\n const secondsSinceLastMessage = lastMessageSendTimeSeconds.current\n && Math.floor(nowSeconds - lastMessageSendTimeSeconds.current);\n const nextSendDateNotReached = slowMode.nextSendDate && slowMode.nextSendDate > nowSeconds;\n\n if (\n (secondsSinceLastMessage && secondsSinceLastMessage < slowMode.seconds)\n || nextSendDateNotReached\n ) {\n const secondsRemaining = nextSendDateNotReached\n ? slowMode.nextSendDate! - nowSeconds\n : slowMode.seconds - secondsSinceLastMessage!;\n showDialog({\n data: {\n message: lang('SlowModeHint', formatMediaDuration(secondsRemaining)),\n isSlowMode: true,\n hasErrorKey: false,\n },\n });\n\n messageInput?.blur();\n\n return;\n }\n }\n\n sendMessage({\n text,\n entities,\n attachments: currentAttachments,\n scheduledAt,\n isSilent,\n });\n }\n\n if (isForwarding) {\n forwardMessages({\n scheduledAt,\n isSilent,\n });\n }\n\n lastMessageSendTimeSeconds.current = getServerTime(serverTimeOffset);\n\n clearDraft({ chatId, localOnly: true });\n\n if (IS_IOS && messageInput && messageInput === document.activeElement) {\n applyIosAutoCapitalizationFix(messageInput);\n }\n\n // Wait until message animation starts\n requestAnimationFrame(() => {\n resetComposer();\n });\n }, [\n connectionState, attachments, activeVoiceRecording, isForwarding, clearDraft, chatId, captionLimit,\n resetComposer, stopRecordingVoice, showDialog, slowMode, isAdmin, sendMessage, forwardMessages, lang, htmlRef,\n ]);\n\n const handleClickBotMenu = useCallback(() => {\n if (botMenuButton?.type !== 'webApp') return;\n callAttachMenuBot({\n botId: chatId, chatId, isFromBotMenu: true, url: botMenuButton.url,\n });\n }, [botMenuButton, callAttachMenuBot, chatId]);\n\n const handleActivateBotCommandMenu = useCallback(() => {\n closeSymbolMenu();\n openBotCommandMenu();\n }, [closeSymbolMenu, openBotCommandMenu]);\n\n const handleActivateSymbolMenu = useCallback(() => {\n closeBotCommandMenu();\n closeSendAsMenu();\n openSymbolMenu();\n }, [closeBotCommandMenu, closeSendAsMenu, openSymbolMenu]);\n\n const handleMessageSchedule = useCallback((\n args: ScheduledMessageArgs, scheduledAt: number,\n ) => {\n if (args && 'queryId' in args) {\n const { id, queryId, isSilent } = args;\n sendInlineBotResult({\n id,\n queryId,\n scheduledAt,\n isSilent,\n });\n return;\n }\n\n const { isSilent, ...restArgs } = args || {};\n\n if (!args || Object.keys(restArgs).length === 0) {\n void handleSend(Boolean(isSilent), scheduledAt);\n } else {\n sendMessage({\n ...args,\n scheduledAt,\n });\n }\n }, [handleSend, sendInlineBotResult, sendMessage]);\n\n useEffect(() => {\n if (contentToBeScheduled) {\n requestCalendar((scheduledAt) => {\n handleMessageSchedule(contentToBeScheduled, scheduledAt);\n });\n }\n }, [contentToBeScheduled, handleMessageSchedule, requestCalendar]);\n\n useEffect(() => {\n if (requestedText) {\n setHtml(requestedText);\n resetOpenChatWithText();\n requestAnimationFrame(() => {\n const messageInput = document.getElementById(EDITABLE_INPUT_ID)!;\n focusEditableElement(messageInput, true);\n });\n }\n }, [requestedText, resetOpenChatWithText]);\n\n const handleStickerSelect = useCallback((\n sticker: ApiSticker, isSilent?: boolean, isScheduleRequested?: boolean, shouldPreserveInput = false,\n ) => {\n sticker = {\n ...sticker,\n isPreloadedGlobally: true,\n };\n\n if (shouldSchedule || isScheduleRequested) {\n forceShowSymbolMenu();\n requestCalendar((scheduledAt) => {\n cancelForceShowSymbolMenu();\n handleMessageSchedule({ sticker, isSilent }, scheduledAt);\n requestAnimationFrame(() => {\n resetComposer(shouldPreserveInput);\n });\n });\n } else {\n sendMessage({ sticker, isSilent });\n requestAnimationFrame(() => {\n resetComposer(shouldPreserveInput);\n });\n }\n }, [\n shouldSchedule, forceShowSymbolMenu, requestCalendar, cancelForceShowSymbolMenu, handleMessageSchedule,\n resetComposer, sendMessage,\n ]);\n\n const handleGifSelect = useCallback((gif: ApiVideo, isSilent?: boolean, isScheduleRequested?: boolean) => {\n if (shouldSchedule || isScheduleRequested) {\n forceShowSymbolMenu();\n requestCalendar((scheduledAt) => {\n cancelForceShowSymbolMenu();\n handleMessageSchedule({ gif, isSilent }, scheduledAt);\n requestAnimationFrame(() => {\n resetComposer(true);\n });\n });\n } else {\n sendMessage({ gif, isSilent });\n requestAnimationFrame(() => {\n resetComposer(true);\n });\n }\n }, [\n shouldSchedule, forceShowSymbolMenu, requestCalendar, cancelForceShowSymbolMenu, handleMessageSchedule,\n resetComposer, sendMessage,\n ]);\n\n const handleInlineBotSelect = useCallback((\n inlineResult: ApiBotInlineResult | ApiBotInlineMediaResult, isSilent?: boolean, isScheduleRequested?: boolean,\n ) => {\n if (connectionState !== 'connectionStateReady') {\n return;\n }\n\n if (shouldSchedule || isScheduleRequested) {\n requestCalendar((scheduledAt) => {\n handleMessageSchedule({\n id: inlineResult.id,\n queryId: inlineResult.queryId,\n isSilent,\n }, scheduledAt);\n });\n } else {\n sendInlineBotResult({\n id: inlineResult.id,\n queryId: inlineResult.queryId,\n isSilent,\n });\n }\n\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n if (IS_IOS && messageInput && messageInput === document.activeElement) {\n applyIosAutoCapitalizationFix(messageInput);\n }\n\n clearDraft({ chatId, localOnly: true });\n requestAnimationFrame(() => {\n resetComposer();\n });\n }, [\n chatId, clearDraft, connectionState, handleMessageSchedule, requestCalendar, resetComposer, sendInlineBotResult,\n shouldSchedule,\n ]);\n\n const handleBotCommandSelect = useCallback(() => {\n clearDraft({ chatId, localOnly: true });\n requestAnimationFrame(() => {\n resetComposer();\n });\n }, [chatId, clearDraft, resetComposer]);\n\n const handlePollSend = useCallback((poll: ApiNewPoll) => {\n if (shouldSchedule) {\n requestCalendar((scheduledAt) => {\n handleMessageSchedule({ poll }, scheduledAt);\n });\n closePollModal();\n } else {\n sendMessage({ poll });\n closePollModal();\n }\n }, [closePollModal, handleMessageSchedule, requestCalendar, sendMessage, shouldSchedule]);\n\n const handleSendSilent = useCallback(() => {\n if (shouldSchedule) {\n requestCalendar((scheduledAt) => {\n handleMessageSchedule({ isSilent: true }, scheduledAt);\n });\n } else {\n void handleSend(true);\n }\n }, [handleMessageSchedule, handleSend, requestCalendar, shouldSchedule]);\n\n const handleSearchOpen = useCallback((type: 'stickers' | 'gifs') => {\n if (type === 'stickers') {\n setStickerSearchQuery({ query: '' });\n setGifSearchQuery({ query: undefined });\n } else {\n setGifSearchQuery({ query: '' });\n setStickerSearchQuery({ query: undefined });\n }\n }, [setStickerSearchQuery, setGifSearchQuery]);\n\n const handleSymbolMenuOpen = useCallback(() => {\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n\n if (!IS_SINGLE_COLUMN_LAYOUT || messageInput !== document.activeElement) {\n openSymbolMenu();\n return;\n }\n\n messageInput?.blur();\n setTimeout(() => {\n closeBotCommandMenu();\n openSymbolMenu();\n }, MOBILE_KEYBOARD_HIDE_DELAY_MS);\n }, [openSymbolMenu, closeBotCommandMenu]);\n\n const handleSendAsMenuOpen = useCallback(() => {\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n\n if (!IS_SINGLE_COLUMN_LAYOUT || messageInput !== document.activeElement) {\n closeBotCommandMenu();\n closeSymbolMenu();\n openSendAsMenu();\n return;\n }\n\n messageInput?.blur();\n setTimeout(() => {\n closeBotCommandMenu();\n closeSymbolMenu();\n openSendAsMenu();\n }, MOBILE_KEYBOARD_HIDE_DELAY_MS);\n }, [closeBotCommandMenu, closeSymbolMenu, openSendAsMenu]);\n\n const handleAllScheduledClick = useCallback(() => {\n openChat({ id: chatId, threadId, type: 'scheduled' });\n }, [openChat, chatId, threadId]);\n\n useEffect(() => {\n if (isRightColumnShown && IS_SINGLE_COLUMN_LAYOUT) {\n closeSymbolMenu();\n }\n }, [isRightColumnShown, closeSymbolMenu]);\n\n useEffect(() => {\n if (!isReady) return;\n\n if (isSelectModeActive) {\n disableHover();\n } else {\n setTimeout(() => {\n enableHover();\n }, SELECT_MODE_TRANSITION_MS);\n }\n }, [isSelectModeActive, enableHover, disableHover, isReady]);\n\n const areVoiceMessagesNotAllowed = mainButtonState === MainButtonState.Record\n && (!canAttachMedia || !canSendVoiceByPrivacy);\n\n const mainButtonHandler = useCallback(() => {\n switch (mainButtonState) {\n case MainButtonState.Send:\n handleSend();\n break;\n case MainButtonState.Record: {\n if (areVoiceMessagesNotAllowed) {\n if (!canSendVoiceByPrivacy) {\n showNotification({\n message: lang('VoiceMessagesRestrictedByPrivacy', chat?.title),\n });\n }\n } else {\n startRecordingVoice();\n }\n break;\n }\n case MainButtonState.Edit:\n handleEditComplete();\n break;\n case MainButtonState.Schedule:\n if (activeVoiceRecording) {\n pauseRecordingVoice();\n }\n requestCalendar((scheduledAt) => {\n handleMessageSchedule({}, scheduledAt);\n });\n break;\n default:\n break;\n }\n }, [\n mainButtonState, handleSend, handleEditComplete, activeVoiceRecording, requestCalendar, areVoiceMessagesNotAllowed,\n canSendVoiceByPrivacy, showNotification, lang, chat?.title, startRecordingVoice, pauseRecordingVoice,\n handleMessageSchedule,\n ]);\n\n const prevEditedMessage = usePrevious(editingMessage, true);\n const renderedEditedMessage = editingMessage || prevEditedMessage;\n\n const scheduledDefaultDate = new Date();\n scheduledDefaultDate.setSeconds(0);\n scheduledDefaultDate.setMilliseconds(0);\n\n const scheduledMaxDate = new Date();\n scheduledMaxDate.setFullYear(scheduledMaxDate.getFullYear() + 1);\n\n let sendButtonAriaLabel = 'SendMessage';\n switch (mainButtonState) {\n case MainButtonState.Edit:\n sendButtonAriaLabel = 'Save edited message';\n break;\n case MainButtonState.Record:\n sendButtonAriaLabel = !canAttachMedia\n ? 'Conversation.DefaultRestrictedMedia'\n : 'AccDescrVoiceMessage';\n }\n\n const className = buildClassName(\n 'Composer',\n !isSelectModeActive && 'shown',\n isHoverDisabled && 'hover-disabled',\n );\n\n const symbolMenuButtonClassName = buildClassName(\n 'mobile-symbol-menu-button',\n !isReady && 'not-ready',\n isSymbolMenuLoaded\n ? (isSymbolMenuOpen && 'menu-opened')\n : (isSymbolMenuOpen && 'is-loading'),\n );\n\n const handleSendScheduled = useCallback(() => {\n requestCalendar((scheduledAt) => {\n handleMessageSchedule({}, scheduledAt);\n });\n }, [handleMessageSchedule, requestCalendar]);\n\n const onSend = mainButtonState === MainButtonState.Edit\n ? handleEditComplete\n : mainButtonState === MainButtonState.Schedule ? handleSendScheduled\n : handleSend;\n\n const isBotMenuButtonCommands = botMenuButton && botMenuButton?.type === 'commands';\n\n return (\n <div className={className}>\n {canAttachMedia && isReady && (\n <DropArea\n isOpen={dropAreaState !== DropAreaState.None}\n withQuick={dropAreaState === DropAreaState.QuickFile || prevDropAreaState === DropAreaState.QuickFile}\n onHide={onDropHide}\n onFileSelect={handleFileSelect}\n />\n )}\n <AttachmentModal\n chatId={chatId}\n threadId={threadId}\n canShowCustomSendMenu={canShowCustomSendMenu}\n attachments={attachments}\n captionLimit={captionLimit}\n caption={attachments.length ? html : ''}\n groupChatMembers={groupChatMembers}\n currentUserId={currentUserId}\n recentEmojis={recentEmojis}\n isReady={isReady}\n isChatWithSelf={isChatWithSelf}\n onCaptionUpdate={setHtml}\n baseEmojiKeywords={baseEmojiKeywords}\n emojiKeywords={emojiKeywords}\n addRecentEmoji={addRecentEmoji}\n shouldSchedule={shouldSchedule}\n onSendSilent={handleSendSilent}\n onSend={handleSend}\n onSendScheduled={handleSendScheduled}\n onFileAppend={handleAppendFiles}\n onClear={handleClearAttachment}\n />\n <PollModal\n isOpen={pollModal.isOpen}\n isQuiz={pollModal.isQuiz}\n shouldBeAnonymous={isChannel}\n onClear={closePollModal}\n onSend={handlePollSend}\n />\n {renderedEditedMessage && (\n <DeleteMessageModal\n isOpen={isDeleteModalOpen}\n isSchedule={messageListType === 'scheduled'}\n onClose={closeDeleteModal}\n message={renderedEditedMessage}\n />\n )}\n <SendAsMenu\n isOpen={isSendAsMenuOpen}\n onClose={closeSendAsMenu}\n chatId={chatId}\n selectedSendAsId={sendAsId}\n sendAsIds={sendAsIds}\n />\n <MentionTooltip\n isOpen={isMentionTooltipOpen}\n onClose={closeMentionTooltip}\n onInsertUserName={insertMention}\n filteredUsers={mentionFilteredUsers}\n />\n <InlineBotTooltip\n isOpen={isInlineBotTooltipOpen}\n botId={inlineBotId}\n isGallery={isInlineBotTooltipGallery}\n inlineBotResults={inlineBotResults}\n switchPm={inlineBotSwitchPm}\n onSelectResult={handleInlineBotSelect}\n loadMore={loadMoreForInlineBot}\n onClose={closeInlineBotTooltip}\n isSavedMessages={isChatWithSelf}\n canSendGifs={canSendGifs}\n isCurrentUserPremium={isCurrentUserPremium}\n />\n <BotCommandTooltip\n isOpen={isBotCommandTooltipOpen}\n withUsername={Boolean(chatBotCommands)}\n botCommands={botTooltipCommands}\n onClick={handleBotCommandSelect}\n onClose={closeBotCommandTooltip}\n />\n <div id=\"message-compose\">\n <div className=\"svg-appendix\" ref={appendixRef} />\n <ComposerEmbeddedMessage onClear={handleEmbeddedClear} />\n <WebPagePreview\n chatId={chatId}\n threadId={threadId}\n messageText={!attachments.length ? html : ''}\n disabled={!canAttachEmbedLinks}\n />\n <div className=\"message-input-wrapper\">\n {isChatWithBot && botMenuButton && botMenuButton.type === 'webApp' && !editingMessage\n && (\n <BotMenuButton\n isOpen={!html && !activeVoiceRecording}\n onClick={handleClickBotMenu}\n text={botMenuButton.text}\n isDisabled={Boolean(activeVoiceRecording)}\n />\n )}\n {(isChatWithBot && isBotMenuButtonCommands\n && botCommands !== false && !activeVoiceRecording && !editingMessage) && (\n <ResponsiveHoverButton\n className={buildClassName('bot-commands', isBotCommandMenuOpen && 'activated')}\n round\n disabled={botCommands === undefined}\n color=\"translucent\"\n onActivate={handleActivateBotCommandMenu}\n ariaLabel=\"Open bot command keyboard\"\n >\n <i className=\"icon-bot-commands-filled\" />\n </ResponsiveHoverButton>\n )}\n {canShowSendAs && (sendAsUser || sendAsChat) && (\n <Button\n round\n color=\"translucent\"\n onClick={isSendAsMenuOpen ? closeSendAsMenu : handleSendAsMenuOpen}\n ariaLabel={lang('SendMessageAsTitle')}\n className={buildClassName('send-as-button', shouldAnimateSendAsButtonRef.current && 'appear-animation')}\n >\n <Avatar\n user={sendAsUser}\n chat={sendAsChat}\n size=\"tiny\"\n />\n </Button>\n )}\n {IS_SINGLE_COLUMN_LAYOUT ? (\n <Button\n className={symbolMenuButtonClassName}\n round\n color=\"translucent\"\n onClick={isSymbolMenuOpen ? closeSymbolMenu : handleSymbolMenuOpen}\n ariaLabel=\"Choose emoji, sticker or GIF\"\n >\n <i className=\"icon-smile\" />\n <i className=\"icon-keyboard\" />\n {isSymbolMenuOpen && !isSymbolMenuLoaded && <Spinner color=\"gray\" />}\n </Button>\n ) : (\n <ResponsiveHoverButton\n className={isSymbolMenuOpen ? 'activated' : ''}\n round\n color=\"translucent\"\n onActivate={handleActivateSymbolMenu}\n ariaLabel=\"Choose emoji, sticker or GIF\"\n >\n <i className=\"icon-smile\" />\n </ResponsiveHoverButton>\n )}\n <MessageInput\n id=\"message-input-text\"\n chatId={chatId}\n threadId={threadId}\n html={!attachments.length ? html : ''}\n placeholder={\n activeVoiceRecording && windowWidth <= SCREEN_WIDTH_TO_HIDE_PLACEHOLDER\n ? ''\n : botKeyboardPlaceholder || lang('Message')\n }\n forcedPlaceholder={inlineBotHelp}\n canAutoFocus={isReady && !attachments.length}\n shouldSuppressFocus={IS_SINGLE_COLUMN_LAYOUT && isSymbolMenuOpen}\n shouldSuppressTextFormatter={isEmojiTooltipOpen || isMentionTooltipOpen || isInlineBotTooltipOpen}\n onUpdate={setHtml}\n onSend={onSend}\n onSuppressedFocus={closeSymbolMenu}\n />\n {isInlineBotLoading && Boolean(inlineBotId) && (\n <Spinner color=\"gray\" />\n )}\n {withScheduledButton && (\n <Button\n round\n faded\n className=\"scheduled-button\"\n color=\"translucent\"\n onClick={handleAllScheduledClick}\n ariaLabel=\"Open scheduled messages\"\n >\n <i className=\"icon-schedule\" />\n </Button>\n )}\n {botKeyboardMessageId && !activeVoiceRecording && !editingMessage && (\n <ResponsiveHoverButton\n className={isBotKeyboardOpen ? 'activated' : ''}\n round\n color=\"translucent\"\n onActivate={openBotKeyboard}\n ariaLabel=\"Open bot command keyboard\"\n >\n <i className=\"icon-bot-command\" />\n </ResponsiveHoverButton>\n )}\n {activeVoiceRecording && currentRecordTime && (\n <span className=\"recording-state\">\n {formatVoiceRecordDuration(currentRecordTime - startRecordTimeRef.current!)}\n </span>\n )}\n <AttachMenu\n chatId={chatId}\n isButtonVisible={!activeVoiceRecording && !editingMessage}\n canAttachMedia={canAttachMedia}\n canAttachPolls={canAttachPolls}\n onFileSelect={handleFileSelect}\n onPollCreate={openPollModal}\n isScheduled={shouldSchedule}\n attachMenuBots={attachMenuBots}\n peerType={attachMenuPeerType}\n theme={theme}\n />\n {botKeyboardMessageId && (\n <BotKeyboardMenu\n messageId={botKeyboardMessageId}\n isOpen={isBotKeyboardOpen}\n onClose={closeBotKeyboard}\n />\n )}\n {botCommands && (\n <BotCommandMenu\n isOpen={isBotCommandMenuOpen}\n botCommands={botCommands}\n onClose={closeBotCommandMenu}\n />\n )}\n <StickerTooltip\n chatId={chatId}\n threadId={threadId}\n isOpen={isStickerTooltipOpen}\n onStickerSelect={handleStickerSelect}\n />\n <EmojiTooltip\n isOpen={isEmojiTooltipOpen}\n emojis={filteredEmojis}\n onClose={closeEmojiTooltip}\n onEmojiSelect={insertEmoji}\n addRecentEmoji={addRecentEmoji}\n />\n <SymbolMenu\n chatId={chatId}\n threadId={threadId}\n isOpen={isSymbolMenuOpen || isSymbolMenuForced}\n canSendGifs={canSendGifs}\n canSendStickers={canSendStickers}\n onLoad={onSymbolMenuLoadingComplete}\n onClose={closeSymbolMenu}\n onEmojiSelect={insertTextAndUpdateCursor}\n onStickerSelect={handleStickerSelect}\n onGifSelect={handleGifSelect}\n onRemoveSymbol={removeSymbol}\n onSearchOpen={handleSearchOpen}\n addRecentEmoji={addRecentEmoji}\n />\n </div>\n </div>\n {activeVoiceRecording && (\n <Button\n round\n color=\"danger\"\n className=\"cancel\"\n onClick={stopRecordingVoice}\n ariaLabel=\"Cancel voice recording\"\n >\n <i className=\"icon-delete\" />\n </Button>\n )}\n <Button\n ref={mainButtonRef}\n round\n color=\"secondary\"\n className={buildClassName(mainButtonState, !isReady && 'not-ready', activeVoiceRecording && 'recording')}\n disabled={areVoiceMessagesNotAllowed}\n allowDisabledClick\n ariaLabel={lang(sendButtonAriaLabel)}\n onClick={mainButtonHandler}\n onContextMenu={\n mainButtonState === MainButtonState.Send && canShowCustomSendMenu ? handleContextMenu : undefined\n }\n >\n <i className=\"icon-send\" />\n <i className=\"icon-schedule\" />\n <i className=\"icon-microphone-alt\" />\n <i className=\"icon-check\" />\n </Button>\n {canShowCustomSendMenu && (\n <CustomSendMenu\n isOpen={isCustomSendMenuOpen}\n onSendSilent={!isChatWithSelf ? handleSendSilent : undefined}\n onSendSchedule={!shouldSchedule ? handleSendScheduled : undefined}\n onClose={handleContextMenuClose}\n onCloseAnimationEnd={handleContextMenuHide}\n isSavedMessages={isChatWithSelf}\n />\n )}\n {calendar}\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, threadId, messageListType }): StateProps => {\n const chat = selectChat(global, chatId);\n const chatBot = chatId !== REPLIES_USER_ID ? selectChatBot(global, chatId) : undefined;\n const isChatWithBot = Boolean(chatBot);\n const isChatWithSelf = selectIsChatWithSelf(global, chatId);\n const messageWithActualBotKeyboard = isChatWithBot && selectNewestMessageWithBotKeyboardButtons(global, chatId);\n const scheduledIds = selectScheduledIds(global, chatId);\n const { language, shouldSuggestStickers } = global.settings.byKey;\n const baseEmojiKeywords = global.emojiKeywords[BASE_EMOJI_KEYWORD_LANG];\n const emojiKeywords = language !== BASE_EMOJI_KEYWORD_LANG ? global.emojiKeywords[language] : undefined;\n const botKeyboardMessageId = messageWithActualBotKeyboard ? messageWithActualBotKeyboard.id : undefined;\n const keyboardMessage = botKeyboardMessageId ? selectChatMessage(global, chatId, botKeyboardMessageId) : undefined;\n const { currentUserId } = global;\n const defaultSendAsId = chat?.fullInfo ? chat?.fullInfo?.sendAsId || currentUserId : undefined;\n const sendAsId = chat?.sendAsIds && defaultSendAsId && chat.sendAsIds.includes(defaultSendAsId)\n ? defaultSendAsId\n : (chat?.adminRights?.anonymous ? chat?.id : undefined);\n const sendAsUser = sendAsId ? selectUser(global, sendAsId) : undefined;\n const sendAsChat = !sendAsUser && sendAsId ? selectChat(global, sendAsId) : undefined;\n const requestedText = selectRequestedText(global, chatId);\n const currentMessageList = selectCurrentMessageList(global);\n const isForCurrentMessageList = chatId === currentMessageList?.chatId\n && threadId === currentMessageList?.threadId\n && messageListType === currentMessageList?.type;\n const user = selectUser(global, chatId);\n const canSendVoiceByPrivacy = (user && !user.fullInfo?.noVoiceMessages) ?? true;\n\n const editingDraft = messageListType === 'scheduled'\n ? selectEditingScheduledDraft(global, chatId)\n : selectEditingDraft(global, chatId, threadId);\n\n return {\n editingMessage: selectEditingMessage(global, chatId, threadId, messageListType),\n connectionState: global.connectionState,\n draft: selectDraft(global, chatId, threadId),\n chat,\n isChatWithBot,\n isChatWithSelf,\n isForCurrentMessageList,\n canScheduleUntilOnline: selectCanScheduleUntilOnline(global, chatId),\n isChannel: chat ? isChatChannel(chat) : undefined,\n isRightColumnShown: selectIsRightColumnShown(global),\n isSelectModeActive: selectIsInSelectMode(global),\n withScheduledButton: (\n threadId === MAIN_THREAD_ID\n && messageListType === 'thread'\n && Boolean(scheduledIds?.length)\n ),\n shouldSchedule: messageListType === 'scheduled',\n botKeyboardMessageId,\n botKeyboardPlaceholder: keyboardMessage?.keyboardPlaceholder,\n isForwarding: chatId === global.forwardMessages.toChatId,\n pollModal: global.pollModal,\n stickersForEmoji: global.stickers.forEmoji.stickers,\n groupChatMembers: chat?.fullInfo?.members,\n topInlineBotIds: global.topInlineBots?.userIds,\n currentUserId,\n lastSyncTime: global.lastSyncTime,\n contentToBeScheduled: global.messages.contentToBeScheduled,\n shouldSuggestStickers,\n recentEmojis: global.recentEmojis,\n baseEmojiKeywords: baseEmojiKeywords?.keywords,\n emojiKeywords: emojiKeywords?.keywords,\n inlineBots: global.inlineBots.byUsername,\n isInlineBotLoading: global.inlineBots.isLoading,\n chatBotCommands: chat?.fullInfo && chat.fullInfo.botCommands,\n botCommands: chatBot?.fullInfo ? (chatBot.fullInfo.botInfo?.commands || false) : undefined,\n botMenuButton: chatBot?.fullInfo?.botInfo?.menuButton,\n sendAsUser,\n sendAsChat,\n sendAsId,\n editingDraft,\n requestedText,\n attachMenuBots: global.attachMenu.bots,\n attachMenuPeerType: selectAttachMenuPeerType(global, chatId),\n theme: selectTheme(global),\n fileSizeLimit: selectCurrentLimit(global, 'uploadMaxFileparts') * MAX_UPLOAD_FILEPART_SIZE,\n captionLimit: selectCurrentLimit(global, 'captionLength'),\n isCurrentUserPremium: selectIsCurrentUserPremium(global),\n canSendVoiceByPrivacy,\n };\n },\n)(Composer));\n","import {\n useCallback, useEffect, useRef, useState,\n} from '../../../../lib/teact/teact';\n\nimport { IS_SAFARI, IS_VOICE_RECORDING_SUPPORTED } from '../../../../util/environment';\nimport * as voiceRecording from '../../../../util/voiceRecording';\nimport captureEscKeyListener from '../../../../util/captureEscKeyListener';\n\ntype ActiveVoiceRecording = { stop: () => Promise<voiceRecording.Result>; pause: NoneToVoidFunction } | undefined;\n\nconst useVoiceRecording = () => {\n // eslint-disable-next-line no-null/no-null\n const recordButtonRef = useRef<HTMLButtonElement>(null);\n const [activeVoiceRecording, setActiveVoiceRecording] = useState<ActiveVoiceRecording>();\n const startRecordTimeRef = useRef<number>();\n const [currentRecordTime, setCurrentRecordTime] = useState<number | undefined>();\n\n useEffect(() => {\n // Preloading worker fixes silent first record on iOS\n if (IS_SAFARI && IS_VOICE_RECORDING_SUPPORTED) {\n void voiceRecording.init();\n }\n }, []);\n\n const startRecordingVoice = useCallback(async () => {\n try {\n const { stop, pause } = await voiceRecording.start((tickVolume: number) => {\n if (recordButtonRef.current) {\n if (startRecordTimeRef.current && Date.now() % 4 === 0) {\n recordButtonRef.current.style.boxShadow = `0 0 0 ${(tickVolume || 0) * 50}px rgba(0,0,0,.15)`;\n }\n setCurrentRecordTime(Date.now());\n }\n });\n startRecordTimeRef.current = Date.now();\n setCurrentRecordTime(Date.now());\n\n setActiveVoiceRecording({ stop, pause });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n }, []);\n\n const pauseRecordingVoice = useCallback(() => {\n if (!activeVoiceRecording) {\n return undefined;\n }\n\n if (recordButtonRef.current) {\n recordButtonRef.current.style.boxShadow = 'none';\n }\n try {\n return activeVoiceRecording!.pause();\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n return undefined;\n }\n }, [activeVoiceRecording]);\n\n const stopRecordingVoice = useCallback(() => {\n if (!activeVoiceRecording) {\n return undefined;\n }\n\n setActiveVoiceRecording(undefined);\n startRecordTimeRef.current = undefined;\n setCurrentRecordTime(undefined);\n if (recordButtonRef.current) {\n recordButtonRef.current.style.boxShadow = 'none';\n }\n try {\n return activeVoiceRecording!.stop();\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n return undefined;\n }\n }, [activeVoiceRecording]);\n\n useEffect(() => {\n return activeVoiceRecording ? captureEscKeyListener(stopRecordingVoice) : undefined;\n }, [activeVoiceRecording, stopRecordingVoice]);\n\n return {\n startRecordingVoice,\n pauseRecordingVoice,\n stopRecordingVoice,\n activeVoiceRecording,\n currentRecordTime,\n recordButtonRef,\n startRecordTimeRef,\n };\n};\n\nexport default useVoiceRecording;\n","import { useEffect, useMemo } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\n\nimport type { ApiSticker } from '../../../../api/types';\n\nimport { IS_EMOJI_SUPPORTED } from '../../../../util/environment';\n\nimport parseEmojiOnlyString from '../../../common/helpers/parseEmojiOnlyString';\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\n\nexport default function useStickerTooltip(\n isAllowed: boolean,\n html: string,\n stickers?: ApiSticker[],\n isDisabled = false,\n) {\n const cleanHtml = useMemo(() => prepareForRegExp(html).trim(), [html]);\n const { loadStickersForEmoji, clearStickersForEmoji } = getActions();\n const isSingleEmoji = (\n (IS_EMOJI_SUPPORTED && parseEmojiOnlyString(cleanHtml) === 1)\n || (!IS_EMOJI_SUPPORTED && Boolean(html.match(/^<img.[^>]*?>$/g)))\n );\n const hasStickers = Boolean(stickers?.length) && isSingleEmoji;\n\n useEffect(() => {\n if (isDisabled) return;\n\n if (isAllowed && isSingleEmoji) {\n loadStickersForEmoji({\n emoji: IS_EMOJI_SUPPORTED ? cleanHtml : cleanHtml.match(/alt=\"(.+)\"/)?.[1]!,\n });\n } else if (hasStickers || !isSingleEmoji) {\n clearStickersForEmoji();\n }\n // We omit `hasStickers` here to prevent re-fetching after manually closing tooltip (via <Esc>).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [html, isSingleEmoji, clearStickersForEmoji, loadStickersForEmoji, isAllowed, isDisabled]);\n\n return {\n isStickerTooltipOpen: hasStickers,\n closeStickerTooltip: clearStickersForEmoji,\n };\n}\n","export default function deleteLastCharacterOutsideSelection(html: string) {\n const tempInput = document.createElement('div');\n tempInput.contentEditable = 'true';\n tempInput.style.position = 'absolute';\n tempInput.style.left = '-10000px';\n tempInput.style.top = '-10000px';\n tempInput.innerHTML = html;\n document.body.appendChild(tempInput);\n let element = tempInput.lastChild!;\n\n if (element.lastChild) {\n // Selects the last and the deepest child of the element.\n while (element.lastChild) {\n element = element.lastChild;\n }\n }\n\n // Gets length of the element's content.\n const textLength = element.textContent!.length;\n const range = document.createRange();\n const selection = window.getSelection()!;\n\n // Sets selection position to the end of the element.\n range.setStart(element, textLength);\n range.setEnd(element, textLength);\n selection.removeAllRanges();\n selection.addRange(range);\n document.execCommand('delete', false);\n\n const result = tempInput.innerHTML;\n document.body.removeChild(tempInput);\n\n return result;\n}\n","import { useCallback, useEffect } from '../../../../lib/teact/teact';\nimport { getActions } from '../../../../global';\n\nimport type { ApiFormattedText, ApiMessage } from '../../../../api/types';\nimport type { MessageListType } from '../../../../global/types';\n\nimport useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps';\nimport { EDITABLE_INPUT_CSS_SELECTOR } from '../../../../config';\nimport parseMessageInput from '../../../../util/parseMessageInput';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport { hasMessageMedia } from '../../../../global/helpers';\nimport { getTextWithEntitiesAsHtml } from '../../../common/helpers/renderTextWithEntities';\nimport { fastRaf } from '../../../../util/schedulers';\nimport useBackgroundMode from '../../../../hooks/useBackgroundMode';\nimport useBeforeUnload from '../../../../hooks/useBeforeUnload';\n\nconst useEditing = (\n htmlRef: { current: string },\n setHtml: (html: string) => void,\n editedMessage: ApiMessage | undefined,\n resetComposer: (shouldPreserveInput?: boolean) => void,\n openDeleteModal: () => void,\n chatId: string,\n threadId: number,\n type: MessageListType,\n draft?: ApiFormattedText,\n editingDraft?: ApiFormattedText,\n) => {\n const { editMessage, setEditingDraft } = getActions();\n\n useEffectWithPrevDeps(([prevEditedMessage]) => {\n if (!editedMessage) {\n return;\n }\n if (prevEditedMessage?.id === editedMessage.id) {\n return;\n }\n\n const html = getTextWithEntitiesAsHtml(editingDraft?.text.length ? editingDraft : editedMessage.content.text);\n setHtml(html);\n // `fastRaf` would execute syncronously in this case\n requestAnimationFrame(() => {\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n if (messageInput) {\n focusEditableElement(messageInput, true);\n }\n });\n }, [editedMessage, setHtml] as const);\n\n useEffect(() => {\n if (!editedMessage) return undefined;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const edited = parseMessageInput(htmlRef.current!);\n const update = edited.text.length ? edited : undefined;\n setEditingDraft({\n chatId, threadId, type, text: update,\n });\n };\n }, [chatId, editedMessage, htmlRef, setEditingDraft, threadId, type]);\n\n const restoreNewDraftAfterEditing = useCallback(() => {\n if (!draft) return;\n // Run 1 frame after editing draft reset\n fastRaf(() => {\n setHtml(getTextWithEntitiesAsHtml(draft));\n const messageInput = document.querySelector<HTMLDivElement>(EDITABLE_INPUT_CSS_SELECTOR);\n if (messageInput) {\n requestAnimationFrame(() => {\n focusEditableElement(messageInput, true);\n });\n }\n });\n }, [draft, setHtml]);\n\n const handleEditCancel = useCallback(() => {\n resetComposer();\n restoreNewDraftAfterEditing();\n }, [resetComposer, restoreNewDraftAfterEditing]);\n\n const handleEditComplete = useCallback(() => {\n const { text, entities } = parseMessageInput(htmlRef.current!);\n\n if (!editedMessage) {\n return;\n }\n\n if (!text && !hasMessageMedia(editedMessage)) {\n openDeleteModal();\n return;\n }\n\n editMessage({\n messageId: editedMessage.id,\n text,\n entities,\n });\n\n resetComposer();\n restoreNewDraftAfterEditing();\n }, [editMessage, editedMessage, htmlRef, openDeleteModal, resetComposer, restoreNewDraftAfterEditing]);\n\n const handleBlur = useCallback(() => {\n if (!editedMessage) return;\n const edited = parseMessageInput(htmlRef.current!);\n const update = edited.text.length ? edited : undefined;\n setEditingDraft({\n chatId, threadId, type, text: update,\n });\n }, [chatId, editedMessage, htmlRef, setEditingDraft, threadId, type]);\n\n useBackgroundMode(handleBlur);\n useBeforeUnload(handleBlur);\n\n return [handleEditComplete, handleEditCancel];\n};\n\nexport default useEditing;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './MobileSearch';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst MobileSearchAsync: FC<OwnProps> = (props) => {\n const { isActive } = props;\n const MobileSearch = useModuleLoader(Bundles.Extra, 'MobileSearch', !isActive, true);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return MobileSearch ? <MobileSearch {...props} /> : undefined;\n};\n\nexport default memo(MobileSearchAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\nimport type { OwnProps } from './MessageSelectToolbar';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst MessageSelectToolbarAsync: FC<OwnProps> = (props) => {\n const { isActive } = props;\n const MessageSelectToolbar = useModuleLoader(Bundles.Extra, 'MessageSelectToolbar', !isActive);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return MessageSelectToolbar ? <MessageSelectToolbar {...props} /> : undefined;\n};\n\nexport default memo(MessageSelectToolbarAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './UnpinAllMessagesModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst UnpinAllMessagesModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const UnpinAllMessagesModal = useModuleLoader(Bundles.Extra, 'UnpinAllMessagesModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return UnpinAllMessagesModal ? <UnpinAllMessagesModal {...props} /> : undefined;\n};\n\nexport default memo(UnpinAllMessagesModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './SeenByModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst SeenByModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const SeenByModal = useModuleLoader(Bundles.Extra, 'SeenByModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return SeenByModal ? <SeenByModal {...props} /> : undefined;\n};\n\nexport default memo(SeenByModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './EmojiInteractionAnimation';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst EmojiInteractionAnimationAsync: FC<OwnProps> = (props) => {\n const { activeEmojiInteraction } = props;\n const EmojiInteractionAnimation = useModuleLoader(\n Bundles.Extra, 'EmojiInteractionAnimation', !activeEmojiInteraction,\n );\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return EmojiInteractionAnimation ? <EmojiInteractionAnimation {...props} /> : undefined;\n};\n\nexport default memo(EmojiInteractionAnimationAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './ReactorListModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst ReactorListModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const ReactorListModal = useModuleLoader(Bundles.Extra, 'ReactorListModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ReactorListModal ? <ReactorListModal {...props} /> : undefined;\n};\n\nexport default memo(ReactorListModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './GiftPremiumModal';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst GiftPremiumModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const GiftPremiumModal = useModuleLoader(Bundles.Extra, 'GiftPremiumModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return GiftPremiumModal ? <GiftPremiumModal {...props} /> : undefined;\n};\n\nexport default memo(GiftPremiumModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, useState, memo, useMemo, useCallback,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChatBannedRights } from '../../api/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\nimport type {\n MessageListType,\n ActiveEmojiInteraction,\n} from '../../global/types';\nimport type { AnimationLevel, ThemeKey } from '../../types';\n\nimport {\n MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN,\n MOBILE_SCREEN_MAX_WIDTH,\n MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,\n SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN,\n SAFE_SCREEN_WIDTH_FOR_CHAT_INFO,\n ANIMATION_LEVEL_MAX,\n ANIMATION_END_DELAY,\n DARK_THEME_BG_COLOR,\n LIGHT_THEME_BG_COLOR,\n ANIMATION_LEVEL_MIN,\n SUPPORTED_IMAGE_CONTENT_TYPES,\n} from '../../config';\nimport {\n IS_SINGLE_COLUMN_LAYOUT,\n IS_TABLET_COLUMN_LAYOUT,\n IS_TOUCH_ENV,\n MASK_IMAGE_DISABLED,\n} from '../../util/environment';\nimport { DropAreaState } from './composer/DropArea';\nimport {\n selectChat,\n selectChatBot,\n selectCurrentMessageList,\n selectCurrentTextSearch,\n selectIsChatBotNotStarted,\n selectIsInSelectMode,\n selectIsRightColumnShown,\n selectIsUserBlocked,\n selectPinnedIds,\n selectTheme,\n} from '../../global/selectors';\nimport {\n getCanPostInChat, getMessageSendingRestrictionReason, isChatChannel, isChatSuperGroup, isUserId,\n} from '../../global/helpers';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport buildClassName from '../../util/buildClassName';\nimport useCustomBackground from '../../hooks/useCustomBackground';\nimport useWindowSize from '../../hooks/useWindowSize';\nimport usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation';\nimport useLang from '../../hooks/useLang';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport usePrevious from '../../hooks/usePrevious';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport useOnChange from '../../hooks/useOnChange';\nimport calculateMiddleFooterTransforms from './helpers/calculateMiddleFooterTransforms';\n\nimport Transition from '../ui/Transition';\nimport MiddleHeader from './MiddleHeader';\nimport MessageList from './MessageList';\nimport FloatingActionButtons from './FloatingActionButtons';\nimport Composer from './composer/Composer';\nimport Button from '../ui/Button';\nimport MobileSearch from './MobileSearch.async';\nimport MessageSelectToolbar from './MessageSelectToolbar.async';\nimport UnpinAllMessagesModal from '../common/UnpinAllMessagesModal.async';\nimport SeenByModal from '../common/SeenByModal.async';\nimport EmojiInteractionAnimation from './EmojiInteractionAnimation.async';\nimport ReactorListModal from './ReactorListModal.async';\nimport GiftPremiumModal from '../main/premium/GiftPremiumModal.async';\n\nimport './MiddleColumn.scss';\nimport styles from './MiddleColumn.module.scss';\n\ntype StateProps = {\n chatId?: string;\n threadId?: number;\n messageListType?: MessageListType;\n isPrivate?: boolean;\n isPinnedMessageList?: boolean;\n isScheduledMessageList?: boolean;\n canPost?: boolean;\n currentUserBannedRights?: ApiChatBannedRights;\n defaultBannedRights?: ApiChatBannedRights;\n hasPinnedOrAudioPlayer?: boolean;\n pinnedMessagesCount?: number;\n theme: ThemeKey;\n customBackground?: string;\n backgroundColor?: string;\n patternColor?: string;\n isLeftColumnShown?: boolean;\n isRightColumnShown?: boolean;\n isBackgroundBlurred?: boolean;\n isMobileSearchActive?: boolean;\n isSelectModeActive?: boolean;\n isSeenByModalOpen: boolean;\n isReactorListModalOpen: boolean;\n isGiftPremiumModalOpen?: boolean;\n animationLevel: AnimationLevel;\n shouldSkipHistoryAnimations?: boolean;\n currentTransitionKey: number;\n isChannel?: boolean;\n areChatSettingsLoaded?: boolean;\n canSubscribe?: boolean;\n canStartBot?: boolean;\n canRestartBot?: boolean;\n activeEmojiInteractions?: ActiveEmojiInteraction[];\n shouldJoinToSend?: boolean;\n shouldSendJoinRequest?: boolean;\n lastSyncTime?: number;\n};\n\nconst CLOSE_ANIMATION_DURATION = IS_SINGLE_COLUMN_LAYOUT ? 450 + ANIMATION_END_DELAY : undefined;\n\nfunction isImage(item: DataTransferItem) {\n return item.kind === 'file' && item.type && SUPPORTED_IMAGE_CONTENT_TYPES.has(item.type);\n}\n\nconst MiddleColumn: FC<StateProps> = ({\n chatId,\n threadId,\n messageListType,\n isPrivate,\n isPinnedMessageList,\n canPost,\n currentUserBannedRights,\n defaultBannedRights,\n hasPinnedOrAudioPlayer,\n pinnedMessagesCount,\n customBackground,\n theme,\n backgroundColor,\n patternColor,\n isLeftColumnShown,\n isRightColumnShown,\n isBackgroundBlurred,\n isMobileSearchActive,\n isSelectModeActive,\n isSeenByModalOpen,\n isReactorListModalOpen,\n isGiftPremiumModalOpen,\n animationLevel,\n shouldSkipHistoryAnimations,\n currentTransitionKey,\n isChannel,\n areChatSettingsLoaded,\n canSubscribe,\n canStartBot,\n canRestartBot,\n activeEmojiInteractions,\n shouldJoinToSend,\n shouldSendJoinRequest,\n lastSyncTime,\n}) => {\n const {\n openChat,\n openPreviousChat,\n unpinAllMessages,\n loadUser,\n loadChatSettings,\n closeLocalTextSearch,\n exitMessageSelectMode,\n joinChannel,\n sendBotCommand,\n restartBot,\n showNotification,\n } = getActions();\n\n const { width: windowWidth } = useWindowSize();\n\n const lang = useLang();\n const [dropAreaState, setDropAreaState] = useState(DropAreaState.None);\n const [isFabShown, setIsFabShown] = useState<boolean | undefined>();\n const [isNotchShown, setIsNotchShown] = useState<boolean | undefined>();\n const [isUnpinModalOpen, setIsUnpinModalOpen] = useState(false);\n\n const hasTools = hasPinnedOrAudioPlayer && (\n windowWidth < MOBILE_SCREEN_MAX_WIDTH\n || (\n isRightColumnShown && windowWidth > MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN\n && windowWidth < SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN\n ) || (\n windowWidth >= MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN\n && windowWidth < SAFE_SCREEN_WIDTH_FOR_CHAT_INFO\n )\n );\n\n const renderingChatId = usePrevDuringAnimation(chatId, CLOSE_ANIMATION_DURATION);\n const renderingThreadId = usePrevDuringAnimation(threadId, CLOSE_ANIMATION_DURATION);\n const renderingMessageListType = usePrevDuringAnimation(messageListType, CLOSE_ANIMATION_DURATION);\n const renderingCanSubscribe = usePrevDuringAnimation(canSubscribe, CLOSE_ANIMATION_DURATION);\n const renderingCanStartBot = usePrevDuringAnimation(canStartBot, CLOSE_ANIMATION_DURATION);\n const renderingCanRestartBot = usePrevDuringAnimation(canRestartBot, CLOSE_ANIMATION_DURATION);\n const renderingCanPost = usePrevDuringAnimation(canPost, CLOSE_ANIMATION_DURATION)\n && !renderingCanRestartBot && !renderingCanStartBot && !renderingCanSubscribe;\n const renderingHasTools = usePrevDuringAnimation(hasTools, CLOSE_ANIMATION_DURATION);\n const renderingIsFabShown = usePrevDuringAnimation(isFabShown, CLOSE_ANIMATION_DURATION);\n const renderingIsChannel = usePrevDuringAnimation(isChannel, CLOSE_ANIMATION_DURATION);\n const renderingShouldJoinToSend = usePrevDuringAnimation(shouldJoinToSend, CLOSE_ANIMATION_DURATION);\n const renderingShouldSendJoinRequest = usePrevDuringAnimation(shouldSendJoinRequest, CLOSE_ANIMATION_DURATION);\n\n const prevTransitionKey = usePrevious(currentTransitionKey);\n\n const cleanupExceptionKey = (\n prevTransitionKey !== undefined && prevTransitionKey < currentTransitionKey ? prevTransitionKey : undefined\n );\n\n const { isReady, handleOpenEnd, handleSlideStop } = useIsReady(\n !shouldSkipHistoryAnimations && animationLevel !== ANIMATION_LEVEL_MIN,\n currentTransitionKey,\n prevTransitionKey,\n chatId,\n );\n\n useEffect(() => {\n return chatId\n ? captureEscKeyListener(() => {\n openChat({ id: undefined });\n })\n : undefined;\n }, [chatId, openChat]);\n\n useOnChange(() => {\n setDropAreaState(DropAreaState.None);\n setIsFabShown(undefined);\n setIsNotchShown(undefined);\n }, [chatId]);\n\n // Fix for mobile virtual keyboard\n useEffect(() => {\n const { visualViewport } = window as any;\n if (!visualViewport) {\n return undefined;\n }\n\n const handleResize = () => {\n if (window.visualViewport.height !== document.documentElement.clientHeight) {\n document.body.classList.add('keyboard-visible');\n } else {\n document.body.classList.remove('keyboard-visible');\n }\n };\n\n visualViewport.addEventListener('resize', handleResize);\n\n return () => {\n visualViewport.removeEventListener('resize', handleResize);\n };\n }, []);\n\n useEffect(() => {\n if (isPrivate) {\n loadUser({ userId: chatId });\n }\n }, [chatId, isPrivate, loadUser]);\n\n useEffect(() => {\n if (!areChatSettingsLoaded && lastSyncTime) {\n loadChatSettings({ chatId });\n }\n }, [chatId, isPrivate, areChatSettingsLoaded, lastSyncTime, loadChatSettings]);\n\n const handleDragEnter = useCallback((e: React.DragEvent<HTMLDivElement>) => {\n if (IS_TOUCH_ENV) {\n return;\n }\n\n const { items } = e.dataTransfer || {};\n const shouldDrawQuick = items && items.length > 0 && Array.from(items)\n // Filter unnecessary element for drag and drop images in Firefox (https://github.com/Ajaxy/telegram-tt/issues/49)\n // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#image\n .filter((item) => item.type !== 'text/uri-list')\n // As of September 2021, native clients suggest \"send quick, but compressed\" only for images\n .every(isImage);\n\n setDropAreaState(shouldDrawQuick ? DropAreaState.QuickFile : DropAreaState.Document);\n }, []);\n\n const handleHideDropArea = useCallback(() => {\n setDropAreaState(DropAreaState.None);\n }, []);\n\n const handleOpenUnpinModal = useCallback(() => {\n setIsUnpinModalOpen(true);\n }, []);\n\n const closeUnpinModal = useCallback(() => {\n setIsUnpinModalOpen(false);\n }, []);\n\n const handleUnpinAllMessages = useCallback(() => {\n unpinAllMessages({ chatId });\n closeUnpinModal();\n openPreviousChat();\n }, [unpinAllMessages, chatId, closeUnpinModal, openPreviousChat]);\n\n const handleTabletFocus = useCallback(() => {\n openChat({ id: chatId });\n }, [openChat, chatId]);\n\n const handleSubscribeClick = useCallback(() => {\n joinChannel({ chatId });\n if (renderingShouldSendJoinRequest) {\n showNotification({\n message: isChannel ? lang('RequestToJoinChannelSentDescription') : lang('RequestToJoinGroupSentDescription'),\n });\n }\n }, [joinChannel, chatId, renderingShouldSendJoinRequest, showNotification, isChannel, lang]);\n\n const handleStartBot = useCallback(() => {\n sendBotCommand({ command: '/start' });\n }, [sendBotCommand]);\n\n const handleRestartBot = useCallback(() => {\n restartBot({ chatId: chatId! });\n }, [chatId, restartBot]);\n\n const customBackgroundValue = useCustomBackground(theme, customBackground);\n\n const className = buildClassName(\n renderingHasTools && 'has-header-tools',\n MASK_IMAGE_DISABLED ? 'mask-image-disabled' : 'mask-image-enabled',\n );\n\n const bgClassName = buildClassName(\n styles.background,\n styles.withTransition,\n customBackground && styles.customBgImage,\n backgroundColor && styles.customBgColor,\n customBackground && isBackgroundBlurred && styles.blurred,\n isRightColumnShown && styles.withRightColumn,\n );\n\n const messagingDisabledClassName = buildClassName(\n 'messaging-disabled',\n !isSelectModeActive && 'shown',\n );\n\n const messageSendingRestrictionReason = getMessageSendingRestrictionReason(\n lang, currentUserBannedRights, defaultBannedRights,\n );\n\n // CSS Variables calculation doesn't work properly with transforms, so we calculate transform values in JS\n const {\n composerHiddenScale, toolbarHiddenScale,\n composerTranslateX, toolbarTranslateX,\n unpinHiddenScale, toolbarForUnpinHiddenScale,\n } = useMemo(\n () => calculateMiddleFooterTransforms(windowWidth, renderingCanPost),\n [renderingCanPost, windowWidth],\n );\n\n const footerClassName = buildClassName(\n 'middle-column-footer',\n !renderingCanPost && 'no-composer',\n renderingCanPost && isNotchShown && !isSelectModeActive && 'with-notch',\n );\n\n useHistoryBack({\n isActive: isSelectModeActive,\n onBack: exitMessageSelectMode,\n });\n\n useHistoryBack({\n isActive: isMobileSearchActive,\n onBack: closeLocalTextSearch,\n });\n\n const isMessagingDisabled = Boolean(\n !isPinnedMessageList && !renderingCanPost && !renderingCanRestartBot && !renderingCanStartBot\n && !renderingCanSubscribe && messageSendingRestrictionReason,\n );\n const withMessageListBottomShift = Boolean(\n renderingCanRestartBot || renderingCanSubscribe || renderingCanStartBot || isPinnedMessageList,\n );\n const withExtraShift = Boolean(isMessagingDisabled || isSelectModeActive || isPinnedMessageList);\n\n return (\n <div\n id=\"MiddleColumn\"\n className={className}\n onTransitionEnd={handleOpenEnd}\n style={`\n --composer-hidden-scale: ${composerHiddenScale};\n --toolbar-hidden-scale: ${toolbarHiddenScale};\n --unpin-hidden-scale: ${unpinHiddenScale};\n --toolbar-unpin-hidden-scale: ${toolbarForUnpinHiddenScale};\n --composer-translate-x: ${composerTranslateX}px;\n --toolbar-translate-x: ${toolbarTranslateX}px;\n --pattern-color: ${patternColor};\n --theme-background-color:\n ${backgroundColor || (theme === 'dark' ? DARK_THEME_BG_COLOR : LIGHT_THEME_BG_COLOR)};\n `}\n onClick={(IS_TABLET_COLUMN_LAYOUT && isLeftColumnShown) ? handleTabletFocus : undefined}\n >\n <div\n className={bgClassName}\n style={customBackgroundValue ? `--custom-background: ${customBackgroundValue}` : undefined}\n />\n <div id=\"middle-column-portals\" />\n {renderingChatId && renderingThreadId && (\n <>\n <div className=\"messages-layout\" onDragEnter={renderingCanPost ? handleDragEnter : undefined}>\n <MiddleHeader\n chatId={renderingChatId}\n threadId={renderingThreadId}\n messageListType={renderingMessageListType}\n isReady={isReady}\n />\n <Transition\n name={shouldSkipHistoryAnimations ? 'none' : animationLevel === ANIMATION_LEVEL_MAX ? 'slide' : 'fade'}\n activeKey={currentTransitionKey}\n shouldCleanup\n cleanupExceptionKey={cleanupExceptionKey}\n onStop={handleSlideStop}\n >\n <MessageList\n key={`${renderingChatId}-${renderingThreadId}-${renderingMessageListType}`}\n chatId={renderingChatId}\n threadId={renderingThreadId}\n type={renderingMessageListType}\n canPost={renderingCanPost}\n hasTools={renderingHasTools}\n onFabToggle={setIsFabShown}\n onNotchToggle={setIsNotchShown}\n isReady={isReady}\n withBottomShift={withMessageListBottomShift}\n />\n <div className={footerClassName}>\n {renderingCanPost && (\n <Composer\n chatId={renderingChatId}\n threadId={renderingThreadId}\n messageListType={renderingMessageListType}\n dropAreaState={dropAreaState}\n onDropHide={handleHideDropArea}\n isReady={isReady}\n />\n )}\n {isPinnedMessageList && (\n <div className=\"middle-column-footer-button-container\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n size=\"tiny\"\n fluid\n color=\"secondary\"\n className=\"unpin-all-button\"\n onClick={handleOpenUnpinModal}\n >\n <i className=\"icon-unpin\" />\n <span>{lang('Chat.Pinned.UnpinAll', pinnedMessagesCount, 'i')}</span>\n </Button>\n </div>\n )}\n {isMessagingDisabled && (\n <div className={messagingDisabledClassName}>\n <div className=\"messaging-disabled-inner\">\n <span>\n {messageSendingRestrictionReason}\n </span>\n </div>\n </div>\n )}\n {IS_SINGLE_COLUMN_LAYOUT\n && (renderingCanSubscribe || (renderingShouldJoinToSend && !renderingShouldSendJoinRequest)) && (\n <div className=\"middle-column-footer-button-container\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n size=\"tiny\"\n fluid\n ripple\n className=\"join-subscribe-button\"\n onClick={handleSubscribeClick}\n >\n {lang(renderingIsChannel ? 'ProfileJoinChannel' : 'ProfileJoinGroup')}\n </Button>\n </div>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && renderingShouldSendJoinRequest && (\n <div className=\"middle-column-footer-button-container\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n size=\"tiny\"\n fluid\n ripple\n className=\"join-subscribe-button\"\n onClick={handleSubscribeClick}\n >\n {lang('ChannelJoinRequest')}\n </Button>\n </div>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && renderingCanStartBot && (\n <div className=\"middle-column-footer-button-container\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n size=\"tiny\"\n fluid\n ripple\n className=\"join-subscribe-button\"\n onClick={handleStartBot}\n >\n {lang('BotStart')}\n </Button>\n </div>\n )}\n {IS_SINGLE_COLUMN_LAYOUT && renderingCanRestartBot && (\n <div className=\"middle-column-footer-button-container\" dir={lang.isRtl ? 'rtl' : undefined}>\n <Button\n size=\"tiny\"\n fluid\n ripple\n className=\"join-subscribe-button\"\n onClick={handleRestartBot}\n >\n {lang('BotRestart')}\n </Button>\n </div>\n )}\n <MessageSelectToolbar\n messageListType={renderingMessageListType}\n isActive={isSelectModeActive}\n canPost={renderingCanPost}\n />\n <SeenByModal isOpen={isSeenByModalOpen} />\n <ReactorListModal isOpen={isReactorListModalOpen} />\n </div>\n </Transition>\n\n <FloatingActionButtons\n isShown={renderingIsFabShown}\n canPost={renderingCanPost}\n withExtraShift={withExtraShift}\n />\n </div>\n {IS_SINGLE_COLUMN_LAYOUT && <MobileSearch isActive={Boolean(isMobileSearchActive)} />}\n </>\n )}\n {chatId && (\n <UnpinAllMessagesModal\n isOpen={isUnpinModalOpen}\n chatId={chatId}\n pinnedMessagesCount={pinnedMessagesCount}\n onClose={closeUnpinModal}\n onUnpin={handleUnpinAllMessages}\n />\n )}\n <div teactFastList>\n {activeEmojiInteractions?.map((activeEmojiInteraction, i) => (\n <EmojiInteractionAnimation\n teactOrderKey={i}\n key={activeEmojiInteraction.id}\n activeEmojiInteraction={activeEmojiInteraction}\n />\n ))}\n </div>\n <GiftPremiumModal isOpen={isGiftPremiumModalOpen} />\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const theme = selectTheme(global);\n const {\n isBlurred: isBackgroundBlurred, background: customBackground, backgroundColor, patternColor,\n } = global.settings.themes[theme] || {};\n\n const { messageLists } = global.messages;\n const currentMessageList = selectCurrentMessageList(global);\n const {\n isLeftColumnShown, chats: { listIds }, activeEmojiInteractions, lastSyncTime,\n } = global;\n\n const state: StateProps = {\n theme,\n customBackground,\n backgroundColor,\n patternColor,\n isLeftColumnShown,\n isRightColumnShown: selectIsRightColumnShown(global),\n isBackgroundBlurred,\n isMobileSearchActive: Boolean(IS_SINGLE_COLUMN_LAYOUT && selectCurrentTextSearch(global)),\n isSelectModeActive: selectIsInSelectMode(global),\n isSeenByModalOpen: Boolean(global.seenByModal),\n isReactorListModalOpen: Boolean(global.reactorModal),\n isGiftPremiumModalOpen: global.giftPremiumModal?.isOpen,\n animationLevel: global.settings.byKey.animationLevel,\n currentTransitionKey: Math.max(0, messageLists.length - 1),\n activeEmojiInteractions,\n lastSyncTime,\n };\n\n if (!currentMessageList || !listIds.active) {\n return state;\n }\n\n const { chatId, threadId, type: messageListType } = currentMessageList;\n const isPrivate = isUserId(chatId);\n const chat = selectChat(global, chatId);\n const bot = selectChatBot(global, chatId);\n const pinnedIds = selectPinnedIds(global, chatId);\n const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;\n\n const canPost = chat && getCanPostInChat(chat, threadId);\n const isBotNotStarted = selectIsChatBotNotStarted(global, chatId);\n const isPinnedMessageList = messageListType === 'pinned';\n const isScheduledMessageList = messageListType === 'scheduled';\n const isMainThread = messageListType === 'thread' && threadId === MAIN_THREAD_ID;\n const isChannel = Boolean(chat && isChatChannel(chat));\n const canSubscribe = Boolean(\n chat && isMainThread && (isChannel || isChatSuperGroup(chat)) && chat.isNotJoined && !chat.joinRequests,\n );\n const shouldJoinToSend = Boolean(chat?.isNotJoined && chat.isJoinToSend);\n const shouldSendJoinRequest = Boolean(chat?.isNotJoined && chat.isJoinRequest);\n const canRestartBot = Boolean(bot && selectIsUserBlocked(global, bot.id));\n const canStartBot = !canRestartBot && isBotNotStarted;\n\n return {\n ...state,\n chatId,\n threadId,\n messageListType,\n isPrivate,\n areChatSettingsLoaded: Boolean(chat?.settings),\n canPost: !isPinnedMessageList\n && (!chat || canPost)\n && !isBotNotStarted\n && !(shouldJoinToSend && chat?.isNotJoined),\n isPinnedMessageList,\n isScheduledMessageList,\n currentUserBannedRights: chat?.currentUserBannedRights,\n defaultBannedRights: chat?.defaultBannedRights,\n hasPinnedOrAudioPlayer: (\n threadId !== MAIN_THREAD_ID\n || Boolean(!isPinnedMessageList && pinnedIds?.length)\n || Boolean(audioChatId && audioMessageId)\n ),\n pinnedMessagesCount: pinnedIds ? pinnedIds.length : 0,\n shouldSkipHistoryAnimations: global.shouldSkipHistoryAnimations,\n isChannel,\n canSubscribe,\n canStartBot,\n canRestartBot,\n shouldJoinToSend,\n shouldSendJoinRequest,\n };\n },\n)(MiddleColumn));\n\nfunction useIsReady(\n withAnimations?: boolean,\n currentTransitionKey?: number,\n prevTransitionKey?: number,\n chatId?: string,\n) {\n const [isReady, setIsReady] = useState(!IS_SINGLE_COLUMN_LAYOUT);\n const forceUpdate = useForceUpdate();\n\n const willSwitchMessageList = prevTransitionKey !== undefined && prevTransitionKey !== currentTransitionKey;\n if (willSwitchMessageList) {\n if (withAnimations) {\n setIsReady(false);\n } else {\n forceUpdate();\n }\n }\n\n useOnChange(() => {\n if (!withAnimations) {\n setIsReady(true);\n }\n }, [withAnimations]);\n\n function handleOpenEnd(e: React.TransitionEvent<HTMLDivElement>) {\n if (e.propertyName === 'transform' && e.target === e.currentTarget) {\n setIsReady(Boolean(chatId));\n }\n }\n\n function handleSlideStop() {\n setIsReady(true);\n }\n\n return {\n isReady: isReady && !willSwitchMessageList,\n handleOpenEnd: withAnimations ? handleOpenEnd : undefined,\n handleSlideStop: withAnimations ? handleSlideStop : undefined,\n };\n}\n","import { useEffect, useState } from '../lib/teact/teact';\n\nimport type { ThemeKey } from '../types';\n\nimport { CUSTOM_BG_CACHE_NAME } from '../config';\nimport * as cacheApi from '../util/cacheApi';\nimport { preloadImage } from '../util/files';\n\nconst useCustomBackground = (theme: ThemeKey, settingValue?: string) => {\n const [value, setValue] = useState(settingValue);\n\n useEffect(() => {\n if (!settingValue) {\n return;\n }\n\n if (settingValue.startsWith('#')) {\n setValue(settingValue);\n } else {\n cacheApi.fetch(CUSTOM_BG_CACHE_NAME, theme, cacheApi.Type.Blob)\n .then((blob) => {\n const url = URL.createObjectURL(blob);\n preloadImage(url)\n .then(() => {\n setValue(`url(${url})`);\n });\n });\n }\n }, [settingValue, theme]);\n\n return settingValue ? value : undefined;\n};\n\nexport default useCustomBackground;\n","// extracted by mini-css-extract-plugin\nexport default {\"background\":\"ON5E8MkEVA1mAlkuIxhG\",\"customBgImage\":\"Ik9ZZlj3eKtKXRrUZKVk\",\"customBgColor\":\"avVozLQe3SaWcSkIt6pG\",\"withTransition\":\"OWFg9Wf1uioPWDz_IgS8\",\"blurred\":\"Tipa66fYcSvl6w0587Xz\",\"withRightColumn\":\"vhOr8s3T_LCKSt2BF7fs\"};","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport { ManagementScreens, ProfileState } from '../../types';\nimport type { ApiExportedInvite } from '../../api/types';\n\nimport { ANIMATION_END_DELAY } from '../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { debounce } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport {\n selectChat,\n selectCurrentGifSearch,\n selectCurrentStickerSearch,\n selectCurrentTextSearch,\n selectIsChatWithSelf,\n selectUser,\n} from '../../global/selectors';\nimport {\n getCanAddContact, isChatAdmin, isChatChannel, isUserId,\n} from '../../global/helpers';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\nimport useLang from '../../hooks/useLang';\nimport useFlag from '../../hooks/useFlag';\nimport { getDayStartAt } from '../../util/dateFormat';\n\nimport SearchInput from '../ui/SearchInput';\nimport Button from '../ui/Button';\nimport Transition from '../ui/Transition';\nimport ConfirmDialog from '../ui/ConfirmDialog';\n\nimport './RightHeader.scss';\n\ntype OwnProps = {\n chatId?: string;\n isColumnOpen?: boolean;\n isProfile?: boolean;\n isSearch?: boolean;\n isManagement?: boolean;\n isStatistics?: boolean;\n isMessageStatistics?: boolean;\n isStickerSearch?: boolean;\n isGifSearch?: boolean;\n isPollResults?: boolean;\n isAddingChatMembers?: boolean;\n profileState?: ProfileState;\n managementScreen?: ManagementScreens;\n onClose: () => void;\n onScreenSelect: (screen: ManagementScreens) => void;\n};\n\ntype StateProps = {\n canAddContact?: boolean;\n canManage?: boolean;\n canViewStatistics?: boolean;\n isChannel?: boolean;\n userId?: string;\n messageSearchQuery?: string;\n stickerSearchQuery?: string;\n gifSearchQuery?: string;\n isEditingInvite?: boolean;\n currentInviteInfo?: ApiExportedInvite;\n shouldSkipHistoryAnimations?: boolean;\n};\n\nconst COLUMN_ANIMATION_DURATION = 450 + ANIMATION_END_DELAY;\nconst runDebouncedForSearch = debounce((cb) => cb(), 200, false);\n\nenum HeaderContent {\n Profile,\n MemberList,\n SharedMedia,\n Search,\n Statistics,\n MessageStatistics,\n Management,\n ManageInitial,\n ManageChannelSubscribers,\n ManageChatAdministrators,\n ManageChatPrivacyType,\n ManageDiscussion,\n ManageGroupPermissions,\n ManageGroupRemovedUsers,\n ManageChannelRemovedUsers,\n ManageGroupUserPermissionsCreate,\n ManageGroupUserPermissions,\n ManageGroupRecentActions,\n ManageGroupAdminRights,\n ManageGroupNewAdminRights,\n ManageGroupMembers,\n ManageGroupAddAdmins,\n StickerSearch,\n GifSearch,\n PollResults,\n AddingMembers,\n ManageInvites,\n ManageEditInvite,\n ManageReactions,\n ManageInviteInfo,\n ManageJoinRequests,\n}\n\nconst RightHeader: FC<OwnProps & StateProps> = ({\n chatId,\n isColumnOpen,\n isProfile,\n isSearch,\n isManagement,\n isStatistics,\n isMessageStatistics,\n isStickerSearch,\n isGifSearch,\n isPollResults,\n isAddingChatMembers,\n profileState,\n managementScreen,\n canAddContact,\n userId,\n canManage,\n isChannel,\n onClose,\n onScreenSelect,\n messageSearchQuery,\n stickerSearchQuery,\n gifSearchQuery,\n isEditingInvite,\n canViewStatistics,\n currentInviteInfo,\n shouldSkipHistoryAnimations,\n}) => {\n const {\n setLocalTextSearchQuery,\n setStickerSearchQuery,\n setGifSearchQuery,\n searchTextMessagesLocal,\n toggleManagement,\n openHistoryCalendar,\n openAddContactDialog,\n toggleStatistics,\n setEditingExportedInvite,\n deleteExportedChatInvite,\n } = getActions();\n\n const [isDeleteDialogOpen, openDeleteDialog, closeDeleteDialog] = useFlag();\n\n const handleEditInviteClick = useCallback(() => {\n setEditingExportedInvite({ chatId: chatId!, invite: currentInviteInfo! });\n onScreenSelect(ManagementScreens.EditInvite);\n }, [chatId, currentInviteInfo, onScreenSelect, setEditingExportedInvite]);\n\n const handleDeleteInviteClick = useCallback(() => {\n deleteExportedChatInvite({ chatId: chatId!, link: currentInviteInfo!.link });\n onScreenSelect(ManagementScreens.Invites);\n closeDeleteDialog();\n }, [chatId, closeDeleteDialog, currentInviteInfo, deleteExportedChatInvite, onScreenSelect]);\n\n const handleMessageSearchQueryChange = useCallback((query: string) => {\n setLocalTextSearchQuery({ query });\n\n if (query.length) {\n runDebouncedForSearch(searchTextMessagesLocal);\n }\n }, [searchTextMessagesLocal, setLocalTextSearchQuery]);\n\n const handleStickerSearchQueryChange = useCallback((query: string) => {\n setStickerSearchQuery({ query });\n }, [setStickerSearchQuery]);\n\n const handleGifSearchQueryChange = useCallback((query: string) => {\n setGifSearchQuery({ query });\n }, [setGifSearchQuery]);\n\n const handleAddContact = useCallback(() => {\n openAddContactDialog({ userId });\n }, [openAddContactDialog, userId]);\n\n const [shouldSkipTransition, setShouldSkipTransition] = useState(!isColumnOpen);\n\n useEffect(() => {\n setTimeout(() => {\n setShouldSkipTransition(!isColumnOpen);\n }, COLUMN_ANIMATION_DURATION);\n }, [isColumnOpen]);\n\n const lang = useLang();\n const contentKey = isProfile ? (\n profileState === ProfileState.Profile ? (\n HeaderContent.Profile\n ) : profileState === ProfileState.SharedMedia ? (\n HeaderContent.SharedMedia\n ) : profileState === ProfileState.MemberList ? (\n HeaderContent.MemberList\n ) : -1 // Never reached\n ) : isSearch ? (\n HeaderContent.Search\n ) : isPollResults ? (\n HeaderContent.PollResults\n ) : isStickerSearch ? (\n HeaderContent.StickerSearch\n ) : isGifSearch ? (\n HeaderContent.GifSearch\n ) : isAddingChatMembers ? (\n HeaderContent.AddingMembers\n ) : isManagement ? (\n managementScreen === ManagementScreens.Initial ? (\n HeaderContent.ManageInitial\n ) : managementScreen === ManagementScreens.ChatPrivacyType ? (\n HeaderContent.ManageChatPrivacyType\n ) : managementScreen === ManagementScreens.Discussion ? (\n HeaderContent.ManageDiscussion\n ) : managementScreen === ManagementScreens.ChannelSubscribers ? (\n HeaderContent.ManageChannelSubscribers\n ) : managementScreen === ManagementScreens.GroupPermissions ? (\n HeaderContent.ManageGroupPermissions\n ) : managementScreen === ManagementScreens.ChatAdministrators ? (\n HeaderContent.ManageChatAdministrators\n ) : managementScreen === ManagementScreens.GroupRemovedUsers ? (\n HeaderContent.ManageGroupRemovedUsers\n ) : managementScreen === ManagementScreens.ChannelRemovedUsers ? (\n HeaderContent.ManageChannelRemovedUsers\n ) : managementScreen === ManagementScreens.GroupUserPermissionsCreate ? (\n HeaderContent.ManageGroupUserPermissionsCreate\n ) : managementScreen === ManagementScreens.GroupUserPermissions ? (\n HeaderContent.ManageGroupUserPermissions\n ) : managementScreen === ManagementScreens.GroupRecentActions ? (\n HeaderContent.ManageGroupRecentActions\n ) : managementScreen === ManagementScreens.ChatAdminRights ? (\n HeaderContent.ManageGroupAdminRights\n ) : managementScreen === ManagementScreens.ChatNewAdminRights ? (\n HeaderContent.ManageGroupNewAdminRights\n ) : managementScreen === ManagementScreens.GroupMembers ? (\n HeaderContent.ManageGroupMembers\n ) : managementScreen === ManagementScreens.Invites ? (\n HeaderContent.ManageInvites\n ) : managementScreen === ManagementScreens.EditInvite ? (\n HeaderContent.ManageEditInvite\n ) : managementScreen === ManagementScreens.GroupAddAdmins ? (\n HeaderContent.ManageGroupAddAdmins\n ) : managementScreen === ManagementScreens.Reactions ? (\n HeaderContent.ManageReactions\n ) : managementScreen === ManagementScreens.InviteInfo ? (\n HeaderContent.ManageInviteInfo\n ) : managementScreen === ManagementScreens.JoinRequests ? (\n HeaderContent.ManageJoinRequests\n ) : undefined // Never reached\n ) : isStatistics ? (\n HeaderContent.Statistics\n ) : isMessageStatistics ? (\n HeaderContent.MessageStatistics\n ) : undefined; // When column is closed\n\n const renderingContentKey = useCurrentOrPrev(contentKey, true) ?? -1;\n\n function renderHeaderContent() {\n if (renderingContentKey === -1) {\n return undefined;\n }\n\n switch (renderingContentKey) {\n case HeaderContent.PollResults:\n return <h3>{lang('PollResults')}</h3>;\n case HeaderContent.Search:\n return (\n <>\n <SearchInput\n parentContainerClassName=\"RightSearch\"\n value={messageSearchQuery}\n onChange={handleMessageSearchQueryChange}\n />\n <Button\n round\n size=\"smaller\"\n color=\"translucent\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openHistoryCalendar({ selectedAt: getDayStartAt(Date.now()) })}\n ariaLabel=\"Search messages by date\"\n >\n <i className=\"icon-calendar\" />\n </Button>\n </>\n );\n case HeaderContent.AddingMembers:\n return <h3>{lang(isChannel ? 'ChannelAddSubscribers' : 'GroupAddMembers')}</h3>;\n case HeaderContent.ManageInitial:\n return <h3>{lang('Edit')}</h3>;\n case HeaderContent.ManageChatPrivacyType:\n return <h3>{lang(isChannel ? 'ChannelTypeHeader' : 'GroupTypeHeader')}</h3>;\n case HeaderContent.ManageDiscussion:\n return <h3>{lang('Discussion')}</h3>;\n case HeaderContent.ManageChatAdministrators:\n return <h3>{lang('ChannelAdministrators')}</h3>;\n case HeaderContent.ManageGroupRecentActions:\n return <h3>{lang('Group.Info.AdminLog')}</h3>;\n case HeaderContent.ManageGroupAdminRights:\n return <h3>{lang('EditAdminRights')}</h3>;\n case HeaderContent.ManageGroupNewAdminRights:\n return <h3>{lang('SetAsAdmin')}</h3>;\n case HeaderContent.ManageGroupPermissions:\n return <h3>{lang('ChannelPermissions')}</h3>;\n case HeaderContent.ManageGroupRemovedUsers:\n return <h3>{lang('BlockedUsers')}</h3>;\n case HeaderContent.ManageChannelRemovedUsers:\n return <h3>{lang('ChannelBlockedUsers')}</h3>;\n case HeaderContent.ManageGroupUserPermissionsCreate:\n return <h3>{lang('ChannelAddException')}</h3>;\n case HeaderContent.ManageGroupUserPermissions:\n return <h3>{lang('UserRestrictions')}</h3>;\n case HeaderContent.ManageInvites:\n return <h3>{lang('lng_group_invite_title')}</h3>;\n case HeaderContent.ManageEditInvite:\n return <h3>{isEditingInvite ? lang('EditLink') : lang('NewLink')}</h3>;\n case HeaderContent.ManageInviteInfo:\n return (\n <>\n <h3>{lang('InviteLink')}</h3>\n <section className=\"tools\">\n {currentInviteInfo && !currentInviteInfo.isRevoked && (\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Edit')}\n onClick={handleEditInviteClick}\n >\n <i className=\"icon-edit\" />\n </Button>\n )}\n {currentInviteInfo && currentInviteInfo.isRevoked && (\n <>\n <Button\n round\n color=\"danger\"\n size=\"smaller\"\n ariaLabel={lang('Delete')}\n onClick={openDeleteDialog}\n >\n <i className=\"icon-delete\" />\n </Button>\n <ConfirmDialog\n isOpen={isDeleteDialogOpen}\n onClose={closeDeleteDialog}\n title={lang('DeleteLink')}\n text={lang('DeleteLinkHelp')}\n confirmIsDestructive\n confirmLabel={lang('Delete')}\n confirmHandler={handleDeleteInviteClick}\n />\n </>\n )}\n </section>\n </>\n );\n case HeaderContent.ManageJoinRequests:\n return <h3>{isChannel ? lang('SubscribeRequests') : lang('MemberRequests')}</h3>;\n case HeaderContent.ManageGroupAddAdmins:\n return <h3>{lang('Channel.Management.AddModerator')}</h3>;\n case HeaderContent.StickerSearch:\n return (\n <SearchInput\n value={stickerSearchQuery}\n placeholder={lang('SearchStickersHint')}\n autoFocusSearch\n onChange={handleStickerSearchQueryChange}\n />\n );\n case HeaderContent.GifSearch:\n return (\n <SearchInput\n value={gifSearchQuery}\n placeholder={lang('SearchGifsTitle')}\n autoFocusSearch\n onChange={handleGifSearchQueryChange}\n />\n );\n case HeaderContent.Statistics:\n return <h3>{lang(isChannel ? 'ChannelStats.Title' : 'GroupStats.Title')}</h3>;\n case HeaderContent.MessageStatistics:\n return <h3>{lang('Stats.MessageTitle')}</h3>;\n case HeaderContent.SharedMedia:\n return <h3>{lang('SharedMedia')}</h3>;\n case HeaderContent.ManageChannelSubscribers:\n return <h3>{lang('ChannelSubscribers')}</h3>;\n case HeaderContent.MemberList:\n case HeaderContent.ManageGroupMembers:\n return <h3>{lang('GroupMembers')}</h3>;\n case HeaderContent.ManageReactions:\n return <h3>{lang('Reactions')}</h3>;\n default:\n return (\n <>\n <h3>Profile</h3>\n <section className=\"tools\">\n {canAddContact && (\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('AddContact')}\n onClick={handleAddContact}\n >\n <i className=\"icon-add-user\" />\n </Button>\n )}\n {canManage && (\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Edit')}\n onClick={toggleManagement}\n >\n <i className=\"icon-edit\" />\n </Button>\n )}\n {canViewStatistics && (\n <Button\n round\n color=\"translucent\"\n size=\"smaller\"\n ariaLabel={lang('Statistics')}\n onClick={toggleStatistics}\n >\n <i className=\"icon-stats\" />\n </Button>\n )}\n </section>\n </>\n );\n }\n }\n\n const isBackButton = (\n IS_SINGLE_COLUMN_LAYOUT\n || contentKey === HeaderContent.SharedMedia\n || contentKey === HeaderContent.MemberList\n || contentKey === HeaderContent.AddingMembers\n || contentKey === HeaderContent.MessageStatistics\n || isManagement\n );\n\n const buttonClassName = buildClassName(\n 'animated-close-icon',\n isBackButton && 'state-back',\n (shouldSkipTransition || shouldSkipHistoryAnimations) && 'no-transition',\n );\n\n return (\n <div className=\"RightHeader\">\n <Button\n className=\"close-button\"\n round\n color=\"translucent\"\n size=\"smaller\"\n onClick={onClose}\n ariaLabel={isBackButton ? lang('Common.Back') : lang('Common.Close')}\n >\n <div className={buttonClassName} />\n </Button>\n <Transition\n name={(shouldSkipTransition || shouldSkipHistoryAnimations) ? 'none' : 'slide-fade'}\n activeKey={renderingContentKey}\n >\n {renderHeaderContent()}\n </Transition>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId, isProfile, isManagement }): StateProps => {\n const { query: messageSearchQuery } = selectCurrentTextSearch(global) || {};\n const { query: stickerSearchQuery } = selectCurrentStickerSearch(global) || {};\n const { query: gifSearchQuery } = selectCurrentGifSearch(global) || {};\n const chat = chatId ? selectChat(global, chatId) : undefined;\n const isChannel = chat && isChatChannel(chat);\n const user = isProfile && chatId && isUserId(chatId) ? selectUser(global, chatId) : undefined;\n\n const canAddContact = user && getCanAddContact(user);\n const canManage = Boolean(\n !isManagement\n && isProfile\n && !canAddContact\n && chat\n && !selectIsChatWithSelf(global, chat.id)\n // chat.isCreator is for Basic Groups\n && (isUserId(chat.id) || ((isChatAdmin(chat) || chat.isCreator) && !chat.isNotJoined)),\n );\n const isEditingInvite = Boolean(chatId && global.management.byChatId[chatId]?.editingInvite);\n const canViewStatistics = chat?.fullInfo?.canViewStatistics;\n const currentInviteInfo = chatId ? global.management.byChatId[chatId]?.inviteInfo?.invite : undefined;\n\n return {\n canManage,\n canAddContact,\n canViewStatistics,\n isChannel,\n userId: user?.id,\n messageSearchQuery,\n stickerSearchQuery,\n gifSearchQuery,\n isEditingInvite,\n currentInviteInfo,\n shouldSkipHistoryAnimations: global.shouldSkipHistoryAnimations,\n };\n },\n)(RightHeader));\n","import { useMemo, useRef } from '../../../lib/teact/teact';\n\nimport type {\n ApiChat, ApiChatMember, ApiMessage, ApiUser, ApiUserStatus,\n} from '../../../api/types';\nimport type { ProfileTabType, SharedMediaType } from '../../../types';\n\nimport { MEMBERS_SLICE, MESSAGE_SEARCH_SLICE, SHARED_MEDIA_SLICE } from '../../../config';\nimport { getMessageContentIds, sortChatIds, sortUserIds } from '../../../global/helpers';\nimport useOnChange from '../../../hooks/useOnChange';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\n\nexport default function useProfileViewportIds(\n isRightColumnShown: boolean,\n loadMoreMembers: AnyToVoidFunction,\n loadCommonChats: AnyToVoidFunction,\n searchMessages: AnyToVoidFunction,\n tabType: ProfileTabType,\n mediaSearchType?: SharedMediaType,\n groupChatMembers?: ApiChatMember[],\n commonChatIds?: string[],\n usersById?: Record<string, ApiUser>,\n userStatusesById?: Record<string, ApiUserStatus>,\n chatsById?: Record<string, ApiChat>,\n chatMessages?: Record<number, ApiMessage>,\n foundIds?: number[],\n chatId?: string,\n lastSyncTime?: number,\n serverTimeOffset = 0,\n) {\n const resultType = tabType === 'members' || !mediaSearchType ? tabType : mediaSearchType;\n\n const memberIds = useMemo(() => {\n if (!groupChatMembers || !usersById || !userStatusesById) {\n return undefined;\n }\n\n return sortUserIds(\n groupChatMembers.map(({ userId }) => userId),\n usersById,\n userStatusesById,\n undefined,\n serverTimeOffset,\n );\n }, [groupChatMembers, serverTimeOffset, usersById, userStatusesById]);\n\n const chatIds = useMemo(() => {\n if (!commonChatIds || !chatsById) {\n return undefined;\n }\n\n return sortChatIds(commonChatIds, chatsById, true);\n }, [chatsById, commonChatIds]);\n\n const [memberViewportIds, getMoreMembers, noProfileInfoForMembers] = useInfiniteScrollForLoadableItems(\n resultType, loadMoreMembers, lastSyncTime, memberIds,\n );\n\n const [mediaViewportIds, getMoreMedia, noProfileInfoForMedia] = useInfiniteScrollForSharedMedia(\n 'media', resultType, searchMessages, lastSyncTime, chatMessages, foundIds,\n );\n\n const [documentViewportIds, getMoreDocuments, noProfileInfoForDocuments] = useInfiniteScrollForSharedMedia(\n 'documents', resultType, searchMessages, lastSyncTime, chatMessages, foundIds,\n );\n\n const [linkViewportIds, getMoreLinks, noProfileInfoForLinks] = useInfiniteScrollForSharedMedia(\n 'links', resultType, searchMessages, lastSyncTime, chatMessages, foundIds,\n );\n\n const [audioViewportIds, getMoreAudio, noProfileInfoForAudio] = useInfiniteScrollForSharedMedia(\n 'audio', resultType, searchMessages, lastSyncTime, chatMessages, foundIds,\n );\n\n const [voiceViewportIds, getMoreVoices, noProfileInfoForVoices] = useInfiniteScrollForSharedMedia(\n 'voice', resultType, searchMessages, lastSyncTime, chatMessages, foundIds,\n );\n\n const [commonChatViewportIds, getMoreCommonChats, noProfileInfoForCommonChats] = useInfiniteScrollForLoadableItems(\n resultType, loadCommonChats, lastSyncTime, chatIds,\n );\n\n let viewportIds: number[] | string[] | undefined;\n let getMore: AnyToVoidFunction | undefined;\n let noProfileInfo = false;\n\n switch (resultType) {\n case 'members':\n viewportIds = memberViewportIds;\n getMore = getMoreMembers;\n noProfileInfo = noProfileInfoForMembers;\n break;\n case 'commonChats':\n viewportIds = commonChatViewportIds;\n getMore = getMoreCommonChats;\n noProfileInfo = noProfileInfoForCommonChats;\n break;\n case 'media':\n viewportIds = mediaViewportIds;\n getMore = getMoreMedia;\n noProfileInfo = noProfileInfoForMedia;\n break;\n case 'documents':\n viewportIds = documentViewportIds;\n getMore = getMoreDocuments;\n noProfileInfo = noProfileInfoForDocuments;\n break;\n case 'links':\n viewportIds = linkViewportIds;\n getMore = getMoreLinks;\n noProfileInfo = noProfileInfoForLinks;\n break;\n case 'audio':\n viewportIds = audioViewportIds;\n getMore = getMoreAudio;\n noProfileInfo = noProfileInfoForAudio;\n break;\n case 'voice':\n viewportIds = voiceViewportIds;\n getMore = getMoreVoices;\n noProfileInfo = noProfileInfoForVoices;\n break;\n }\n\n return [resultType, viewportIds, getMore, noProfileInfo] as const;\n}\n\nfunction useInfiniteScrollForLoadableItems(\n currentResultType?: ProfileTabType,\n handleLoadMore?: AnyToVoidFunction,\n lastSyncTime?: number,\n itemIds?: string[],\n) {\n const [viewportIds, getMore] = useInfiniteScroll(\n lastSyncTime ? handleLoadMore : undefined,\n itemIds,\n undefined,\n MEMBERS_SLICE,\n );\n\n const isOnTop = !viewportIds || !itemIds || viewportIds[0] === itemIds[0];\n\n return [viewportIds, getMore, !isOnTop] as const;\n}\n\nfunction useInfiniteScrollForSharedMedia(\n forSharedMediaType: SharedMediaType,\n currentResultType?: ProfileTabType,\n handleLoadMore?: AnyToVoidFunction,\n lastSyncTime?: number,\n chatMessages?: Record<number, ApiMessage>,\n foundIds?: number[],\n) {\n const messageIdsRef = useRef<number[]>();\n\n useOnChange(() => {\n if (currentResultType === forSharedMediaType && chatMessages && foundIds) {\n messageIdsRef.current = getMessageContentIds(\n chatMessages,\n foundIds,\n forSharedMediaType,\n );\n }\n }, [chatMessages, foundIds, currentResultType, forSharedMediaType]);\n\n const [viewportIds, getMore] = useInfiniteScroll(\n lastSyncTime ? handleLoadMore : undefined,\n messageIdsRef.current,\n undefined,\n forSharedMediaType === 'media' ? SHARED_MEDIA_SLICE : MESSAGE_SEARCH_SLICE,\n );\n\n const isOnTop = !viewportIds || !messageIdsRef.current || viewportIds[0] === messageIdsRef.current[0];\n\n return [viewportIds, getMore, !isOnTop] as const;\n}\n","import { useCallback, useEffect } from '../../../lib/teact/teact';\n\nimport { ProfileState } from '../../../types';\n\nimport fastSmoothScroll from '../../../util/fastSmoothScroll';\nimport { throttle } from '../../../util/schedulers';\nimport useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps';\n\nconst TRANSITION_DURATION = 300;\nconst PROGRAMMATIC_SCROLL_TIMEOUT_MS = 350;\n\nconst runThrottledForScroll = throttle((cb) => cb(), 250, false);\n\nlet isScrollingProgrammatically = false;\n\nexport default function useProfileState(\n containerRef: { current: HTMLDivElement | null },\n tabType: string,\n profileState: ProfileState,\n onProfileStateChange: (state: ProfileState) => void,\n) {\n // Scroll to tabs if needed\n useEffectWithPrevDeps(([prevTabType]) => {\n if (prevTabType && prevTabType !== tabType) {\n const container = containerRef.current!;\n const tabsEl = container.querySelector<HTMLDivElement>('.TabList')!;\n if (container.scrollTop < tabsEl.offsetTop) {\n onProfileStateChange(tabType === 'members' ? ProfileState.MemberList : ProfileState.SharedMedia);\n isScrollingProgrammatically = true;\n fastSmoothScroll(container, tabsEl, 'start', undefined, undefined, undefined, TRANSITION_DURATION);\n setTimeout(() => {\n isScrollingProgrammatically = false;\n }, PROGRAMMATIC_SCROLL_TIMEOUT_MS);\n }\n }\n }, [tabType, onProfileStateChange]);\n\n // Scroll to top\n useEffectWithPrevDeps(([prevProfileState]) => {\n if (profileState !== ProfileState.Profile || profileState === prevProfileState) {\n return;\n }\n\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const tabListEl = container.querySelector<HTMLDivElement>('.TabList');\n if (!tabListEl || tabListEl.offsetTop > container.scrollTop) {\n return;\n }\n\n isScrollingProgrammatically = true;\n fastSmoothScroll(\n container,\n container.firstElementChild as HTMLElement,\n 'start',\n undefined,\n container.offsetHeight * 2,\n );\n\n setTimeout(() => {\n isScrollingProgrammatically = false;\n }, PROGRAMMATIC_SCROLL_TIMEOUT_MS);\n\n onProfileStateChange(profileState);\n }, [profileState]);\n\n const determineProfileState = useCallback(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n\n const tabListEl = container.querySelector<HTMLDivElement>('.TabList');\n if (!tabListEl) {\n return;\n }\n\n let state: ProfileState = ProfileState.Profile;\n if (container.scrollTop >= tabListEl.offsetTop) {\n state = tabType === 'members'\n ? ProfileState.MemberList\n : ProfileState.SharedMedia;\n }\n\n onProfileStateChange(state);\n }, [containerRef, onProfileStateChange, tabType]);\n\n // Determine profile state when switching tabs\n useEffect(() => {\n if (isScrollingProgrammatically) {\n return;\n }\n\n determineProfileState();\n }, [determineProfileState, tabType]);\n\n // Determine profile state when scrolling\n const handleScroll = useCallback(() => {\n if (isScrollingProgrammatically) {\n return;\n }\n\n runThrottledForScroll(determineProfileState);\n }, [determineProfileState]);\n\n return { handleScroll };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, useEffect, useMemo, useRef, useState, memo,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type {\n ApiMessage,\n ApiChat,\n ApiChatMember,\n ApiUser,\n ApiUserStatus,\n} from '../../api/types';\nimport {\n MAIN_THREAD_ID,\n} from '../../api/types';\nimport type {\n ISettings, ProfileState, ProfileTabType, SharedMediaType,\n} from '../../types';\nimport {\n NewChatMembersProgress, MediaViewerOrigin, AudioOrigin,\n} from '../../types';\n\nimport {\n MEMBERS_SLICE,\n PROFILE_SENSITIVE_AREA,\n SHARED_MEDIA_SLICE,\n SLIDE_TRANSITION_DURATION,\n} from '../../config';\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport {\n getHasAdminRight, isChatAdmin, isChatChannel, isChatGroup, isUserBot, isUserId, isUserRightBanned,\n} from '../../global/helpers';\nimport {\n selectChatMessages,\n selectChat,\n selectCurrentMediaSearch,\n selectIsRightColumnShown,\n selectTheme,\n selectActiveDownloadIds,\n selectUser,\n} from '../../global/selectors';\nimport { captureEvents, SwipeDirection } from '../../util/captureEvents';\nimport { getSenderName } from '../left/search/helpers/getSenderName';\nimport useCacheBuster from '../../hooks/useCacheBuster';\nimport useProfileViewportIds from './hooks/useProfileViewportIds';\nimport useProfileState from './hooks/useProfileState';\nimport useTransitionFixes from './hooks/useTransitionFixes';\nimport useAsyncRendering from './hooks/useAsyncRendering';\nimport useLang from '../../hooks/useLang';\n\nimport Transition from '../ui/Transition';\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport TabList from '../ui/TabList';\nimport Spinner from '../ui/Spinner';\nimport ListItem from '../ui/ListItem';\nimport PrivateChatInfo from '../common/PrivateChatInfo';\nimport ProfileInfo from '../common/ProfileInfo';\nimport Document from '../common/Document';\nimport Audio from '../common/Audio';\nimport ChatExtra from '../common/ChatExtra';\nimport Media from '../common/Media';\nimport WebLink from '../common/WebLink';\nimport NothingFound from '../common/NothingFound';\nimport FloatingActionButton from '../ui/FloatingActionButton';\nimport DeleteMemberModal from './DeleteMemberModal';\nimport GroupChatInfo from '../common/GroupChatInfo';\n\nimport './Profile.scss';\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\n\ntype OwnProps = {\n chatId: string;\n profileState: ProfileState;\n onProfileStateChange: (state: ProfileState) => void;\n};\n\ntype StateProps = {\n theme: ISettings['theme'];\n isChannel?: boolean;\n currentUserId?: string;\n resolvedUserId?: string;\n chatMessages?: Record<number, ApiMessage>;\n foundIds?: number[];\n mediaSearchType?: SharedMediaType;\n hasCommonChatsTab?: boolean;\n hasMembersTab?: boolean;\n areMembersHidden?: boolean;\n canAddMembers?: boolean;\n canDeleteMembers?: boolean;\n members?: ApiChatMember[];\n commonChatIds?: string[];\n chatsById: Record<string, ApiChat>;\n usersById: Record<string, ApiUser>;\n userStatusesById: Record<string, ApiUserStatus>;\n isRightColumnShown: boolean;\n isRestricted?: boolean;\n lastSyncTime?: number;\n serverTimeOffset: number;\n activeDownloadIds: number[];\n isChatProtected?: boolean;\n};\n\nconst TABS = [\n { type: 'media', title: 'SharedMediaTab2' },\n { type: 'documents', title: 'SharedFilesTab2' },\n { type: 'links', title: 'SharedLinksTab2' },\n { type: 'audio', title: 'SharedMusicTab2' },\n { type: 'voice', title: 'SharedVoiceTab2' },\n];\n\nconst HIDDEN_RENDER_DELAY = 1000;\nconst INTERSECTION_THROTTLE = 500;\n\nconst Profile: FC<OwnProps & StateProps> = ({\n chatId,\n profileState,\n onProfileStateChange,\n theme,\n isChannel,\n resolvedUserId,\n currentUserId,\n chatMessages,\n foundIds,\n mediaSearchType,\n hasCommonChatsTab,\n hasMembersTab,\n areMembersHidden,\n canAddMembers,\n canDeleteMembers,\n commonChatIds,\n members,\n usersById,\n userStatusesById,\n chatsById,\n isRightColumnShown,\n isRestricted,\n lastSyncTime,\n activeDownloadIds,\n serverTimeOffset,\n isChatProtected,\n}) => {\n const {\n setLocalMediaSearchType,\n loadMoreMembers,\n loadCommonChats,\n openChat,\n searchMediaMessagesLocal,\n openMediaViewer,\n openAudioPlayer,\n focusMessage,\n loadProfilePhotos,\n setNewChatMembersDialogState,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef<HTMLDivElement>(null);\n // eslint-disable-next-line no-null/no-null\n const transitionRef = useRef<HTMLDivElement>(null);\n const lang = useLang();\n const [activeTab, setActiveTab] = useState(0);\n const [deletingUserId, setDeletingUserId] = useState<string | undefined>();\n\n const tabs = useMemo(() => ([\n ...(hasMembersTab ? [{\n type: 'members', title: isChannel ? 'ChannelSubscribers' : 'GroupMembers',\n }] : []),\n ...TABS,\n ...(hasCommonChatsTab ? [{\n type: 'commonChats', title: 'SharedGroupsTab2',\n }] : []),\n ]), [hasCommonChatsTab, hasMembersTab, isChannel]);\n const tabType = tabs[activeTab].type as ProfileTabType;\n\n const [resultType, viewportIds, getMore, noProfileInfo] = useProfileViewportIds(\n isRightColumnShown,\n loadMoreMembers,\n loadCommonChats,\n searchMediaMessagesLocal,\n tabType,\n mediaSearchType,\n members,\n commonChatIds,\n usersById,\n userStatusesById,\n chatsById,\n chatMessages,\n foundIds,\n chatId,\n lastSyncTime,\n serverTimeOffset,\n );\n const activeKey = tabs.findIndex(({ type }) => type === resultType);\n\n const { handleScroll } = useProfileState(containerRef, tabType, profileState, onProfileStateChange);\n\n const { applyTransitionFix, releaseTransitionFix } = useTransitionFixes(containerRef);\n\n const [cacheBuster, resetCacheBuster] = useCacheBuster();\n\n const { observe: observeIntersectionForMedia } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleTransitionStop = useCallback(() => {\n releaseTransitionFix();\n resetCacheBuster();\n }, [releaseTransitionFix, resetCacheBuster]);\n\n const handleNewMemberDialogOpen = useCallback(() => {\n setNewChatMembersDialogState(NewChatMembersProgress.InProgress);\n }, [setNewChatMembersDialogState]);\n\n // Update search type when switching tabs\n useEffect(() => {\n setLocalMediaSearchType({ mediaType: tabType });\n }, [setLocalMediaSearchType, tabType]);\n\n const profileId = resolvedUserId || chatId;\n\n useEffect(() => {\n if (lastSyncTime) {\n loadProfilePhotos({ profileId });\n }\n }, [loadProfilePhotos, profileId, lastSyncTime]);\n\n const handleSelectMedia = useCallback((mediaId: number) => {\n openMediaViewer({\n chatId: profileId,\n threadId: MAIN_THREAD_ID,\n mediaId,\n origin: MediaViewerOrigin.SharedMedia,\n });\n }, [profileId, openMediaViewer]);\n\n const handlePlayAudio = useCallback((messageId: number) => {\n openAudioPlayer({ chatId: profileId, messageId });\n }, [profileId, openAudioPlayer]);\n\n const handleMemberClick = useCallback((id: string) => {\n openChat({ id });\n }, [openChat]);\n\n const handleMessageFocus = useCallback((messageId: number) => {\n focusMessage({ chatId: profileId, messageId });\n }, [profileId, focusMessage]);\n\n const handleDeleteMembersModalClose = useCallback(() => {\n setDeletingUserId(undefined);\n }, []);\n\n useEffect(() => {\n if (!transitionRef.current || !IS_TOUCH_ENV) {\n return undefined;\n }\n\n return captureEvents(transitionRef.current, {\n selectorToPreventScroll: '.Profile',\n onSwipe: ((e, direction) => {\n if (direction === SwipeDirection.Left) {\n setActiveTab(Math.min(activeTab + 1, tabs.length - 1));\n return true;\n } else if (direction === SwipeDirection.Right) {\n setActiveTab(Math.max(0, activeTab - 1));\n return true;\n }\n\n return false;\n }),\n });\n }, [activeTab, tabs.length]);\n\n let renderingDelay;\n const isFirstTab = resultType === 'members' || (!hasMembersTab && resultType === 'media');\n // @optimization Used to unparallelize rendering of message list and profile media\n if (isFirstTab) {\n renderingDelay = !isRightColumnShown ? HIDDEN_RENDER_DELAY : 0;\n // @optimization Used to delay first render of secondary tabs while animating\n } else if (!viewportIds) {\n renderingDelay = SLIDE_TRANSITION_DURATION;\n }\n const canRenderContent = useAsyncRendering([chatId, resultType], renderingDelay);\n\n function getMemberContextAction(memberId: string) {\n return memberId === currentUserId || !canDeleteMembers ? undefined : [{\n title: lang('lng_context_remove_from_group'),\n icon: 'stop',\n handler: () => {\n setDeletingUserId(memberId);\n },\n }];\n }\n\n function renderContent() {\n if (!viewportIds || !canRenderContent || !chatMessages) {\n const noSpinner = isFirstTab && !canRenderContent;\n const forceRenderHiddenMembers = Boolean(resultType === 'members' && areMembersHidden);\n\n return (\n <div className=\"content empty-list\">\n {!noSpinner && !forceRenderHiddenMembers && <Spinner />}\n {forceRenderHiddenMembers && <NothingFound text=\"You have no access to group members list.\" />}\n </div>\n );\n }\n\n if (!viewportIds.length) {\n let text: string;\n\n switch (resultType) {\n case 'members':\n text = areMembersHidden ? 'You have no access to group members list.' : 'No members found';\n break;\n case 'commonChats':\n text = lang('NoGroupsInCommon');\n break;\n case 'documents':\n text = lang('lng_media_file_empty');\n break;\n case 'links':\n text = lang('lng_media_link_empty');\n break;\n case 'audio':\n text = lang('lng_media_song_empty');\n break;\n case 'voice':\n text = lang('lng_media_audio_empty');\n break;\n default:\n text = lang('SharedMedia.EmptyTitle');\n }\n\n return (\n <div className=\"content empty-list\">\n <NothingFound text={text} />\n </div>\n );\n }\n\n return (\n <div\n className={`content ${resultType}-list`}\n dir={lang.isRtl && resultType === 'media' ? 'rtl' : undefined}\n teactFastList\n >\n {resultType === 'media' ? (\n (viewportIds as number[])!.map((id) => chatMessages[id] && (\n <Media\n key={id}\n message={chatMessages[id]}\n isProtected={isChatProtected || chatMessages[id].isProtected}\n observeIntersection={observeIntersectionForMedia}\n onClick={handleSelectMedia}\n />\n ))\n ) : resultType === 'documents' ? (\n (viewportIds as number[])!.map((id) => chatMessages[id] && (\n <Document\n key={id}\n message={chatMessages[id]}\n withDate\n smaller\n className=\"scroll-item\"\n isDownloading={activeDownloadIds.includes(id)}\n observeIntersection={observeIntersectionForMedia}\n onDateClick={handleMessageFocus}\n />\n ))\n ) : resultType === 'links' ? (\n (viewportIds as number[])!.map((id) => chatMessages[id] && (\n <WebLink\n key={id}\n message={chatMessages[id]}\n isProtected={isChatProtected || chatMessages[id].isProtected}\n observeIntersection={observeIntersectionForMedia}\n onMessageClick={handleMessageFocus}\n />\n ))\n ) : resultType === 'audio' ? (\n (viewportIds as number[])!.map((id) => chatMessages[id] && (\n <Audio\n key={id}\n theme={theme}\n message={chatMessages[id]}\n origin={AudioOrigin.SharedMedia}\n date={chatMessages[id].date}\n lastSyncTime={lastSyncTime}\n className=\"scroll-item\"\n onPlay={handlePlayAudio}\n onDateClick={handleMessageFocus}\n canDownload={!isChatProtected && !chatMessages[id].isProtected}\n isDownloading={activeDownloadIds.includes(id)}\n />\n ))\n ) : resultType === 'voice' ? (\n (viewportIds as number[])!.map((id) => chatMessages[id] && (\n <Audio\n key={id}\n theme={theme}\n message={chatMessages[id]}\n senderTitle={getSenderName(lang, chatMessages[id], chatsById, usersById)}\n origin={AudioOrigin.SharedMedia}\n date={chatMessages[id].date}\n lastSyncTime={lastSyncTime}\n className=\"scroll-item\"\n onPlay={handlePlayAudio}\n onDateClick={handleMessageFocus}\n canDownload={!isChatProtected && !chatMessages[id].isProtected}\n isDownloading={activeDownloadIds.includes(id)}\n />\n ))\n ) : resultType === 'members' ? (\n (viewportIds as string[])!.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i}\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => handleMemberClick(id)}\n contextActions={getMemberContextAction(id)}\n >\n <PrivateChatInfo userId={id} forceShowSelf />\n </ListItem>\n ))\n ) : resultType === 'commonChats' ? (\n (viewportIds as string[])!.map((id, i) => (\n <ListItem\n key={id}\n teactOrderKey={i}\n className=\"chat-item-clickable scroll-item small-icon\"\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => openChat({ id })}\n >\n <GroupChatInfo chatId={id} />\n </ListItem>\n ))\n ) : undefined}\n </div>\n );\n }\n\n return (\n <InfiniteScroll\n ref={containerRef}\n className=\"Profile custom-scroll\"\n itemSelector={buildInfiniteScrollItemSelector(resultType)}\n items={canRenderContent ? viewportIds : undefined}\n cacheBuster={cacheBuster}\n sensitiveArea={PROFILE_SENSITIVE_AREA}\n preloadBackwards={canRenderContent ? (resultType === 'members' ? MEMBERS_SLICE : SHARED_MEDIA_SLICE) : 0}\n // To prevent scroll jumps caused by reordering member list\n noScrollRestoreOnTop\n noFastList\n onLoadMore={getMore}\n onScroll={handleScroll}\n >\n {!noProfileInfo && renderProfileInfo(chatId, resolvedUserId)}\n {!isRestricted && (\n <div\n className=\"shared-media\"\n >\n <Transition\n ref={transitionRef}\n name={lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized'}\n activeKey={activeKey}\n renderCount={tabs.length}\n shouldRestoreHeight\n className=\"shared-media-transition\"\n onStart={applyTransitionFix}\n onStop={handleTransitionStop}\n >\n {renderContent()}\n </Transition>\n <TabList big activeTab={activeTab} tabs={tabs} onSwitchTab={setActiveTab} />\n </div>\n )}\n\n {canAddMembers && (\n <FloatingActionButton\n isShown={resultType === 'members'}\n onClick={handleNewMemberDialogOpen}\n ariaLabel={lang('lng_channel_add_users')}\n >\n <i className=\"icon-add-user-filled\" />\n </FloatingActionButton>\n )}\n {canDeleteMembers && (\n <DeleteMemberModal\n isOpen={Boolean(deletingUserId)}\n userId={deletingUserId}\n onClose={handleDeleteMembersModalClose}\n />\n )}\n </InfiniteScroll>\n );\n};\n\nfunction renderProfileInfo(chatId: string, resolvedUserId?: string) {\n return (\n <div className=\"profile-info\">\n <ProfileInfo userId={resolvedUserId || chatId} />\n <ChatExtra chatOrUserId={resolvedUserId || chatId} />\n </div>\n );\n}\n\nfunction buildInfiniteScrollItemSelector(resultType: string) {\n return [\n // Used on first render\n `.shared-media-transition > div:only-child > .${resultType}-list > .scroll-item`,\n // Used after transition\n `.shared-media-transition > .Transition__slide--active > .${resultType}-list > .scroll-item`,\n ].join(', ');\n}\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const chatMessages = selectChatMessages(global, chatId);\n const { currentType: mediaSearchType, resultsByType } = selectCurrentMediaSearch(global) || {};\n const { foundIds } = (resultsByType && mediaSearchType && resultsByType[mediaSearchType]) || {};\n\n const { byId: usersById, statusesById: userStatusesById } = global.users;\n const { byId: chatsById } = global.chats;\n\n const isGroup = chat && isChatGroup(chat);\n const isChannel = chat && isChatChannel(chat);\n const hasMembersTab = isGroup || (isChannel && isChatAdmin(chat!));\n const members = chat?.fullInfo?.members;\n const areMembersHidden = hasMembersTab && chat\n && (chat.isForbidden || (chat.fullInfo && !chat.fullInfo.canViewMembers));\n const canAddMembers = hasMembersTab && chat\n && (getHasAdminRight(chat, 'inviteUsers') || !isUserRightBanned(chat, 'inviteUsers') || chat.isCreator);\n const canDeleteMembers = hasMembersTab && chat && (getHasAdminRight(chat, 'banUsers') || chat.isCreator);\n const activeDownloadIds = selectActiveDownloadIds(global, chatId);\n\n let hasCommonChatsTab;\n let resolvedUserId;\n let user;\n if (isUserId(chatId)) {\n resolvedUserId = chatId;\n user = selectUser(global, resolvedUserId);\n hasCommonChatsTab = user && !user.isSelf && !isUserBot(user);\n }\n\n return {\n theme: selectTheme(global),\n isChannel,\n resolvedUserId,\n chatMessages,\n foundIds,\n mediaSearchType,\n hasCommonChatsTab,\n hasMembersTab,\n areMembersHidden,\n canAddMembers,\n canDeleteMembers,\n currentUserId: global.currentUserId,\n isRightColumnShown: selectIsRightColumnShown(global),\n isRestricted: chat?.isRestricted,\n lastSyncTime: global.lastSyncTime,\n serverTimeOffset: global.serverTimeOffset,\n activeDownloadIds,\n usersById,\n userStatusesById,\n chatsById,\n isChatProtected: chat?.isProtected,\n ...(hasMembersTab && members && { members }),\n ...(hasCommonChatsTab && user && { commonChatIds: user.commonChats?.ids }),\n };\n },\n)(Profile));\n","import { useCallback, useEffect } from '../../../lib/teact/teact';\n\nexport default function useTransitionFixes(\n containerRef: { current: HTMLDivElement | null },\n transitionElSelector = '.Transition.shared-media-transition',\n) {\n // Set `min-height` for shared media container to prevent jumping when switching tabs\n useEffect(() => {\n function setMinHeight() {\n const container = containerRef.current!;\n const transitionEl = container.querySelector<HTMLDivElement>(transitionElSelector);\n const tabsEl = container.querySelector<HTMLDivElement>('.TabList');\n if (transitionEl && tabsEl) {\n transitionEl.style.minHeight = `${container.offsetHeight - tabsEl.offsetHeight}px`;\n }\n }\n\n setMinHeight();\n\n window.addEventListener('resize', setMinHeight, false);\n\n return () => {\n window.removeEventListener('resize', setMinHeight, false);\n };\n }, [containerRef, transitionElSelector]);\n\n // Workaround for scrollable content flickering during animation.\n const applyTransitionFix = useCallback(() => {\n const container = containerRef.current!;\n if (container.style.overflowY !== 'hidden') {\n const scrollBarWidth = container.offsetWidth - container.clientWidth;\n container.style.overflowY = 'hidden';\n container.style.marginRight = `${scrollBarWidth}px`;\n }\n }, [containerRef]);\n\n const releaseTransitionFix = useCallback(() => {\n const container = containerRef.current!;\n container.style.overflowY = 'scroll';\n container.style.marginRight = '0';\n }, [containerRef]);\n\n return { applyTransitionFix, releaseTransitionFix };\n}\n","import { useCallback, useState } from '../lib/teact/teact';\n\nconst useCacheBuster = () => {\n const [cacheBuster, setCacheBuster] = useState<boolean>(false);\n\n const updateCacheBuster = useCallback(() => {\n setCacheBuster((current) => !current);\n }, []);\n\n return [cacheBuster, updateCacheBuster] as const;\n};\n\nexport default useCacheBuster;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './RightSearch';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport Loading from '../ui/Loading';\n\nconst RightSearchAsync: FC<OwnProps> = (props) => {\n const RightSearch = useModuleLoader(Bundles.Extra, 'RightSearch');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return RightSearch ? <RightSearch {...props} /> : <Loading />;\n};\n\nexport default memo(RightSearchAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './Management';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nimport Loading from '../../ui/Loading';\n\nconst ManagementAsync: FC<OwnProps> = (props) => {\n const Management = useModuleLoader(Bundles.Extra, 'Management');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return Management ? <Management {...props} /> : <Loading />;\n};\n\nexport default memo(ManagementAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './Statistics';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst StatisticsAsync: FC<OwnProps> = (props) => {\n const Statistics = useModuleLoader(Bundles.Extra, 'Statistics');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return Statistics ? <Statistics {...props} /> : <Loading />;\n};\n\nexport default StatisticsAsync;\n","import type { FC } from '../../../lib/teact/teact';\nimport React from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './MessageStatistics';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport Loading from '../../ui/Loading';\n\nconst MessageStatisticsAsync: FC<OwnProps> = (props) => {\n const MessageStatistics = useModuleLoader(Bundles.Extra, 'MessageStatistics');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return MessageStatistics ? <MessageStatistics {...props} /> : <Loading />;\n};\n\nexport default MessageStatisticsAsync;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport Loading from '../ui/Loading';\n\nconst StickerSearchAsync: FC = () => {\n const StickerSearch = useModuleLoader(Bundles.Extra, 'StickerSearch');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return StickerSearch ? <StickerSearch /> : <Loading />;\n};\n\nexport default memo(StickerSearchAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport Loading from '../ui/Loading';\n\nconst GifSearchAsync: FC = () => {\n const GifSearch = useModuleLoader(Bundles.Extra, 'GifSearch');\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return GifSearch ? <GifSearch /> : <Loading />;\n};\n\nexport default memo(GifSearchAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport Loading from '../ui/Loading';\n\nconst PollResultsAsync: FC = () => {\n const PollResults = useModuleLoader(Bundles.Extra, 'PollResults');\n\n return PollResults ? <PollResults /> : <Loading />;\n};\n\nexport default memo(PollResultsAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, useMemo, memo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type {\n ApiChat, ApiChatMember,\n} from '../../api/types';\nimport { NewChatMembersProgress } from '../../types';\n\nimport { unique } from '../../util/iteratees';\nimport { selectChat } from '../../global/selectors';\nimport {\n filterUsersByName, isChatChannel, isUserBot, sortChatIds,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\nimport useHistoryBack from '../../hooks/useHistoryBack';\n\nimport Picker from '../common/Picker';\nimport FloatingActionButton from '../ui/FloatingActionButton';\nimport Spinner from '../ui/Spinner';\n\nimport './AddChatMembers.scss';\n\nexport type OwnProps = {\n chatId: string;\n isActive: boolean;\n onNextStep: (memberIds: string[]) => void;\n onClose: NoneToVoidFunction;\n};\n\ntype StateProps = {\n isChannel?: boolean;\n members?: ApiChatMember[];\n currentUserId?: string;\n chatsById: Record<string, ApiChat>;\n localContactIds?: string[];\n searchQuery?: string;\n isLoading: boolean;\n isSearching?: boolean;\n localUserIds?: string[];\n globalUserIds?: string[];\n};\n\nconst AddChatMembers: FC<OwnProps & StateProps> = ({\n isChannel,\n members,\n onNextStep,\n currentUserId,\n chatsById,\n localContactIds,\n isLoading,\n searchQuery,\n isSearching,\n localUserIds,\n globalUserIds,\n onClose,\n isActive,\n}) => {\n const { setUserSearchQuery } = getActions();\n\n const lang = useLang();\n const [selectedMemberIds, setSelectedMemberIds] = useState<string[]>([]);\n const prevSelectedMemberIds = usePrevious(selectedMemberIds);\n const noPickerScrollRestore = prevSelectedMemberIds === selectedMemberIds;\n\n useHistoryBack({\n isActive,\n onBack: onClose,\n });\n\n const memberIds = useMemo(() => {\n return members ? members.map((member) => member.userId) : [];\n }, [members]);\n\n const handleFilterChange = useCallback((query: string) => {\n setUserSearchQuery({ query });\n }, [setUserSearchQuery]);\n\n const displayedIds = useMemo(() => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n const filteredContactIds = localContactIds ? filterUsersByName(localContactIds, usersById, searchQuery) : [];\n\n return sortChatIds(\n unique([\n ...filteredContactIds,\n ...(localUserIds || []),\n ...(globalUserIds || []),\n ]).filter((userId) => {\n const user = usersById[userId];\n\n // The user can be added to the chat if the following conditions are met:\n // the user has not yet been added to the current chat\n // AND it is not the current user,\n // AND (it is not found (user from global search) OR it is not a bot OR it is a bot,\n // but the current chat is not a channel AND the appropriate permission is set).\n return (\n !memberIds.includes(userId)\n && userId !== currentUserId\n && (!user || !isUserBot(user) || (!isChannel && user.canBeInvitedToGroup))\n );\n }),\n chatsById,\n );\n }, [\n localContactIds, chatsById, searchQuery, localUserIds, globalUserIds, currentUserId, memberIds, isChannel,\n ]);\n\n const handleNextStep = useCallback(() => {\n if (selectedMemberIds.length) {\n setUserSearchQuery({ query: '' });\n onNextStep(selectedMemberIds);\n }\n }, [selectedMemberIds, setUserSearchQuery, onNextStep]);\n\n return (\n <div className=\"AddChatMembers\">\n <div className=\"AddChatMembers-inner\">\n <Picker\n itemIds={displayedIds}\n selectedIds={selectedMemberIds}\n filterValue={searchQuery}\n filterPlaceholder={lang('lng_channel_add_users')}\n searchInputId=\"new-members-picker-search\"\n isLoading={isSearching}\n onSelectedIdsChange={setSelectedMemberIds}\n onFilterChange={handleFilterChange}\n noScrollRestore={noPickerScrollRestore}\n />\n\n <FloatingActionButton\n isShown={Boolean(selectedMemberIds.length)}\n disabled={isLoading}\n ariaLabel={lang('lng_channel_add_users')}\n onClick={handleNextStep}\n >\n {isLoading ? (\n <Spinner color=\"white\" />\n ) : (\n <i className=\"icon-arrow-right\" />\n )}\n </FloatingActionButton>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n const { userIds: localContactIds } = global.contactList || {};\n const { byId: chatsById } = global.chats;\n const { currentUserId, newChatMembersProgress } = global;\n const isChannel = chat && isChatChannel(chat);\n\n const {\n query: searchQuery,\n fetchingStatus,\n globalUserIds,\n localUserIds,\n } = global.userSearch;\n\n return {\n isChannel,\n members: chat?.fullInfo?.members,\n currentUserId,\n chatsById,\n localContactIds,\n searchQuery,\n isSearching: fetchingStatus,\n isLoading: newChatMembersProgress === NewChatMembersProgress.Loading,\n globalUserIds,\n localUserIds,\n };\n },\n)(AddChatMembers));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport {\n ManagementScreens, NewChatMembersProgress, ProfileState, RightColumnContent,\n} from '../../types';\n\nimport { ANIMATION_END_DELAY, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN } from '../../config';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\nimport {\n selectAreActiveChatsLoaded,\n selectCurrentMessageList,\n selectRightColumnContentKey,\n} from '../../global/selectors';\nimport useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps';\nimport useWindowSize from '../../hooks/useWindowSize';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport useCurrentOrPrev from '../../hooks/useCurrentOrPrev';\n\nimport RightHeader from './RightHeader';\nimport Profile from './Profile';\nimport Transition from '../ui/Transition';\nimport RightSearch from './RightSearch.async';\nimport Management from './management/Management.async';\nimport Statistics from './statistics/Statistics.async';\nimport MessageStatistics from './statistics/MessageStatistics.async';\nimport StickerSearch from './StickerSearch.async';\nimport GifSearch from './GifSearch.async';\nimport PollResults from './PollResults.async';\nimport AddChatMembers from './AddChatMembers';\n\nimport './RightColumn.scss';\n\ntype StateProps = {\n contentKey?: RightColumnContent;\n chatId?: string;\n threadId?: number;\n isChatSelected: boolean;\n shouldSkipHistoryAnimations?: boolean;\n nextManagementScreen?: ManagementScreens;\n};\n\nconst ANIMATION_DURATION = 450 + ANIMATION_END_DELAY;\nconst MAIN_SCREENS_COUNT = Object.keys(RightColumnContent).length / 2;\nconst MANAGEMENT_SCREENS_COUNT = Object.keys(ManagementScreens).length / 2;\n\nfunction blurSearchInput() {\n const searchInput = document.querySelector('.RightHeader .SearchInput input') as HTMLInputElement;\n if (searchInput) {\n searchInput.blur();\n }\n}\n\nconst RightColumn: FC<StateProps> = ({\n contentKey,\n chatId,\n threadId,\n isChatSelected,\n shouldSkipHistoryAnimations,\n nextManagementScreen,\n}) => {\n const {\n toggleChatInfo,\n toggleManagement,\n closeLocalTextSearch,\n setStickerSearchQuery,\n setGifSearchQuery,\n closePollResults,\n addChatMembers,\n setNewChatMembersDialogState,\n setEditingExportedInvite,\n toggleStatistics,\n toggleMessageStatistics,\n setOpenedInviteInfo,\n requestNextManagementScreen,\n } = getActions();\n\n const { width: windowWidth } = useWindowSize();\n const [profileState, setProfileState] = useState<ProfileState>(ProfileState.Profile);\n const [managementScreen, setManagementScreen] = useState<ManagementScreens>(ManagementScreens.Initial);\n const [selectedChatMemberId, setSelectedChatMemberId] = useState<string | undefined>();\n const [isPromotedByCurrentUser, setIsPromotedByCurrentUser] = useState<boolean | undefined>();\n const isScrolledDown = profileState !== ProfileState.Profile;\n\n const isOpen = contentKey !== undefined;\n const isProfile = contentKey === RightColumnContent.ChatInfo;\n const isSearch = contentKey === RightColumnContent.Search;\n const isManagement = contentKey === RightColumnContent.Management;\n const isStatistics = contentKey === RightColumnContent.Statistics;\n const isMessageStatistics = contentKey === RightColumnContent.MessageStatistics;\n const isStickerSearch = contentKey === RightColumnContent.StickerSearch;\n const isGifSearch = contentKey === RightColumnContent.GifSearch;\n const isPollResults = contentKey === RightColumnContent.PollResults;\n const isAddingChatMembers = contentKey === RightColumnContent.AddingMembers;\n const isOverlaying = windowWidth <= MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN;\n\n const [shouldSkipTransition, setShouldSkipTransition] = useState(!isOpen);\n\n const renderingContentKey = useCurrentOrPrev(contentKey, true, !isChatSelected) ?? -1;\n\n const close = useCallback((shouldScrollUp = true) => {\n switch (contentKey) {\n case RightColumnContent.AddingMembers:\n setNewChatMembersDialogState(NewChatMembersProgress.Closed);\n break;\n case RightColumnContent.ChatInfo:\n if (isScrolledDown && shouldScrollUp) {\n setProfileState(ProfileState.Profile);\n break;\n }\n toggleChatInfo(undefined, { forceSyncOnIOs: true });\n break;\n case RightColumnContent.Management: {\n switch (managementScreen) {\n case ManagementScreens.Initial:\n toggleManagement();\n break;\n case ManagementScreens.ChatPrivacyType:\n case ManagementScreens.Discussion:\n case ManagementScreens.GroupPermissions:\n case ManagementScreens.GroupType:\n case ManagementScreens.ChatAdministrators:\n case ManagementScreens.ChannelSubscribers:\n case ManagementScreens.GroupMembers:\n case ManagementScreens.Invites:\n case ManagementScreens.Reactions:\n case ManagementScreens.JoinRequests:\n case ManagementScreens.ChannelRemovedUsers:\n setManagementScreen(ManagementScreens.Initial);\n break;\n case ManagementScreens.GroupUserPermissionsCreate:\n case ManagementScreens.GroupRemovedUsers:\n case ManagementScreens.GroupUserPermissions:\n setManagementScreen(ManagementScreens.GroupPermissions);\n setSelectedChatMemberId(undefined);\n setIsPromotedByCurrentUser(undefined);\n break;\n case ManagementScreens.ChatAdminRights:\n case ManagementScreens.ChatNewAdminRights:\n case ManagementScreens.GroupAddAdmins:\n case ManagementScreens.GroupRecentActions:\n setManagementScreen(ManagementScreens.ChatAdministrators);\n break;\n case ManagementScreens.EditInvite:\n case ManagementScreens.InviteInfo:\n setManagementScreen(ManagementScreens.Invites);\n setOpenedInviteInfo({ invite: undefined });\n setEditingExportedInvite({ chatId, invite: undefined });\n break;\n }\n\n break;\n }\n case RightColumnContent.MessageStatistics:\n toggleMessageStatistics();\n break;\n case RightColumnContent.Statistics:\n toggleStatistics();\n break;\n case RightColumnContent.Search: {\n blurSearchInput();\n closeLocalTextSearch();\n break;\n }\n case RightColumnContent.StickerSearch:\n blurSearchInput();\n setStickerSearchQuery({ query: undefined });\n break;\n case RightColumnContent.GifSearch: {\n blurSearchInput();\n setGifSearchQuery({ query: undefined });\n break;\n }\n case RightColumnContent.PollResults:\n closePollResults();\n break;\n }\n }, [\n contentKey, isScrolledDown, toggleChatInfo, closePollResults, setNewChatMembersDialogState,\n managementScreen, toggleManagement, closeLocalTextSearch, setStickerSearchQuery, setGifSearchQuery,\n setEditingExportedInvite, chatId, setOpenedInviteInfo, toggleStatistics, toggleMessageStatistics,\n ]);\n\n const handleSelectChatMember = useCallback((memberId, isPromoted) => {\n setSelectedChatMemberId(memberId);\n setIsPromotedByCurrentUser(isPromoted);\n }, []);\n\n const handleAppendingChatMembers = useCallback((memberIds: string[]) => {\n addChatMembers({ chatId, memberIds });\n }, [addChatMembers, chatId]);\n\n useEffect(() => (isOpen ? captureEscKeyListener(close) : undefined), [isOpen, close]);\n\n useEffect(() => {\n setTimeout(() => {\n setShouldSkipTransition(!isOpen);\n }, ANIMATION_DURATION);\n }, [isOpen]);\n\n useEffect(() => {\n if (nextManagementScreen) {\n setManagementScreen(nextManagementScreen);\n requestNextManagementScreen(undefined);\n }\n }, [nextManagementScreen, requestNextManagementScreen]);\n\n // Close Right Column when it transforms into overlayed state on screen resize\n useEffect(() => {\n if (isOpen && isOverlaying) {\n close();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOverlaying]);\n\n // We need to clear profile state and management screen state, when changing chats\n useLayoutEffectWithPrevDeps(([prevChatId]) => {\n if (prevChatId !== chatId) {\n setProfileState(ProfileState.Profile);\n setManagementScreen(ManagementScreens.Initial);\n }\n }, [chatId]);\n\n useHistoryBack({\n isActive: isChatSelected && (\n contentKey === RightColumnContent.ChatInfo\n || contentKey === RightColumnContent.Management\n || contentKey === RightColumnContent.AddingMembers),\n onBack: () => close(false),\n });\n\n // eslint-disable-next-line consistent-return\n function renderContent(isActive: boolean) {\n if (renderingContentKey === -1) {\n return undefined;\n }\n\n switch (renderingContentKey) {\n case RightColumnContent.AddingMembers:\n return (\n <AddChatMembers\n key={chatId!}\n chatId={chatId!}\n isActive={isOpen && isActive}\n onNextStep={handleAppendingChatMembers}\n onClose={close}\n />\n );\n case RightColumnContent.ChatInfo:\n return (\n <Profile\n key={chatId!}\n chatId={chatId!}\n profileState={profileState}\n onProfileStateChange={setProfileState}\n />\n );\n case RightColumnContent.Search:\n return <RightSearch chatId={chatId!} threadId={threadId!} onClose={close} isActive={isOpen && isActive} />;\n case RightColumnContent.Management:\n return (\n <Management\n key={chatId!}\n chatId={chatId!}\n currentScreen={managementScreen}\n isPromotedByCurrentUser={isPromotedByCurrentUser}\n selectedChatMemberId={selectedChatMemberId}\n isActive={isOpen && isActive}\n onScreenSelect={setManagementScreen}\n onChatMemberSelect={handleSelectChatMember}\n onClose={close}\n />\n );\n\n case RightColumnContent.Statistics:\n return <Statistics chatId={chatId!} />;\n case RightColumnContent.MessageStatistics:\n return <MessageStatistics chatId={chatId!} isActive={isOpen && isActive} />;\n case RightColumnContent.StickerSearch:\n return <StickerSearch onClose={close} isActive={isOpen && isActive} />;\n case RightColumnContent.GifSearch:\n return <GifSearch onClose={close} isActive={isOpen && isActive} />;\n case RightColumnContent.PollResults:\n return <PollResults onClose={close} isActive={isOpen && isActive} />;\n }\n }\n\n return (\n <div\n id=\"RightColumn-wrapper\"\n className={!isChatSelected ? 'is-hidden' : undefined}\n >\n {isOverlaying && (\n <div className=\"overlay-backdrop\" onClick={close} />\n )}\n <div id=\"RightColumn\">\n <RightHeader\n chatId={chatId}\n isColumnOpen={isOpen}\n isProfile={isProfile}\n isSearch={isSearch}\n isManagement={isManagement}\n isStatistics={isStatistics}\n isMessageStatistics={isMessageStatistics}\n isStickerSearch={isStickerSearch}\n isGifSearch={isGifSearch}\n isPollResults={isPollResults}\n isAddingChatMembers={isAddingChatMembers}\n profileState={profileState}\n managementScreen={managementScreen}\n onClose={close}\n onScreenSelect={setManagementScreen}\n />\n <Transition\n name={(shouldSkipTransition || shouldSkipHistoryAnimations) ? 'none' : 'zoom-fade'}\n renderCount={MAIN_SCREENS_COUNT + MANAGEMENT_SCREENS_COUNT}\n activeKey={isManagement ? MAIN_SCREENS_COUNT + managementScreen : renderingContentKey}\n shouldCleanup\n cleanupExceptionKey={\n renderingContentKey === RightColumnContent.MessageStatistics\n ? RightColumnContent.Statistics : undefined\n }\n >\n {renderContent}\n </Transition>\n </div>\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const { chatId, threadId } = selectCurrentMessageList(global) || {};\n const areActiveChatsLoaded = selectAreActiveChatsLoaded(global);\n const nextManagementScreen = chatId ? global.management.byChatId[chatId]?.nextScreen : undefined;\n\n return {\n contentKey: selectRightColumnContentKey(global),\n chatId,\n threadId,\n isChatSelected: Boolean(chatId && areActiveChatsLoaded),\n shouldSkipHistoryAnimations: global.shouldSkipHistoryAnimations,\n nextManagementScreen,\n };\n },\n)(RightColumn));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport { Bundles } from '../../util/moduleLoader';\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\ninterface OwnProps {\n isOpen: boolean;\n}\n\nconst MediaViewerAsync: FC<OwnProps> = ({ isOpen }) => {\n const MediaViewer = useModuleLoader(Bundles.Extra, 'MediaViewer', !isOpen);\n\n return MediaViewer ? <MediaViewer /> : undefined;\n};\n\nexport default memo(MediaViewerAsync);\n","import { pause } from './schedulers';\n\ntype PendingDownload = {\n url: string;\n filename: string;\n};\n\n// Chrome prevents more than 10 downloads per second\nconst LIMIT_PER_BATCH = 10;\nconst BATCH_INTERVAL = 1000;\n\nlet pendingDownloads: PendingDownload[] = [];\nlet planned = false;\n\nexport default function download(url: string, filename: string) {\n pendingDownloads.push({ url, filename });\n if (!planned) {\n planned = true;\n setTimeout(async () => {\n await processQueue();\n planned = false;\n }, BATCH_INTERVAL);\n }\n}\n\nasync function processQueue() {\n let count = 0;\n for (const pendingDownload of pendingDownloads) {\n downloadOne(pendingDownload);\n count++;\n if (count === LIMIT_PER_BATCH) {\n await pause(BATCH_INTERVAL);\n count = 0;\n }\n }\n pendingDownloads = [];\n}\n\nfunction downloadOne({ url, filename }: PendingDownload) {\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n try {\n link.click();\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err); // Suppress redundant \"Blob loading failed\" error popup on IOS\n }\n}\n","import type { FC } from '../../lib/teact/teact';\nimport { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { Thread } from '../../global/types';\nimport type { ApiMessage } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\n\nimport { IS_OPFS_SUPPORTED, IS_SERVICE_WORKER_SUPPORTED, MAX_BUFFER_SIZE } from '../../util/environment';\nimport * as mediaLoader from '../../util/mediaLoader';\nimport download from '../../util/download';\nimport {\n getMessageContentFilename, getMessageMediaFormat, getMessageMediaHash,\n} from '../../global/helpers';\n\nimport useRunDebounced from '../../hooks/useRunDebounced';\n\ntype StateProps = {\n activeDownloads: Record<string, number[]>;\n messages: Record<string, {\n byId: Record<number, ApiMessage>;\n threadsById: Record<number, Thread>;\n }>;\n};\n\nconst GLOBAL_UPDATE_DEBOUNCE = 1000;\n\nconst processedMessages = new Set<ApiMessage>();\nconst downloadedMessages = new Set<ApiMessage>();\n\nconst DownloadManager: FC<StateProps> = ({\n activeDownloads,\n messages,\n}) => {\n const { cancelMessagesMediaDownload, showNotification } = getActions();\n\n const runDebounced = useRunDebounced(GLOBAL_UPDATE_DEBOUNCE, true);\n\n const handleMessageDownloaded = useCallback((message: ApiMessage) => {\n downloadedMessages.add(message);\n runDebounced(() => {\n if (downloadedMessages.size) {\n cancelMessagesMediaDownload({ messages: Array.from(downloadedMessages) });\n downloadedMessages.clear();\n }\n });\n }, [cancelMessagesMediaDownload, runDebounced]);\n\n useEffect(() => {\n const activeMessages = Object.entries(activeDownloads).map(([chatId, messageIds]) => (\n messageIds.map((id) => messages[chatId].byId[id])\n )).flat();\n\n if (!activeMessages.length) {\n processedMessages.clear();\n return;\n }\n\n activeMessages.forEach((message) => {\n if (processedMessages.has(message)) {\n return;\n }\n processedMessages.add(message);\n const downloadHash = getMessageMediaHash(message, 'download');\n if (!downloadHash) {\n handleMessageDownloaded(message);\n return;\n }\n\n const mediaData = mediaLoader.getFromMemory(downloadHash);\n\n if (mediaData) {\n download(mediaData, getMessageContentFilename(message));\n handleMessageDownloaded(message);\n return;\n }\n\n const {\n document, video, audio,\n } = message.content;\n const mediaSize = (document || video || audio)?.size || 0;\n if (mediaSize > MAX_BUFFER_SIZE && !IS_OPFS_SUPPORTED && !IS_SERVICE_WORKER_SUPPORTED) {\n showNotification({\n message: 'Downloading files bigger than 2GB is not supported in your browser.',\n });\n handleMessageDownloaded(message);\n return;\n }\n\n const mediaFormat = getMessageMediaFormat(message, 'download');\n mediaLoader.fetch(downloadHash, mediaFormat, true).then((result) => {\n if (mediaFormat === ApiMediaFormat.DownloadUrl) {\n const url = new URL(result, window.document.baseURI);\n const filename = getMessageContentFilename(message);\n url.searchParams.set('filename', encodeURIComponent(filename));\n const downloadWindow = window.open(url.toString());\n downloadWindow?.addEventListener('beforeunload', () => {\n showNotification({\n message: 'Download started. Please, do not close the app before it is finished.',\n });\n });\n } else if (result) {\n download(result, getMessageContentFilename(message));\n }\n\n handleMessageDownloaded(message);\n });\n });\n }, [messages, activeDownloads, cancelMessagesMediaDownload, handleMessageDownloaded, showNotification]);\n\n return undefined;\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const activeDownloads = global.activeDownloads.byChatId;\n const messages = global.messages.byChatId;\n return {\n activeDownloads,\n messages,\n };\n },\n)(DownloadManager));\n","import React, { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions } from '../../lib/teact/teactn';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { GlobalState } from '../../global/types';\nimport { MAIN_THREAD_ID } from '../../api/types';\n\nimport { withGlobal } from '../../global';\nimport { selectChat } from '../../global/selectors';\nimport { getCanPostInChat } from '../../global/helpers';\nimport windowSize from '../../util/windowSize';\n\nimport useLang from '../../hooks/useLang';\nimport useSendMessageAction from '../../hooks/useSendMessageAction';\nimport useInterval from '../../hooks/useInterval';\n\nimport Modal from '../ui/Modal';\n\nimport './GameModal.scss';\n\ntype GameEvents = { eventType: 'share_score' | 'share_game' };\n\nconst PLAY_GAME_ACTION_INTERVAL = 5000;\n\ntype OwnProps = {\n openedGame?: GlobalState['openedGame'];\n gameTitle?: string;\n};\n\ntype StateProps = {\n canPost?: boolean;\n};\n\nconst GameModal: FC<OwnProps & StateProps> = ({ openedGame, gameTitle, canPost }) => {\n const { closeGame, openForwardMenu } = getActions();\n const lang = useLang();\n const { url, chatId, messageId } = openedGame || {};\n const isOpen = Boolean(url);\n\n const sendMessageAction = useSendMessageAction(chatId);\n useInterval(() => {\n sendMessageAction({ type: 'playingGame' });\n }, isOpen && canPost ? PLAY_GAME_ACTION_INTERVAL : undefined);\n\n const handleMessage = useCallback((event: MessageEvent<string>) => {\n try {\n const data = JSON.parse(event.data) as GameEvents;\n if (data.eventType === 'share_score') {\n openForwardMenu({ fromChatId: chatId, messageIds: [messageId], withMyScore: true });\n closeGame();\n }\n\n if (data.eventType === 'share_game') {\n openForwardMenu({ fromChatId: chatId, messageIds: [messageId] });\n closeGame();\n }\n } catch (e) {\n // Ignore other messages\n }\n }, [chatId, closeGame, messageId, openForwardMenu]);\n\n const handleLoad = useCallback((event: React.SyntheticEvent<HTMLIFrameElement>) => {\n event.currentTarget.focus();\n }, []);\n\n useEffect(() => {\n window.addEventListener('message', handleMessage);\n return () => window.removeEventListener('message', handleMessage);\n }, [handleMessage]);\n\n // Prevent refresh when rotating device\n useEffect(() => {\n if (!isOpen) return undefined;\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [isOpen]);\n\n return (\n <Modal\n className=\"GameModal\"\n isOpen={isOpen}\n onClose={closeGame}\n title={gameTitle}\n hasCloseButton\n >\n {isOpen && (\n <iframe\n className=\"game-frame\"\n onLoad={handleLoad}\n src={url}\n title={lang('AttachGame')}\n sandbox=\"allow-scripts allow-same-origin allow-orientation-lock\"\n allow=\"fullscreen\"\n />\n )}\n </Modal>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global, { openedGame }): StateProps => {\n const { chatId } = openedGame || {};\n const chat = chatId && selectChat(global, chatId);\n const canPost = Boolean(chat) && getCanPostInChat(chat, MAIN_THREAD_ID);\n\n return {\n canPost,\n };\n },\n)(GameModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst NotificationsAsync: FC = ({ isOpen }) => {\n const Notifications = useModuleLoader(Bundles.Extra, 'Notifications', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return Notifications ? <Notifications /> : undefined;\n};\n\nexport default memo(NotificationsAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst DialogsAsync: FC = ({ isOpen }) => {\n const Dialogs = useModuleLoader(Bundles.Extra, 'Dialogs', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return Dialogs ? <Dialogs /> : undefined;\n};\n\nexport default memo(DialogsAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\nimport type { OwnProps } from './ForwardPicker';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst ForwardPickerAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const ForwardPicker = useModuleLoader(Bundles.Extra, 'ForwardPicker', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ForwardPicker ? <ForwardPicker {...props} /> : undefined;\n};\n\nexport default memo(ForwardPickerAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './SafeLinkModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst SafeLinkModalAsync: FC<OwnProps> = (props) => {\n const { url } = props;\n const SafeLinkModal = useModuleLoader(Bundles.Extra, 'SafeLinkModal', !url);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return SafeLinkModal ? <SafeLinkModal {...props} /> : undefined;\n};\n\nexport default memo(SafeLinkModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './HistoryCalendar';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst HistoryCalendarAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const HistoryCalendar = useModuleLoader(Bundles.Extra, 'HistoryCalendar', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return HistoryCalendar ? <HistoryCalendar {...props} /> : undefined;\n};\n\nexport default memo(HistoryCalendarAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport { Bundles } from '../../../util/moduleLoader';\nimport type { OwnProps } from './GroupCall';\n\nconst GroupCallAsync: FC<OwnProps> = (props) => {\n const { groupCallId } = props;\n const GroupCall = useModuleLoader(Bundles.Calls, 'GroupCall', !groupCallId);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return GroupCall ? <GroupCall {...props} /> : undefined;\n};\n\nexport default memo(GroupCallAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport useModuleLoader from '../../hooks/useModuleLoader';\nimport { Bundles } from '../../util/moduleLoader';\n\ntype OwnProps = {\n isActive?: boolean;\n};\n\nconst ActiveCallHeaderAsync: FC<OwnProps> = (props) => {\n const { isActive } = props;\n const ActiveCallHeader = useModuleLoader(Bundles.Calls, 'ActiveCallHeader', !isActive);\n\n return ActiveCallHeader ? <ActiveCallHeader /> : undefined;\n};\n\nexport default memo(ActiveCallHeaderAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport useModuleLoader from '../../../hooks/useModuleLoader';\nimport { Bundles } from '../../../util/moduleLoader';\n\ntype OwnProps = {\n isActive?: boolean;\n};\n\nconst PhoneCallAsync: FC<OwnProps> = (props) => {\n const { isActive } = props;\n const PhoneCall = useModuleLoader(Bundles.Calls, 'PhoneCall', !isActive);\n\n return PhoneCall ? <PhoneCall /> : undefined;\n};\n\nexport default memo(PhoneCallAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../lib/teact/teactn';\n\nimport { createMessageHash } from '../../util/routing';\nimport useHistoryBack from '../../hooks/useHistoryBack';\nimport type { MessageList as GlobalMessageList } from '../../global/types';\n\ntype StateProps = {\n messageLists?: GlobalMessageList[];\n};\n\n// Actual `MessageList` components are unmounted when deep in the history,\n// so we need a separate component just for handling history\nconst MessageListHistoryHandler: FC<StateProps> = ({ messageLists }) => {\n const { openChat } = getActions();\n\n const closeChat = () => {\n openChat({ id: undefined }, { forceSyncOnIOs: true });\n };\n\n const MessageHistoryRecord: FC<GlobalMessageList> = ({ chatId, type, threadId }) => {\n useHistoryBack({\n isActive: true,\n hash: createMessageHash(chatId, type, threadId),\n onBack: closeChat,\n });\n };\n\n return (\n <div>\n {messageLists?.map((messageList, i) => (\n <MessageHistoryRecord\n // eslint-disable-next-line react/no-array-index-key\n key={`${messageList.chatId}_${messageList.threadId}_${messageList.type}_${i}`}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...messageList}\n />\n ))}\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => {\n return {\n messageLists: global.messages.messageLists,\n };\n },\n)(MessageListHistoryHandler));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './NewContactModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst NewContactModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const NewContactModal = useModuleLoader(Bundles.Extra, 'NewContactModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return NewContactModal ? <NewContactModal {...props} /> : undefined;\n};\n\nexport default memo(NewContactModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type { OwnProps } from './RatePhoneCallModal';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst RatePhoneCallModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const RatePhoneCallModal = useModuleLoader(Bundles.Calls, 'RatePhoneCallModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return RatePhoneCallModal ? <RatePhoneCallModal {...props} /> : undefined;\n};\n\nexport default memo(RatePhoneCallModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './WebAppModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst WebAppModalAsync: FC<OwnProps> = (props) => {\n const { webApp } = props;\n const WebAppModal = useModuleLoader(Bundles.Extra, 'WebAppModal', !webApp);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return WebAppModal ? <WebAppModal {...props} /> : undefined;\n};\n\nexport default memo(WebAppModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './BotTrustModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst BotTrustModalAsync: FC<OwnProps> = (props) => {\n const { bot } = props;\n const BotTrustModal = useModuleLoader(Bundles.Extra, 'BotTrustModal', !bot);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return BotTrustModal ? <BotTrustModal {...props} /> : undefined;\n};\n\nexport default memo(BotTrustModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './BotAttachModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst BotAttachModalAsync: FC<OwnProps> = (props) => {\n const { bot } = props;\n const BotAttachModal = useModuleLoader(Bundles.Extra, 'BotAttachModal', !bot);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return BotAttachModal ? <BotAttachModal {...props} /> : undefined;\n};\n\nexport default memo(BotAttachModalAsync);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"vfd0Bo1X6k19aaxQ577t\"};","import React, { memo, useRef } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type { GlobalState } from '../../global/types';\nimport type { FC } from '../../lib/teact/teact';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { pick } from '../../util/iteratees';\nimport buildStyle from '../../util/buildStyle';\n\nimport useWindowSize from '../../hooks/useWindowSize';\nimport useOnChange from '../../hooks/useOnChange';\nimport useForceUpdate from '../../hooks/useForceUpdate';\n\nimport styles from './ConfettiContainer.module.scss';\n\ntype StateProps = {\n confetti?: GlobalState['confetti'];\n};\n\ninterface Confetti {\n pos: {\n x: number;\n y: number;\n };\n velocity: {\n x: number;\n y: number;\n };\n size: number;\n color: string;\n flicker: number;\n flickerFrequency: number;\n rotation: number;\n lastDrawnAt: number;\n frameCount: number;\n}\n\nconst CONFETTI_FADEOUT_TIMEOUT = 10000;\nconst DEFAULT_CONFETTI_AMOUNT = IS_SINGLE_COLUMN_LAYOUT ? 50 : 100;\nconst DEFAULT_CONFETTI_SIZE = 10;\nconst CONFETTI_COLORS = ['#E8BC2C', '#D0049E', '#02CBFE', '#5723FD', '#FE8C27', '#6CB859'];\n\nconst ConfettiContainer: FC<StateProps> = ({ confetti }) => {\n // eslint-disable-next-line no-null/no-null\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const confettiRef = useRef<Confetti[]>([]);\n const isRafStartedRef = useRef(false);\n const windowSize = useWindowSize();\n const forceUpdate = useForceUpdate();\n\n const {\n lastConfettiTime, top, width, left, height,\n } = confetti || {};\n\n function generateConfetti(w: number, h: number, amount = DEFAULT_CONFETTI_AMOUNT) {\n for (let i = 0; i < amount; i++) {\n const leftSide = i % 2;\n const pos = {\n x: w * (leftSide ? -0.1 : 1.1),\n y: h * 0.75,\n };\n const randomX = Math.random() * w * 1.5;\n const randomY = -h / 2 - Math.random() * h;\n const velocity = {\n x: leftSide ? randomX : randomX * -1,\n y: randomY,\n };\n\n const randomColor = CONFETTI_COLORS[Math.floor(Math.random() * CONFETTI_COLORS.length)];\n const size = DEFAULT_CONFETTI_SIZE;\n confettiRef.current.push({\n pos,\n size,\n color: randomColor,\n velocity,\n flicker: size,\n flickerFrequency: Math.random() * 0.2,\n rotation: 0,\n lastDrawnAt: Date.now(),\n frameCount: 0,\n });\n }\n }\n\n const updateCanvas = () => {\n if (!canvasRef.current || !isRafStartedRef.current) {\n return;\n }\n const canvas = canvasRef.current;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return;\n }\n\n const { width: canvasWidth, height: canvasHeight } = canvas;\n ctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\n const confettiToRemove: Confetti[] = [];\n confettiRef.current.forEach((c, i) => {\n const {\n pos,\n velocity,\n size,\n color,\n flicker,\n flickerFrequency,\n rotation,\n lastDrawnAt,\n frameCount,\n } = c;\n const diff = (Date.now() - lastDrawnAt) / 1000;\n\n const newPos = {\n x: pos.x + velocity.x * diff,\n y: pos.y + velocity.y * diff,\n };\n\n const newVelocity = {\n x: velocity.x * 0.98, // Air Resistance\n y: velocity.y += diff * 1000, // Gravity\n };\n\n const newFlicker = size * Math.abs(Math.sin(frameCount * flickerFrequency));\n const newRotation = 5 * frameCount * flickerFrequency * (Math.PI / 180);\n\n const newFrameCount = frameCount + 1;\n const newLastDrawnAt = Date.now();\n\n const shouldRemove = newPos.y > canvasHeight + c.size;\n if (shouldRemove) {\n confettiToRemove.push(c);\n return;\n }\n\n const newConfetti = {\n ...c,\n pos: newPos,\n velocity: newVelocity,\n flicker: newFlicker,\n rotation: newRotation,\n lastDrawnAt: newLastDrawnAt,\n frameCount: newFrameCount,\n };\n\n confettiRef.current[i] = newConfetti;\n ctx.fillStyle = color;\n ctx.beginPath();\n ctx.ellipse(\n pos.x,\n pos.y,\n size,\n flicker,\n rotation,\n 0,\n 2 * Math.PI,\n );\n ctx.fill();\n });\n confettiRef.current = confettiRef.current.filter((c) => !confettiToRemove.includes(c));\n if (confettiRef.current.length) {\n requestAnimationFrame(updateCanvas);\n } else {\n isRafStartedRef.current = false;\n }\n };\n\n useOnChange(([prevConfettiTime]) => {\n let hideTimeout: ReturnType<typeof setTimeout>;\n if (prevConfettiTime !== lastConfettiTime) {\n generateConfetti(width || windowSize.width, height || windowSize.height);\n hideTimeout = setTimeout(forceUpdate, CONFETTI_FADEOUT_TIMEOUT);\n if (!isRafStartedRef.current) {\n isRafStartedRef.current = true;\n requestAnimationFrame(updateCanvas);\n }\n }\n return () => {\n if (hideTimeout) {\n clearTimeout(hideTimeout);\n }\n };\n }, [lastConfettiTime, updateCanvas]);\n\n if (!lastConfettiTime || Date.now() - lastConfettiTime > CONFETTI_FADEOUT_TIMEOUT) {\n return undefined;\n }\n\n const style = buildStyle(\n Boolean(top) && `top: ${top}px`,\n Boolean(left) && `left: ${left}px`,\n Boolean(width) && `width: ${width}px`,\n Boolean(height) && `height: ${height}px`,\n );\n\n return (\n <div id=\"Confetti\" className={styles.root} style={style}>\n <canvas ref={canvasRef} className={styles.canvas} width={windowSize.width} height={windowSize.height} />\n </div>\n );\n};\n\nexport default memo(withGlobal(\n (global): StateProps => pick(global, ['confetti']),\n)(ConfettiContainer));\n","import React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { FC } from '../../lib/teact/teact';\nimport type { OwnProps } from './UrlAuthModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst UrlAuthModalAsync: FC<OwnProps> = (props) => {\n const { urlAuth } = props;\n const UrlAuthModal = useModuleLoader(Bundles.Extra, 'UrlAuthModal', !urlAuth);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return UrlAuthModal ? <UrlAuthModal {...props} /> : undefined;\n};\n\nexport default memo(UrlAuthModalAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport type { OwnProps } from './PremiumMainModal';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst PremiumMainModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const PremiumMainModal = useModuleLoader(Bundles.Extra, 'PremiumMainModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return PremiumMainModal ? <PremiumMainModal {...props} /> : undefined;\n};\n\nexport default memo(PremiumMainModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './PaymentModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst PaymentModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const PaymentModal = useModuleLoader(Bundles.Extra, 'PaymentModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return PaymentModal ? <PaymentModal {...props} /> : undefined;\n};\n\nexport default memo(PaymentModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './ReceiptModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst ReceiptModalAsync: FC<OwnProps> = (props) => {\n const { isOpen } = props;\n const ReceiptModal = useModuleLoader(Bundles.Extra, 'ReceiptModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ReceiptModal ? <ReceiptModal {...props} /> : undefined;\n};\n\nexport default memo(ReceiptModalAsync);\n","import type { FC } from '../../../../lib/teact/teact';\nimport React, { memo } from '../../../../lib/teact/teact';\nimport { Bundles } from '../../../../util/moduleLoader';\n\nimport type { OwnProps } from './PremiumLimitReachedModal';\n\nimport useModuleLoader from '../../../../hooks/useModuleLoader';\n\nconst PremiumLimitReachedModalAsync: FC<OwnProps> = (props) => {\n const { limit } = props;\n const PremiumLimitReachedModal = useModuleLoader(Bundles.Extra, 'PremiumLimitReachedModal', !limit);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return PremiumLimitReachedModal ? <PremiumLimitReachedModal {...props} /> : undefined;\n};\n\nexport default memo(PremiumLimitReachedModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport type { OwnProps } from './DeleteFolderDialog';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst DeleteFolderDialogAsync: FC<OwnProps> = (props) => {\n const { deleteFolderDialogId } = props;\n const DeleteFolderDialog = useModuleLoader(Bundles.Extra, 'DeleteFolderDialog', !deleteFolderDialogId);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return DeleteFolderDialog ? <DeleteFolderDialog {...props} /> : undefined;\n};\n\nexport default memo(DeleteFolderDialogAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './CustomEmojiSetsModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst CustomEmojiSetsModalAsync: FC<OwnProps> = (props) => {\n const { customEmojiSetIds } = props;\n const CustomEmojiSetsModal = useModuleLoader(Bundles.Extra, 'CustomEmojiSetsModal', !customEmojiSetIds);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return CustomEmojiSetsModal ? <CustomEmojiSetsModal {...props} /> : undefined;\n};\n\nexport default memo(CustomEmojiSetsModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, memo, useCallback, useState, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../global';\n\nimport type { AnimationLevel, LangCode } from '../../types';\nimport type {\n ApiChat, ApiMessage, ApiUpdateAuthorizationStateType, ApiUpdateConnectionStateType, ApiUser,\n} from '../../api/types';\nimport type { ApiLimitTypeWithModal, GlobalState } from '../../global/types';\n\nimport '../../global/actions/all';\nimport {\n BASE_EMOJI_KEYWORD_LANG, DEBUG, INACTIVE_MARKER, PAGE_TITLE,\n} from '../../config';\nimport { IS_ANDROID } from '../../util/environment';\nimport {\n selectChatMessage,\n selectIsForwardModalOpen,\n selectIsMediaViewerOpen,\n selectIsRightColumnShown,\n selectIsServiceChatReady,\n selectUser,\n} from '../../global/selectors';\nimport buildClassName from '../../util/buildClassName';\nimport { waitForTransitionEnd } from '../../util/cssAnimationEndListeners';\nimport { processDeepLink } from '../../util/deeplink';\nimport windowSize from '../../util/windowSize';\nimport { getAllNotificationsCount } from '../../util/folderManager';\nimport { fastRaf } from '../../util/schedulers';\n\nimport useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps';\nimport useBackgroundMode from '../../hooks/useBackgroundMode';\nimport useBeforeUnload from '../../hooks/useBeforeUnload';\nimport useOnChange from '../../hooks/useOnChange';\nimport usePreventPinchZoomGesture from '../../hooks/usePreventPinchZoomGesture';\nimport useForceUpdate from '../../hooks/useForceUpdate';\nimport { LOCATION_HASH } from '../../hooks/useHistoryBack';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\nimport useInterval from '../../hooks/useInterval';\n\nimport StickerSetModal from '../common/StickerSetModal.async';\nimport UnreadCount from '../common/UnreadCounter';\nimport LeftColumn from '../left/LeftColumn';\nimport MiddleColumn from '../middle/MiddleColumn';\nimport RightColumn from '../right/RightColumn';\nimport MediaViewer from '../mediaViewer/MediaViewer.async';\nimport AudioPlayer from '../middle/AudioPlayer';\nimport DownloadManager from './DownloadManager';\nimport GameModal from './GameModal';\nimport Notifications from './Notifications.async';\nimport Dialogs from './Dialogs.async';\nimport ForwardPicker from './ForwardPicker.async';\nimport SafeLinkModal from './SafeLinkModal.async';\nimport HistoryCalendar from './HistoryCalendar.async';\nimport GroupCall from '../calls/group/GroupCall.async';\nimport ActiveCallHeader from '../calls/ActiveCallHeader.async';\nimport PhoneCall from '../calls/phone/PhoneCall.async';\nimport MessageListHistoryHandler from '../middle/MessageListHistoryHandler';\nimport NewContactModal from './NewContactModal.async';\nimport RatePhoneCallModal from '../calls/phone/RatePhoneCallModal.async';\nimport WebAppModal from './WebAppModal.async';\nimport BotTrustModal from './BotTrustModal.async';\nimport BotAttachModal from './BotAttachModal.async';\nimport ConfettiContainer from './ConfettiContainer';\nimport UrlAuthModal from './UrlAuthModal.async';\nimport PremiumMainModal from './premium/PremiumMainModal.async';\nimport PaymentModal from '../payment/PaymentModal.async';\nimport ReceiptModal from '../payment/ReceiptModal.async';\nimport PremiumLimitReachedModal from './premium/common/PremiumLimitReachedModal.async';\nimport DeleteFolderDialog from './DeleteFolderDialog.async';\nimport CustomEmojiSetsModal from '../common/CustomEmojiSetsModal.async';\n\nimport './Main.scss';\n\ntype StateProps = {\n chat?: ApiChat;\n connectionState?: ApiUpdateConnectionStateType;\n authState?: ApiUpdateAuthorizationStateType;\n lastSyncTime?: number;\n isLeftColumnOpen: boolean;\n isRightColumnOpen: boolean;\n isMediaViewerOpen: boolean;\n isForwardModalOpen: boolean;\n hasNotifications: boolean;\n hasDialogs: boolean;\n audioMessage?: ApiMessage;\n safeLinkModalUrl?: string;\n isHistoryCalendarOpen: boolean;\n shouldSkipHistoryAnimations?: boolean;\n openedStickerSetShortName?: string;\n openedCustomEmojiSetIds?: string[];\n activeGroupCallId?: string;\n isServiceChatReady?: boolean;\n animationLevel: AnimationLevel;\n language?: LangCode;\n wasTimeFormatSetManually?: boolean;\n isPhoneCallActive?: boolean;\n addedSetIds?: string[];\n addedCustomEmojiIds?: string[];\n newContactUserId?: string;\n newContactByPhoneNumber?: boolean;\n openedGame?: GlobalState['openedGame'];\n gameTitle?: string;\n isRatePhoneCallModalOpen?: boolean;\n webApp?: GlobalState['webApp'];\n isPremiumModalOpen?: boolean;\n botTrustRequest?: GlobalState['botTrustRequest'];\n botTrustRequestBot?: ApiUser;\n botAttachRequestBot?: ApiUser;\n currentUser?: ApiUser;\n urlAuth?: GlobalState['urlAuth'];\n limitReached?: ApiLimitTypeWithModal;\n deleteFolderDialogId?: number;\n isPaymentModalOpen?: boolean;\n isReceiptModalOpen?: boolean;\n};\n\nconst NOTIFICATION_INTERVAL = 1000;\nconst APP_OUTDATED_TIMEOUT_MS = 5 * 60 * 1000; // 5 min\n\nlet notificationInterval: number | undefined;\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet DEBUG_isLogged = false;\n\nconst Main: FC<StateProps> = ({\n connectionState,\n authState,\n lastSyncTime,\n isLeftColumnOpen,\n isRightColumnOpen,\n isMediaViewerOpen,\n isForwardModalOpen,\n hasNotifications,\n hasDialogs,\n audioMessage,\n activeGroupCallId,\n safeLinkModalUrl,\n isHistoryCalendarOpen,\n shouldSkipHistoryAnimations,\n limitReached,\n openedStickerSetShortName,\n openedCustomEmojiSetIds,\n isServiceChatReady,\n animationLevel,\n language,\n wasTimeFormatSetManually,\n addedSetIds,\n addedCustomEmojiIds,\n isPhoneCallActive,\n newContactUserId,\n newContactByPhoneNumber,\n openedGame,\n gameTitle,\n isRatePhoneCallModalOpen,\n botTrustRequest,\n botTrustRequestBot,\n botAttachRequestBot,\n webApp,\n currentUser,\n urlAuth,\n isPremiumModalOpen,\n isPaymentModalOpen,\n isReceiptModalOpen,\n deleteFolderDialogId,\n}) => {\n const {\n sync,\n loadAnimatedEmojis,\n loadNotificationSettings,\n loadNotificationExceptions,\n updateIsOnline,\n loadTopInlineBots,\n loadEmojiKeywords,\n loadCountryList,\n loadAvailableReactions,\n loadStickerSets,\n loadPremiumGifts,\n loadAddedStickers,\n loadFavoriteStickers,\n ensureTimeFormat,\n closeStickerSetModal,\n closeCustomEmojiSets,\n checkVersionNotification,\n loadAppConfig,\n loadAttachMenuBots,\n loadContactList,\n loadCustomEmojis,\n closePaymentModal,\n clearReceipt,\n checkAppVersion,\n } = getActions();\n\n if (DEBUG && !DEBUG_isLogged) {\n DEBUG_isLogged = true;\n // eslint-disable-next-line no-console\n console.log('>>> RENDER MAIN');\n }\n\n useEffect(() => {\n if (connectionState === 'connectionStateReady' && authState === 'authorizationStateReady') {\n sync();\n }\n }, [connectionState, authState, sync]);\n\n useInterval(checkAppVersion, APP_OUTDATED_TIMEOUT_MS, true);\n\n // Initial API calls\n useEffect(() => {\n if (lastSyncTime) {\n updateIsOnline(true);\n loadAppConfig();\n loadAvailableReactions();\n loadAnimatedEmojis();\n loadNotificationSettings();\n loadNotificationExceptions();\n loadTopInlineBots();\n loadEmojiKeywords({ language: BASE_EMOJI_KEYWORD_LANG });\n loadAttachMenuBots();\n loadContactList();\n loadPremiumGifts();\n checkAppVersion();\n }\n }, [\n lastSyncTime, loadAnimatedEmojis, loadEmojiKeywords, loadNotificationExceptions, loadNotificationSettings,\n loadTopInlineBots, updateIsOnline, loadAvailableReactions, loadAppConfig, loadAttachMenuBots, loadContactList,\n loadPremiumGifts, checkAppVersion,\n ]);\n\n // Language-based API calls\n useEffect(() => {\n if (lastSyncTime) {\n if (language !== BASE_EMOJI_KEYWORD_LANG) {\n loadEmojiKeywords({ language });\n }\n\n loadCountryList({ langCode: language });\n }\n }, [language, lastSyncTime, loadCountryList, loadEmojiKeywords]);\n\n // Re-fetch cached saved emoji for `localDb`\n useEffectWithPrevDeps(([prevLastSyncTime]) => {\n if (!prevLastSyncTime && lastSyncTime) {\n loadCustomEmojis({\n ids: Object.keys(getGlobal().customEmojis.byId),\n ignoreCache: true,\n });\n }\n }, [lastSyncTime] as const);\n\n // Sticker sets\n useEffect(() => {\n if (lastSyncTime) {\n if (!addedSetIds || !addedCustomEmojiIds) {\n loadStickerSets();\n loadFavoriteStickers();\n }\n\n if (addedSetIds && addedCustomEmojiIds) {\n loadAddedStickers();\n }\n }\n }, [lastSyncTime, addedSetIds, loadStickerSets, loadFavoriteStickers, loadAddedStickers, addedCustomEmojiIds]);\n\n // Check version when service chat is ready\n useEffect(() => {\n if (lastSyncTime && isServiceChatReady) {\n checkVersionNotification();\n }\n }, [lastSyncTime, isServiceChatReady, checkVersionNotification]);\n\n // Ensure time format\n useEffect(() => {\n if (lastSyncTime && !wasTimeFormatSetManually) {\n ensureTimeFormat();\n }\n }, [lastSyncTime, wasTimeFormatSetManually, ensureTimeFormat]);\n\n // Parse deep link\n useEffect(() => {\n if (lastSyncTime && LOCATION_HASH.startsWith('#?tgaddr=')) {\n processDeepLink(decodeURIComponent(LOCATION_HASH.substr('#?tgaddr='.length)));\n }\n }, [lastSyncTime]);\n\n // Prevent refresh by accidentally rotating device when listening to a voice chat\n useEffect(() => {\n if (!activeGroupCallId && !isPhoneCallActive) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [activeGroupCallId, isPhoneCallActive]);\n\n const leftColumnTransition = useShowTransition(\n isLeftColumnOpen, undefined, true, undefined, shouldSkipHistoryAnimations,\n );\n const willAnimateLeftColumnRef = useRef(false);\n const forceUpdate = useForceUpdate();\n\n // Handle opening middle column\n useOnChange(([prevIsLeftColumnOpen]) => {\n if (prevIsLeftColumnOpen === undefined || animationLevel === 0) {\n return;\n }\n\n willAnimateLeftColumnRef.current = true;\n\n if (IS_ANDROID) {\n fastRaf(() => {\n document.body.classList.toggle('android-left-blackout-open', !isLeftColumnOpen);\n });\n }\n\n const dispatchHeavyAnimationEnd = dispatchHeavyAnimationEvent();\n\n waitForTransitionEnd(document.getElementById('MiddleColumn')!, () => {\n dispatchHeavyAnimationEnd();\n willAnimateLeftColumnRef.current = false;\n forceUpdate();\n });\n }, [isLeftColumnOpen]);\n\n const rightColumnTransition = useShowTransition(\n isRightColumnOpen, undefined, true, undefined, shouldSkipHistoryAnimations,\n );\n const willAnimateRightColumnRef = useRef(false);\n const [isNarrowMessageList, setIsNarrowMessageList] = useState(isRightColumnOpen);\n\n // Handle opening right column\n useOnChange(([prevIsRightColumnOpen]) => {\n if (prevIsRightColumnOpen === undefined || animationLevel === 0) {\n return;\n }\n\n willAnimateRightColumnRef.current = true;\n\n const dispatchHeavyAnimationEnd = dispatchHeavyAnimationEvent();\n\n waitForTransitionEnd(document.getElementById('RightColumn')!, () => {\n dispatchHeavyAnimationEnd();\n willAnimateRightColumnRef.current = false;\n forceUpdate();\n setIsNarrowMessageList(isRightColumnOpen);\n });\n }, [isRightColumnOpen]);\n\n const className = buildClassName(\n leftColumnTransition.hasShownClass && 'left-column-shown',\n leftColumnTransition.hasOpenClass && 'left-column-open',\n willAnimateLeftColumnRef.current && 'left-column-animating',\n rightColumnTransition.hasShownClass && 'right-column-shown',\n rightColumnTransition.hasOpenClass && 'right-column-open',\n willAnimateRightColumnRef.current && 'right-column-animating',\n isNarrowMessageList && 'narrow-message-list',\n shouldSkipHistoryAnimations && 'history-animation-disabled',\n );\n\n const handleBlur = useCallback(() => {\n updateIsOnline(false);\n\n const initialUnread = getAllNotificationsCount();\n let index = 0;\n\n clearInterval(notificationInterval);\n notificationInterval = window.setInterval(() => {\n if (document.title.includes(INACTIVE_MARKER)) {\n updateIcon(false);\n return;\n }\n\n if (index % 2 === 0) {\n const newUnread = getAllNotificationsCount() - initialUnread;\n if (newUnread > 0) {\n updatePageTitle(`${newUnread} notification${newUnread > 1 ? 's' : ''}`);\n updateIcon(true);\n }\n } else {\n updatePageTitle(PAGE_TITLE);\n updateIcon(false);\n }\n\n index++;\n }, NOTIFICATION_INTERVAL);\n }, [updateIsOnline]);\n\n const handleFocus = useCallback(() => {\n updateIsOnline(true);\n\n clearInterval(notificationInterval);\n notificationInterval = undefined;\n\n if (!document.title.includes(INACTIVE_MARKER)) {\n updatePageTitle(PAGE_TITLE);\n }\n\n updateIcon(false);\n }, [updateIsOnline]);\n\n const handleStickerSetModalClose = useCallback(() => {\n closeStickerSetModal();\n }, [closeStickerSetModal]);\n\n const handleCustomEmojiSetsModalClose = useCallback(() => {\n closeCustomEmojiSets();\n }, [closeCustomEmojiSets]);\n\n // Online status and browser tab indicators\n useBackgroundMode(handleBlur, handleFocus);\n useBeforeUnload(handleBlur);\n usePreventPinchZoomGesture(isMediaViewerOpen);\n\n return (\n <div id=\"Main\" className={className}>\n <LeftColumn />\n <MiddleColumn />\n <RightColumn />\n <MediaViewer isOpen={isMediaViewerOpen} />\n <ForwardPicker isOpen={isForwardModalOpen} />\n <Notifications isOpen={hasNotifications} />\n <Dialogs isOpen={hasDialogs} />\n {audioMessage && <AudioPlayer key={audioMessage.id} message={audioMessage} noUi />}\n <SafeLinkModal url={safeLinkModalUrl} />\n <UrlAuthModal urlAuth={urlAuth} currentUser={currentUser} />\n <HistoryCalendar isOpen={isHistoryCalendarOpen} />\n <StickerSetModal\n isOpen={Boolean(openedStickerSetShortName)}\n onClose={handleStickerSetModalClose}\n stickerSetShortName={openedStickerSetShortName}\n />\n <CustomEmojiSetsModal\n customEmojiSetIds={openedCustomEmojiSetIds}\n onClose={handleCustomEmojiSetsModalClose}\n />\n {activeGroupCallId && <GroupCall groupCallId={activeGroupCallId} />}\n <ActiveCallHeader isActive={Boolean(activeGroupCallId || isPhoneCallActive)} />\n <NewContactModal\n isOpen={Boolean(newContactUserId || newContactByPhoneNumber)}\n userId={newContactUserId}\n isByPhoneNumber={newContactByPhoneNumber}\n />\n <GameModal openedGame={openedGame} gameTitle={gameTitle} />\n <WebAppModal webApp={webApp} />\n <DownloadManager />\n <ConfettiContainer />\n <PhoneCall isActive={isPhoneCallActive} />\n <UnreadCount isForAppBadge />\n <RatePhoneCallModal isOpen={isRatePhoneCallModalOpen} />\n <BotTrustModal bot={botTrustRequestBot} type={botTrustRequest?.type} />\n <BotAttachModal bot={botAttachRequestBot} />\n <MessageListHistoryHandler />\n {isPremiumModalOpen && <PremiumMainModal isOpen={isPremiumModalOpen} />}\n <PremiumLimitReachedModal limit={limitReached} />\n <PaymentModal isOpen={isPaymentModalOpen} onClose={closePaymentModal} />\n <ReceiptModal isOpen={isReceiptModalOpen} onClose={clearReceipt} />\n <DeleteFolderDialog deleteFolderDialogId={deleteFolderDialogId} />\n </div>\n );\n};\n\nfunction updateIcon(asUnread: boolean) {\n document.querySelectorAll<HTMLLinkElement>('link[rel=\"icon\"], link[rel=\"alternate icon\"]')\n .forEach((link) => {\n if (asUnread) {\n if (!link.href.includes('favicon-unread')) {\n link.href = link.href.replace('favicon', 'favicon-unread');\n }\n } else {\n link.href = link.href.replace('favicon-unread', 'favicon');\n }\n });\n}\n\n// For some reason setting `document.title` to the same value\n// causes increment of Chrome Dev Tools > Performance Monitor > DOM Nodes counter\nfunction updatePageTitle(nextTitle: string) {\n if (document.title !== nextTitle) {\n document.title = nextTitle;\n }\n}\n\nexport default memo(withGlobal(\n (global): StateProps => {\n const {\n settings: {\n byKey: {\n animationLevel, language, wasTimeFormatSetManually,\n },\n },\n botTrustRequest,\n botAttachRequest,\n } = global;\n const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;\n const audioMessage = audioChatId && audioMessageId\n ? selectChatMessage(global, audioChatId, audioMessageId)\n : undefined;\n const openedGame = global.openedGame;\n const gameMessage = openedGame && selectChatMessage(global, openedGame.chatId, openedGame.messageId);\n const gameTitle = gameMessage?.content.game?.title;\n const currentUser = global.currentUserId ? selectUser(global, global.currentUserId) : undefined;\n\n return {\n connectionState: global.connectionState,\n authState: global.authState,\n lastSyncTime: global.lastSyncTime,\n isLeftColumnOpen: global.isLeftColumnShown,\n isRightColumnOpen: selectIsRightColumnShown(global),\n isMediaViewerOpen: selectIsMediaViewerOpen(global),\n isForwardModalOpen: selectIsForwardModalOpen(global),\n hasNotifications: Boolean(global.notifications.length),\n hasDialogs: Boolean(global.dialogs.length),\n audioMessage,\n safeLinkModalUrl: global.safeLinkModalUrl,\n isHistoryCalendarOpen: Boolean(global.historyCalendarSelectedAt),\n shouldSkipHistoryAnimations: global.shouldSkipHistoryAnimations,\n openedStickerSetShortName: global.openedStickerSetShortName,\n openedCustomEmojiSetIds: global.openedCustomEmojiSetIds,\n isServiceChatReady: selectIsServiceChatReady(global),\n activeGroupCallId: global.groupCalls.activeGroupCallId,\n animationLevel,\n language,\n wasTimeFormatSetManually,\n isPhoneCallActive: Boolean(global.phoneCall),\n addedSetIds: global.stickers.added.setIds,\n addedCustomEmojiIds: global.customEmojis.added.setIds,\n newContactUserId: global.newContact?.userId,\n newContactByPhoneNumber: global.newContact?.isByPhoneNumber,\n openedGame,\n gameTitle,\n isRatePhoneCallModalOpen: Boolean(global.ratingPhoneCall),\n botTrustRequest,\n botTrustRequestBot: botTrustRequest && selectUser(global, botTrustRequest.botId),\n botAttachRequestBot: botAttachRequest && selectUser(global, botAttachRequest.botId),\n webApp: global.webApp,\n currentUser,\n urlAuth: global.urlAuth,\n isPremiumModalOpen: global.premiumModal?.isOpen,\n limitReached: global.limitReachedModal?.limit,\n isPaymentModalOpen: global.payment.isPaymentModalOpen,\n isReceiptModalOpen: Boolean(global.payment.receipt),\n deleteFolderDialogId: global.deleteFolderDialogModal,\n };\n },\n)(Main));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { GlobalState } from '../../global/types';\n\nimport { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets';\nimport useLang from '../../hooks/useLang';\nimport { decryptSession } from '../../util/passcode';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useTimeout from '../../hooks/useTimeout';\nimport useFlag from '../../hooks/useFlag';\n\nimport AnimatedIconWithPreview from '../common/AnimatedIconWithPreview';\nimport PasswordForm from '../common/PasswordForm';\nimport ConfirmDialog from '../ui/ConfirmDialog';\nimport Button from '../ui/Button';\nimport Link from '../ui/Link';\n\nimport styles from './LockScreen.module.scss';\nimport lockPreviewUrl from '../../assets/lock.png';\n\nexport type OwnProps = {\n isLocked?: boolean;\n};\n\ntype StateProps = {\n passcodeSettings: GlobalState['passcode'];\n};\n\nconst MAX_INVALID_ATTEMPTS = 5;\nconst TIMEOUT_RESET_INVALID_ATTEMPTS_MS = 180000; // 3 minutes\nconst ICON_SIZE = 160;\n\nconst LockScreen: FC<OwnProps & StateProps> = ({\n isLocked,\n passcodeSettings,\n}) => {\n const {\n unlockScreen,\n signOut,\n logInvalidUnlockAttempt,\n resetInvalidUnlockAttempts,\n } = getActions();\n\n const {\n invalidAttemptsCount,\n isLoading,\n } = passcodeSettings;\n\n const lang = useLang();\n const [validationError, setValidationError] = useState<string>('');\n const [shouldShowPasscode, setShouldShowPasscode] = useState(false);\n const [isSignOutDialogOpen, openSignOutConfirmation, closeSignOutConfirmation] = useFlag(false);\n const { shouldRender } = useShowTransition(isLocked);\n\n useTimeout(\n resetInvalidUnlockAttempts,\n invalidAttemptsCount && invalidAttemptsCount >= MAX_INVALID_ATTEMPTS\n ? TIMEOUT_RESET_INVALID_ATTEMPTS_MS\n : undefined,\n );\n\n const handleClearError = useCallback(() => {\n setValidationError('');\n }, []);\n\n const handleSubmit = useCallback((passcode: string) => {\n if (invalidAttemptsCount && invalidAttemptsCount >= MAX_INVALID_ATTEMPTS) {\n setValidationError(lang('FloodWait'));\n return;\n }\n\n setValidationError('');\n decryptSession(passcode).then(unlockScreen, () => {\n logInvalidUnlockAttempt();\n setValidationError(lang('lng_passcode_wrong'));\n });\n }, [invalidAttemptsCount, lang, logInvalidUnlockAttempt, unlockScreen]);\n\n useEffect(() => {\n if (invalidAttemptsCount && invalidAttemptsCount >= MAX_INVALID_ATTEMPTS) {\n setValidationError(lang('FloodWait'));\n } else if (invalidAttemptsCount === 0) {\n setValidationError('');\n }\n }, [invalidAttemptsCount, lang]);\n\n const handleSignOutMessage = useCallback(() => {\n closeSignOutConfirmation();\n signOut();\n }, [closeSignOutConfirmation, signOut]);\n\n if (!shouldRender) {\n return undefined;\n }\n\n function renderLogoutPrompt() {\n return (\n <div className={styles.help}>\n <p>\n <Link onClick={openSignOutConfirmation}>Log out</Link>{' '}\n if you don't remember your passcode.\n </p>\n <p>\n <Button color=\"translucent\" size=\"tiny\" isText onClick={openSignOutConfirmation}>\n {lang('AccountSettings.Logout')}\n </Button>\n </p>\n </div>\n );\n }\n\n return (\n <div className={styles.container}>\n <div className={styles.wrapper} dir={lang.isRtl ? 'rtl' : undefined}>\n <AnimatedIconWithPreview\n tgsUrl={LOCAL_TGS_URLS.Lock}\n previewUrl={lockPreviewUrl}\n size={ICON_SIZE}\n className={styles.icon}\n />\n\n <PasswordForm\n key=\"password-form\"\n shouldShowSubmit\n shouldDisablePasswordManager\n isLoading={isLoading}\n error={validationError}\n placeholder={lang('Passcode.EnterPasscodePlaceholder')}\n submitLabel={lang('Next')}\n clearError={handleClearError}\n isPasswordVisible={shouldShowPasscode}\n noRipple\n onChangePasswordVisibility={setShouldShowPasscode}\n onSubmit={handleSubmit}\n />\n\n {renderLogoutPrompt()}\n </div>\n\n <ConfirmDialog\n isOpen={isSignOutDialogOpen}\n onClose={closeSignOutConfirmation}\n text={lang('lng_sure_logout')}\n confirmLabel={lang('AccountSettings.Logout')}\n confirmHandler={handleSignOutMessage}\n confirmIsDestructive\n />\n </div>\n );\n};\n\nexport default memo(withGlobal<OwnProps>(\n (global): StateProps => {\n return {\n passcodeSettings: global.passcode,\n };\n },\n)(LockScreen));\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"sY59IPNwkaRsrfYPhEJc\",\"wrapper\":\"DlErQEIDwmZ0duQgO_2b\",\"icon\":\"ar9YdQbWJreREHmnZa9m\",\"help\":\"uOmdTQr_cJEvuTkQipx7\"};","import { getActions, getGlobal } from '../global';\n\nimport { DEBUG } from '../config';\n\n// eslint-disable-next-line import/no-cycle\nexport { default as Main } from '../components/main/Main';\nexport { default as LockScreen } from '../components/main/LockScreen';\n\nif (DEBUG) {\n // eslint-disable-next-line no-console\n console.log('>>> FINISH LOAD MAIN BUNDLE');\n}\n\nconst { connectionState, passcode: { isScreenLocked } } = getGlobal();\nif (!connectionState && !isScreenLocked) {\n getActions().initApi();\n}\n"],"names":["closeLocalTextSearch","global","chatId","threadId","selectCurrentMessageList","updateLocalTextSearch","replaceLocalTextSearchResults","undefined","addActionHandler","actions","payload","query","chatThreadKey","buildChatThreadKey","currentQuery","localTextSearch","byChatThreadKey","MEMO_EMPTY_ARRAY","mediaType","updateLocalMediaSearchType","id","MAIN_THREAD_ID","type","shouldReplaceHistory","currentMessageList","premiumModal","promo","isOpen","replaceThreadParam","exitMessageSelectMode","isStatisticsShown","messages","contentToBeScheduled","forwardMessages","toChatId","updateCurrentMessageList","setGlobal","isChatInfoShown","openChat","text","openChatWithText","chatCreation","newChatMembersProgress","targetIndexDelta","orderedIds","position","indexOf","nextId","folderId","deleteFolderDialogModal","FOCUS_NO_HIGHLIGHT_DURATION","FAST_SMOOTH_MAX_DURATION","ANIMATION_END_DELAY","blurTimeout","copyTextForMessages","messageIds","messageListType","lang","langProvider","chatMessages","selectScheduledMessages","selectChatMessages","result","map","filter","message","selectAllowedMessageActions","canCopy","sort","message1","message2","reduce","acc","sender","selectSender","push","getSenderTitle","getMessageSummaryText","copyTextToClipboard","join","scrollOffset","messageId","paramName","viewportIds","selectViewportIds","lastOwnEditableMessageId","findLast","Boolean","canEdit","replyingToId","selectReplyingToId","selectIsViewportNewest","chatMessageKeys","Object","keys","newIndex","toString","length","Number","chat","selectChat","lastMessage","threadInfo","selectThreadInfo","lastMessageId","setReplyingToId","focusMessage","origin","volume","playbackRate","isMuted","audioPlayer","selectIsRightColumnShown","pollResults","voters","window","setTimeout","getGlobal","noHighlight","replyStack","selectReplyStack","pop","focusLastMessage","groupedId","groupedChatId","replyMessageId","isResizingContainer","ids","selectForwardedMessageIdsByGroupId","shouldSwitchChat","clearTimeout","newGlobal","updateFocusedMessage","updateFocusDirection","FocusDirection","includes","direction","loadViewportMessages","fromChatId","withMyScore","groupedMessageIds","selectMessageIdsByGroupId","isModalShown","noAuthors","noCaptions","selectedMessages","openForwardMenu","byChatId","activeDownloads","newByChatId","forEach","find","canDownload","downloadMessageMedia","selectCurrentChat","enterMessageSelectMode","childMessageIds","withShift","toggleMessageSelection","shouldShowContextMenuHint","disableContextMenuHint","showNotification","IS_TOUCH_ENV","isQuiz","pollModal","currentVersion","APP_VERSION","slice","serviceNotifications","version","SERVICE_NOTIFICATIONS_USER_ID","date","getServerTime","serverTimeOffset","content","parseMessageInput","isOutgoing","createServiceNotification","serviceChat","maxId","Math","max","fractionalPart","floor","previousLocalId","serviceNotification","isUnread","apiUpdate","reactorModal","seenByModal","globalSearch","updateGlobalSearch","globalResults","localResults","resultsByType","fetchingStatus","chats","recentlyFoundChatIds","newRecentIds","unshift","updateGlobalSearchContent","stickers","search","resultIds","gifs","offsetId","results","updateUserSearch","globalUserIds","localUserIds","userId","newContact","isByPhoneNumber","closeNewContactDialog","action","leftColumnWidth","management","isActive","screen","nextScreen","IS_SINGLE_COLUMN_LAYOUT","IS_TABLET_COLUMN_LAYOUT","isLeftColumnShown","messageLists","statistics","currentMessageId","emoji","recentEmojis","newEmojis","e","sticker","recent","hash","newStickers","s","order","isCustomEmoji","setIds","notification","localId","generateIdFor","newNotifications","notifications","existingNotificationIndex","findIndex","n","splice","data","hasErrorKey","getReadableErrorText","newDialogs","dialogs","existingErrorIndex","err","url","safeLinkModalUrl","selectedAt","historyCalendarSelectedAt","selectChatMessage","botId","viaBotId","senderId","selectIsTrustedBot","openedGame","botTrustRequest","onConfirm","top","left","width","height","animationLevel","settings","byKey","confetti","lastConfettiTime","Date","now","limit","limitReachedModal","openedStickerSetShortName","openedCustomEmojiSetIds","lastRendered","customEmojis","unique","GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT","APP_VERSION_REGEX","fetch","then","response","trim","test","isUpdateAvailable","status","payment","clearPayment","closeInvoice","error","mediaId","avatarOwnerId","profilePhotoIndex","mediaViewer","noLockOnUnload","onBeforeUnload","passcode","hasPasscode","clearStoredSession","async","updatePasscodeSettings","isLoading","setupPasscode","sessionJson","JSON","stringify","loadStoredSession","currentUserId","globalJson","serializeGlobal","encryptSession","forceUpdateCache","clearEncryptedSession","clearPasscodeSettings","session","parse","storeSession","migrateCache","cloneDeep","INITIAL_STATE","isScreenLocked","invalidAttemptsCount","initApi","uploadProgressCallbacks","Map","runDebouncedForMarkRead","debounce","cb","isOutlying","isBudgetPreload","addOffset","LoadMoreDirection","round","MESSAGE_LIST_SLICE","callApi","selectThreadOriginChat","users","threadInfos","localMessages","allMessages","concat","byId","buildCollectionByKey","addChatMessagesById","updateOutlyingIds","updateListedIds","addUsers","addChats","updateThreadInfos","listedIds","selectListedIds","outlyingIds","selectOutlyingIds","areSortedArraysIntersecting","historyIds","newViewportIds","getViewportSlice","safeReplaceViewportIds","sourceIds","index","i","findClosestIndex","indexForDirection","from","to","areSomeLocal","areAllLocal","sendMessage","params","progressCallback","attachment","progress","messageLocalId","has","set","fileUploads","byMessageLocalId","replyingTo","IS_IOS","rafPromise","selectThreadTopMessageId","replyingToTopId","delete","isRestricted","onTickEnd","loadWithBudget","selectFocusedMessageId","selectRealLastReadId","replyOriginForId","threadUpdate","MESSAGE_DELETED","replyMessage","updateChatMessage","replyToMessageId","loadMessage","isDeleting","updateThreadUnreadFromForwardedMessage","scheduledAt","noWebPage","selectNoWebPage","sendAs","selectSendAs","clearWebPagePreview","value","isSingle","attachments","isGrouped","restParams","entities","commonParams","groupedAttachments","split","MAX_MEDIA_FILES_FOR_ALBUM","firstAttachment","restAttachments","selectEditingMessage","setEditingId","get","getMessageOriginalId","cancelApiProgress","draft","replyToMsgId","updateChat","draftDate","localOnly","selectDraft","isUnpin","isOneSide","isSilent","unpinAllMessages","shouldDeleteForAll","editingId","selectEditingId","selectEditingScheduledId","activeChat","reason","description","peer","getTranslation","minId","selectFirstUnreadId","unreadCount","readCount","count","l","countSortedIds","lastReadInboxMessageId","webPagePreview","loadWebPagePreview","options","poll","option","offset","shouldResetVoters","user","offsets","nextOffset","loadPollOptionResults","isCurrentUserPremium","selectIsCurrentUserPremium","fromChat","toChat","a","b","realMessages","m","isServiceNotificationMessage","replaceScheduledMessages","loadScheduledHistory","selectScheduledMessage","transcriptionId","isTranscriptionError","ignoreCache","newCustomEmojiIds","documentId","customEmoji","loadPinnedMessages","seenByUserIds","sendAsId","sendAsChat","selectUser","fullInfo","sendAsIds","updateSponsoredMessage","selectSponsoredMessage","random","randomId","unreadMentions","unreadMentionsCount","fetchUnreadMentions","markMessagesRead","shouldSkipModal","urlWithProtocol","ensureProtocol","match","RE_TME_LINK","RE_TG_LINK","openTelegramLink","appConfig","parsedUrl","URL","autologinDomains","hostname","searchParams","autologinToken","open","href","urlAuthDomains","requestLinkUrlAuth","RE_TELEGRAM_LINK","toggleSafeLinkModal","selectForwardsContainVoiceMessages","accessHash","noVoiceMessages","showDialog","getUserFullName","closeMediaViewer","searchThrottled","throttle","loadRecentStickers","recentStickers","loadStickers","stickerSetInfo","stickerSet","getActions","shortName","packs","updateStickerSet","currentEmoji","forEmoji","rebuildStickersForEmoji","searchGifs","updateGifSearch","addedStickers","updateStickerSets","sets","loadStickerSets","added","addedCustomEmojis","loadCustomEmojiSets","loadCustomEmojis","recentCustomEmojis","addedSetIds","setsById","cached","customEmojiSetIds","setIdsToLoad","pause","favorite","favoriteStickers","loadFavoriteStickers","premium","premiumSet","greeting","featured","featuredStickers","loadFeaturedStickers","premiumGifts","cachedSet","selectStickerSet","replaceAnimatedEmojis","loadAnimatedEmojis","animatedEmojiEffects","loadAnimatedEmojiEffects","saved","savedGifs","loadSavedGifs","gif","shouldUnsave","selectCurrentLimit","premiumLimit","selectPremiumLimit","isPremium","title","openPremiumModal","className","newGifs","current","unfave","unfaveSticker","stickerSetId","installedDate","language","currentEmojiKeywords","emojiKeywords","fromVersion","keywords","searchStickers","searchWords","updateStickersForEmoji","loadStickersForEmoji","searchMessagesGlobal","offsetRate","maxDate","minDate","localResult","GLOBAL_SEARCH_SLICE","totalCount","nextOffsetId","nextRate","currentSearchQuery","selectCurrentGlobalSearchQuery","updateGlobalSearchFetchingStatus","addMessages","updateGlobalSearchResults","searchSharedMedia","SHARED_MEDIA_SLICE","newFoundIds","currentSearch","selectCurrentMediaSearch","updateLocalMediaSearchResults","localChats","localUsers","globalChats","globalUsers","chatIds","userIds","searchChats","timestampPlusDay","foundIds","selectCurrentTextSearch","topMessageId","MESSAGE_SEARCH_SLICE","updateLocalTextSearchResults","searchTextMessages","currentType","currentResults","timestamp","searchMessagesByDate","ManagementProgress","username","updateManagementProgress","updateManagement","isUsernameAvailable","openLimitReachedModal","isChatBasicGroup","migrateChat","invite","editingInvite","update","inviteInfo","adminId","isRevoked","admin","revokedInvites","invites","link","expireDate","usageLimit","isRequestNeeded","oldInvite","newInvite","managementState","offsetDate","offsetUserId","offsetUser","importers","currentInviteInfo","isRequested","requesters","joinRequests","isApproved","targetChat","importer","recentRequesterIds","requestsPending","releaseStatusTimeout","loadTopMessages","DEBUG","console","log","isSyncing","loadAllChats","preloadTopChatMessages","listType","shouldReplace","onReplace","areMessagesLoaded","draftsByChatId","editingDraft","selectEditingDraft","currentChatId","currentThreadId","currentChat","newCurrentChatId","currentMessageListInfo","originChannelId","currentMessageListInfoOrigin","resultOrigin","byIdOrigin","listedIdsOrigin","threadsById","updateChats","updateUsers","updateThread","audioChatId","audioMessageId","closeAudioPlayer","loadAndReplaceMessages","lastSyncTime","initFolderManager","photo","activeSessions","byHash","authorizations","orderedHashes","ttlDays","removedSessions","newSessions","el","currentSessionHash","isCurrent","currentSession","areCallsEnabled","areSecretChatsEnabled","days","activeWebSessions","runThrottledForSearch","replaceInlineBotSettings","inlineBotSettings","inlineBots","byUsername","replaceInlineBotsIsLoading","userStatusesById","replaceUserStatuses","statusesById","topPeers","lastRequestedAt","loadTopUsers","contactList","addUserStatuses","getCompareString","lastName","firstName","collator","Intl","Collator","sortedUsers","compare","isSelf","loadContactList","isUserBot","commonChats","isFullyLoaded","updateUser","shouldSharePhoneNumber","updateChatMutedState","isContact","phoneNumber","phone","loadChatSettings","updateContact","deleteContact","profileId","isPrivate","isUserId","photos","userSearch","updateUserSearchFetchingStatus","searchUsers","userOrChat","SHOULD_PRE_OPEN","IS_ANDROID","PopupManager","constructor","features","onFail","preOpenIfNeeded","this","preOpened","blur","location","focus","popup","cancelPreOpen","close","GAMEE_URL","runDebouncedForSearch","toggleBotInAttachMenu","bot","isEnabled","loadAttachMenuBots","attachMenu","bots","handleUrlAuthResult","urlAuth","domain","shouldRequestWriteAccess","request","siteUrl","closeUrlAuthModal","sendBotCommand","command","gameePopups","answerCallbackButton","isGame","openUrl","openGame","alert","isError","validateRequestedInfo","inputInvoice","requestInfo","shouldSave","shippingOptions","setRequestInfoId","updateShippingOptions","setPaymentStep","PaymentStep","getPaymentForm","form","invoice","setPaymentForm","step","shippingAddressRequested","nameRequested","phoneRequested","emailRequested","button","openPollModal","receiptMessageId","getReceipt","openInvoice","isSamePeer","switchBotInline","openChatWithInfo","theme","extractCurrentThemeParams","requestSimpleWebView","buttonText","requestWebView","peerId","requestBotUrlAuth","buttonId","selectChatBot","removeBlockedContact","topInlineBots","inlineBotData","inlineBot","switchPm","canLoadMore","shouldReplaceSettings","newInlineBotData","currentIds","Set","newResults","help","isGallery","searchInlineBot","botSender","botUsername","queryId","resultId","scheduleDate","param","isBlocked","startParam","webViewUrl","webApp","isFromBotMenu","reply","closeWebApp","slug","trustedBotIds","newTrustedBotIds","add","Array","callbackPayload","botAttachRequest","callAttachMenuBot","isWriteAllowed","replaceSettings","hasPassword","updateTwoFaSettings","hint","currentPassword","onSuccess","isSuccess","password","email","waitingEmailCodeLength","code","saveInfo","selectPaymentInputInvoice","setInvoiceInfo","isPaymentModalOpen","setReceipt","receipt","nativeProvider","credentials","publishableKey","selectProviderPublishableKey","k","buildQueryString","cardNumber","expiryMonth","expiryYear","cvv","zip","country","method","headers","Authorization","json","getStripeError","setStripeCardInfo","sendStripeCredentials","publicToken","selectProviderPublicToken","card","number","replace","expiration_month","expiration_year","security_code","DEBUG_PAYMENT_SMART_GLOCAL","Accept","body","setSmartGlocalCardInfo","token","sendSmartGlocalCredentials","shippingOptionId","saveCredentials","formId","selectPaymentFormId","requestInfoId","selectPaymentRequestId","requestInputInvoice","requestedInfoId","sendPaymentForm","save","selectStripeCredentials","selectSmartGlocalCredentials","isClosed","isClosing","initialSection","fromUserId","isGift","monthsAmount","toUserId","loadPremiumStickers","forUserId","giftPremiumModal","monthlyCurrency","currency","monthlyAmount","MAX_MESSAGES_LIST_WIDTH","SIDE_COLUMN_MAX_WIDTH","MIN_LEFT_COLUMN_WIDTH","subtractXForEmojiInteraction","x","windowWidth","windowSize","MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN","min","MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN","updateUnreadReactions","interactionLocalId","availableReaction","aroundAnimation","mediaLoader","ApiMediaFormat","centerIcon","availableReactions","y","localEffect","startSize","isReversed","activeEmojiInteraction","animatedEffect","INTERACTION_RANDOM_OFFSET","activeEmojiInteractions","interactions","emoticon","selectLocalAnimatedEmojiEffectByName","timestamps","reaction","selectDefaultReaction","isMessageLocal","sendReaction","isInDocumentGroup","isInAlbum","documentGroupFirstMessageId","reactions","some","isChosen","ANIMATION_LEVEL_MAX","activeReactions","omit","recentReactions","canSeeList","addMessageReaction","defaultReaction","reactors","unreadReactionsCount","unreadReactions","fetchUnreadReactions","fromEntries","unread","isGroup","recentTopMessages","msgId","updateStatistics","views","forwards","dcId","statisticsDcId","publicForwards","publicForwardsData","updateMessageStatistics","name","isPercentage","updateStatisticsGraph","areDeepEqual","value1","value2","type1","isArray1","isArray","array1","array2","every","member1","object1","object2","key1","newProfilePhoto","noTopChatsRequest","selectIsChatListed","loadTopChats","closeMessageNotifications","selectChatListType","updateChatListIds","isNotJoined","requestChatUpdate","leaveChat","typingStatus","isFromScheduled","hasUnreadMention","notifyAboutMessage","messageUpdate","channelId","selectCommonBoxChatId","ARCHIVED_FOLDER_ID","orderedPinnedIds","isPinned","newOrderedPinnedIds","MAX_ACTIVE_PINNED_CHATS","listIds","active","pinnedId","updateChatListType","folder","chatFoldersById","chatFolders","newChatFoldersById","pick","newOrderedIds","orderedId","folders","recommended","replacedMembers","addedMember","deletedMemberId","shouldUpdate","members","deleteIndex","adminMembers","isOwner","isAdmin","membersCount","formattedText","loadChatJoinRequests","ANIMATION_DELAY","updateReactions","currentReactions","alreadyHasUnreadReaction","checkIfHasUnreadReactions","newMessage","isReaction","updateWithLocalMedia","isScheduled","currentMessage","video","document","getMessageContent","blobUrl","thumbnail","isPreloadedGlobally","previewBlobUrl","updateScheduledMessage","updateThreadUnread","selectThreadByMessage","originMessage","updateListedAndViewportIds","firstMessageId","isUnreadChatNotLoaded","addViewportId","messagesCount","firstUnreadId","candidateGlobal","updateChatLastMessage","force","currentLastMessage","findLastMessage","deleteMessages","newLastMessage","threadIdsToUpdate","deleteChatMessages","requestThreadInfoUpdate","chatsIdsToUpdate","commonBoxChatId","shouldForceReply","updateThreadInfo","selectIsMessageInCurrentMessageList","delayedGlobal","getMessageText","localEmoji","selectLocalAnimatedEmoji","selectLocalAnimatedEmojiEffect","scheduledIds","selectScheduledIds","selectIsChatWithBot","deleteChatScheduledMessages","thread","markMessageListRead","currentPinnedIds","selectPinnedIds","newPinnedIds","newTheadInfo","messagesById","loadFullChat","scheduledMessages","deleteScheduledMessages","lastNotification","isHidden","pollId","pollUpdate","selectChatMessageByPollId","oldResults","isMin","r","updatedPoll","recentVoterIds","totalVoters","newRecentVoterIds","newTotalVoters","targetOptionIndex","targetOption","updatedOption","votersCount","selectIsServiceChatReady","isPending","transcriptions","flushStatusUpdatesThrottled","pendingStatusUpdates","statusUpdate","targetUser","botInfo","menuButton","addBlockedContact","reorderStickerSets","privacy","key","rules","setConfirmPaymentUrl","updateNotifySettings","peerType","shouldShowPreviews","addNotifyException","twoFaSettings","call","connectionState","groupCalls","activeGroupCallId","leaveGroupCall","shouldRemove","removeGroupCall","updateGroupCall","participantsCount","groupCallId","participants","participant","updateGroupCallParticipant","ARE_CALLS_SUPPORTED","phoneCall","state","playGroupCallSound","sound","needRating","ratingPhoneCall","isCallPanelVisible","notifyAboutCall","selectPhoneCallUser","initializeSoundsForSafari","IS_PRODUCTION_HOST","useBeforeUnload","callback","useEffect","metaViewport","querySelector","defaultViewportContent","getAttribute","allowedZoomViewportContent","preventEvent","preventDefault","memo","props","StickerSetModal","useModuleLoader","Bundles","isForAppBadge","useFolderManagerForUnreadCounters","unreadNotificationsCount","getAllNotificationsCount","updateAppBadge","formatIntegerCompact","ConnectionStatus","useConnectionStatus","hasMiddleHeader","isMinimized","isDisabled","isOnline","setIsOnline","useState","navigator","onLine","handleChange","addEventListener","removeEventListener","useBrowserOnline","syncing","online","waitingForNetwork","toLowerCase","connectionStatus","connectionStatusPosition","connectionStatusText","onClick","useLang","dir","isRtl","Spinner","color","Transition","activeKey","Button","size","withGlobal","searchQuery","chatsById","isConnectionStatusMinimized","globalSearchChatId","searchDate","selectTheme","isMessageListOpen","areChatsLoaded","canInstall","contactsFilter","onSearchQuery","onSelectSettings","onSelectContacts","onSelectArchived","onReset","shouldSkipTransition","setGlobalSearchDate","setSettingOption","setGlobalSearchChatId","openChatByUsername","lockScreen","requestNextSettingsScreen","skipLockOnUnload","hasMenu","LeftColumnContent","selectedSearchDate","useMemo","formatDateToString","archivedUnreadChatsCount","values","total","isChatArchived","handleLockScreenHotkey","useCallback","stopPropagation","SettingsScreens","useHotkeys","IS_PWA","withOtherVersions","PRODUCTION_HOSTNAME","IS_TEST","MainButton","onTrigger","ripple","ariaLabel","buildClassName","handleSearchFocus","toggleConnectionStatus","handleSelectSaved","handleDarkModeToggle","newTheme","shouldUseSystemTheme","switchTheme","handleChangelogClick","BETA_CHANGELOG_URL","handleSwitchToWebK","localStorage","setItem","clearWebsync","handleSwitchToLegacy","handleOpenTipsChat","handleLockScreen","isSearchFocused","captureEscKeyListener","searchInputPlaceholder","versionString","IS_BETA","APP_REVISION","DropdownMenu","trigger","footer","APP_NAME","MenuItem","icon","Switcher","label","checked","noAnimation","FEEDBACK_URL","getPromptInstall","SearchInput","inputId","parentContainerClassName","focused","spinnerColor","spinnerBackgroundColor","placeholder","autoComplete","canClose","onChange","onFocus","onSpinnerClick","PickerSelectedItem","clickArg","chatOrUserId","ShowTransition","isCustom","orderedFolderIds","activeChatFolder","shouldSkipHistoryAnimations","maxFolders","foldersDispatch","onScreenSelect","loadChatFolders","setActiveChatFolder","transitionRef","useRef","allChatsFolder","ALL_FOLDER_ID","displayedFolders","isInAllChatsFolder","isInFirstFolder","folderCountersById","folderTabs","badgeCount","chatsCount","isBadgeActive","notificationsCount","handleSwitchTab","forceOnHeavyAnimation","captureEvents","selectorToPreventScroll","onSwipe","SwipeDirection","isNotInFirstFolderRef","useHistoryBack","onBack","handleKeyDown","ctrlKey","shiftKey","startsWith","digit","shouldRender","shouldRenderPlaceholder","transitionClassNames","useShowTransition","renderCurrentTab","activeFolder","ChatList","folderType","shouldRenderFolders","TabList","tabs","activeTab","onSwitchTab","areFolders","ref","renderCount","LeftSearch","Loading","ContactList","isShown","onNewPrivateChat","onNewChannel","onNewGroup","isMenuOpen","setIsMenuOpen","fabClassName","toggleIsMenuOpen","handleClose","tabIndex","Menu","positionX","positionY","autoClose","onClose","TRANSITION_RENDER_COUNT","closeTimeout","onContentChange","isNewChatButtonShown","setIsNewChatButtonShown","shouldRenderUpdateButton","updateButtonClassNames","isMouseInside","handleMouseEnter","handleMouseLeave","handleSelectSettings","handleSelectContacts","handleSelectArchived","handleUpdateClick","reload","handleSelectNewChannel","handleSelectNewGroup","autoCloseTimeout","onMouseEnter","onMouseLeave","shouldCleanup","cleanupExceptionKey","fluid","pill","Settings","NewChat","ArchivedChats","ContentType","RENDER_COUNT","nextSettingsScreen","isFirstChatFolderActive","isChatOpen","setGlobalSearchQuery","resetChatCreation","loadPasswordInfo","clearTwoFaError","setLeftColumnWidth","resetLeftColumnWidth","resizeRef","setContent","settingsScreen","setSettingsScreen","setContactsFilter","foldersState","useFoldersReducer","lastResetTime","setLastResetTime","contentType","Main","Archived","NewChannel","NewGroup","handleReset","forceReturnToChatList","fullReset","pickerSearchInput","getElementById","handleSearchQuery","handleHotkeySearch","handleHotkeySavedMessages","handleHotkeySettings","IS_MAC_OS","useOnChange","initResize","resetResize","handleMouseUp","elementRef","onResize","initialWidth","markIsActive","unmarkIsActive","useFlag","initialMouseX","setInitialMouseX","initialElementWidth","setInitialElementWidth","classList","remove","useLayoutEffect","style","handleMouseMove","newWidth","ceil","clientX","stopDrag","cleanup","offsetWidth","useResize","handleSettingsScreenSelect","LAYERS_ANIMATION_NAME","currentScreen","isChannel","onMouseDown","onMouseUp","onDoubleClick","HeaderMenuContainer","isChatChannel","selectIsInSelectMode","noMenu","isChatWithSelf","selectIsChatWithSelf","isMainThread","isDiscussionThread","isRightColumnShown","canRestartBot","selectIsUserBlocked","canStartBot","selectIsChatBotNotStarted","canSubscribe","isChatSuperGroup","canSearch","canCall","canMute","canLeave","canEnterVoiceChat","isCallActive","canCreateVoiceChat","adminRights","manageCall","isCreator","canViewStatistics","pendingJoinRequests","shouldJoinToSend","isJoinToSend","shouldSendJoinRequest","isJoinRequest","canExpandActions","joinChannel","openLocalTextSearch","restartBot","requestCall","requestNextManagementScreen","menuButtonRef","menuPosition","setMenuPosition","handleHeaderMenuOpen","rect","getBoundingClientRect","right","bottom","handleHeaderMenuClose","handleHeaderMenuHide","handleSubscribeClick","handleStartBot","handleRestartBot","handleJoinRequestsClick","ManagementScreens","handleSearchClick","searchInput","handleHotkeySearchClick","disabled","anchor","withExtraActions","onSubscribeChannel","onSearchClick","onCloseAnimationEnd","drawRect","radius","containerRef","markupParams","reverseIndex","barHeight","getBarHeight","markHeight","getMarkHeight","trackHeight","getTrackHeight","clipPathId","clipPath","d","getClipPath","markTranslateY","getMarkTranslateY","trackTranslateY","getTrackTranslateY","calculateMarkup","firstChild","firstElementChild","currentElement","transform","svg","div","defs","innerHTML","customTitle","onUnpinMessage","onAllPinnedClick","clickBotInlineButton","mediaThumbnail","useThumbnail","mediaBlobUrl","useMedia","getMessageMediaHash","renderMessageSummary","isUnpinDialogOpen","openUnpinDialog","closeUnpinDialog","handleUnpinMessage","inlineButton","getMessageSingleInlineButton","handleInlineButtonClick","noHoverColor","markNoHoverColor","unmarkNoHoverColor","ConfirmDialog","confirmLabel","confirmHandler","thumbDataUri","getPictogramDimensions","src","alt","renderPictogram","RippleEffect","shouldStopPropagation","LUMA_THRESHOLD","scaleImage","image","ratio","outputType","Blob","createObjectURL","img","Image","Promise","resolve","onload","scale","blob","Error","finally","revokeObjectURL","steppedScale","bitmap","createImageBitmap","resizeWidth","resizeHeight","resizeQuality","averageColor","getAverageColor","fillColor","getColorLuma","res","canvas","createElement","ctx2D","getContext","fillStyle","fillRect","ctx","transferFromImageBitmap","drawImage","toBlob","oc","octx","mul","cur","globalCompositeOperation","LOGO_DIMENSIONS","MINIMAL_SIZE","noUi","setAudioPlayerVolume","setAudioPlayerPlaybackRate","setAudioPlayerMuted","audio","voice","isVoice","shouldRenderPlaybackButton","duration","PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION","senderName","mediaData","mediaMetadata","fileName","artist","performer","album","getChatTitle","audioCoverHash","getAudioHasCover","avatarHash","getChatAvatarHash","media","thumbnailSizes","preferred","AVATAR_FULL_DIMENSIONS","getCoverSize","useAsync","telegramLogoPath","resizeImage","makeGoodArtwork","buildMediaMetadata","artwork","useMessageMediaMetadata","playPause","stop","isPlaying","requestNextTrack","requestPreviousTrack","isFirst","isLast","setVolume","toggleMuted","setPlaybackRate","useAudioPlayer","makeTrackId","getMediaDuration","isVoicePlaying","handleClick","clearMediaSession","handleVolumeChange","handleVolumeClick","handlePlaybackClick","volumeIcon","renderText","renderAudio","subtitle","renderVoice","noPreventDefault","RangeSlider","bold","groupCall","selectChatGroupCall","usersById","isLoaded","isCallNotEmpty","hasPinnedOffset","joinGroupCall","subscribeToGroupCallUpdates","handleJoinGroupCall","fetchedParticipants","_","isUser","subscribed","p","Avatar","openAddContactDialog","blockContact","reportSpam","deleteChat","leaveChannel","deleteChatUser","deleteHistory","toggleChatArchived","hideChatReportPanel","isBlockUserModalOpen","openBlockUserModal","closeBlockUserModal","shouldReportSpam","setShouldReportSpam","shouldDeleteChat","setShouldDeleteChat","isAutoArchived","canReportSpam","canAddContact","canBlockContact","isBasicGroup","handleAddContact","handleConfirmBlock","contactId","handleCloseReportPanel","handleChatReportSpam","isText","getUserFirstOrLastName","isButtonsInOneRow","confirmIsDestructive","Checkbox","onCheck","audioMessage","pinnedIds","isChatWithBot","isSelectModeActive","currentTransitionKey","hasButtonInHeader","assign","pinnedMessageId","topMessageSender","selectForwardedSender","pinnedMessageIds","canUnpin","firstPinnedMessage","isReady","pinMessage","openPreviousChat","toggleLeftColumn","isBackButtonActive","pinnedMessageIndex","setPinnedMessageIndex","pinnedMessage","pinnedMessagesCount","chatTitleLength","topMessageTitle","useEnsureMessage","useWindowSize","isLeftColumnHideable","shouldShowCloseButton","componentRef","shouldAnimateTools","handleHeaderClick","handlePinnedMessageClick","cycleRestrict","handleAllPinnedClick","setBackButtonActive","handleBackClick","messageInput","EDITABLE_INPUT_CSS_SELECTOR","canToolsCollideWithChatInfo","SAFE_SCREEN_WIDTH_FOR_CHAT_INFO","MOBILE_SCREEN_MAX_WIDTH","shouldUseStackedToolsClass","SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN","hasChatSettings","shouldShowChatReportPanel","chatReportPanelClassNames","renderingChatSettings","useCurrentOrPrev","shouldRenderAudioPlayer","audioPlayerClassNames","renderingAudioMessage","shouldRenderPinnedMessage","pinnedMessageClassNames","renderingPinnedMessage","renderingPinnedMessagesCount","renderingCanUnpin","renderingPinnedMessageTitle","canRevealTools","componentEl","renderBackButton","asClose","withUnreadCounter","isAudioPlayerRendered","isPinnedMessagesFullWidth","MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES","PrivateChatInfo","withDots","withFullInfo","withMediaViewer","withUpdatingStatus","withVideoAvatar","noRtl","GroupChatInfo","getMessageKey","isAlbum","messageOrAlbum","groupMessages","currentAlbum","currentSenderGroup","currentDateGroup","originalDate","datetime","getDayStartAt","senderGroups","dateGroups","mainMessage","albumId","nextMessage","nextMessageDayStartsAt","isActionMessage","forwardInfo","senderUserId","hiddenUserName","inlineButtons","INTERSECTION_THROTTLE_FOR_MEDIA","INTERSECTION_MARGIN_FOR_MEDIA","isEmojiOnlyMessage","customShape","getMinMediaWidth","hasText","hasCommentButton","calculateMediaDimensions","noAvatars","isOwn","isOwnMessage","isForwarded","isForwardedMessage","getMessagePhoto","getMessageWebPagePhoto","getMessageVideo","isWebPagePhoto","calculateInlineImageDimensions","calculateVideoDimensions","minMediaWidth","stretchFactor","finalWidth","finalHeight","isSmall","accumulate","list","initValue","accumulator","item","calculateContainerSize","layout","styles","dimensions","sides","calculateAlbumLayout","ratios","getRatios","proportions","getProportions","averageRatio","getAverageRatio","albumCount","forceCalc","maxWidth","getAvailableWidth","REM","minWidth","maxHeight","spacing","originalRatios","clamp","cropRatios","attempts","pushAttempt","lineCounts","heights","currentCount","attemptCount","sum","multiHeight","first","second","third","fourth","optimalAttempt","optimalDiff","lineCount","totalHeight","bad1","bad2","line","diff","abs","optimalCounts","optimalHeights","rowCount","row","colCount","lineHeight","col","layoutWithComplexLayouter","AlbumRectPart","layoutTwoTopBottom","layoutTwoLeftRightEqual","minimalWidth","secondWidth","firstWidth","layoutTwoLeftRight","layoutTwo","firstHeight","thirdHeight","secondHeight","rightWidth","leftWidth","layoutThreeLeftAndOther","layoutThreeTopAndOther","layoutThree","w","h0","h","w0","w2","w1","h1","layoutFourTopAndOther","h2","layoutFourLeftAndOther","layoutFour","containerStyle","element","fontFamily","calculateAuthorWidth","getComputedStyle","documentElement","getPropertyValue","font","whiteSpace","opacity","appendChild","useFocusMessage","isFocused","focusDirection","noFocusHighlight","messagesContainer","closest","fastSmoothScroll","QUICK_REACTION_AREA_WIDTH","QUICK_REACTION_AREA_HEIGHT","GROUP_MESSAGE_HOVER_ATTRIBUTE","useOuterHandlers","selectMessage","isInSelectMode","canReply","isProtected","onContextMenu","handleBeforeContextMenu","isContextMenuShown","contentRef","shouldHandleMouseLeave","sendDefaultReaction","isQuickReactionVisible","markQuickReactionVisible","unmarkQuickReactionVisible","isSwiped","markSwiped","unmarkSwiped","doubleTapTimeoutRef","startedAt","excludedClosestSelector","onRelease","handleMouseDown","preventMessageInputBlur","clearInterval","pageX","pageY","handleDoubleTap","target","contains","handleTap","handleContextMenu","stopEvent","matches","handleDoubleClick","handleContentDoubleClick","container","clientY","isVisibleX","isVisibleY","handleSendQuickReaction","currentTarget","lastGroupElement","getLastElementInDocumentGroup","removeAttribute","handleDocumentGroupMouseLeave","handleDocumentGroupMouseEnter","setAttribute","nextElementSibling","ContextMenuContainer","targetUserIds","targetChatId","targetMessageId","targetMessage","selectIsMessageFocused","focusedMessage","isChat","senderUser","senderChat","premiumGiftSticker","observeIntersection","observeIntersectionForAnimation","isEmbedded","appearanceOrder","isLastInList","memoFirstUnreadIdRef","requestConfetti","useOnIntersect","noAppearanceAnimation","markShown","isVisible","useIsIntersecting","shouldShowConfettiRef","targetUsers","renderActionMessageText","asTextWithSpoilers","isContextMenuOpen","contextMenuPosition","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","getMessageHtmlId","role","months","AnimatedIconFromSticker","play","noLoop","nonInteractive","customText","noUserColors","hasContextMenu","isIntersecting","isRoundVideo","getMessageRoundVideo","senderTitle","getUserColorKey","draggable","activeReaction","isInMeta","stopActiveReaction","centerIconId","effectId","mediaDataCenterIcon","mediaDataEffect","shouldPlay","shouldRenderAnimation","animationClassNames","handleEnded","isAnimationLoaded","markAnimationLoaded","unmarkAnimationLoaded","shouldRenderStatic","ReactionStaticEmoji","AnimatedSticker","tgsUrl","onLoad","onEnded","outgoingStatus","signature","withReactions","withReactionOffset","reactionMessage","isActivated","markActivated","createDateTime","formatDateTimeToString","editDateTime","isEdited","editDate","forwardedDateTime","formatTime","MessageOutgoingStatus","observeIntersectionForPlaying","shouldLoop","shouldPlayEffect","onPlayEffect","onStopEffect","openStickerSet","isLottie","isVideo","hasEffect","canDisplayVideo","IS_WEBM_SUPPORTED","isMemojiSticker","isPlayingEffect","startPlayingEffect","stopPlayingEffect","shouldLoad","mediaHash","mediaHashEffect","previewMediaHash","previewUrl","getMessageMediaFormat","effectBlobUrl","isMediaLoaded","isLottieLoaded","markLottieLoaded","isMediaReady","useMediaTransition","getStickerDimensions","thumbClassName","stickerClassName","handleEffectEnded","safePlay","openModal","actionText","autoPlay","playsInline","disablePictureInPicture","loop","muted","isLowPriority","withEffects","localSticker","selectAnimatedEmoji","effect","selectAnimatedEmojiEffect","soundId","selectAnimatedEmojiSound","forceLoadPreview","interactWithAnimatedEmoji","sendEmojiInteraction","sendWatchingEmojiInteraction","audioRef","soundMediaData","startedInteractions","sendInteractionBunch","Audio","once","performance","interactionMessageId","useAnimatedEmoji","AnimatedIconWithPreview","LOCAL_TGS_URLS","quality","noLoad","forcePreview","LIKE_STICKER_ID","useBlurredMediaThumbRef","fullMediaData","useCanvasBlur","getMessageMediaThumbDataUri","IS_CANVAS_FILTER_SUPPORTED","SELECTED_APPENDIX_COLORS","dark","outgoing","incoming","light","getCustomAppendixBg","inSelectMode","isSelected","crossOrigin","getImageData","getAppendixColorFromImage","canAutoLoad","uploadProgress","shouldAffectAppendix","isDownloading","withAspectRatio","onCancelUpload","localBlobUrl","isLoadAllowed","setIsLoadAllowed","loadProgress","useMediaWithLoadProgress","thumbRef","downloadProgress","isUploading","isTransferring","transferProgress","getMediaTransferState","wasLoadDisabled","usePrevious","shouldRenderSpinner","spinnerClassNames","shouldRenderDownloadButton","downloadButtonClassNames","isAllowed","contentEl","appendixBg","setProperty","CUSTOM_APPENDIX_ATTRIBUTE","aspectRatio","toFixed","ProgressSpinner","canAutoPlay","videoRef","getMessageWebPageVideo","isPlayAllowed","setIsPlayAllowed","previewClassNames","isInline","isBuffered","bufferingHandlers","useBuffering","shouldRenderPlayButton","playButtonClassNames","playProgress","setPlayProgress","handleTimeUpdate","currentTime","useVideoAutoPause","useVideoCleanup","cancelMessageMediaDownload","onTimeUpdate","isGif","formatMediaDuration","contact","countryList","phoneCodes","phoneCodeList","isRegistered","withVideo","formatPhoneNumberWithCode","getPercentage","answer","voteResults","maxVotersCount","correctResults","shouldAnimate","correctAnswer","showIcon","answerPercent","finalPercent","setFinalPercent","lineRef","lineWidth","isAnimationDoesNotStart","lineEl","svgEl","lineStyle","onSendVote","openPollResults","summary","isSubmitting","setIsSubmitting","chosenOptions","setChosenOptions","isSolutionShown","setIsSolutionShown","wasSubmitted","setWasSubmitted","closePeriod","setClosePeriod","closed","closeDate","countdownRef","hasVoted","canVote","canViewResult","isPublic","isMultiple","multipleChoice","answers","isCorrect","hidden","quiz","chosen","countdownEl","circumference","PI","lastElementChild","timerEl","strokeDashOffset","textContent","timer","recentVoters","handleRadioChange","handleCheckboxChange","handleVoteClick","handleViewResultsClick","handleSolutionShow","handleSolutionHide","solution","Notification","renderTextWithEntities","solutionEntities","onDismiss","containerId","question","getPollTypeString","CheckboxGroup","loadingOptions","RadioGroup","loadingOption","getReadableVotersCount","inPreview","onMediaClick","onCancelMediaTransfer","webPage","getMessageWebPage","handleMediaClick","siteName","displayUrl","truncatedDescription","trimText","isArticle","isSquarePhoto","isMediaInteractive","SafeLink","getMessageInvoice","amount","isTest","photoUrl","getWebDocumentHash","Skeleton","forceAspectRatio","formatCurrency","VENUE_COLORS","entries","arts_entertainment","building","education","event","food","home","nightlife","parks_outdoors","shops","travel","work","RANDOM_COLORS","MOVE_THRESHOLD","DEFAULT_MAP_CONFIG","zoom","SVG_PIN","__html","forceUpdate","useForceUpdate","getMessageLocation","geo","serverTime","isExpired","isGeoLiveExpired","secondsBeforeEnd","period","point","setPoint","shouldRenderText","buildStaticMapHash","prevMediaBlobUrl","mapBlobUrl","isPeerUser","avatarUser","avatarChat","accuracyRadiusPx","accuracyRadius","lat","cos","getMetersPerPixel","updateCountdown","timeLeft","formatCountdownShort","long","useTimeout","useInterval","prepareMapUrl","pinClassName","dangerouslySetInnerHTML","heading","str","prevHash","currVal","charCodeAt","getVenueColor","venueType","getVenueIconUrl","mapPin","renderPin","renderOverlay","address","formatLastUpdated","renderInfo","canAutoLoadMedia","game","photoHash","getGamePreviewPhotoHash","videoHash","getGamePreviewVideoHash","photoBlobUrl","videoBlobUrl","withSelectControl","WrappedComponent","ownProps","selectIsMessageSelected","handleMessageSelect","newProps","dims","PhotoWithSelect","Photo","VideoWithSelect","Video","activeDownloadIds","selectActiveDownloadIds","uploadsById","hasCustomAppendix","albumLayout","cancelSendingMessage","mediaCount","handleCancelUpload","containerWidth","containerHeight","fileUpload","selectCanAutoLoadMedia","selectCanAutoPlayMedia","stopPrevious","playingProgressRef","playerRef","shouldSpinnerRender","setIsActivated","setProgress","svgCenter","ROUND_VIDEO_DIMENSIONS_PX","playerEl","playingProgressEl","stopPlaying","fastRaf","capturePlaying","paused","stopCurrentAudio","videoClassName","renderIcon","recentReplierIds","recentRepliers","hasUnread","recentReactors","recentReaction","isOutside","metaChildren","isMissed","isCancelled","handleCall","reasonText","formatTimeDuration","timeFormatted","APPENDIX_OWN","APPENDIX_NOT_OWN","withSenderName","withAvatar","isLastInDocumentGroup","replyToChatId","isRepliesChat","isChatWithRepliesBot","chatUsername","forceSenderName","isAnonymousOwnMessage","canShowSender","originSender","threadTopMessageId","isThreadTop","shouldHideReply","replyMessageSender","selectReplySender","selectUploadProgress","isForwarding","highlight","singleEmoji","getMessageSingleEmoji","animatedEmoji","selectIsDownloading","actualThreadInfo","hasUnreadReaction","selectIsMessageProtected","isGroupSelected","selectIsDocumentGroupSelected","isPinnedList","canAutoPlayMedia","autoLoadFileMaxSizeMb","shouldLoopStickers","selectShouldLoopStickers","selectOutgoingStatus","isTranscribing","transcribedText","observeIntersectionForBottom","observeIntersectionForMedia","observeIntersectionForAnimatedStickers","areReactionsInMeta","noComments","isFirstInGroup","isLastInGroup","isFirstInDocumentGroup","animateUnreadReaction","bottomMarkerRef","isTranscriptionHidden","setTranscriptionHidden","hasActiveStickerEffect","startStickerEffect","stopStickerEffect","isLocal","hasReply","isReplyMessage","hasThread","getMessageCustomShape","hasAnimatedEmoji","hasReactions","areReactionsEmpty","asForwarded","isLinkedChannelPost","msg","isInDocumentGroupNotFirst","isInDocumentGroupNotLast","canShowActionButton","canForward","canFocus","isChannelPost","fromMessageId","messageSender","withVoiceTranscription","avatarPeer","senderPeer","handleAvatarClick","handleSenderClick","handleViaBotClick","handleReplyClick","handleAudioPlay","handleAlbumMediaClick","handleMetaClick","handleReadMedia","handleVoteSend","handleGroupForward","handleForward","handleFocus","handleFocusForwarded","handleDocumentGroupSelectAll","openMediaViewer","openAudioPlayer","sendPollVote","focusMessageInComments","replyToTopMessageId","channelPostId","MediaViewerOrigin","albumMessageId","selectWithGroupedId","useInnerHandlers","containerClassName","withCommentButton","withQuickReactionButton","contentClassName","hasComments","hasActionButton","isGeoLiveActive","classNames","isMedia","isMediaWithNoText","isViaBot","isRound","buildContentClassName","withAppendix","textParts","renderMessageText","metaPosition","reactionsPosition","bottomMarker","isElementInViewport","calculatedWidth","noMediaCorners","extraPadding","adminTitle","metaSafeAuthorWidth","renderReactionsAndMeta","meta","onMouseMove","isAvatarPeerUser","hiddenName","isAvatarPremium","PremiumIcon","renderAvatar","textContentClass","senderColor","renderSenderName","AudioOrigin","isSelectable","onPlay","onReadMedia","isTranscribed","onHideTranscription","canTranscribe","Document","DotAnimation","renderContent","AboutAdsModal","SponsoredMessageContextMenuContainer","isBot","channel","viewSponsoredMessage","openChatByInvite","startBot","shouldObserve","observe","useIntersectionObserver","rootRef","debounceMs","threshold","isAboutAdsModalOpen","openAboutAdsModal","closeAboutAdsModal","chatInviteHash","chatInviteTitle","isRecommended","onAboutAds","messageGroups","isViewportNewest","withUsers","anchorIdRef","memoUnreadDividerBeforeIdRef","isScrollingRef","isScrollPatchNeededRef","hasLinkedChat","isSchedule","onFabToggle","onNotchToggle","openHistoryCalendar","observeIntersectionForReading","markMentionsRead","throttleMs","margin","freeze","freezeForReading","unfreeze","unfreezeForReading","mentionIds","reactionIds","entry","dataset","useBackgroundMode","useMessageObservers","backwardsTriggerRef","forwardsTriggerRef","fabTriggerRef","loadMoreBackwards","loadMoreForwards","toggleScrollTools","offsetHeight","scrollHeight","scrollTop","scrollBottom","isAtBottom","MESSAGE_LIST_SENSITIVE_AREA","LOCAL_MESSAGE_MIN_ID","triggerEntry","IS_SCROLL_PATCH_NEEDED","observeIntersectionForFab","freezeForFab","unfreezeForFab","FAB_THRESHOLD","observeIntersectionForNotch","freezeForNotch","unfreezeForNotch","useScrollHooks","unreadDivider","messageCountToAnimate","messageGroup","flat","appearanceIndex","dateGroup","dateGroupIndex","dateGroupsArray","senderGroup","senderGroupIndex","senderGroupsArray","compact","currentDocumentGroupId","messageIndex","isMessageAlbum","documentGroupId","nextDocumentGroupId","originalId","teactFastList","SCHEDULED_WHEN_ONLINE","formatHumanDate","dividend","getUserIdDividend","lastUnreadMessageId","loadGreetingStickers","handleStickerSelect","selectedSticker","StickerButton","noContextMenu","isGroupChatJustCreated","renderScheduled","renderSavedMessages","renderGroup","runDebouncedForScroll","selectCurrentMessageIds","restrictionReason","focusingId","withLastMessageWhenPreloading","chatBot","isLoadingBotInfo","isChatLoaded","isChannelChat","isGroupChat","isChatGroup","threadFirstMessageId","selectFirstMessageId","linkedChatId","hasTools","canPost","withBottomShift","setScrollOffset","loadSponsoredMessages","loadMessageReactions","copyMessagesByIds","scrollOffsetRef","selectScrollOffset","anchorTopRef","listItemElementsRef","memoFocusingIdRef","isScrollTopJustUpdatedRef","shouldAnimateAppearanceRef","setContainerHeight","botInfoPhotoUrl","getBotCoverMediaHash","botInfoGifUrl","getDocumentMediaHash","botInfoDimensions","getPhotoFullDimensions","getVideoDimensions","botInfoRealDimensions","DPR","getMessageIdsForSelectedText","useNativeCopySelectedMessages","listedMessages","orderBy","loadMoreAround","isScrolled","updateStickyDates","markIsScrolled","runDebounced","useRunDebounced","currentStuck","stuckDateEl","allElements","querySelectorAll","containerTop","offsetTop","findStuckDate","useStickyDates","handleScroll","parentElement","observer","ResizeObserver","offsetParent","contentRect","disconnect","windowHeight","normalHeight","String","clientHeight","preservedItemElements","useLayoutEffectWithPrevDeps","prevMessageIds","prevIsViewportNewest","prevContainerHeight","hasLastMessageChanged","hasViewportShifted","wasMessageAdded","isAlreadyFocusing","shouldForceScroll","lastItemElement","bottomOffset","newScrollTop","isResized","isAnimatingScroll","patchChromiumScroll","resetScroll","useEffectWithPrevDeps","prevIsSelectModeActive","dispatchHeavyAnimationEvent","shouldRenderGreeting","isBotInfoEmpty","onScroll","backgroundColor","ariaLabelLang","onReadAll","shouldShowCount","reactionsCount","mentionsCount","withExtraShift","focusNextReply","focusNextReaction","focusNextMention","readAllMentions","readAllReactions","hasUnreadReactions","hasUnreadMentions","messageElements","lastMessageElement","MAX_QUICK_IMG_SIZE","FILE_EXT_REGEX","buildAttachment","filename","isQuick","mimeType","quick","SUPPORTED_IMAGE_CONTENT_TYPES","preloadImage","shouldShrink","resizedUrl","fetchBlob","SUPPORTED_VIDEO_CONTENT_TYPES","videoWidth","videoHeight","preloadVideo","createPosterForVideo","SUPPORTED_AUDIO_CONTENT_TYPES","coverUrl","fetchFromUrl","selectCover","metadata","common","picture","format","cover","parseAudioMetadata","insertHtmlInSelection","html","selection","getSelection","getRangeAt","rangeCount","range","deleteContents","fragment","createContextualFragment","lastInsertedNode","lastChild","insertNode","setStartAfter","setEndAfter","collapse","removeAllRanges","addRange","resetInput","applyIosAutoCapitalizationFix","inputEl","POLYFILL_OPTIONS","encoderPath","reuseWorker","BLOB_PARAMS","opusRecorderPromise","OpusRecorder","mediaRecorder","init","default","start","analyzerCallback","startMediaRecorder","pausedAt","chunks","waveform","ondataavailable","typedArray","releaseAnalyzer","recorder","source","sourceNode","analyser","context","createAnalyser","fftSize","connect","dataLength","frequencyBinCount","dataArray","Uint8Array","isDestroyed","tick","getByteFrequencyData","requestAnimationFrame","subscribeToAnalyzer","reject","onstop","onerror","delayStop","CLIPBOARD_ACCEPTED_TYPES","useDebouncedMemo","resolverFn","ms","dependencies","setValue","isFrozen","updateWhenUnfrozen","handleUnfreeze","useHeavyAnimationCheck","noop","isHeavyAnimating","useHeavyAnimationFreeze","INLINE_BOT_QUERY_REGEXP","HAS_NEW_LINE","MEMO_NO_RESULT","canShowHelp","usernameLowered","tempEl","runThrottled","RE_COMMAND","DeleteMessageModal","openTimeout","isFirstTimeActivation","onActivate","buttonProps","COLOR_REPLACE_PATTERN","iconSvg","mediaDataWithReplacedColors","doc","DOMParser","parseFromString","stroke","strokeWidth","outerHTML","IS_COMPACT_MENU","onMenuOpened","onMenuClosed","icons","openMenu","closeMenu","handleCloseMenu","handleCloseAnimationEnd","handleRemoveBot","customIcon","Portal","destructive","isButtonVisible","canAttachMedia","canAttachPolls","attachMenuBots","onFileSelect","onPollCreate","isAttachMenuOpen","openAttachMenu","closeAttachMenu","markMouseInside","useMouseInside","isAttachmentBotMenuOpen","markAttachmentBotMenuOpen","unmarkAttachmentBotMenuOpen","handleToggleAttachMenu","handleFileSelect","files","handleQuickSelect","openSystemFilesDialog","CONTENT_TYPES_WITH_PREVIEW","handleDocumentSelect","peerTypes","ariaControls","hasPopup","noCloseOnBackdrop","ariaLabelledBy","SymbolMenu","InlineBotTooltip","MentionTooltip","StickerTooltip","BotCommandTooltip","isKeyboardSingleUse","forceOpen","markForceOpen","unmarkForceOpen","keyboardButtons","noCompact","forwardMessageIds","forwardedMessages","forwardsHaveCaptions","forward","forwardedMessagesCount","onClear","changeForwardRecipient","setForwardNoAuthors","setForwardNoCaptions","exitForwardMode","canAnimate","useAsyncRendering","clearEmbedded","handleMessageClick","handleClearClick","handleChangeRecipientClick","getTriggerElement","getRootElement","getMenuElement","transformOriginX","transformOriginY","menuStyle","useContextMenuPosition","leftIcon","strippedMessage","textEntities","filteredEntities","entity","ApiMessageEntityTypes","faded","MenuSeparator","AttachmentModal","BotCommandMenu","PollModal","DropArea","RE_LINK","RegExp","RE_LINK_TEMPLATE","messageText","toggleMessageWebPage","linkEntity","textMatch","renderingWebPage","handleClearWebpagePreview","webPageWithoutPhoto","messageStub","SendAsMenu","textRef","textEl","scrollWidth","composerEl","removeProperty","MainButtonState","VOICE_RECORDING_FILENAME","REPLIES_USER_ID","messageWithActualBotKeyboard","selectNewestMessageWithBotKeyboardButtons","shouldSuggestStickers","baseEmojiKeywords","BASE_EMOJI_KEYWORD_LANG","botKeyboardMessageId","keyboardMessage","defaultSendAsId","anonymous","sendAsUser","requestedText","selectRequestedText","isForCurrentMessageList","canSendVoiceByPrivacy","selectEditingScheduledDraft","editingMessage","canScheduleUntilOnline","selectCanScheduleUntilOnline","withScheduledButton","shouldSchedule","botKeyboardPlaceholder","keyboardPlaceholder","stickersForEmoji","groupChatMembers","topInlineBotIds","isInlineBotLoading","chatBotCommands","botCommands","commands","botMenuButton","attachMenuPeerType","selectAttachMenuPeerType","fileSizeLimit","MAX_UPLOAD_FILEPART_SIZE","captionLimit","dropAreaState","onDropHide","clearDraft","setStickerSearchQuery","setGifSearchQuery","closePollModal","addRecentEmoji","sendInlineBotResult","loadSendAs","resetOpenChatWithText","appendixRef","setHtml","htmlRef","useStateRef","lastMessageSendTimeSeconds","prevDropAreaState","canShowSendAs","isSymbolMenuForced","forceShowSymbolMenu","cancelForceShowSymbolMenu","sendMessageAction","useSendMessageAction","handleScheduleCancel","requestCalendar","calendar","useSchedule","shouldAnimateSendAsButtonRef","prevChatId","prevSendAsIds","setAttachments","isBotKeyboardOpen","openBotKeyboard","closeBotKeyboard","isBotCommandMenuOpen","openBotCommandMenu","closeBotCommandMenu","isSymbolMenuOpen","openSymbolMenu","closeSymbolMenu","isSendAsMenuOpen","openSendAsMenu","closeSendAsMenu","isDeleteModalOpen","openDeleteModal","closeDeleteModal","isSymbolMenuLoaded","onSymbolMenuLoadingComplete","isHoverDisabled","disableHover","enableHover","handleSetAttachments","newValue","newAttachments","startRecordingVoice","stopRecordingVoice","pauseRecordingVoice","activeVoiceRecording","currentRecordTime","recordButtonRef","mainButtonRef","startRecordTimeRef","setActiveVoiceRecording","setCurrentRecordTime","IS_SAFARI","IS_VOICE_RECORDING_SUPPORTED","voiceRecording","tickVolume","boxShadow","useVoiceRecording","SEND_MESSAGE_ACTION_INTERVAL","mainButtonState","Edit","Schedule","Send","Record","canShowCustomSendMenu","isMentionTooltipOpen","closeMentionTooltip","insertMention","mentionFilteredUsers","useMentionTooltip","isInlineBotTooltipOpen","inlineBotId","isInlineBotTooltipGallery","inlineBotSwitchPm","inlineBotResults","closeTooltip","closeInlineBotTooltip","inlineBotHelp","loadMore","loadMoreForInlineBot","queryInlineBot","resetInlineBot","markIsOpen","unmarkIsOpen","innerText","getPlainText","parseBotQuery","prevQuery","prevUsername","useInlineBotTooltip","isBotCommandTooltipOpen","closeBotCommandTooltip","filteredBotCommands","botTooltipCommands","setFilteredBotCommands","getFilteredCommands","nextFilteredBotCommands","prepareForRegExp","substr","useBotCommandTooltip","isCustomSendMenuOpen","canSendStickers","canSendGifs","canAttachEmbedLinks","getAllowedAttachmentOptions","isChatAdmin","slowMode","getChatSlowModeOptions","isStickerTooltipOpen","closeStickerTooltip","cleanHtml","clearStickersForEmoji","isSingleEmoji","IS_EMOJI_SUPPORTED","parseEmojiOnlyString","hasStickers","useStickerTooltip","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","insertHtmlAndUpdateCursor","newHtml","EDITABLE_INPUT_ID","selectionRange","isSelectionInsideInput","dispatchEvent","Event","bubbles","focusEditableElement","insertTextAndUpdateCursor","removeSymbol","execCommand","tempInput","contentEditable","textLength","createRange","setStart","setEnd","removeChild","deleteLastCharacterOutsideSelection","resetComposer","shouldPreserveInput","stopRecordingVoiceRef","handleEditComplete","handleEditCancel","editedMessage","editMessage","setEditingDraft","prevEditedMessage","getTextWithEntitiesAsHtml","edited","restoreNewDraftAfterEditing","hasMessageMedia","handleBlur","useEditing","saveDraft","updateDraft","draftChatId","draftThreadId","currentHtml","runDebouncedForSaveDraft","DRAFT_DEBOUNCE","prevThreadId","prevHtml","useDraft","handlePaste","clipboardData","input","activeElement","EDITABLE_INPUT_MODAL_ID","pastedText","getData","substring","items","getFilesFromDataTransferItems","all","file","useClipboardPaste","handleEmbeddedClear","handleAppendFiles","handleClearAttachment","handleSend","currentAttachments","record","maxLength","extraLength","textParams","nowSeconds","secondsSinceLastMessage","nextSendDateNotReached","nextSendDate","seconds","secondsRemaining","isSlowMode","handleClickBotMenu","handleActivateBotCommandMenu","handleActivateSymbolMenu","handleMessageSchedule","args","restArgs","isScheduleRequested","handleGifSelect","handleInlineBotSelect","inlineResult","handleBotCommandSelect","handlePollSend","handleSendSilent","handleSearchOpen","handleSymbolMenuOpen","handleSendAsMenuOpen","handleAllScheduledClick","areVoiceMessagesNotAllowed","mainButtonHandler","renderedEditedMessage","scheduledDefaultDate","setSeconds","setMilliseconds","scheduledMaxDate","setFullYear","getFullYear","sendButtonAriaLabel","symbolMenuButtonClassName","handleSendScheduled","onSend","isBotMenuButtonCommands","DropAreaState","withQuick","onHide","caption","onCaptionUpdate","onSendSilent","onSendScheduled","onFileAppend","shouldBeAnonymous","selectedSendAsId","onInsertUserName","filteredUsers","onSelectResult","isSavedMessages","withUsername","MessageInput","forcedPlaceholder","canAutoFocus","shouldSuppressFocus","shouldSuppressTextFormatter","onUpdate","onSuppressedFocus","formatVoiceRecordDuration","onStickerSelect","emojis","onEmojiSelect","onGifSelect","onRemoveSymbol","onSearchOpen","allowDisabledClick","onSendSchedule","MobileSearch","MessageSelectToolbar","UnpinAllMessagesModal","SeenByModal","EmojiInteractionAnimation","ReactorListModal","GiftPremiumModal","CLOSE_ANIMATION_DURATION","isImage","kind","isBlurred","isBackgroundBlurred","background","customBackground","patternColor","themes","isMobileSearchActive","isSeenByModalOpen","isReactorListModalOpen","isGiftPremiumModalOpen","getCanPostInChat","isBotNotStarted","isPinnedMessageList","isScheduledMessageList","areChatSettingsLoaded","currentUserBannedRights","defaultBannedRights","hasPinnedOrAudioPlayer","loadUser","setDropAreaState","isFabShown","setIsFabShown","isNotchShown","setIsNotchShown","isUnpinModalOpen","setIsUnpinModalOpen","renderingChatId","usePrevDuringAnimation","renderingThreadId","renderingMessageListType","renderingCanSubscribe","renderingCanStartBot","renderingCanRestartBot","renderingCanPost","renderingHasTools","renderingIsFabShown","renderingIsChannel","renderingShouldJoinToSend","renderingShouldSendJoinRequest","prevTransitionKey","handleOpenEnd","handleSlideStop","withAnimations","setIsReady","willSwitchMessageList","propertyName","useIsReady","ANIMATION_LEVEL_MIN","visualViewport","handleResize","handleDragEnter","dataTransfer","shouldDrawQuick","handleHideDropArea","handleOpenUnpinModal","closeUnpinModal","handleUnpinAllMessages","handleTabletFocus","customBackgroundValue","settingValue","cacheApi","CUSTOM_BG_CACHE_NAME","Type","useCustomBackground","MASK_IMAGE_DISABLED","bgClassName","messagingDisabledClassName","messageSendingRestrictionReason","getMessageSendingRestrictionReason","composerHiddenScale","toolbarHiddenScale","composerTranslateX","toolbarTranslateX","unpinHiddenScale","toolbarForUnpinHiddenScale","sidePadding","messageListWidth","rightColumnWidth","getMessageListWidth","sendButtonWidth","composerWidth","toolbarWidth","calculateMiddleFooterTransforms","footerClassName","isMessagingDisabled","withMessageListBottomShift","onTransitionEnd","DARK_THEME_BG_COLOR","LIGHT_THEME_BG_COLOR","onDragEnter","onStop","onUnpin","teactOrderKey","COLUMN_ANIMATION_DURATION","HeaderContent","isProfile","isManagement","messageSearchQuery","stickerSearchQuery","selectCurrentStickerSearch","gifSearchQuery","selectCurrentGifSearch","getCanAddContact","canManage","isEditingInvite","isColumnOpen","isSearch","isStatistics","isMessageStatistics","isStickerSearch","isGifSearch","isPollResults","isAddingChatMembers","profileState","managementScreen","setLocalTextSearchQuery","searchTextMessagesLocal","toggleManagement","toggleStatistics","setEditingExportedInvite","deleteExportedChatInvite","isDeleteDialogOpen","openDeleteDialog","closeDeleteDialog","handleEditInviteClick","handleDeleteInviteClick","handleMessageSearchQueryChange","handleStickerSearchQueryChange","handleGifSearchQueryChange","setShouldSkipTransition","contentKey","ProfileState","Profile","SharedMedia","MemberList","Search","PollResults","StickerSearch","GifSearch","AddingMembers","ManageInitial","ManageChatPrivacyType","ManageDiscussion","ManageChannelSubscribers","ManageGroupPermissions","ManageChatAdministrators","ManageGroupRemovedUsers","ManageChannelRemovedUsers","ManageGroupUserPermissionsCreate","ManageGroupUserPermissions","ManageGroupRecentActions","ManageGroupAdminRights","ManageGroupNewAdminRights","ManageGroupMembers","ManageInvites","ManageEditInvite","ManageGroupAddAdmins","ManageReactions","ManageInviteInfo","ManageJoinRequests","Statistics","MessageStatistics","renderingContentKey","isBackButton","buttonClassName","autoFocusSearch","renderHeaderContent","useInfiniteScrollForLoadableItems","currentResultType","handleLoadMore","itemIds","getMore","useInfiniteScroll","MEMBERS_SLICE","useInfiniteScrollForSharedMedia","forSharedMediaType","messageIdsRef","getMessageContentIds","runThrottledForScroll","isScrollingProgrammatically","TABS","buildInfiniteScrollItemSelector","resultType","mediaSearchType","hasMembersTab","areMembersHidden","isForbidden","canViewMembers","canAddMembers","getHasAdminRight","isUserRightBanned","canDeleteMembers","hasCommonChatsTab","resolvedUserId","isChatProtected","commonChatIds","onProfileStateChange","setLocalMediaSearchType","loadMoreMembers","loadCommonChats","searchMediaMessagesLocal","loadProfilePhotos","setNewChatMembersDialogState","setActiveTab","deletingUserId","setDeletingUserId","tabType","noProfileInfo","searchMessages","memberIds","sortUserIds","sortChatIds","memberViewportIds","getMoreMembers","noProfileInfoForMembers","mediaViewportIds","getMoreMedia","noProfileInfoForMedia","documentViewportIds","getMoreDocuments","noProfileInfoForDocuments","linkViewportIds","getMoreLinks","noProfileInfoForLinks","audioViewportIds","getMoreAudio","noProfileInfoForAudio","voiceViewportIds","getMoreVoices","noProfileInfoForVoices","commonChatViewportIds","getMoreCommonChats","noProfileInfoForCommonChats","useProfileViewportIds","prevTabType","tabsEl","prevProfileState","tabListEl","determineProfileState","useProfileState","applyTransitionFix","releaseTransitionFix","transitionElSelector","setMinHeight","transitionEl","minHeight","overflowY","scrollBarWidth","clientWidth","marginRight","useTransitionFixes","cacheBuster","resetCacheBuster","setCacheBuster","useCacheBuster","handleTransitionStop","handleNewMemberDialogOpen","NewChatMembersProgress","handleSelectMedia","handlePlayAudio","handleMemberClick","handleMessageFocus","handleDeleteMembersModalClose","renderingDelay","isFirstTab","SLIDE_TRANSITION_DURATION","canRenderContent","InfiniteScroll","itemSelector","sensitiveArea","PROFILE_SENSITIVE_AREA","preloadBackwards","noScrollRestoreOnTop","noFastList","onLoadMore","ProfileInfo","ChatExtra","renderProfileInfo","shouldRestoreHeight","onStart","noSpinner","forceRenderHiddenMembers","NothingFound","Media","withDate","smaller","onDateClick","WebLink","onMessageClick","getSenderName","ListItem","contextActions","memberId","handler","forceShowSelf","big","FloatingActionButton","DeleteMemberModal","RightSearch","Management","localContactIds","isSearching","onNextStep","setUserSearchQuery","selectedMemberIds","setSelectedMemberIds","noPickerScrollRestore","member","handleFilterChange","displayedIds","filteredContactIds","filterUsersByName","canBeInvitedToGroup","handleNextStep","Picker","selectedIds","filterValue","filterPlaceholder","searchInputId","onSelectedIdsChange","onFilterChange","noScrollRestore","ANIMATION_DURATION","MAIN_SCREENS_COUNT","RightColumnContent","MANAGEMENT_SCREENS_COUNT","blurSearchInput","areActiveChatsLoaded","selectAreActiveChatsLoaded","nextManagementScreen","selectRightColumnContentKey","isChatSelected","toggleChatInfo","closePollResults","addChatMembers","toggleMessageStatistics","setOpenedInviteInfo","setProfileState","setManagementScreen","selectedChatMemberId","setSelectedChatMemberId","isPromotedByCurrentUser","setIsPromotedByCurrentUser","isScrolledDown","isOverlaying","shouldScrollUp","forceSyncOnIOs","handleSelectChatMember","isPromoted","handleAppendingChatMembers","onChatMemberSelect","MediaViewer","pendingDownloads","planned","download","pendingDownload","downloadOne","processQueue","click","processedMessages","downloadedMessages","cancelMessagesMediaDownload","handleMessageDownloaded","clear","activeMessages","downloadHash","getMessageContentFilename","MAX_BUFFER_SIZE","IS_OPFS_SUPPORTED","IS_SERVICE_WORKER_SUPPORTED","mediaFormat","baseURI","encodeURIComponent","downloadWindow","gameTitle","closeGame","handleMessage","eventType","handleLoad","Modal","hasCloseButton","sandbox","allow","Notifications","Dialogs","ForwardPicker","SafeLinkModal","HistoryCalendar","GroupCall","ActiveCallHeader","PhoneCall","closeChat","MessageHistoryRecord","createMessageHash","messageList","NewContactModal","RatePhoneCallModal","WebAppModal","BotTrustModal","BotAttachModal","DEFAULT_CONFETTI_AMOUNT","CONFETTI_COLORS","canvasRef","confettiRef","isRafStartedRef","updateCanvas","canvasWidth","canvasHeight","clearRect","confettiToRemove","c","pos","velocity","flicker","flickerFrequency","rotation","lastDrawnAt","frameCount","newPos","newVelocity","newFlicker","sin","newRotation","newFrameCount","newLastDrawnAt","newConfetti","beginPath","ellipse","fill","hideTimeout","prevConfettiTime","leftSide","randomX","randomColor","generateConfetti","buildStyle","UrlAuthModal","PremiumMainModal","PaymentModal","ReceiptModal","PremiumLimitReachedModal","deleteFolderDialogId","DeleteFolderDialog","CustomEmojiSetsModal","notificationInterval","DEBUG_isLogged","updateIcon","asUnread","updatePageTitle","nextTitle","wasTimeFormatSetManually","gameMessage","currentUser","authState","isLeftColumnOpen","isRightColumnOpen","isMediaViewerOpen","selectIsMediaViewerOpen","isForwardModalOpen","selectIsForwardModalOpen","hasNotifications","hasDialogs","isHistoryCalendarOpen","isServiceChatReady","isPhoneCallActive","addedCustomEmojiIds","newContactUserId","newContactByPhoneNumber","isRatePhoneCallModalOpen","botTrustRequestBot","botAttachRequestBot","isPremiumModalOpen","limitReached","isReceiptModalOpen","sync","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots","loadEmojiKeywords","loadCountryList","loadAvailableReactions","loadPremiumGifts","loadAddedStickers","ensureTimeFormat","closeStickerSetModal","closeCustomEmojiSets","checkVersionNotification","loadAppConfig","closePaymentModal","clearReceipt","checkAppVersion","langCode","prevLastSyncTime","LOCATION_HASH","processDeepLink","decodeURIComponent","leftColumnTransition","willAnimateLeftColumnRef","prevIsLeftColumnOpen","toggle","dispatchHeavyAnimationEnd","waitForTransitionEnd","rightColumnTransition","willAnimateRightColumnRef","isNarrowMessageList","setIsNarrowMessageList","prevIsRightColumnOpen","hasShownClass","hasOpenClass","initialUnread","setInterval","INACTIVE_MARKER","newUnread","PAGE_TITLE","handleStickerSetModalClose","handleCustomEmojiSetsModalClose","usePreventPinchZoomGesture","stickerSetShortName","passcodeSettings","isLocked","unlockScreen","signOut","logInvalidUnlockAttempt","resetInvalidUnlockAttempts","validationError","setValidationError","shouldShowPasscode","setShouldShowPasscode","isSignOutDialogOpen","openSignOutConfirmation","closeSignOutConfirmation","handleClearError","handleSubmit","decryptSession","handleSignOutMessage","lockPreviewUrl","PasswordForm","shouldShowSubmit","shouldDisablePasswordManager","submitLabel","clearError","isPasswordVisible","noRipple","onChangePasswordVisibility","onSubmit","Link"],"sourceRoot":""} |