telegram-tt/dist/5769.d2b8af27d159fb4beb9a.js.map
Alexander Zinchuk 54b5c8c7e4 [Build]
2022-08-07 18:43:53 +02:00

1 line
1.3 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"5769.d2b8af27d159fb4beb9a.js","mappings":"4PAoDO,SAASA,EAAqBC,GACnC,MAAM,OAAEC,EAAF,SAAUC,IAAaC,EAAAA,EAAAA,IAAyBH,IAAW,GACjE,OAAKC,GAAWC,GAIhBF,GAASI,EAAAA,EAAAA,IAAsBJ,EAAQC,EAAQC,GAAU,GACzDF,GAASK,EAAAA,EAAAA,IAA8BL,EAAQC,EAAQC,OAAUI,IAJxDN,GA3CXO,EAAAA,EAAAA,IAAiB,uBAAwBP,IACvC,MAAM,OAAEC,EAAF,SAAUC,IAAaC,EAAAA,EAAAA,IAAyBH,IAAW,GACjE,GAAKC,GAAWC,EAIhB,OAAOE,EAAAA,EAAAA,IAAsBJ,EAAQC,EAAQC,GAAU,OAGzDK,EAAAA,EAAAA,IAAiB,uBAAwBR,IAEzCQ,EAAAA,EAAAA,IAAiB,2BAA2B,CAACP,EAAQQ,EAASC,KAC5D,MAAM,OAAER,EAAF,SAAUC,IAAaC,EAAAA,EAAAA,IAAyBH,IAAW,GACjE,IAAKC,IAAWC,EACd,OAGF,MAAM,MAAEQ,GAAUD,EACZE,GAAgBC,EAAAA,EAAAA,IAAmBX,EAAQC,IACzCQ,MAAOG,GAAiBb,EAAOc,gBAAgBC,gBAAgBJ,IAAkB,GAQzF,OANID,IAAUG,IACZb,GAASK,EAAAA,EAAAA,IAA8BL,EAAQC,EAAQC,EAAUc,EAAAA,KAG1DZ,EAAAA,EAAAA,IAAsBJ,EAAQC,EAAQC,GAAU,EAAMQ,OAKjEH,EAAAA,EAAAA,IAAiB,2BAA2B,CAACP,EAAQQ,EAASC,KAC5D,MAAM,OAAER,IAAWE,EAAAA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,MAEpB,CAACl/G,EAAsBhQ,IAE1B,MAAM2vH,GAAuBjlF,EAAAA,EAAAA,KAAY,KACvC6kF,IACAT,MACC,CAACS,EAA0BT,IAE9B,GAAK59E,EAoBL,OACE,0BAAKryB,WAAWysB,EAAAA,GAAAA,GCpHQ,uBDoHyB8F,IAC/C,0BAAKvyB,UCrHkD,uBDqHvBipB,IAAK9nC,EAAK+nC,MAAQ,WAAQhrC,GACxD,mBAAC2nE,GAAA,EAAD,CACEnF,OAAQoF,GAAAA,EAAAA,KACR1C,WAAY2tD,GACZvnF,KAvFQ,IAwFRxpB,UC1HiF,yBD6HnF,mBAACgxG,GAAA,EAAD,CACExsF,IAAI,gBACJysF,kBAAgB,EAChBC,8BAA4B,EAC5BhhH,UAAWA,EACXZ,MAAO8gH,EACP7gF,YAAapuC,EAAK,qCAClBgwH,YAAahwH,EAAK,QAClBiwH,WAAYT,EACZU,kBAAmBf,EACnBgB,UAAQ,EACRC,2BAA4BhB,EAC5BiB,SAAUZ,IApCd,0BAAK5wG,UCrG8G,wBDsGjH,4BACE,mBAACyxG,GAAA,EAAD,CAAM1oF,QAAS0nF,GAAf,WAAuD,IADzD,wCAIA,4BACE,mBAAClnF,GAAA,EAAD,CAAQH,MAAM,cAAcI,KAAK,OAAOuiB,QAAM,EAAChjB,QAAS0nF,GACrDtvH,EAAK,8BAmCZ,mBAACghD,GAAA,EAAD,CACE7iD,OAAQkxH,EACRh8E,QAASk8E,EACTxwH,KAAMiB,EAAK,mBACXihD,aAAcjhD,EAAK,0BACnBkhD,eAAgByuE,EAChB3kE,sBAAoB,SE9IxBtmC,EAAAA,IAEFC,QAAQC,IAAI,+BAGd,MAAM,gBAAEkf,GAAiBp1B,UAAU,eAAEqB,MAAqBpM,EAAAA,EAAAA,MACrDmgC,IAAoB/zB,KACvBmM,EAAAA,EAAAA,MAAajM,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/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/hooks/useWebpThumbnail.ts","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/insertHtmlInSelection.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/ui/MenuSeparator.module.scss?43c3","webpack://telegram-t/./src/components/ui/MenuSeparator.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/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/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} 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('setForwardChatId', (global, actions, payload) => {\n const { id } = payload;\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\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 { threadId } = selectCurrentMessageList(global) || {};\n const lang = langProvider.getTranslation;\n\n const chatMessages = 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, setGlobal } from '../../index';\n\nimport type { ApiError } from '../../../api/types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TABLET_COLUMN_LAYOUT } from '../../../util/environment';\nimport getReadableErrorText from '../../../util/getReadableErrorText';\nimport {\n selectChatMessage, selectCurrentMessageList, selectIsTrustedBot,\n} from '../../selectors';\nimport generateIdFor from '../../../util/generateIdFor';\n\nconst MAX_STORED_EMOJIS = 18; // Represents two 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 } = payload;\n return {\n ...global,\n stickers: {\n ...global.stickers,\n 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","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, serializeGlobal } from '../../cache';\nimport { onBeforeUnload } from '../../../util/schedulers';\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 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} from '../../selectors';\nimport { debounce, onTickEnd, rafPromise } from '../../../util/schedulers';\nimport { getMessageOriginalId, 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 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 });\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\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\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 { 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) => {\n const { hash } = global.stickers.added || {};\n void loadStickerSets(hash);\n});\n\naddActionHandler('loadAddedStickers', async (global, actions) => {\n const { setIds: addedSetIds } = global.stickers.added;\n const cached = global.stickers.setsById;\n if (!addedSetIds || !addedSetIds.length) {\n return;\n }\n\n for (let i = 0; i < addedSetIds.length; i++) {\n const id = addedSetIds[i];\n if (cached[id]?.stickers) {\n continue; // Already loaded\n }\n actions.loadStickers({ stickerSetId: id });\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('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('loadStickers', (global, actions, payload) => {\n const { stickerSetId, stickerSetShortName } = payload!;\n let { stickerSetAccessHash } = payload!;\n\n if (!stickerSetAccessHash && !stickerSetShortName) {\n const stickerSet = selectStickerSet(global, stickerSetId);\n if (!stickerSet) {\n if (global.openedStickerSetShortName === stickerSetShortName) {\n setGlobal({\n ...global,\n openedStickerSetShortName: undefined,\n });\n }\n return;\n }\n\n stickerSetAccessHash = stickerSet.accessHash;\n }\n\n void loadStickers(stickerSetId, stickerSetAccessHash!, stickerSetShortName);\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 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(stickerSetId: string, accessHash: string, stickerSetShortName?: string) {\n const stickerSet = await callApi(\n 'fetchStickers',\n { stickerSetShortName, stickerSetId, accessHash },\n );\n let global = getGlobal();\n\n if (!stickerSet) {\n onTickEnd(() => {\n getActions().showNotification({\n message: getTranslation('StickerPack.ErrorNotFound'),\n });\n });\n if (global.openedStickerSetShortName === stickerSetShortName) {\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('openStickerSetShortName', (global, actions, payload) => {\n const { stickerSetShortName } = payload;\n return {\n ...global,\n openedStickerSetShortName: stickerSetShortName,\n };\n});\n\naddActionHandler('openStickerSet', async (global, actions, payload) => {\n const { sticker } = payload;\n\n if (!selectStickerSet(global, sticker.stickerSetId)) {\n if (!sticker.stickerSetAccessHash) {\n actions.showNotification({\n message: getTranslation('StickerPack.ErrorNotFound'),\n });\n return;\n }\n\n await loadStickers(sticker.stickerSetId, sticker.stickerSetAccessHash);\n }\n\n global = getGlobal();\n const set = selectStickerSet(global, sticker.stickerSetId);\n if (!set?.shortName) {\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; // 10 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 { initialSection, fromUserId, isSuccess } = 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 isSuccess,\n },\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 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 });\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 if (update.slug && inputInvoice && 'slug' in inputInvoice && inputInvoice.slug !== update.slug) {\n return undefined;\n }\n\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 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, 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 { 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, selectIsPremiumPurchaseBlocked, 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 PremiumIcon from '../../common/PremiumIcon';\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: 0 | 1 | 2;\n chatsById?: Record<string, ApiChat>;\n isMessageListOpen: boolean;\n isConnectionStatusMinimized: ISettings['isConnectionStatusMinimized'];\n areChatsLoaded?: boolean;\n hasPasscode?: boolean;\n isPremiumPurchaseBlocked?: 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 isPremiumPurchaseBlocked,\n}) => {\n const {\n openChat,\n setGlobalSearchDate,\n setSettingOption,\n setGlobalSearchChatId,\n openChatByUsername,\n lockScreen,\n requestNextSettingsScreen,\n skipLockOnUnload,\n openPremiumModal,\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 handleSelectPremium = useCallback(() => {\n openPremiumModal();\n }, [openPremiumModal]);\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 {!isPremiumPurchaseBlocked && (\n <MenuItem\n customIcon={<PremiumIcon withGradient big />}\n onClick={handleSelectPremium}\n >\n {lang('TelegramPremium')}\n <span className=\"menu-item-badge\">{lang('New')}</span>\n </MenuItem>\n )}\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 isPremiumPurchaseBlocked: selectIsPremiumPurchaseBlocked(global),\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} />\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}>\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=\"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 useFlag from '../../../hooks/useFlag';\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 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;\nconst APP_OUTDATED_TIMEOUT = 3 * 24 * 60 * 60 * 1000; // 3 days\n\nlet closeTimeout: number | undefined;\n\nconst LeftMain: FC<OwnProps> = ({\n content,\n searchQuery,\n searchDate,\n contactsFilter,\n shouldSkipTransition,\n foldersDispatch,\n onSearchQuery,\n onContentChange,\n onScreenSelect,\n onReset,\n}) => {\n const [isNewChatButtonShown, setIsNewChatButtonShown] = useState(IS_TOUCH_ENV);\n\n const isMouseInside = useRef(false);\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 handleSelectNewChannel = useCallback(() => {\n onContentChange(LeftColumnContent.NewChannelStep1);\n }, [onContentChange]);\n\n const handleSelectNewGroup = useCallback(() => {\n onContentChange(LeftColumnContent.NewGroupStep1);\n }, [onContentChange]);\n\n const handleSelectArchived = useCallback(() => {\n onContentChange(LeftColumnContent.Archived);\n }, [onContentChange]);\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 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 [shouldRenderUpdateButton, updateButtonClassNames, handleUpdateClick] = useAppOutdatedCheck();\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\nfunction useAppOutdatedCheck() {\n const [isAppOutdated, markIsAppOutdated] = useFlag(false);\n\n useEffect(() => {\n const timeout = window.setTimeout(markIsAppOutdated, APP_OUTDATED_TIMEOUT);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [markIsAppOutdated]);\n\n const { shouldRender, transitionClassNames } = useShowTransition(isAppOutdated);\n\n const handleUpdateClick = () => {\n window.location.reload();\n };\n\n return [shouldRender, transitionClassNames, handleUpdateClick] as const;\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};\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}) => {\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.Experimental:\n setSettingsScreen(SettingsScreens.Main);\n return;\n\n case SettingsScreens.GeneralChatBackground:\n case SettingsScreens.QuickReaction:\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.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.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 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 />\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 } = 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 };\n },\n)(LeftColumn));\n","import type { RefObject } from 'react';\nimport { useState, useEffect } 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 useEffect(() => {\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 { useLayoutEffect, useState } from '../lib/teact/teact';\n\nimport type { ApiMessage } from '../api/types';\n\nimport { DEBUG } from '../config';\nimport { isWebpSupported } from '../util/environment';\nimport { EMPTY_IMAGE_DATA_URI, webpToPngBase64 } from '../util/webpToPng';\nimport { getMessageMediaThumbDataUri } from '../global/helpers';\n\nexport default function useWebpThumbnail(message?: ApiMessage) {\n const thumbDataUri = message && getMessageMediaThumbDataUri(message);\n const sticker = message?.content?.sticker;\n const shouldDecodeThumbnail = thumbDataUri && sticker && !isWebpSupported() && thumbDataUri.includes('image/webp');\n const [thumbnailDecoded, setThumbnailDecoded] = useState(EMPTY_IMAGE_DATA_URI);\n const messageId = message?.id;\n\n useLayoutEffect(() => {\n if (!shouldDecodeThumbnail) {\n return;\n }\n\n webpToPngBase64(`b64-${messageId}`, thumbDataUri!)\n .then(setThumbnailDecoded)\n .catch((err) => {\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n });\n }, [messageId, shouldDecodeThumbnail, thumbDataUri]);\n\n return shouldDecodeThumbnail ? thumbnailDecoded : thumbDataUri;\n}\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 useWebpThumbnail from '../../hooks/useWebpThumbnail';\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 = useWebpThumbnail(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';\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};\n\nconst GroupCallTopPane: FC<OwnProps & StateProps> = ({\n chatId,\n isActive,\n groupCall,\n hasPinnedOffset,\n usersById,\n chatsById,\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} />;\n } else {\n return <Avatar key={p.chat.id} chat={p.chat} />;\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 };\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 isChatWithBot?: 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 isChatWithBot,\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 });\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={isChatWithBot}\n withMediaViewer\n withUpdatingStatus\n withVideoAvatar\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\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 isChatWithBot,\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 { withGlobal } from '../../global';\n\nimport type { ApiUser, ApiMessage, ApiChat } 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 useEnsureMessage from '../../hooks/useEnsureMessage';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useOnIntersect } from '../../hooks/useIntersectionObserver';\nimport useFocusMessage from './message/hooks/useFocusMessage';\nimport useLang from '../../hooks/useLang';\n\nimport ContextMenuContainer from './message/ContextMenuContainer.async';\nimport useFlag from '../../hooks/useFlag';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport { preventMessageInputBlur } from './helpers/preventMessageInputBlur';\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n isEmbedded?: boolean;\n appearanceOrder?: number;\n isLastInList?: boolean;\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};\n\nconst APPEARANCE_DELAY = 10;\n\nconst ActionMessage: FC<OwnProps & StateProps> = ({\n message,\n observeIntersection,\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}) => {\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 lang = useLang();\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 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 if (isEmbedded) {\n return <span className=\"embedded-action-message\">{content}</span>;\n }\n\n const className = buildClassName(\n 'ActionMessage message-list-item',\n isFocused && !noFocusHighlight && 'focused',\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 {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\n return {\n usersById,\n senderUser,\n senderChat,\n targetChatId,\n targetUserIds,\n targetMessage,\n isFocused,\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 type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useWebpThumbnail from '../../hooks/useWebpThumbnail';\nimport useLang from '../../hooks/useLang';\nimport { renderMessageSummary } from './helpers/renderMessageText';\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 = useWebpThumbnail(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 { NO_STICKER_SET_ID } from '../../../config';\nimport { getStickerDimensions } from '../../common/helpers/mediaDimensions';\nimport { getMessageMediaFormat, getMessageMediaHash } from '../../../global/helpers';\nimport buildClassName from '../../../util/buildClassName';\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 useWebpThumbnail from '../../../hooks/useWebpThumbnail';\nimport safePlay from '../../../util/safePlay';\nimport { IS_WEBM_SUPPORTED } from '../../../util/environment';\nimport { getActions } from '../../../global';\nimport useLang from '../../../hooks/useLang';\n\nimport AnimatedSticker from '../../common/AnimatedSticker';\nimport StickerSetModal from '../../common/StickerSetModal.async';\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 } = getActions();\n\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef<HTMLDivElement>(null);\n\n const [isModalOpen, openModal, closeModal] = useFlag();\n\n const sticker = message.content.sticker!;\n const {\n isLottie, stickerSetId, isVideo, hasEffect,\n } = sticker;\n const canDisplayVideo = IS_WEBM_SUPPORTED;\n const isMemojiSticker = stickerSetId === NO_STICKER_SET_ID;\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 = useWebpThumbnail(message);\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 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 <StickerSetModal\n isOpen={isModalOpen}\n fromSticker={sticker}\n onClose={closeModal}\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';\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};\n\nconst UNREGISTERED_CONTACT_ID = '0';\n\nconst Contact: FC<OwnProps & StateProps> = ({\n contact, user, phoneCodeList,\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} />\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 };\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 noVideo\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\">\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\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 let isSquarePhoto = false;\n if (webPage?.photo && !webPage.video) {\n const { width, height } = calculateMediaDimensions(message);\n isSquarePhoto = width === height;\n }\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 isMediaInteractive = (photo || video) && onMediaClick && !isSquarePhoto;\n const truncatedDescription = trimText(description, MAX_TEXT_LENGTH);\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 );\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 <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 {!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 noVideo\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\" noVideo />)}\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 { FocusDirection, IAlbum, ISettings } 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 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};\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}) => {\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 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, highlight, isEmojiOnlyMessage(customShape), undefined, undefined, isProtected,\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\n return (\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 />\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 };\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 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 { 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?: number;\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 default 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","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"GC8g9Q16IaK76g6rcU78\"};","import React from '../../lib/teact/teact';\n\nimport type { FC } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport styles from './MenuSeparator.module.scss';\n\ntype OwnProps = {\n className?: string;\n};\n\nconst MenuSeparator: FC<OwnProps> = ({ className }) => {\n return (\n <div className={buildClassName(styles.root, className)} />\n );\n};\n\nexport default MenuSeparator;\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';\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} 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};\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 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 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={message}\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 };\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, 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 && entities.find(({ type }) => type === ApiMessageEntityTypes.TextUrl);\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/insertHtmlInSelection';\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 }\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 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 } = 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 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 insertTextAndUpdateCursor = useCallback((text: 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 const newHtml = renderText(text, ['escape_html', 'emoji_html', 'br_html'])\n .join('')\n .replace(/\\u200b+/g, '\\u200b');\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 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 mainButtonHandler = useCallback(() => {\n switch (mainButtonState) {\n case MainButtonState.Send:\n handleSend();\n break;\n case MainButtonState.Record:\n void startRecordingVoice();\n break;\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, startRecordingVoice, handleEditComplete, activeVoiceRecording, requestCalendar,\n pauseRecordingVoice, handleMessageSchedule,\n ]);\n\n const areVoiceMessagesNotAllowed = mainButtonState === MainButtonState.Record && !canAttachMedia;\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 = areVoiceMessagesNotAllowed\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 && botCommands !== false && !activeVoiceRecording\n && !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 noVideo\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 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\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 };\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) && 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, {\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 { 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';\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 animationLevel?: number;\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 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 </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 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 type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useEffect } from '../../lib/teact/teact';\nimport { getActions } from '../../lib/teact/teactn';\nimport type { GlobalState } from '../../global/types';\n\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\nconst GameModal: FC<OwnProps> = ({ openedGame, gameTitle }) => {\n const { closeGame, showNotification, 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 ? 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 showNotification({ message: 'Unsupported game action' });\n }\n } catch (e) {\n // Ignore messages from other origins\n }\n }, [chatId, closeGame, messageId, openForwardMenu, showNotification]);\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(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, {\n useEffect, memo, useCallback, useState, useRef,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { 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 { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck';\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 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 { fastRaf } from '../../util/schedulers';\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';\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 activeGroupCallId?: string;\n isServiceChatReady?: boolean;\n animationLevel: number;\n language?: LangCode;\n wasTimeFormatSetManually?: boolean;\n isPhoneCallActive?: boolean;\n addedSetIds?: 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;\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 isServiceChatReady,\n animationLevel,\n language,\n wasTimeFormatSetManually,\n addedSetIds,\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 loadAddedStickers,\n loadFavoriteStickers,\n ensureTimeFormat,\n openStickerSetShortName,\n checkVersionNotification,\n loadAppConfig,\n loadAttachMenuBots,\n loadContactList,\n closePaymentModal,\n clearReceipt,\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 // 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 }\n }, [\n lastSyncTime, loadAnimatedEmojis, loadEmojiKeywords, loadNotificationExceptions, loadNotificationSettings,\n loadTopInlineBots, updateIsOnline, loadAvailableReactions, loadAppConfig, loadAttachMenuBots, loadContactList,\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 // Sticker sets\n useEffect(() => {\n if (lastSyncTime) {\n if (!addedSetIds) {\n loadStickerSets();\n loadFavoriteStickers();\n } else {\n loadAddedStickers();\n }\n }\n }, [lastSyncTime, addedSetIds, loadStickerSets, loadFavoriteStickers, loadAddedStickers]);\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) {\n return undefined;\n }\n\n windowSize.disableRefresh();\n\n return () => {\n windowSize.enableRefresh();\n };\n }, [activeGroupCallId]);\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 openStickerSetShortName({ stickerSetShortName: undefined });\n }, [openStickerSetShortName]);\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 {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 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 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 buildClassName from '../../util/buildClassName';\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 { transitionClassNames, 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&apos;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={buildClassName(styles.container, transitionClassNames)}>\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","lang","langProvider","chatMessages","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","messageListType","groupedId","groupedChatId","replyMessageId","isResizingContainer","ids","selectForwardedMessageIdsByGroupId","shouldSwitchChat","clearTimeout","newGlobal","updateFocusedMessage","updateFocusDirection","FocusDirection","includes","direction","loadViewportMessages","fromChatId","withMyScore","groupedMessageIds","selectMessageIdsByGroupId","isModalShown","noAuthors","noCaptions","closeMediaViewer","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","added","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","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","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","unique","user","offsets","nextOffset","loadPollOptionResults","fromChat","toChat","a","b","realMessages","m","isServiceNotificationMessage","replaceScheduledMessages","loadScheduledHistory","selectScheduledMessage","transcriptionId","isTranscriptionError","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","searchThrottled","throttle","loadRecentStickers","recentStickers","loadStickers","stickerSetId","accessHash","stickerSetShortName","stickerSet","getActions","openedStickerSetShortName","packs","updateStickerSet","currentEmoji","forEmoji","rebuildStickersForEmoji","searchGifs","updateGifSearch","addedStickers","updateStickerSets","sets","loadStickerSets","addedSetIds","cached","setsById","pause","favorite","favoriteStickers","loadFavoriteStickers","premium","greeting","featured","featuredStickers","loadFeaturedStickers","stickerSetAccessHash","selectStickerSet","replaceAnimatedEmojis","loadAnimatedEmojis","animatedEmojiEffects","loadAnimatedEmojiEffects","saved","savedGifs","loadSavedGifs","gif","shouldUnsave","selectCurrentLimit","premiumLimit","selectPremiumLimit","isPremium","selectIsCurrentUserPremium","title","openPremiumModal","className","newGifs","current","unfave","unfaveSticker","installedDate","language","currentEmojiKeywords","emojiKeywords","fromVersion","keywords","searchStickers","searchWords","updateStickersForEmoji","loadStickersForEmoji","shortName","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","showDialog","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","response","fetch","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","loadPremiumStickers","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","selectScheduledMessages","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","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","isPremiumPurchaseBlocked","selectIsPremiumPurchaseBlocked","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","handleSelectPremium","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","customIcon","PremiumIcon","withGradient","big","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","ref","renderCount","props","LeftSearch","useModuleLoader","Bundles","Loading","ContactList","isShown","onNewPrivateChat","onNewChannel","onNewGroup","isMenuOpen","setIsMenuOpen","fabClassName","toggleIsMenuOpen","handleClose","tabIndex","Menu","positionX","positionY","autoClose","onClose","TRANSITION_RENDER_COUNT","closeTimeout","onContentChange","isNewChatButtonShown","setIsNewChatButtonShown","isMouseInside","handleSelectSettings","handleSelectContacts","handleSelectNewChannel","handleSelectNewGroup","handleSelectArchived","handleMouseEnter","handleMouseLeave","autoCloseTimeout","shouldRenderUpdateButton","updateButtonClassNames","handleUpdateClick","isAppOutdated","markIsAppOutdated","useFlag","timeout","reload","useAppOutdatedCheck","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","initialMouseX","setInitialMouseX","initialElementWidth","setInitialElementWidth","classList","remove","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","useWebpThumbnail","thumbDataUri","getMessageMediaThumbDataUri","shouldDecodeThumbnail","isWebpSupported","thumbnailDecoded","setThumbnailDecoded","EMPTY_IMAGE_DATA_URI","useLayoutEffect","webpToPngBase64","then","catch","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","mediaBlobUrl","useMedia","getMessageMediaHash","renderMessageSummary","isUnpinDialogOpen","openUnpinDialog","closeUnpinDialog","handleUnpinMessage","inlineButton","getMessageSingleInlineButton","handleInlineButtonClick","noHoverColor","markNoHoverColor","unmarkNoHoverColor","ConfirmDialog","confirmLabel","confirmHandler","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","getUserFullName","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","observeIntersection","isEmbedded","appearanceOrder","isLastInList","useOnIntersect","noAppearanceAnimation","markShown","targetUsers","renderActionMessageText","asTextWithSpoilers","isContextMenuOpen","contextMenuPosition","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","getMessageHtmlId","customText","noUserColors","hasContextMenu","isIntersecting","useIsIntersecting","isRoundVideo","getMessageRoundVideo","senderTitle","getUserColorKey","draggable","activeReaction","isInMeta","stopActiveReaction","centerIconId","effectId","mediaDataCenterIcon","mediaDataEffect","shouldPlay","shouldRenderAnimation","animationClassNames","handleEnded","isAnimationLoaded","markAnimationLoaded","unmarkAnimationLoaded","shouldRenderStatic","ReactionStaticEmoji","AnimatedSticker","tgsUrl","play","noLoop","onLoad","onEnded","outgoingStatus","signature","withReactions","withReactionOffset","reactionMessage","isActivated","markActivated","createDateTime","formatDateTimeToString","editDateTime","isEdited","editDate","forwardedDateTime","formatTime","MessageOutgoingStatus","observeIntersectionForPlaying","shouldLoop","shouldPlayEffect","onPlayEffect","onStopEffect","isModalOpen","openModal","closeModal","isLottie","isVideo","hasEffect","canDisplayVideo","IS_WEBM_SUPPORTED","isMemojiSticker","NO_STICKER_SET_ID","isPlayingEffect","startPlayingEffect","stopPlayingEffect","shouldLoad","mediaHash","mediaHashEffect","previewMediaHash","previewUrl","getMessageMediaFormat","effectBlobUrl","isMediaLoaded","isLottieLoaded","markLottieLoaded","isMediaReady","useMediaTransition","getStickerDimensions","thumbClassName","stickerClassName","handleEffectEnded","safePlay","actionText","autoPlay","playsInline","disablePictureInPicture","loop","muted","isLowPriority","fromSticker","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","AnimatedIconFromSticker","noLoad","forcePreview","LIKE_STICKER_ID","useBlurredMediaThumbRef","fullMediaData","useCanvasBlur","IS_CANVAS_FILTER_SUPPORTED","SELECTED_APPENDIX_COLORS","dark","outgoing","incoming","light","getCustomAppendixBg","inSelectMode","isSelected","crossOrigin","getImageData","getAppendixColorFromImage","canAutoLoad","uploadProgress","nonInteractive","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","formatPhoneNumberWithCode","getPercentage","answer","voteResults","maxVotersCount","correctResults","shouldAnimate","correctAnswer","showIcon","answerPercent","finalPercent","setFinalPercent","lineRef","lineWidth","isAnimationDoesNotStart","lineEl","svgEl","lineStyle","onSendVote","openPollResults","requestConfetti","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","noVideo","CheckboxGroup","loadingOptions","RadioGroup","loadingOption","getReadableVotersCount","inPreview","onMediaClick","onCancelMediaTransfer","webPage","getMessageWebPage","isSquarePhoto","handleMediaClick","siteName","displayUrl","isMediaInteractive","truncatedDescription","trimText","SafeLink","getMessageInvoice","amount","currency","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","memoFirstUnreadIdRef","animateUnreadReaction","bottomMarkerRef","isTranscriptionHidden","setTranscriptionHidden","hasActiveStickerEffect","startStickerEffect","stopStickerEffect","isLocal","hasReply","isReplyMessage","hasThread","getMessageCustomShape","hasAnimatedEmoji","hasReactions","areReactionsEmpty","asForwarded","isLinkedChannelPost","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","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","isCurrentUserPremium","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","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","faded","AttachmentModal","BotCommandMenu","PollModal","DropArea","RE_LINK","RegExp","RE_LINK_TEMPLATE","messageText","toggleMessageWebPage","linkEntity","ApiMessageEntityTypes","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","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","trim","clearStickersForEmoji","isSingleEmoji","IS_EMOJI_SUPPORTED","parseEmojiOnlyString","hasStickers","useStickerTooltip","isEmojiTooltipOpen","closeEmojiTooltip","filteredEmojis","insertEmoji","useEmojiTooltip","insertTextAndUpdateCursor","EDITABLE_INPUT_ID","newHtml","selectionRange","isSelectionInsideInput","dispatchEvent","Event","bubbles","focusEditableElement","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","mainButtonHandler","areVoiceMessagesNotAllowed","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","onSendSchedule","MobileSearch","MessageSelectToolbar","UnpinAllMessagesModal","SeenByModal","EmojiInteractionAnimation","ReactorListModal","CLOSE_ANIMATION_DURATION","isImage","kind","isBlurred","isBackgroundBlurred","background","customBackground","patternColor","themes","isMobileSearchActive","isSeenByModalOpen","isReactorListModalOpen","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","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","notificationInterval","DEBUG_isLogged","updateIcon","asUnread","updatePageTitle","nextTitle","wasTimeFormatSetManually","gameMessage","currentUser","authState","isLeftColumnOpen","isRightColumnOpen","isMediaViewerOpen","selectIsMediaViewerOpen","isForwardModalOpen","selectIsForwardModalOpen","hasNotifications","hasDialogs","isHistoryCalendarOpen","isServiceChatReady","isPhoneCallActive","newContactUserId","newContactByPhoneNumber","isRatePhoneCallModalOpen","botTrustRequestBot","botAttachRequestBot","isPremiumModalOpen","limitReached","isReceiptModalOpen","sync","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots","loadEmojiKeywords","loadCountryList","loadAvailableReactions","loadAddedStickers","ensureTimeFormat","openStickerSetShortName","checkVersionNotification","loadAppConfig","closePaymentModal","clearReceipt","langCode","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","usePreventPinchZoomGesture","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":""}