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AAkBonB,EAAmB/4D,EAAO,sBAC5Cg5D,EAAYD,EAAmB/4D,EAAO,gBACtCi5D,EAAcF,EAAmB/4D,EAAO,mBACxCk5D,EAAkBH,EAAmB/4D,EAAO,iBAC5Cm5D,EAAYJ,EAAmB/4D,EAAO,iBAG5C,MAAO,CACLo5D,SAAUznB,EACV0nB,WAAYL,EACZM,WALgBP,EAAmB/4D,EAAO,0BAM1Cu5D,WAAYJ,EACZK,aAAcP,EACdQ,kBAAmBP,EACnBQ,mBARuBX,EAAmB/4D,EAAO,iCAY9C,SAAS25D,EAAiBvsD,GAC/B,MAAO,kBAAkBwsD,KAAKxsD,GAGhC,SAAS2rD,EAAmB/4D,EAA4B65D,GAEtD,OAIIF,EADavsD,EAJHpN,EAAM85D,iBAAiBD,GACdxxC,QAIajb,EAC5B,IAAGA,EAAM0oB,MAAM,8DACpBrU,MAAM,GACN9c,KAAI,CAACo1D,EAAWz4D,KAAqB,IAANA,EAAUG,KAAK+H,MAAsB,IAAhBwwD,WAAWD,IAAYC,WAAWD,IACpFx8B,SAAS,IACT08B,SAAS,EAAG,KACZ7xC,QAAQ,MAAO,MACjB/a,KAAK,MARV,IAAmBD,E","sources":["webpack://telegram-t/./src/components/common/AnimatedIconFromSticker.tsx","webpack://telegram-t/./src/components/common/AnimatedIconWithPreview.module.scss?eca8","webpack://telegram-t/./src/components/common/AnimatedIconWithPreview.tsx","webpack://telegram-t/./src/components/common/helpers/waveform.ts","webpack://telegram-t/./src/util/waveform.ts","webpack://telegram-t/./src/components/common/Audio.tsx","webpack://telegram-t/./src/components/common/ChatExtra.tsx","webpack://telegram-t/./src/components/common/DeleteChatModal.tsx","webpack://telegram-t/./src/components/common/Document.tsx","webpack://telegram-t/./src/components/common/DotAnimation.tsx","webpack://telegram-t/./src/components/common/FakeIcon.tsx","webpack://telegram-t/./src/components/common/File.tsx","webpack://telegram-t/./src/components/common/GroupChatInfo.tsx","webpack://telegram-t/./src/components/common/LastMessageMeta.tsx","webpack://telegram-t/./src/components/common/Media.tsx","webpack://telegram-t/./src/components/common/MessageOutgoingStatus.tsx","webpack://telegram-t/./src/components/common/NothingFound.tsx","webpack://telegram-t/./src/components/common/PasswordForm.tsx","webpack://telegram-t/./src/components/common/Picker.tsx","webpack://telegram-t/./src/components/common/PickerSelectedItem.tsx","webpack://telegram-t/./src/components/common/PremiumIcon.tsx","webpack://telegram-t/./src/components/common/PrivateChatInfo.tsx","webpack://telegram-t/./src/components/common/ProfilePhoto.tsx","webpack://telegram-t/./src/components/common/ProfileInfo.tsx","webpack://telegram-t/./src/components/common/hooks/usePhotosPreload.ts","webpack://telegram-t/./src/components/common/ReactionStaticEmoji.tsx","webpack://telegram-t/./src/components/common/ReportModal.tsx","webpack://telegram-t/./src/components/common/StickerButton.tsx","webpack://telegram-t/./src/components/common/StickerSetModal.async.tsx","webpack://telegram-t/./src/components/common/TypingStatus.tsx","webpack://telegram-t/./src/components/common/VerifiedIcon.tsx","webpack://telegram-t/./src/components/common/WebLink.tsx","webpack://telegram-t/./src/components/common/helpers/mediaDimensions.ts","webpack://telegram-t/./src/components/left/ChatFolderModal.async.tsx","webpack://telegram-t/./src/components/left/main/hooks/useChatAnimationType.ts","webpack://telegram-t/./src/components/left/main/Badge.tsx","webpack://telegram-t/./src/components/left/main/ChatCallStatus.tsx","webpack://telegram-t/./src/components/left/main/Chat.tsx","webpack://telegram-t/./src/components/left/main/EmptyFolder.tsx","webpack://telegram-t/./src/components/left/main/ChatList.tsx","webpack://telegram-t/./src/components/left/search/helpers/getSenderName.ts","webpack://telegram-t/./src/components/middle/composer/CustomSendMenu.async.tsx","webpack://telegram-t/./src/components/middle/composer/DropTarget.tsx","webpack://telegram-t/./src/components/middle/composer/DropArea.tsx","webpack://telegram-t/./src/components/middle/composer/EmojiTooltip.async.tsx","webpack://telegram-t/./src/components/middle/composer/MessageInput.tsx","webpack://telegram-t/./src/components/middle/composer/TextFormatter.tsx","webpack://telegram-t/./src/util/getKeyFromEvent.ts","webpack://telegram-t/./src/components/middle/composer/helpers/getFilesFromDataTransferItems.ts","webpack://telegram-t/./src/components/middle/composer/helpers/prepareForRegExp.ts","webpack://telegram-t/./src/components/middle/composer/helpers/selection.ts","webpack://telegram-t/./src/util/memoized.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useEmojiTooltip.ts","webpack://telegram-t/./src/components/middle/composer/hooks/useMentionTooltip.ts","webpack://telegram-t/./src/components/right/hooks/useAsyncRendering.ts","webpack://telegram-t/./src/components/ui/CheckboxGroup.tsx","webpack://telegram-t/./src/components/ui/ConfirmDialog.tsx","webpack://telegram-t/./src/components/ui/FloatingActionButton.tsx","webpack://telegram-t/./src/components/ui/ListItem.tsx","webpack://telegram-t/./src/components/ui/Notification.tsx","webpack://telegram-t/./src/components/ui/ProgressSpinner.tsx","webpack://telegram-t/./src/components/ui/Radio.tsx","webpack://telegram-t/./src/components/ui/RadioGroup.tsx","webpack://telegram-t/./src/components/ui/RangeSlider.tsx","webpack://telegram-t/./src/components/ui/SearchInput.tsx","webpack://telegram-t/./src/components/ui/ShowTransition.tsx","webpack://telegram-t/./src/components/ui/Skeleton.tsx","webpack://telegram-t/./src/components/ui/Switcher.tsx","webpack://telegram-t/./src/components/ui/Tab.tsx","webpack://telegram-t/./src/components/ui/TabList.tsx","webpack://telegram-t/./src/hooks/reducers/useFoldersReducer.ts","webpack://telegram-t/./src/hooks/useAudioPlayer.ts","webpack://telegram-t/./src/hooks/useBuffering.ts","webpack://telegram-t/./src/hooks/useCanvasBlur.ts","webpack://telegram-t/./src/hooks/useChatContextActions.ts","webpack://telegram-t/./src/hooks/useContextMenuHandlers.ts","webpack://telegram-t/./src/hooks/useContextMenuPosition.ts","webpack://telegram-t/./src/hooks/useEnsureMessage.ts","webpack://telegram-t/./src/hooks/useFolderManager.ts","webpack://telegram-t/./src/hooks/useHorizontalScroll.ts","webpack://telegram-t/./src/hooks/useHotkeys.ts","webpack://telegram-t/./src/util/parseHotkey.ts","webpack://telegram-t/./src/hooks/useInputFocusOnOpen.ts","webpack://telegram-t/./src/hooks/useLayoutEffectWithPrevDeps.ts","webpack://telegram-t/./src/hooks/useUniqueId.ts","webpack://telegram-t/./src/hooks/useMediaWithLoadProgress.ts","webpack://telegram-t/./src/hooks/useMouseInside.ts","webpack://telegram-t/./src/hooks/usePrevDuringAnimation.ts","webpack://telegram-t/./src/hooks/useReducer.ts","webpack://telegram-t/./src/hooks/useRunDebounced.ts","webpack://telegram-t/./src/components/common/CalendarModal.async.tsx","webpack://telegram-t/./src/hooks/useSchedule.tsx","webpack://telegram-t/./src/hooks/useSendMessageAction.ts","webpack://telegram-t/./src/hooks/useStateRef.ts","webpack://telegram-t/./src/hooks/useTimeout.ts","webpack://telegram-t/./src/hooks/useVideoCleanup.ts","webpack://telegram-t/./src/lib/fastBlur.js","webpack://telegram-t/./src/util/audioPlayer.ts","webpack://telegram-t/./src/util/captureEvents.ts","webpack://telegram-t/./src/util/lethargy.ts","webpack://telegram-t/./src/util/colors.ts","webpack://telegram-t/./src/util/cycleRestrict.ts","webpack://telegram-t/./src/util/fastSmoothScroll.ts","webpack://telegram-t/./src/util/fastSmoothScrollHorizontal.ts","webpack://telegram-t/./src/util/focusEditableElement.ts","webpack://telegram-t/./src/util/getMessageIdsForSelectedText.ts","webpack://telegram-t/./src/util/isElementInViewport.ts","webpack://telegram-t/./src/util/mediaSession.ts","webpack://telegram-t/./src/util/parseMessageInput.ts","webpack://telegram-t/./src/util/patchSafariProgressiveAudio.ts","webpack://telegram-t/./src/util/stopEvent.ts","webpack://telegram-t/./src/util/systemFilesDialog.ts","webpack://telegram-t/./src/util/themeStyle.ts"],"sourcesContent":["import React, { memo } from '../../lib/teact/teact';\n\nimport type { OwnProps as AnimatedIconProps } from './AnimatedIcon';\nimport type { ApiSticker } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\n\nimport useMedia from '../../hooks/useMedia';\n\nimport AnimatedIconWithPreview from './AnimatedIconWithPreview';\n\ntype OwnProps =\n Partial\n & { sticker?: ApiSticker; noLoad?: boolean; forcePreview?: boolean; lastSyncTime?: number };\n\nfunction AnimatedIconFromSticker(props: OwnProps) {\n const {\n sticker, noLoad, forcePreview, lastSyncTime, ...otherProps\n } = props;\n\n const thumbDataUri = sticker?.thumbnail?.dataUri;\n const localMediaHash = `sticker${sticker?.id}`;\n const previewBlobUrl = useMedia(\n sticker ? `${localMediaHash}?size=m` : undefined,\n noLoad && !forcePreview,\n ApiMediaFormat.BlobUrl,\n lastSyncTime,\n );\n const tgsUrl = useMedia(localMediaHash, noLoad, undefined, lastSyncTime);\n\n return (\n \n );\n}\n\nexport default memo(AnimatedIconFromSticker);\n","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"oGmd77AsTbJeJk8CV6gl\",\"preview\":\"gp5OwinzPeHwkesmaEIR\"};","import React, { memo } from '../../lib/teact/teact';\n\nimport type { OwnProps as AnimatedIconProps } from './AnimatedIcon';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport AnimatedIcon from './AnimatedIcon';\nimport styles from './AnimatedIconWithPreview.module.scss';\nimport useFlag from '../../hooks/useFlag';\nimport buildStyle from '../../util/buildStyle';\n\ntype OwnProps =\n Partial\n & { previewUrl?: string; thumbDataUri?: string };\n\nfunction AnimatedIconWithPreview(props: OwnProps) {\n const {\n previewUrl, thumbDataUri, className, ...otherProps\n } = props;\n\n const transitionClassNames = useMediaTransition(previewUrl);\n const [isAnimationReady, markAnimationReady] = useFlag(false);\n const { size } = props;\n\n return (\n \n {!isAnimationReady && thumbDataUri && (\n // eslint-disable-next-line jsx-a11y/alt-text\n \n )}\n {!isAnimationReady && (\n // eslint-disable-next-line jsx-a11y/alt-text\n \n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n \n \n );\n}\n\nexport default memo(AnimatedIconWithPreview);\n","type IWaveformProps = {\n peak: number;\n fillStyle: string;\n progressFillStyle: string;\n};\n\nexport const MAX_EMPTY_WAVEFORM_POINTS = 30;\nconst SPIKE_WIDTH = 2;\nconst SPIKE_STEP = 4;\nconst SPIKE_RADIUS = 1;\nconst HEIGHT = 23;\n\nexport function renderWaveform(\n canvas: HTMLCanvasElement,\n spikes: number[],\n progress: number,\n {\n peak, fillStyle, progressFillStyle,\n }: IWaveformProps,\n) {\n const width = spikes.length * SPIKE_STEP;\n const height = HEIGHT;\n\n canvas.width = width * 2;\n canvas.height = height * 2;\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n\n const ctx = canvas.getContext('2d')!;\n ctx.scale(2, 2);\n\n spikes.forEach((item, i) => {\n ctx.globalAlpha = (i / spikes.length >= progress) ? 0.5 : 1;\n ctx.fillStyle = progress > i / spikes.length ? progressFillStyle : fillStyle;\n const spikeHeight = Math.max(2, HEIGHT * (item / Math.max(1, peak)));\n roundedRectangle(ctx, i * SPIKE_STEP, (height + spikeHeight) / 2, SPIKE_WIDTH, spikeHeight, SPIKE_RADIUS);\n ctx.fill();\n });\n}\n\nfunction roundedRectangle(\n ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number,\n) {\n if (width < 2 * radius) {\n radius = width / 2;\n }\n if (height < 2 * radius) {\n radius = height / 2;\n }\n\n ctx.beginPath();\n ctx.moveTo(x + radius, y);\n ctx.arcTo(x + width, y, x + width, y - height, radius);\n ctx.arcTo(x + width, y - height, x, y - height, radius);\n ctx.arcTo(x, y - height, x, y, radius);\n ctx.arcTo(x, y, x + width, y, radius);\n ctx.closePath();\n}\n","/* eslint-disable no-bitwise */\n\n// eslint-disable-next-line max-len\n// Ref: https://github.com/telegramdesktop/tdesktop/blob/0743e71ab6b928d2ee5bae1aed991849b1e2b291/Telegram/SourceFiles/data/data_document.cpp#L1018\nexport function decodeWaveform(encoded5bit: Uint8Array) {\n const bitsCount = encoded5bit.length * 8;\n const valuesCount = Math.floor(bitsCount / 5);\n if (!valuesCount) {\n return [];\n }\n\n // Read each 5 bit of encoded5bit as 0-31 unsigned char.\n // We count the index of the byte in which the desired 5-bit sequence starts.\n // And then we read a uint16 starting from that byte to guarantee to get all of those 5 bits.\n //\n // BUT! if it is the last byte we have, we're not allowed to read a uint16 starting with it.\n // Because it will be an overflow (we'll access one byte after the available memory).\n // We see, that only the last 5 bits could start in the last available byte and be problematic.\n // So we read in a general way all the entries in a general way except the last one.\n const result = Array(valuesCount);\n const bitsData = encoded5bit;\n for (let i = 0, l = valuesCount - 1; i !== l; ++i) {\n const byteIndex = Math.floor((i * 5) / 8);\n const bitShift = Math.floor((i * 5) % 8);\n const value = bitsData[byteIndex] + (bitsData[byteIndex + 1] << 8);\n result[i] = ((value >> bitShift) & 0x1F);\n }\n const lastByteIndex = Math.floor(((valuesCount - 1) * 5) / 8);\n const lastBitShift = Math.floor(((valuesCount - 1) * 5) % 8);\n const lastValue = bitsData[lastByteIndex] + (bitsData[lastByteIndex + 1] << 8);\n result[valuesCount - 1] = (lastValue >> lastBitShift) & 0x1F;\n\n return result;\n}\n\nexport function interpolateArray(data: number[], fitCount: number) {\n let peak = 0;\n const newData = new Array(fitCount);\n const springFactor = data.length / fitCount;\n const leftFiller = data[0];\n const rightFiller = data[data.length - 1];\n for (let i = 0; i < fitCount; i++) {\n const idx = Math.floor(i * springFactor);\n const val = ((data[idx - 1] ?? leftFiller) + (data[idx] ?? leftFiller) + (data[idx + 1] ?? rightFiller)) / 3;\n newData[i] = val;\n if (peak < val) {\n peak = val;\n }\n }\n return { data: newData, peak };\n}\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 } from '../../global';\n\nimport type { ApiAudio, ApiMessage, ApiVoice } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\nimport type { ISettings } from '../../types';\nimport { AudioOrigin } from '../../types';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport { formatMediaDateTime, formatMediaDuration, formatPastTimeShort } from '../../util/dateFormat';\nimport {\n getMediaDuration,\n getMediaTransferState,\n getMessageMediaFormat,\n getMessageMediaHash,\n isMessageLocal,\n isOwnMessage,\n} from '../../global/helpers';\nimport { MAX_EMPTY_WAVEFORM_POINTS, renderWaveform } from './helpers/waveform';\nimport buildClassName from '../../util/buildClassName';\nimport renderText from './helpers/renderText';\nimport { getFileSizeString } from './helpers/documentInfo';\nimport { decodeWaveform, interpolateArray } from '../../util/waveform';\nimport useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport type { BufferedRange } from '../../hooks/useBuffering';\nimport useBuffering from '../../hooks/useBuffering';\nimport useAudioPlayer from '../../hooks/useAudioPlayer';\nimport type { LangFn } from '../../hooks/useLang';\nimport useLang from '../../hooks/useLang';\nimport { captureEvents } from '../../util/captureEvents';\nimport useMedia from '../../hooks/useMedia';\nimport { makeTrackId } from '../../util/audioPlayer';\nimport { getTranslation } from '../../util/langProvider';\n\nimport Button from '../ui/Button';\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport Link from '../ui/Link';\n\nimport './Audio.scss';\n\ntype OwnProps = {\n theme: ISettings['theme'];\n message: ApiMessage;\n senderTitle?: string;\n uploadProgress?: number;\n origin: AudioOrigin;\n date?: number;\n lastSyncTime?: number;\n noAvatars?: boolean;\n className?: string;\n isSelectable?: boolean;\n isSelected?: boolean;\n isDownloading: boolean;\n isTranscribing?: boolean;\n isTranscribed?: boolean;\n canDownload?: boolean;\n canTranscribe?: boolean;\n isTranscriptionHidden?: boolean;\n isTranscriptionError?: boolean;\n onHideTranscription?: (isHidden: boolean) => void;\n onPlay: (messageId: number, chatId: string) => void;\n onReadMedia?: () => void;\n onCancelUpload?: () => void;\n onDateClick?: (messageId: number, chatId: string) => void;\n};\n\nexport const TINY_SCREEN_WIDTH_MQL = window.matchMedia('(max-width: 375px)');\nexport const WITH_AVATAR_TINY_SCREEN_WIDTH_MQL = window.matchMedia('(max-width: 410px)');\nconst AVG_VOICE_DURATION = 10;\n// This is needed for browsers requiring user interaction before playing.\nconst PRELOAD = true;\n// eslint-disable-next-line max-len\nconst TRANSCRIBE_SVG = '';\n\nconst Audio: FC = ({\n theme,\n message,\n senderTitle,\n uploadProgress,\n origin,\n date,\n lastSyncTime,\n noAvatars,\n className,\n isSelectable,\n isSelected,\n isDownloading,\n isTranscribing,\n isTranscriptionHidden,\n isTranscribed,\n isTranscriptionError,\n canDownload,\n canTranscribe,\n onHideTranscription,\n onPlay,\n onReadMedia,\n onCancelUpload,\n onDateClick,\n}) => {\n const { cancelMessageMediaDownload, downloadMessageMedia, transcribeAudio } = getActions();\n\n const { content: { audio, voice, video }, isMediaUnread } = message;\n const isVoice = Boolean(voice || video);\n const isSeeking = useRef(false);\n // eslint-disable-next-line no-null/no-null\n const seekerRef = useRef(null);\n const lang = useLang();\n const { isRtl } = lang;\n\n const [isActivated, setIsActivated] = useState(false);\n const shouldLoad = (isActivated || PRELOAD) && lastSyncTime;\n const coverHash = getMessageMediaHash(message, 'pictogram');\n const coverBlobUrl = useMedia(coverHash, false, ApiMediaFormat.BlobUrl);\n\n const mediaData = useMedia(\n getMessageMediaHash(message, 'inline'),\n !shouldLoad,\n getMessageMediaFormat(message, 'inline'),\n );\n\n const { loadProgress: downloadProgress } = useMediaWithLoadProgress(\n getMessageMediaHash(message, 'download'),\n !isDownloading,\n getMessageMediaFormat(message, 'download'),\n );\n\n const handleForcePlay = useCallback(() => {\n setIsActivated(true);\n onPlay(message.id, message.chatId);\n }, [message, onPlay]);\n\n const handleTrackChange = useCallback(() => {\n setIsActivated(false);\n }, []);\n\n const {\n isBuffered, bufferedRanges, bufferingHandlers, checkBuffering,\n } = useBuffering();\n\n const {\n isPlaying, playProgress, playPause, setCurrentTime, duration,\n } = useAudioPlayer(\n makeTrackId(message),\n getMediaDuration(message)!,\n isVoice ? 'voice' : 'audio',\n mediaData,\n bufferingHandlers,\n undefined,\n checkBuffering,\n isActivated,\n handleForcePlay,\n handleTrackChange,\n isMessageLocal(message),\n );\n\n const isOwn = isOwnMessage(message);\n const waveformCanvasRef = useWaveformCanvas(\n theme, voice, (isMediaUnread && !isOwn) ? 1 : playProgress, isOwn, !noAvatars,\n );\n\n const withSeekline = isPlaying || (playProgress > 0 && playProgress < 1);\n\n useEffect(() => {\n setIsActivated(isPlaying);\n }, [isPlaying]);\n\n const isLoadingForPlaying = isActivated && !isBuffered;\n\n const {\n isUploading, isTransferring, transferProgress,\n } = getMediaTransferState(\n message,\n uploadProgress || downloadProgress,\n isLoadingForPlaying || isDownloading,\n );\n\n const {\n shouldRender: shouldRenderSpinner,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring);\n\n const shouldRenderCross = shouldRenderSpinner && (isLoadingForPlaying || isUploading);\n\n const handleButtonClick = useCallback(() => {\n if (isUploading) {\n onCancelUpload?.();\n return;\n }\n\n if (!isPlaying) {\n onPlay(message.id, message.chatId);\n }\n\n getActions().setAudioPlayerOrigin({ origin });\n setIsActivated(!isActivated);\n playPause();\n }, [isUploading, isPlaying, isActivated, playPause, onCancelUpload, onPlay, message.id, message.chatId, origin]);\n\n useEffect(() => {\n if (onReadMedia && isMediaUnread && (isPlaying || isDownloading)) {\n onReadMedia();\n }\n }, [isPlaying, isMediaUnread, onReadMedia, isDownloading]);\n\n const handleDownloadClick = useCallback(() => {\n if (isDownloading) {\n cancelMessageMediaDownload({ message });\n } else {\n downloadMessageMedia({ message });\n }\n }, [cancelMessageMediaDownload, downloadMessageMedia, isDownloading, message]);\n\n const handleSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (isSeeking.current && seekerRef.current) {\n const { width, left } = seekerRef.current.getBoundingClientRect();\n const clientX = e instanceof MouseEvent ? e.clientX : e.targetTouches[0].clientX;\n e.stopPropagation(); // Prevent Slide-to-Reply activation\n // Prevent track skipping while seeking near end\n setCurrentTime(Math.max(Math.min(duration * ((clientX - left) / width), duration - 0.1), 0.001));\n }\n }, [duration, setCurrentTime]);\n\n const handleStartSeek = useCallback((e: MouseEvent | TouchEvent) => {\n if (e instanceof MouseEvent && e.button === 2) return;\n isSeeking.current = true;\n handleSeek(e);\n }, [handleSeek]);\n\n const handleStopSeek = useCallback(() => {\n isSeeking.current = false;\n }, []);\n\n const handleDateClick = useCallback(() => {\n onDateClick!(message.id, message.chatId);\n }, [onDateClick, message.id, message.chatId]);\n\n const handleTranscribe = useCallback(() => {\n transcribeAudio({ chatId: message.chatId, messageId: message.id });\n }, [message.chatId, message.id, transcribeAudio]);\n\n useEffect(() => {\n if (!seekerRef.current || !withSeekline) return undefined;\n return captureEvents(seekerRef.current, {\n onCapture: handleStartSeek,\n onRelease: handleStopSeek,\n onClick: handleStopSeek,\n onDrag: handleSeek,\n });\n }, [withSeekline, handleStartSeek, handleSeek, handleStopSeek]);\n\n const transcribeSvgMemo = useMemo(() => (\n
\n ), []);\n\n function renderFirstLine() {\n if (isVoice) {\n return senderTitle || 'Voice';\n }\n\n const { title, fileName } = audio!;\n\n return title || fileName;\n }\n\n function renderSecondLine() {\n if (isVoice) {\n return (\n
\n {formatMediaDuration((voice || video)!.duration)}\n
\n );\n }\n\n const { performer } = audio!;\n\n return (\n
\n {formatMediaDuration(duration)}\n \n {performer && {renderText(performer)}}\n {performer && senderTitle && }\n {senderTitle && {renderText(senderTitle)}}\n
\n );\n }\n\n const fullClassName = buildClassName(\n 'Audio',\n className,\n isOwn && origin === AudioOrigin.Inline && 'own',\n (origin === AudioOrigin.Search || origin === AudioOrigin.SharedMedia) && 'bigger',\n isSelected && 'audio-is-selected',\n );\n\n const buttonClassNames = ['toggle-play'];\n if (shouldRenderCross) {\n buttonClassNames.push('loading');\n } else {\n buttonClassNames.push(isPlaying ? 'pause' : 'play');\n }\n\n const contentClassName = buildClassName('content', withSeekline && 'with-seekline');\n\n function renderWithTitle() {\n return (\n
\n
\n

{renderText(renderFirstLine())}

\n\n
\n {date && (\n \n {formatPastTimeShort(lang, date * 1000)}\n \n )}\n
\n
\n\n {withSeekline && (\n
\n \n {playProgress < 1 && `${formatMediaDuration(duration * playProgress, duration)}`}\n \n {renderSeekline(playProgress, bufferedRanges, seekerRef)}\n
\n )}\n {!withSeekline && renderSecondLine()}\n
\n );\n }\n\n return (\n
\n {isSelectable && (\n
\n {isSelected && }\n
\n )}\n \n \n \n \n {shouldRenderSpinner && (\n
\n \n
\n )}\n {audio && canDownload && !isUploading && (\n \n \n \n )}\n {origin === AudioOrigin.Search && renderWithTitle()}\n {origin !== AudioOrigin.Search && audio && renderAudio(\n lang,\n audio,\n duration,\n isPlaying,\n playProgress,\n bufferedRanges,\n seekerRef,\n (isDownloading || isUploading),\n date,\n transferProgress,\n onDateClick ? handleDateClick : undefined,\n )}\n {origin === AudioOrigin.SharedMedia && (voice || video) && renderWithTitle()}\n {origin === AudioOrigin.Inline && voice && (\n renderVoice(\n voice,\n seekerRef,\n waveformCanvasRef,\n playProgress,\n isMediaUnread,\n isTranscribing,\n isTranscriptionHidden,\n isTranscribed,\n isTranscriptionError,\n transcribeSvgMemo,\n canTranscribe ? handleTranscribe : undefined,\n onHideTranscription,\n )\n )}\n
\n );\n};\n\nfunction getSeeklineSpikeAmounts(withAvatar?: boolean) {\n return {\n MIN_SPIKES: IS_SINGLE_COLUMN_LAYOUT ? (TINY_SCREEN_WIDTH_MQL.matches ? 16 : 20) : 25,\n MAX_SPIKES: IS_SINGLE_COLUMN_LAYOUT\n ? (TINY_SCREEN_WIDTH_MQL.matches\n ? 35\n : (withAvatar && WITH_AVATAR_TINY_SCREEN_WIDTH_MQL.matches ? 40 : 45))\n : 75,\n };\n}\n\nfunction renderAudio(\n lang: LangFn,\n audio: ApiAudio,\n duration: number,\n isPlaying: boolean,\n playProgress: number,\n bufferedRanges: BufferedRange[],\n seekerRef: React.Ref,\n showProgress?: boolean,\n date?: number,\n progress?: number,\n handleDateClick?: NoneToVoidFunction,\n) {\n const {\n title, performer, fileName,\n } = audio;\n const showSeekline = isPlaying || (playProgress > 0 && playProgress < 1);\n const { isRtl } = getTranslation;\n\n return (\n
\n

{renderText(title || fileName)}

\n {showSeekline && (\n
\n \n {formatMediaDuration(duration * playProgress, duration)}\n \n {renderSeekline(playProgress, bufferedRanges, seekerRef)}\n
\n )}\n {!showSeekline && showProgress && (\n
\n {progress ? `${getFileSizeString(audio!.size * progress)} / ` : undefined}{getFileSizeString(audio!.size)}\n
\n )}\n {!showSeekline && !showProgress && (\n
\n {formatMediaDuration(duration)}\n {performer && (\n <>\n \n {renderText(performer)}\n \n )}\n {date && (\n <>\n \n \n {formatMediaDateTime(lang, date * 1000, true)}\n \n \n )}\n
\n )}\n
\n );\n}\n\nfunction renderVoice(\n voice: ApiVoice,\n seekerRef: React.Ref,\n waveformCanvasRef: React.Ref,\n playProgress: number,\n isMediaUnread?: boolean,\n isTranscribing?: boolean,\n isTranscriptionHidden?: boolean,\n isTranscribed?: boolean,\n isTranscriptionError?: boolean,\n svgMemo?: React.ReactNode,\n onClickTranscribe?: VoidFunction,\n onHideTranscription?: (isHidden: boolean) => void,\n) {\n return (\n
\n
\n \n \n
\n {onClickTranscribe && (\n // eslint-disable-next-line react/jsx-no-bind\n \n )}\n
\n

\n {playProgress === 0 ? formatMediaDuration(voice.duration) : formatMediaDuration(voice.duration * playProgress)}\n

\n
\n );\n}\n\nfunction useWaveformCanvas(\n theme: ISettings['theme'],\n voice?: ApiVoice,\n playProgress = 0,\n isOwn = false,\n withAvatar = false,\n) {\n // eslint-disable-next-line no-null/no-null\n const canvasRef = useRef(null);\n\n const { data: spikes, peak } = useMemo(() => {\n if (!voice) {\n return undefined;\n }\n\n const { waveform, duration } = voice;\n if (!waveform) {\n return {\n data: new Array(Math.min(duration, MAX_EMPTY_WAVEFORM_POINTS)).fill(0),\n peak: 0,\n };\n }\n\n const { MIN_SPIKES, MAX_SPIKES } = getSeeklineSpikeAmounts(withAvatar);\n const durationFactor = Math.min(duration / AVG_VOICE_DURATION, 1);\n const spikesCount = Math.round(MIN_SPIKES + (MAX_SPIKES - MIN_SPIKES) * durationFactor);\n const decodedWaveform = decodeWaveform(new Uint8Array(waveform));\n\n return interpolateArray(decodedWaveform, spikesCount);\n }, [voice, withAvatar]) || {};\n\n useLayoutEffect(() => {\n const canvas = canvasRef.current;\n\n if (!canvas || !spikes || peak === undefined) {\n return;\n }\n\n const fillColor = theme === 'dark' ? '#494A78' : '#ADD3F7';\n const fillOwnColor = theme === 'dark' ? '#B7ABED' : '#AEDFA4';\n const progressFillColor = theme === 'dark' ? '#8774E1' : '#3390EC';\n const progressFillOwnColor = theme === 'dark' ? '#FFFFFF' : '#4FAE4E';\n\n renderWaveform(canvas, spikes, playProgress, {\n peak,\n fillStyle: isOwn ? fillOwnColor : fillColor,\n progressFillStyle: isOwn ? progressFillOwnColor : progressFillColor,\n });\n }, [isOwn, peak, playProgress, spikes, theme]);\n\n return canvasRef;\n}\n\nfunction renderSeekline(\n playProgress: number,\n bufferedRanges: BufferedRange[],\n seekerRef: React.Ref,\n) {\n return (\n }\n >\n {bufferedRanges.map(({ start, end }) => (\n \n ))}\n \n \n \n \n \n \n \n );\n}\n\nexport default memo(Audio);\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 { GlobalState } from '../../global/types';\nimport type { ApiChat, ApiCountryCode, ApiUser } from '../../api/types';\n\nimport {\n selectChat, selectNotifyExceptions, selectNotifySettings, selectUser,\n} from '../../global/selectors';\nimport {\n getChatDescription, getChatLink, getHasAdminRight, isChatChannel, isUserId, isUserRightBanned, selectIsChatMuted,\n} from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport { copyTextToClipboard } from '../../util/clipboard';\nimport { formatPhoneNumberWithCode } from '../../util/phoneNumber';\nimport useLang from '../../hooks/useLang';\n\nimport ListItem from '../ui/ListItem';\nimport Switcher from '../ui/Switcher';\n\ntype OwnProps = {\n chatOrUserId: string;\n forceShowSelf?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n chat?: ApiChat;\n canInviteUsers?: boolean;\n isMuted?: boolean;\n phoneCodeList: ApiCountryCode[];\n }\n & Pick;\n\nconst ChatExtra: FC = ({\n lastSyncTime,\n user,\n chat,\n forceShowSelf,\n canInviteUsers,\n isMuted,\n phoneCodeList,\n}) => {\n const {\n loadFullUser,\n showNotification,\n updateChatMutedState,\n } = getActions();\n\n const {\n id: userId,\n fullInfo,\n username,\n phoneNumber,\n isSelf,\n } = user || {};\n const { id: chatId } = chat || {};\n const lang = useLang();\n\n useEffect(() => {\n if (lastSyncTime && userId) {\n loadFullUser({ userId });\n }\n }, [loadFullUser, userId, lastSyncTime]);\n\n const handleNotificationChange = useCallback(() => {\n updateChatMutedState({ chatId, isMuted: !isMuted });\n }, [chatId, isMuted, updateChatMutedState]);\n\n if (!chat || chat.isRestricted || (isSelf && !forceShowSelf)) {\n return undefined;\n }\n\n function copy(text: string, entity: string) {\n copyTextToClipboard(text);\n showNotification({ message: `${entity} was copied` });\n }\n\n const formattedNumber = phoneNumber && formatPhoneNumberWithCode(phoneCodeList, phoneNumber);\n const link = getChatLink(chat);\n const description = (fullInfo?.bio) || getChatDescription(chat);\n\n return (\n
\n {formattedNumber && Boolean(formattedNumber.length) && (\n // eslint-disable-next-line react/jsx-no-bind\n copy(formattedNumber, lang('Phone'))}>\n {formattedNumber}\n {lang('Phone')}\n \n )}\n {username && (\n copy(`@${username}`, lang('Username'))}\n >\n {renderText(username)}\n {lang('Username')}\n \n )}\n {description && Boolean(description.length) && (\n \n \n {renderText(description, ['br', 'links', 'emoji'])}\n \n {lang(userId ? 'UserBio' : 'Info')}\n \n )}\n {(canInviteUsers || !username) && link && (\n copy(link, lang('SetUrlPlaceholder'))}\n >\n
{link}
\n {lang('SetUrlPlaceholder')}\n \n )}\n {!forceShowSelf && (\n \n {lang('Notifications')}\n \n \n )}\n
\n );\n};\n\nexport default memo(withGlobal(\n (global, { chatOrUserId }): StateProps => {\n const { lastSyncTime, countryList: { phoneCodes: phoneCodeList } } = global;\n\n const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;\n const user = isUserId(chatOrUserId) ? selectUser(global, chatOrUserId) : undefined;\n const isMuted = chat && selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global));\n\n const canInviteUsers = chat && !user && (\n (!isChatChannel(chat) && !isUserRightBanned(chat, 'inviteUsers'))\n || getHasAdminRight(chat, 'inviteUsers')\n );\n\n return {\n lastSyncTime, phoneCodeList, chat, user, canInviteUsers, isMuted,\n };\n },\n)(ChatExtra));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat } from '../../api/types';\n\nimport { selectIsChatWithSelf, selectUser } from '../../global/selectors';\nimport {\n isUserId,\n isUserBot,\n getUserFirstOrLastName,\n getPrivateChatUserId,\n isChatBasicGroup,\n isChatSuperGroup,\n isChatChannel,\n getChatTitle,\n} from '../../global/helpers';\nimport useLang from '../../hooks/useLang';\nimport renderText from './helpers/renderText';\n\nimport Avatar from './Avatar';\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\n\nimport './DeleteChatModal.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n chat: ApiChat;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n};\n\ntype StateProps = {\n isChannel: boolean;\n isChatWithSelf?: boolean;\n isBot?: boolean;\n isPrivateChat: boolean;\n isBasicGroup: boolean;\n isSuperGroup: boolean;\n currentUserId: string | undefined;\n canDeleteForAll?: boolean;\n contactName?: string;\n};\n\nconst DeleteChatModal: FC = ({\n isOpen,\n chat,\n isChannel,\n isPrivateChat,\n isChatWithSelf,\n isBot,\n isBasicGroup,\n isSuperGroup,\n currentUserId,\n canDeleteForAll,\n contactName,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const {\n leaveChannel,\n deleteHistory,\n deleteChannel,\n deleteChatUser,\n blockContact,\n } = getActions();\n\n const lang = useLang();\n const chatTitle = getChatTitle(lang, chat);\n\n const handleDeleteMessageForAll = useCallback(() => {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: true });\n\n onClose();\n }, [deleteHistory, chat.id, onClose]);\n\n const handleDeleteAndStop = useCallback(() => {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: true });\n blockContact({ contactId: chat.id, accessHash: chat.accessHash });\n\n onClose();\n }, [deleteHistory, chat.id, chat.accessHash, blockContact, onClose]);\n\n const handleDeleteChat = useCallback(() => {\n if (isPrivateChat) {\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: false });\n } else if (isBasicGroup) {\n deleteChatUser({ chatId: chat.id, userId: currentUserId });\n deleteHistory({ chatId: chat.id, shouldDeleteForAll: false });\n } else if ((isChannel || isSuperGroup) && !chat.isCreator) {\n leaveChannel({ chatId: chat.id });\n } else if ((isChannel || isSuperGroup) && chat.isCreator) {\n deleteChannel({ chatId: chat.id });\n }\n onClose();\n }, [\n isPrivateChat,\n isBasicGroup,\n isChannel,\n isSuperGroup,\n currentUserId,\n chat.isCreator,\n chat.id,\n onClose,\n deleteHistory,\n deleteChatUser,\n leaveChannel,\n deleteChannel,\n ]);\n\n const handleLeaveChat = useCallback(() => {\n if (isChannel || isSuperGroup) {\n leaveChannel({ chatId: chat.id });\n onClose();\n } else {\n handleDeleteChat();\n }\n }, [chat.id, handleDeleteChat, isChannel, isSuperGroup, leaveChannel, onClose]);\n\n function renderHeader() {\n return (\n
\n \n

{lang(renderTitle())}

\n
\n );\n }\n\n function renderTitle() {\n if (isChannel && !chat.isCreator) {\n return 'LeaveChannel';\n }\n\n if (isChannel && chat.isCreator) {\n return 'ChannelDelete';\n }\n\n if (isBasicGroup || isSuperGroup) {\n return 'Group.LeaveGroup';\n }\n\n return 'DeleteChatUser';\n }\n\n function renderMessage() {\n if (isChannel && chat.isCreator) {\n return

{renderText(lang('ChatList.DeleteAndLeaveGroupConfirmation', chatTitle), ['simple_markdown'])}

;\n }\n\n if ((isChannel && !chat.isCreator) || isBasicGroup || isSuperGroup) {\n return

{renderText(lang('ChannelLeaveAlertWithName', chatTitle), ['simple_markdown'])}

;\n }\n\n return

{renderText(lang('ChatList.DeleteChatConfirmation', contactName), ['simple_markdown'])}

;\n }\n\n function renderActionText() {\n if (isChannel && !chat.isCreator) {\n return 'LeaveChannel';\n }\n if (isChannel && chat.isCreator) {\n return 'Chat.Input.Delete';\n }\n\n if (isBasicGroup || isSuperGroup) {\n return 'Group.LeaveGroup';\n }\n\n return canDeleteForAll ? 'ChatList.DeleteForCurrentUser' : 'Delete';\n }\n\n return (\n \n {renderMessage()}\n {isBot && (\n \n )}\n {canDeleteForAll && (\n \n )}\n {!isPrivateChat && chat.isCreator && (\n \n )}\n \n {lang(renderActionText())}\n \n \n \n );\n};\n\nexport default memo(withGlobal(\n (global, { chat }): StateProps => {\n const isPrivateChat = isUserId(chat.id);\n const isChatWithSelf = selectIsChatWithSelf(global, chat.id);\n const user = isPrivateChat && selectUser(global, getPrivateChatUserId(chat)!);\n const isBot = user && isUserBot(user) && !chat.isSupport;\n const canDeleteForAll = (isPrivateChat && !isChatWithSelf && !isBot);\n const contactName = isPrivateChat\n ? getUserFirstOrLastName(selectUser(global, getPrivateChatUserId(chat)!))\n : undefined;\n\n return {\n isPrivateChat,\n isChatWithSelf,\n isBot,\n isChannel: isChatChannel(chat),\n isBasicGroup: isChatBasicGroup(chat),\n isSuperGroup: isChatSuperGroup(chat),\n currentUserId: global.currentUserId,\n canDeleteForAll,\n contactName,\n };\n },\n)(DeleteChatModal));\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, memo, useRef, useEffect, useState,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiMessage } from '../../api/types';\n\nimport { getDocumentExtension, getDocumentHasPreview } from './helpers/documentInfo';\nimport {\n getMediaTransferState,\n getMessageMediaFormat,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n isMessageDocumentVideo,\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 useFlag from '../../hooks/useFlag';\n\nimport File from './File';\n\ntype OwnProps = {\n message: ApiMessage;\n observeIntersection?: ObserveFn;\n smaller?: boolean;\n isSelected?: boolean;\n isSelectable?: boolean;\n canAutoLoad?: boolean;\n uploadProgress?: number;\n withDate?: boolean;\n datetime?: number;\n className?: string;\n sender?: string;\n autoLoadFileMaxSizeMb?: number;\n isDownloading: boolean;\n onCancelUpload?: () => void;\n onMediaClick?: () => void;\n onDateClick?: (messageId: number, chatId: string) => void;\n};\n\nconst BYTES_PER_MB = 1024 * 1024;\n\nconst Document: FC = ({\n message,\n observeIntersection,\n smaller,\n canAutoLoad,\n autoLoadFileMaxSizeMb,\n uploadProgress,\n withDate,\n datetime,\n className,\n sender,\n isSelected,\n isSelectable,\n onCancelUpload,\n onMediaClick,\n onDateClick,\n isDownloading,\n}) => {\n const dispatch = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef(null);\n\n const document = message.content.document!;\n const { fileName, size, timestamp } = document;\n const extension = getDocumentExtension(document) || '';\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const [wasIntersected, markIntersected] = useFlag();\n useEffect(() => {\n if (isIntersecting) {\n markIntersected();\n }\n }, [isIntersecting, markIntersected]);\n\n // Auto-loading does not use global download manager because requires additional click to save files locally\n const [isLoadAllowed, setIsLoadAllowed] = useState(\n canAutoLoad && (!autoLoadFileMaxSizeMb || size <= autoLoadFileMaxSizeMb * BYTES_PER_MB),\n );\n\n const shouldDownload = Boolean(isDownloading || (isLoadAllowed && wasIntersected));\n\n const documentHash = getMessageMediaHash(message, 'download');\n const { loadProgress: downloadProgress, mediaData } = useMediaWithLoadProgress(\n documentHash, !shouldDownload, getMessageMediaFormat(message, 'download'), undefined, undefined, true,\n );\n const isLoaded = Boolean(mediaData);\n\n const {\n isUploading, isTransferring, transferProgress,\n } = getMediaTransferState(message, uploadProgress || downloadProgress, shouldDownload && !isLoaded);\n\n const hasPreview = getDocumentHasPreview(document);\n const thumbDataUri = hasPreview ? getMessageMediaThumbDataUri(message) : undefined;\n const localBlobUrl = hasPreview ? document.previewBlobUrl : undefined;\n const previewData = useMedia(getMessageMediaHash(message, 'pictogram'), !isIntersecting);\n\n const withMediaViewer = onMediaClick && Boolean(document.mediaType);\n\n const handleClick = useCallback(() => {\n if (isUploading) {\n if (onCancelUpload) {\n onCancelUpload();\n }\n return;\n }\n\n if (isDownloading) {\n dispatch.cancelMessageMediaDownload({ message });\n return;\n }\n\n if (isTransferring) {\n setIsLoadAllowed(false);\n return;\n }\n\n if (withMediaViewer) {\n onMediaClick!();\n } else {\n dispatch.downloadMessageMedia({ message });\n }\n }, [\n isUploading, isDownloading, isTransferring, withMediaViewer, onCancelUpload, dispatch, message, onMediaClick,\n ]);\n\n const handleDateClick = useCallback(() => {\n onDateClick!(message.id, message.chatId);\n }, [onDateClick, message.id, message.chatId]);\n\n return (\n \n );\n};\n\nexport default memo(Document);\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\n\nimport useLang from '../../hooks/useLang';\nimport buildClassName from '../../util/buildClassName';\n\nimport './DotAnimation.scss';\n\ntype OwnProps = {\n content: string;\n className?: string;\n};\n\nconst DotAnimation: FC = ({ content, className }) => {\n const lang = useLang();\n return (\n \n {content}\n \n \n );\n};\n\nexport default DotAnimation;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { ApiFakeType } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport './FakeIcon.scss';\n\ntype OwnProps = {\n fakeType: ApiFakeType;\n};\n\nconst FakeIcon: FC = ({\n fakeType,\n}) => {\n const lang = useLang();\n\n return {lang(fakeType === 'fake' ? 'FakeMessage' : 'ScamMessage')};\n};\n\nexport default memo(FakeIcon);\n","import type { RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo, useRef } from '../../lib/teact/teact';\n\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport buildClassName from '../../util/buildClassName';\nimport { formatMediaDateTime, formatPastTimeShort } from '../../util/dateFormat';\nimport { getColorFromExtension, getFileSizeString } from './helpers/documentInfo';\nimport { getDocumentThumbnailDimensions } from './helpers/mediaDimensions';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport ProgressSpinner from '../ui/ProgressSpinner';\nimport Link from '../ui/Link';\n\nimport './File.scss';\n\ntype OwnProps = {\n ref?: RefObject;\n name: string;\n extension?: string;\n size: number;\n timestamp?: number;\n sender?: string;\n thumbnailDataUri?: string;\n previewData?: string;\n className?: string;\n smaller?: boolean;\n isTransferring?: boolean;\n isUploading?: boolean;\n isSelectable?: boolean;\n isSelected?: boolean;\n transferProgress?: number;\n actionIcon?: string;\n onClick?: () => void;\n onDateClick?: (e: React.MouseEvent) => void;\n};\n\nconst File: FC = ({\n ref,\n name,\n size,\n extension = '',\n timestamp,\n sender,\n thumbnailDataUri,\n previewData,\n className,\n smaller,\n isTransferring,\n isUploading,\n isSelectable,\n isSelected,\n transferProgress,\n actionIcon,\n onClick,\n onDateClick,\n}) => {\n const lang = useLang();\n // eslint-disable-next-line no-null/no-null\n let elementRef = useRef(null);\n if (ref) {\n elementRef = ref;\n }\n\n const transitionClassNames = useMediaTransition(previewData);\n const {\n shouldRender: shouldSpinnerRender,\n transitionClassNames: spinnerClassNames,\n } = useShowTransition(isTransferring, undefined, true);\n\n const color = getColorFromExtension(extension);\n const sizeString = getFileSizeString(size);\n\n const { width, height } = getDocumentThumbnailDimensions(smaller);\n\n const fullClassName = buildClassName(\n 'File',\n className,\n smaller && 'smaller',\n onClick && !isUploading && 'interactive',\n isSelected && 'file-is-selected',\n );\n\n return (\n
\n {isSelectable && (\n
\n {isSelected && }\n
\n )}\n
\n {thumbnailDataUri || previewData ? (\n
\n \n \n
\n ) : (\n
\n {extension.length <= 4 && (\n {extension}\n )}\n
\n )}\n {shouldSpinnerRender && (\n
\n \n
\n )}\n {onClick && (\n \n )}\n
\n
\n
{renderText(name)}
\n
\n \n {isTransferring && transferProgress ? `${Math.round(transferProgress * 100)}%` : sizeString}\n \n {sender && {renderText(sender)}}\n {!sender && timestamp && (\n <>\n \n {formatMediaDateTime(lang, timestamp * 1000, true)}\n \n )}\n
\n
\n {sender && timestamp && (\n {formatPastTimeShort(lang, timestamp * 1000)}\n )}\n
\n );\n};\n\nexport default memo(File);\n","import type { MouseEvent as ReactMouseEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { useEffect, useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiChat, ApiTypingStatus } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport {\n getChatTypeString,\n getChatTitle,\n isChatSuperGroup,\n} from '../../global/helpers';\nimport { selectChat, selectChatMessages, selectChatOnlineCount } from '../../global/selectors';\nimport renderText from './helpers/renderText';\nimport type { LangFn } from '../../hooks/useLang';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\nimport VerifiedIcon from './VerifiedIcon';\nimport TypingStatus from './TypingStatus';\nimport DotAnimation from './DotAnimation';\nimport FakeIcon from './FakeIcon';\n\ntype OwnProps = {\n chatId: string;\n typingStatus?: ApiTypingStatus;\n avatarSize?: 'small' | 'medium' | 'large' | 'jumbo';\n status?: string;\n withDots?: boolean;\n withMediaViewer?: boolean;\n withUsername?: boolean;\n withFullInfo?: boolean;\n withUpdatingStatus?: boolean;\n withChatType?: boolean;\n withVideoAvatar?: boolean;\n noRtl?: boolean;\n};\n\ntype StateProps =\n {\n chat?: ApiChat;\n onlineCount?: number;\n areMessagesLoaded: boolean;\n }\n & Pick;\n\nconst GroupChatInfo: FC = ({\n typingStatus,\n avatarSize = 'medium',\n status,\n withDots,\n withMediaViewer,\n withUsername,\n withFullInfo,\n withUpdatingStatus,\n withChatType,\n withVideoAvatar,\n noRtl,\n chat,\n onlineCount,\n areMessagesLoaded,\n lastSyncTime,\n}) => {\n const {\n loadFullChat,\n openMediaViewer,\n loadProfilePhotos,\n } = getActions();\n\n const isSuperGroup = chat && isChatSuperGroup(chat);\n const { id: chatId, isMin, isRestricted } = chat || {};\n\n useEffect(() => {\n if (chatId && !isMin && lastSyncTime) {\n if (withFullInfo) loadFullChat({ chatId });\n if (withMediaViewer) loadProfilePhotos({ profileId: chatId });\n }\n }, [chatId, isMin, lastSyncTime, withFullInfo, loadFullChat, loadProfilePhotos, isSuperGroup, withMediaViewer]);\n\n const handleAvatarViewerOpen = useCallback((e: ReactMouseEvent, hasMedia: boolean) => {\n if (chat && hasMedia) {\n e.stopPropagation();\n openMediaViewer({\n avatarOwnerId: chat.id,\n mediaId: 0,\n origin: avatarSize === 'jumbo' ? MediaViewerOrigin.ProfileAvatar : MediaViewerOrigin.MiddleHeaderAvatar,\n });\n }\n }, [chat, avatarSize, openMediaViewer]);\n\n const lang = useLang();\n\n if (!chat) {\n return undefined;\n }\n\n function renderStatusOrTyping() {\n if (status) {\n return withDots ? (\n \n ) : (\n {status}\n );\n }\n\n if (withUpdatingStatus && !areMessagesLoaded && !isRestricted) {\n return (\n \n );\n }\n\n if (!chat) {\n return undefined;\n }\n\n if (typingStatus) {\n return ;\n }\n\n if (withChatType) {\n return (\n {lang(getChatTypeString(chat))}\n );\n }\n\n const handle = withUsername ? chat.username : undefined;\n const groupStatus = getGroupStatus(lang, chat);\n const onlineStatus = onlineCount ? `, ${lang('OnlineCount', onlineCount, 'i')}` : undefined;\n\n return (\n \n {handle && {handle}}\n {groupStatus}\n {onlineStatus && {onlineStatus}}\n \n );\n }\n\n return (\n
\n \n
\n
\n

{renderText(getChatTitle(lang, chat))}

\n {chat.isVerified && }\n {chat.fakeType && }\n
\n {renderStatusOrTyping()}\n
\n
\n );\n};\n\nfunction getGroupStatus(lang: LangFn, chat: ApiChat) {\n const chatTypeString = lang(getChatTypeString(chat));\n const { membersCount } = chat;\n\n if (chat.isRestricted) {\n return chatTypeString === 'Channel' ? 'channel is inaccessible' : 'group is inaccessible';\n }\n\n if (!membersCount) {\n return chatTypeString;\n }\n\n return chatTypeString === 'Channel'\n ? lang('Subscribers', membersCount, 'i')\n : lang('Members', membersCount, 'i');\n}\n\nexport default memo(withGlobal(\n (global, { chatId }): StateProps => {\n const { lastSyncTime } = global;\n const chat = selectChat(global, chatId);\n const onlineCount = chat ? selectChatOnlineCount(global, chat) : undefined;\n const areMessagesLoaded = Boolean(selectChatMessages(global, chatId));\n\n return {\n lastSyncTime, chat, onlineCount, areMessagesLoaded,\n };\n },\n)(GroupChatInfo));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { ApiMessage, ApiMessageOutgoingStatus } from '../../api/types';\n\nimport { formatPastTimeShort } from '../../util/dateFormat';\nimport useLang from '../../hooks/useLang';\n\nimport MessageOutgoingStatus from './MessageOutgoingStatus';\n\nimport './LastMessageMeta.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n outgoingStatus?: ApiMessageOutgoingStatus;\n};\n\nconst LastMessageMeta: FC = ({ message, outgoingStatus }) => {\n const lang = useLang();\n return (\n
\n {outgoingStatus && (\n \n )}\n {formatPastTimeShort(lang, message.date * 1000)}\n
\n );\n};\n\nexport default memo(LastMessageMeta);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useRef } from '../../lib/teact/teact';\n\nimport type { ApiMessage } from '../../api/types';\n\nimport { formatMediaDuration } from '../../util/dateFormat';\nimport stopEvent from '../../util/stopEvent';\nimport {\n getMessageHtmlId,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n} from '../../global/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport useMedia from '../../hooks/useMedia';\nimport useMediaTransition from '../../hooks/useMediaTransition';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../hooks/useIntersectionObserver';\n\nimport './Media.scss';\n\ntype OwnProps = {\n message: ApiMessage;\n idPrefix?: string;\n isProtected?: boolean;\n observeIntersection?: ObserveFn;\n onClick?: (messageId: number, chatId: string) => void;\n};\n\nconst Media: FC = ({\n message,\n idPrefix = 'shared-media',\n isProtected,\n observeIntersection,\n onClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const ref = useRef(null);\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n const thumbDataUri = getMessageMediaThumbDataUri(message);\n const mediaBlobUrl = useMedia(getMessageMediaHash(message, 'pictogram'), !isIntersecting);\n const transitionClassNames = useMediaTransition(mediaBlobUrl);\n\n const video = getMessageVideo(message);\n\n const handleClick = useCallback(() => {\n onClick!(message.id, message.chatId);\n }, [message.id, message.chatId, onClick]);\n\n return (\n \n \n \n {video && {video.isGif ? 'GIF' : formatMediaDuration(video.duration)}}\n {isProtected && }\n \n );\n};\n\nexport default memo(Media);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport type { ApiMessageOutgoingStatus } from '../../api/types';\n\nimport Transition from '../ui/Transition';\n\nimport './MessageOutgoingStatus.scss';\n\ntype OwnProps = {\n status: ApiMessageOutgoingStatus;\n};\n\nenum Keys {\n failed, pending, succeeded, read,\n}\n\nconst MessageOutgoingStatus: FC = ({ status }) => {\n return (\n
\n \n \n \n
\n );\n};\n\nexport default memo(MessageOutgoingStatus);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport './NothingFound.scss';\n\ninterface OwnProps {\n text?: string;\n description?: string;\n}\n\nconst DEFAULT_TEXT = 'Nothing found.';\n\nconst NothingFound: FC = ({ text = DEFAULT_TEXT, description }) => {\n const lang = useLang();\n const { transitionClassNames } = useShowTransition(true);\n\n return (\n
\n {text}\n {description &&

{renderText(lang(description), ['br'])}

}\n
\n );\n};\n\nexport default memo(NothingFound);\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, {\n memo, useEffect, useRef, useState,\n} from '../../lib/teact/teact';\n\nimport { MIN_PASSWORD_LENGTH } from '../../config';\nimport { IS_TOUCH_ENV, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\nimport useTimeout from '../../hooks/useTimeout';\n\nimport Button from '../ui/Button';\n\ntype OwnProps = {\n submitLabel?: string;\n error?: string;\n hint?: string;\n placeholder?: string;\n isLoading?: boolean;\n shouldDisablePasswordManager?: boolean;\n shouldShowSubmit?: boolean;\n shouldResetValue?: boolean;\n isPasswordVisible?: boolean;\n clearError: NoneToVoidFunction;\n noRipple?: boolean;\n onChangePasswordVisibility: (state: boolean) => void;\n onInputChange?: (password: string) => void;\n onSubmit: (password: string) => void;\n};\n\nconst FOCUS_DELAY_TIMEOUT_MS = IS_SINGLE_COLUMN_LAYOUT ? 550 : 400;\n\nconst PasswordForm: FC = ({\n isLoading = false,\n isPasswordVisible,\n error,\n hint,\n placeholder = 'Password',\n submitLabel = 'Next',\n shouldShowSubmit,\n shouldResetValue,\n shouldDisablePasswordManager = false,\n noRipple = false,\n clearError,\n onChangePasswordVisibility,\n onInputChange,\n onSubmit,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef(null);\n const lang = useLang();\n\n const [password, setPassword] = useState('');\n const [canSubmit, setCanSubmit] = useState(false);\n\n useEffect(() => {\n if (shouldResetValue) {\n setPassword('');\n }\n }, [shouldResetValue]);\n\n useTimeout(() => {\n if (!IS_TOUCH_ENV) {\n inputRef.current!.focus();\n }\n }, FOCUS_DELAY_TIMEOUT_MS);\n\n useEffect(() => {\n if (error) {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n inputRef.current!.select();\n });\n }\n }, [error]);\n\n function onPasswordChange(e: ChangeEvent) {\n if (error) {\n clearError();\n }\n\n const { target } = e;\n setPassword(target.value);\n setCanSubmit(target.value.length >= MIN_PASSWORD_LENGTH);\n if (onInputChange) {\n onInputChange(target.value);\n }\n }\n\n function togglePasswordVisibility() {\n onChangePasswordVisibility(!isPasswordVisible);\n }\n\n function handleSubmit(event: React.FormEvent) {\n event.preventDefault();\n\n if (isLoading) {\n return;\n }\n\n if (canSubmit) {\n onSubmit(password);\n }\n }\n\n function renderFakeInput() {\n return (\n \n );\n }\n\n return (\n
\n \n {shouldDisablePasswordManager && renderFakeInput()}\n \n \n \n \n \n \n {(canSubmit || shouldShowSubmit) && (\n \n )}\n \n );\n};\n\nexport default memo(PasswordForm);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback, useRef, useEffect, memo,\n} from '../../lib/teact/teact';\n\nimport { isUserId } from '../../global/helpers';\n\nimport InfiniteScroll from '../ui/InfiniteScroll';\nimport Checkbox from '../ui/Checkbox';\nimport InputText from '../ui/InputText';\nimport ListItem from '../ui/ListItem';\nimport PrivateChatInfo from './PrivateChatInfo';\nimport GroupChatInfo from './GroupChatInfo';\nimport PickerSelectedItem from './PickerSelectedItem';\nimport useInfiniteScroll from '../../hooks/useInfiniteScroll';\nimport useLang from '../../hooks/useLang';\n\nimport Loading from '../ui/Loading';\n\nimport './Picker.scss';\n\ntype OwnProps = {\n itemIds: string[];\n selectedIds: string[];\n filterValue?: string;\n filterPlaceholder?: string;\n notFoundText?: string;\n searchInputId?: string;\n isLoading?: boolean;\n noScrollRestore?: boolean;\n onSelectedIdsChange: (ids: string[]) => void;\n onFilterChange: (value: string) => void;\n onLoadMore?: () => void;\n};\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\n\nconst MAX_FULL_ITEMS = 10;\nconst ALWAYS_FULL_ITEMS_COUNT = 5;\n\nconst Picker: FC = ({\n itemIds,\n selectedIds,\n filterValue,\n filterPlaceholder,\n notFoundText,\n searchInputId,\n isLoading,\n noScrollRestore,\n onSelectedIdsChange,\n onFilterChange,\n onLoadMore,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef(null);\n const shouldMinimize = selectedIds.length > MAX_FULL_ITEMS;\n\n useEffect(() => {\n setTimeout(() => {\n requestAnimationFrame(() => {\n inputRef.current!.focus();\n });\n }, FOCUS_DELAY_MS);\n }, []);\n\n const handleItemClick = useCallback((id: string) => {\n const newSelectedIds = [...selectedIds];\n if (newSelectedIds.includes(id)) {\n newSelectedIds.splice(newSelectedIds.indexOf(id), 1);\n } else {\n newSelectedIds.push(id);\n }\n onSelectedIdsChange(newSelectedIds);\n onFilterChange('');\n }, [selectedIds, onSelectedIdsChange, onFilterChange]);\n\n const handleFilterChange = useCallback((e: React.ChangeEvent) => {\n const { value } = e.currentTarget;\n onFilterChange(value);\n }, [onFilterChange]);\n\n const [viewportIds, getMore] = useInfiniteScroll(onLoadMore, itemIds, Boolean(filterValue));\n\n const lang = useLang();\n\n return (\n
\n
\n {selectedIds.map((id, i) => (\n \n ))}\n \n
\n\n {viewportIds?.length ? (\n \n {viewportIds.map((id) => (\n handleItemClick(id)}\n ripple\n >\n \n {isUserId(id) ? (\n \n ) : (\n \n )}\n \n ))}\n \n ) : !isLoading && viewportIds && !viewportIds.length ? (\n

{notFoundText || 'Sorry, nothing found.'}

\n ) : (\n \n )}\n
\n );\n};\n\nexport default memo(Picker);\n","import type { FC, TeactNode } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type { ApiChat, ApiUser } from '../../api/types';\n\nimport { selectChat, selectUser } from '../../global/selectors';\nimport { getChatTitle, getUserFirstOrLastName, isUserId } from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\n\nimport './PickerSelectedItem.scss';\n\ntype OwnProps = {\n chatOrUserId?: string;\n icon?: string;\n title?: string;\n isMinimized?: boolean;\n canClose?: boolean;\n onClick: (arg: any) => void;\n clickArg: any;\n className?: string;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n user?: ApiUser;\n};\n\nconst PickerSelectedItem: FC = ({\n icon,\n title,\n isMinimized,\n canClose,\n onClick,\n clickArg,\n chat,\n user,\n className,\n}) => {\n const lang = useLang();\n\n let iconElement: TeactNode | undefined;\n let titleText: any;\n\n if (icon && title) {\n iconElement = (\n
\n \n
\n );\n\n titleText = title;\n } else if (chat || user) {\n iconElement = (\n \n );\n\n const name = !chat || (user && !user.isSelf)\n ? getUserFirstOrLastName(user)\n : getChatTitle(lang, chat, user);\n\n titleText = name ? renderText(name) : undefined;\n }\n\n const fullClassName = buildClassName(\n 'PickerSelectedItem',\n className,\n isMinimized && 'minimized',\n canClose && 'closeable',\n );\n\n return (\n onClick(clickArg)}\n title={isMinimized ? titleText : undefined}\n dir={lang.isRtl ? 'rtl' : undefined}\n >\n {iconElement}\n {!isMinimized && (\n
\n {titleText}\n
\n )}\n {canClose && (\n
\n \n
\n )}\n \n );\n};\n\nexport default memo(withGlobal(\n (global, { chatOrUserId }): StateProps => {\n if (!chatOrUserId) {\n return {};\n }\n\n const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;\n const user = isUserId(chatOrUserId) ? selectUser(global, chatOrUserId) : undefined;\n\n return {\n chat,\n user,\n };\n },\n)(PickerSelectedItem));\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useMemo } from '../../lib/teact/teact';\n\nimport generateIdFor from '../../util/generateIdFor';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport './PremiumIcon.scss';\n\n// eslint-disable-next-line max-len\nconst PREMIUM_ICON = { __html: '' };\nconst store: Record = {};\n\ntype OwnProps = {\n withGradient?: boolean;\n big?: boolean;\n onClick?: VoidFunction;\n};\n\nconst PremiumIcon: FC = ({\n withGradient,\n big,\n onClick,\n}) => {\n const html = useMemo(() => {\n return withGradient ? getPremiumIconGradient() : PREMIUM_ICON;\n }, [withGradient]);\n\n return (\n \n );\n};\n\nfunction getPremiumIconGradient() {\n const id = generateIdFor(store);\n return {\n // eslint-disable-next-line max-len\n __html: ``,\n };\n}\n\nexport default memo(PremiumIcon);\n","import type { MouseEvent as ReactMouseEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { useEffect, useCallback, memo } from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiUser, ApiTypingStatus, ApiUserStatus } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { selectChatMessages, selectUser, selectUserStatus } from '../../global/selectors';\nimport { getUserFullName, getUserStatus, isUserOnline } from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport Avatar from './Avatar';\nimport VerifiedIcon from './VerifiedIcon';\nimport TypingStatus from './TypingStatus';\nimport DotAnimation from './DotAnimation';\nimport FakeIcon from './FakeIcon';\nimport PremiumIcon from './PremiumIcon';\n\ntype OwnProps = {\n userId: string;\n typingStatus?: ApiTypingStatus;\n avatarSize?: 'tiny' | 'small' | 'medium' | 'large' | 'jumbo';\n forceShowSelf?: boolean;\n status?: string;\n withDots?: boolean;\n withMediaViewer?: boolean;\n withUsername?: boolean;\n withFullInfo?: boolean;\n withUpdatingStatus?: boolean;\n withVideoAvatar?: boolean;\n noStatusOrTyping?: boolean;\n noRtl?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n isSavedMessages?: boolean;\n areMessagesLoaded: boolean;\n serverTimeOffset: number;\n }\n & Pick;\n\nconst PrivateChatInfo: FC = ({\n typingStatus,\n avatarSize = 'medium',\n status,\n withDots,\n withMediaViewer,\n withUsername,\n withFullInfo,\n withUpdatingStatus,\n withVideoAvatar,\n noStatusOrTyping,\n noRtl,\n user,\n userStatus,\n isSavedMessages,\n areMessagesLoaded,\n lastSyncTime,\n serverTimeOffset,\n}) => {\n const {\n loadFullUser,\n openMediaViewer,\n loadProfilePhotos,\n } = getActions();\n\n const { id: userId } = user || {};\n const fullName = getUserFullName(user);\n\n useEffect(() => {\n if (userId && lastSyncTime) {\n if (withFullInfo) loadFullUser({ userId });\n if (withMediaViewer) loadProfilePhotos({ profileId: userId });\n }\n }, [userId, loadFullUser, loadProfilePhotos, lastSyncTime, withFullInfo, withMediaViewer]);\n\n const handleAvatarViewerOpen = useCallback((e: ReactMouseEvent, hasMedia: boolean) => {\n if (user && hasMedia) {\n e.stopPropagation();\n openMediaViewer({\n avatarOwnerId: user.id,\n mediaId: 0,\n origin: avatarSize === 'jumbo' ? MediaViewerOrigin.ProfileAvatar : MediaViewerOrigin.MiddleHeaderAvatar,\n });\n }\n }, [user, avatarSize, openMediaViewer]);\n\n const lang = useLang();\n\n if (!user) {\n return undefined;\n }\n\n function renderStatusOrTyping() {\n if (status) {\n return withDots ? (\n \n ) : (\n {status}\n );\n }\n\n if (withUpdatingStatus && !areMessagesLoaded) {\n return (\n \n );\n }\n\n if (!user) {\n return undefined;\n }\n\n if (typingStatus) {\n return ;\n }\n\n return (\n \n {withUsername && user.username && {user.username}}\n {getUserStatus(lang, user, userStatus, serverTimeOffset)}\n \n );\n }\n\n return (\n
\n \n
\n {isSavedMessages ? (\n
\n

{lang('SavedMessages')}

\n
\n ) : (\n
\n

{fullName && renderText(fullName)}

\n {user?.isVerified && }\n {user.isPremium && }\n {user.fakeType && }\n
\n )}\n {(status || (!isSavedMessages && !noStatusOrTyping)) && renderStatusOrTyping()}\n
\n
\n );\n};\n\nexport default memo(withGlobal(\n (global, { userId, forceShowSelf }): StateProps => {\n const { lastSyncTime, serverTimeOffset } = global;\n const user = selectUser(global, userId);\n const userStatus = selectUserStatus(global, userId);\n const isSavedMessages = !forceShowSelf && user && user.isSelf;\n const areMessagesLoaded = Boolean(selectChatMessages(global, userId));\n\n return {\n lastSyncTime, user, userStatus, isSavedMessages, areMessagesLoaded, serverTimeOffset,\n };\n },\n)(PrivateChatInfo));\n","import React, { memo, useEffect, useRef } from '../../lib/teact/teact';\n\nimport type { FC, TeactNode } from '../../lib/teact/teact';\nimport type { ApiChat, ApiPhoto, ApiUser } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\n\nimport {\n getChatAvatarHash,\n getChatTitle,\n getUserColorKey,\n getUserFullName,\n isUserId,\n isChatWithRepliesBot,\n isDeletedUser, getVideoAvatarMediaHash,\n} from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport buildClassName from '../../util/buildClassName';\nimport safePlay from '../../util/safePlay';\nimport { getFirstLetters } from '../../util/textFormat';\nimport useMedia from '../../hooks/useMedia';\nimport useLang from '../../hooks/useLang';\n\nimport Spinner from '../ui/Spinner';\n\nimport './ProfilePhoto.scss';\n\ntype OwnProps = {\n chat?: ApiChat;\n user?: ApiUser;\n isFirstPhoto?: boolean;\n isSavedMessages?: boolean;\n photo?: ApiPhoto;\n lastSyncTime?: number;\n notActive?: boolean;\n onClick: NoneToVoidFunction;\n};\n\nconst ProfilePhoto: FC = ({\n chat,\n user,\n photo,\n isFirstPhoto,\n isSavedMessages,\n notActive,\n lastSyncTime,\n onClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const videoRef = useRef(null);\n const lang = useLang();\n const isDeleted = user && isDeletedUser(user);\n const isRepliesChat = chat && isChatWithRepliesBot(chat.id);\n\n function getMediaHash(size: 'normal' | 'big', type: 'photo' | 'video' = 'photo') {\n const userOrChat = user || chat;\n const profilePhoto = photo || userOrChat?.fullInfo?.profilePhoto;\n const hasVideo = profilePhoto?.isVideo;\n const forceAvatar = isFirstPhoto;\n\n if (type === 'video' && !hasVideo) return undefined;\n\n if (photo && !forceAvatar) {\n if (hasVideo && type === 'video') {\n return getVideoAvatarMediaHash(photo);\n }\n if (type === 'photo') {\n return `photo${photo.id}?size=c`;\n }\n }\n\n if (!isSavedMessages && !isDeleted && !isRepliesChat && userOrChat) {\n return getChatAvatarHash(userOrChat, size, type);\n }\n\n return undefined;\n }\n\n useEffect(() => {\n if (!videoRef.current) return;\n if (notActive) {\n videoRef.current.pause();\n videoRef.current.currentTime = 0;\n } else {\n safePlay(videoRef.current);\n }\n }, [notActive]);\n\n const photoHash = getMediaHash('big', 'photo');\n const photoBlobUrl = useMedia(photoHash, false, ApiMediaFormat.BlobUrl, lastSyncTime);\n const videoHash = getMediaHash('normal', 'video');\n const videoBlobUrl = useMedia(videoHash, false, ApiMediaFormat.BlobUrl, lastSyncTime);\n const imageSrc = videoBlobUrl || photoBlobUrl || photo?.thumbnail?.dataUri;\n\n let content: TeactNode | undefined;\n\n if (isSavedMessages) {\n content = ;\n } else if (isDeleted) {\n content = ;\n } else if (isRepliesChat) {\n content = ;\n } else if (imageSrc) {\n if (videoBlobUrl) {\n content = (\n \n );\n } else {\n content = \"\";\n }\n } else if (user) {\n const userFullName = getUserFullName(user);\n content = userFullName ? getFirstLetters(userFullName, 2) : undefined;\n } else if (chat) {\n const title = getChatTitle(lang, chat);\n content = title && getFirstLetters(title, isUserId(chat.id) ? 2 : 1);\n } else {\n content = (\n
\n \n
\n );\n }\n\n const fullClassName = buildClassName(\n 'ProfilePhoto',\n `color-bg-${getUserColorKey(user || chat)}`,\n isSavedMessages && 'saved-messages',\n isDeleted && 'deleted-account',\n isRepliesChat && 'replies-bot-account',\n (!isSavedMessages && !imageSrc) && 'no-photo',\n );\n\n return (\n
\n {typeof content === 'string' ? renderText(content, ['hq_emoji']) : content}\n
\n );\n};\n\nexport default memo(ProfilePhoto);\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useEffect, useCallback, memo, useState,\n} from '../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../global';\n\nimport type { ApiUser, ApiChat, ApiUserStatus } from '../../api/types';\nimport type { GlobalState } from '../../global/types';\nimport { MediaViewerOrigin } from '../../types';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport { MEMO_EMPTY_ARRAY } from '../../util/memo';\nimport { selectChat, selectUser, selectUserStatus } from '../../global/selectors';\nimport {\n getUserFullName, getUserStatus, isChatChannel, isUserOnline,\n} from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport { captureEvents, SwipeDirection } from '../../util/captureEvents';\nimport buildClassName from '../../util/buildClassName';\nimport usePhotosPreload from './hooks/usePhotosPreload';\nimport useLang from '../../hooks/useLang';\nimport usePrevious from '../../hooks/usePrevious';\n\nimport VerifiedIcon from './VerifiedIcon';\nimport ProfilePhoto from './ProfilePhoto';\nimport Transition from '../ui/Transition';\nimport FakeIcon from './FakeIcon';\nimport PremiumIcon from './PremiumIcon';\n\nimport './ProfileInfo.scss';\n\ntype OwnProps = {\n userId: string;\n forceShowSelf?: boolean;\n};\n\ntype StateProps =\n {\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n chat?: ApiChat;\n isSavedMessages?: boolean;\n animationLevel: 0 | 1 | 2;\n serverTimeOffset: number;\n mediaId?: number;\n avatarOwnerId?: string;\n }\n & Pick;\n\nconst ProfileInfo: FC = ({\n forceShowSelf,\n user,\n userStatus,\n chat,\n isSavedMessages,\n connectionState,\n animationLevel,\n serverTimeOffset,\n mediaId,\n avatarOwnerId,\n}) => {\n const {\n loadFullUser,\n openMediaViewer,\n openPremiumModal,\n } = getActions();\n\n const lang = useLang();\n\n const { id: userId } = user || {};\n const { id: chatId } = chat || {};\n const fullName = user ? getUserFullName(user) : (chat ? chat.title : '');\n const photos = user?.photos || chat?.photos || MEMO_EMPTY_ARRAY;\n const prevMediaId = usePrevious(mediaId);\n const prevAvatarOwnerId = usePrevious(avatarOwnerId);\n const [hasSlideAnimation, setHasSlideAnimation] = useState(true);\n const slideAnimation = hasSlideAnimation\n ? animationLevel >= 1 ? (lang.isRtl ? 'slide-optimized-rtl' : 'slide-optimized') : 'none'\n : 'none';\n\n const [currentPhotoIndex, setCurrentPhotoIndex] = useState(0);\n const isFirst = isSavedMessages || photos.length <= 1 || currentPhotoIndex === 0;\n const isLast = isSavedMessages || photos.length <= 1 || currentPhotoIndex === photos.length - 1;\n\n // Set the current avatar photo to the last selected photo in Media Viewer after it is closed\n useEffect(() => {\n if (prevAvatarOwnerId && prevMediaId !== undefined && mediaId === undefined) {\n setHasSlideAnimation(false);\n setCurrentPhotoIndex(prevMediaId);\n }\n }, [mediaId, prevMediaId, prevAvatarOwnerId]);\n\n // Deleting the last profile photo may result in an error\n useEffect(() => {\n if (currentPhotoIndex > photos.length) {\n setCurrentPhotoIndex(Math.max(0, photos.length - 1));\n }\n }, [currentPhotoIndex, photos.length]);\n\n useEffect(() => {\n if (connectionState === 'connectionStateReady' && userId && !forceShowSelf) {\n loadFullUser({ userId });\n }\n }, [userId, loadFullUser, connectionState, forceShowSelf]);\n\n usePhotosPreload(user || chat, photos, currentPhotoIndex);\n\n const handleProfilePhotoClick = useCallback(() => {\n openMediaViewer({\n avatarOwnerId: userId || chatId,\n mediaId: currentPhotoIndex,\n origin: forceShowSelf ? MediaViewerOrigin.SettingsAvatar : MediaViewerOrigin.ProfileAvatar,\n });\n }, [openMediaViewer, userId, chatId, currentPhotoIndex, forceShowSelf]);\n\n const handleClickPremium = useCallback(() => {\n if (!user) return;\n\n openPremiumModal({ fromUserId: user.id });\n }, [openPremiumModal, user]);\n\n const selectPreviousMedia = useCallback(() => {\n if (isFirst) {\n return;\n }\n setHasSlideAnimation(true);\n setCurrentPhotoIndex(currentPhotoIndex - 1);\n }, [currentPhotoIndex, isFirst]);\n\n const selectNextMedia = useCallback(() => {\n if (isLast) {\n return;\n }\n setHasSlideAnimation(true);\n setCurrentPhotoIndex(currentPhotoIndex + 1);\n }, [currentPhotoIndex, isLast]);\n\n // Swipe gestures\n useEffect(() => {\n const element = document.querySelector('.photo-wrapper');\n if (!element) {\n return undefined;\n }\n\n return captureEvents(element, {\n selectorToPreventScroll: '.Profile, .settings-content',\n onSwipe: IS_TOUCH_ENV ? (e, direction) => {\n if (direction === SwipeDirection.Right) {\n selectPreviousMedia();\n return true;\n } else if (direction === SwipeDirection.Left) {\n selectNextMedia();\n return true;\n }\n\n return false;\n } : undefined,\n });\n }, [selectNextMedia, selectPreviousMedia]);\n\n if (!user && !chat) {\n return undefined;\n }\n\n function renderPhotoTabs() {\n if (isSavedMessages || !photos || photos.length <= 1) {\n return undefined;\n }\n\n return (\n
\n {photos.map((_, i) => (\n \n ))}\n
\n );\n }\n\n function renderPhoto(isActive?: boolean) {\n const photo = !isSavedMessages && photos.length > 0 ? photos[currentPhotoIndex] : undefined;\n return (\n \n );\n }\n\n function renderStatus() {\n if (user) {\n return (\n
\n {getUserStatus(lang, user, userStatus, serverTimeOffset)}\n
\n );\n }\n\n return (\n {\n isChatChannel(chat!)\n ? lang('Subscribers', chat!.membersCount ?? 0, 'i')\n : lang('Members', chat!.membersCount ?? 0, 'i')\n }\n \n );\n }\n\n const isVerifiedIconShown = (user || chat)?.isVerified;\n const isPremiumIconShown = user?.isPremium;\n const fakeType = (user || chat)?.fakeType;\n\n return (\n
\n
\n {renderPhotoTabs()}\n \n {renderPhoto}\n \n\n {!isFirst && (\n \n )}\n {!isLast && (\n \n )}\n
\n\n
\n {isSavedMessages ? (\n
\n
{lang('SavedMessages')}
\n
\n ) : (\n
\n
{fullName && renderText(fullName)}
\n {isVerifiedIconShown && }\n {isPremiumIconShown && }\n {fakeType && }\n
\n )}\n {!isSavedMessages && renderStatus()}\n
\n
\n );\n};\n\nexport default memo(withGlobal(\n (global, { userId, forceShowSelf }): StateProps => {\n const { connectionState, serverTimeOffset } = global;\n const user = selectUser(global, userId);\n const userStatus = selectUserStatus(global, userId);\n const chat = selectChat(global, userId);\n const isSavedMessages = !forceShowSelf && user && user.isSelf;\n const { animationLevel } = global.settings.byKey;\n const { mediaId, avatarOwnerId } = global.mediaViewer;\n\n return {\n connectionState,\n user,\n userStatus,\n chat,\n isSavedMessages,\n animationLevel,\n serverTimeOffset,\n mediaId,\n avatarOwnerId,\n };\n },\n)(ProfileInfo));\n","import type { ApiChat, ApiPhoto, ApiUser } from '../../../api/types';\nimport { ApiMediaFormat } from '../../../api/types';\nimport { useEffect } from '../../../lib/teact/teact';\nimport * as mediaLoader from '../../../util/mediaLoader';\n\nconst PHOTOS_TO_PRELOAD = 4;\n\nexport default function usePhotosPreload(\n profile: ApiUser | ApiChat | undefined,\n photos: ApiPhoto[],\n currentIndex: number,\n) {\n useEffect(() => {\n photos.slice(currentIndex, currentIndex + PHOTOS_TO_PRELOAD).forEach((photo) => {\n const mediaData = mediaLoader.getFromMemory(`photo${photo.id}?size=c`);\n if (!mediaData) {\n mediaLoader.fetch(`photo${photo.id}?size=c`, ApiMediaFormat.BlobUrl);\n }\n });\n }, [currentIndex, photos]);\n}\n","import type { RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { getGlobal } from '../../global';\n\nimport { ApiMediaFormat } from '../../api/types';\n\nimport useMedia from '../../hooks/useMedia';\nimport buildClassName from '../../util/buildClassName';\n\nimport './ReactionStaticEmoji.scss';\n\ntype OwnProps = {\n reaction: string;\n ref?: RefObject;\n className?: string;\n};\n\nconst ReactionStaticEmoji: FC = ({\n reaction,\n ref,\n className,\n}) => {\n const staticIconId = getGlobal().availableReactions?.find((l) => l.reaction === reaction)?.staticIcon?.id;\n const mediaData = useMedia(`document${staticIconId}`, !staticIconId, ApiMediaFormat.BlobUrl);\n\n return (\n \n );\n};\n\nexport default memo(ReactionStaticEmoji);\n","import type { ChangeEvent } from 'react';\n\nimport 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 { ApiPhoto, ApiReportReason } from '../../api/types';\n\nimport useLang from '../../hooks/useLang';\n\nimport Modal from '../ui/Modal';\nimport Button from '../ui/Button';\nimport RadioGroup from '../ui/RadioGroup';\nimport InputText from '../ui/InputText';\n\nexport type OwnProps = {\n isOpen: boolean;\n subject?: 'peer' | 'messages' | 'media';\n chatId?: string;\n photo?: ApiPhoto;\n messageIds?: number[];\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n};\n\nconst ReportModal: FC = ({\n isOpen,\n subject = 'messages',\n chatId,\n photo,\n messageIds,\n onClose,\n onCloseAnimationEnd,\n}) => {\n const {\n reportMessages,\n reportPeer,\n reportProfilePhoto,\n exitMessageSelectMode,\n } = getActions();\n\n const [selectedReason, setSelectedReason] = useState('spam');\n const [description, setDescription] = useState('');\n\n const handleReport = useCallback(() => {\n switch (subject) {\n case 'messages':\n reportMessages({ messageIds, reason: selectedReason, description });\n exitMessageSelectMode();\n break;\n case 'peer':\n reportPeer({ chatId, reason: selectedReason, description });\n break;\n case 'media':\n reportProfilePhoto({\n chatId, photo, reason: selectedReason, description,\n });\n break;\n }\n onClose();\n }, [\n description,\n exitMessageSelectMode,\n messageIds,\n photo,\n onClose,\n reportMessages,\n selectedReason,\n chatId,\n reportProfilePhoto,\n reportPeer,\n subject,\n ]);\n\n const handleSelectReason = useCallback((value: string) => {\n setSelectedReason(value as ApiReportReason);\n }, []);\n\n const handleDescriptionChange = useCallback((e: ChangeEvent) => {\n setDescription(e.target.value);\n }, []);\n\n const lang = useLang();\n\n const REPORT_OPTIONS: { value: ApiReportReason; label: string }[] = useMemo(() => [\n { value: 'spam', label: lang('lng_report_reason_spam') },\n { value: 'violence', label: lang('lng_report_reason_violence') },\n { value: 'pornography', label: lang('lng_report_reason_pornography') },\n { value: 'childAbuse', label: lang('lng_report_reason_child_abuse') },\n { value: 'copyright', label: lang('ReportPeer.ReasonCopyright') },\n { value: 'illegalDrugs', label: 'Illegal Drugs' },\n { value: 'personalDetails', label: 'Personal Details' },\n { value: 'other', label: lang('lng_report_reason_other') },\n ], [lang]);\n\n if (\n (subject === 'messages' && !messageIds)\n || (subject === 'peer' && !chatId)\n || (subject === 'media' && (!chatId || !photo))\n ) {\n return undefined;\n }\n\n const title = subject === 'messages'\n ? lang('lng_report_message_title')\n : lang('ReportPeer.Report');\n\n return (\n \n \n \n \n \n \n );\n};\n\nexport default memo(ReportModal);\n","import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react';\nimport React, {\n memo, useCallback, useEffect, useMemo, useRef,\n} from '../../lib/teact/teact';\nimport { getActions } from '../../global';\n\nimport type { ApiBotInlineMediaResult, ApiSticker } from '../../api/types';\nimport { ApiMediaFormat } from '../../api/types';\n\nimport buildClassName from '../../util/buildClassName';\nimport { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur';\nimport safePlay from '../../util/safePlay';\nimport { IS_TOUCH_ENV, IS_WEBM_SUPPORTED } from '../../util/environment';\n\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\nimport { useIsIntersecting } from '../../hooks/useIntersectionObserver';\nimport useMedia from '../../hooks/useMedia';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport useContextMenuPosition from '../../hooks/useContextMenuPosition';\n\nimport AnimatedSticker from './AnimatedSticker';\nimport Button from '../ui/Button';\nimport Menu from '../ui/Menu';\nimport MenuItem from '../ui/MenuItem';\n\nimport './StickerButton.scss';\n\ntype OwnProps = {\n sticker: ApiSticker;\n size: number;\n noAnimate?: boolean;\n title?: string;\n className?: string;\n clickArg: T;\n noContextMenu?: boolean;\n isSavedMessages?: boolean;\n canViewSet?: boolean;\n isCurrentUserPremium?: boolean;\n observeIntersection: ObserveFn;\n onClick?: (arg: OwnProps['clickArg'], isSilent?: boolean, shouldSchedule?: boolean) => void;\n onFaveClick?: (sticker: ApiSticker) => void;\n onUnfaveClick?: (sticker: ApiSticker) => void;\n onRemoveRecentClick?: (sticker: ApiSticker) => void;\n};\n\nconst StickerButton = ({\n sticker,\n size,\n noAnimate,\n title,\n className,\n clickArg,\n noContextMenu,\n isSavedMessages,\n canViewSet,\n observeIntersection,\n onClick,\n onFaveClick,\n onUnfaveClick,\n onRemoveRecentClick,\n isCurrentUserPremium,\n}: OwnProps) => {\n const { openStickerSet, openPremiumModal } = getActions();\n // eslint-disable-next-line no-null/no-null\n const ref = useRef(null);\n const lang = useLang();\n\n const localMediaHash = `sticker${sticker.id}`;\n const stickerSelector = `sticker-button-${sticker.id}`;\n\n const isIntersecting = useIsIntersecting(ref, observeIntersection);\n\n const thumbDataUri = sticker.thumbnail ? sticker.thumbnail.dataUri : undefined;\n const previewBlobUrl = useMedia(`${localMediaHash}?size=m`, !isIntersecting, ApiMediaFormat.BlobUrl);\n\n const shouldPlay = isIntersecting && !noAnimate;\n const lottieData = useMedia(sticker.isLottie && localMediaHash, !shouldPlay);\n const [isLottieLoaded, markLoaded, unmarkLoaded] = useFlag(Boolean(lottieData));\n const canLottiePlay = isLottieLoaded && shouldPlay;\n const isVideo = sticker.isVideo && IS_WEBM_SUPPORTED;\n const videoBlobUrl = useMedia(isVideo && localMediaHash, !shouldPlay, ApiMediaFormat.BlobUrl);\n const canVideoPlay = Boolean(isVideo && videoBlobUrl && shouldPlay);\n const isPremiumSticker = sticker.hasEffect;\n const isLocked = !isCurrentUserPremium && isPremiumSticker;\n\n const { transitionClassNames: previewTransitionClassNames } = useShowTransition(\n Boolean(previewBlobUrl || canLottiePlay),\n undefined,\n undefined,\n 'slow',\n );\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(ref);\n\n const getTriggerElement = useCallback(() => ref.current, []);\n\n const getRootElement = useCallback(\n () => ref.current!.closest('.custom-scroll, .no-scrollbar'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => ref.current!.querySelector('.sticker-context-menu .bubble'),\n [],\n );\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n // To avoid flickering\n useEffect(() => {\n if (!shouldPlay) {\n unmarkLoaded();\n }\n }, [unmarkLoaded, shouldPlay]);\n\n useEffect(() => {\n if (!isVideo || !ref.current) return;\n const video = ref.current.querySelector('video');\n if (!video) return;\n if (canVideoPlay) {\n safePlay(video);\n } else {\n video.pause();\n }\n }, [isVideo, canVideoPlay]);\n\n useEffect(() => {\n if (!isIntersecting) handleContextMenuClose();\n }, [handleContextMenuClose, isIntersecting]);\n\n const handleClick = () => {\n if (isContextMenuOpen) return;\n if (isLocked) {\n openPremiumModal({ initialSection: 'stickers' });\n return;\n }\n onClick?.(clickArg);\n };\n\n const handleMouseDown = (e: React.MouseEvent) => {\n preventMessageInputBlurWithBubbling(e);\n handleBeforeContextMenu(e);\n };\n\n const handleRemoveClick = useCallback((e: ReactMouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n\n onRemoveRecentClick!(sticker);\n }, [onRemoveRecentClick, sticker]);\n\n const handleContextRemoveRecent = useCallback(() => {\n onRemoveRecentClick!(sticker);\n }, [onRemoveRecentClick, sticker]);\n\n const handleContextUnfave = useCallback(() => {\n onUnfaveClick!(sticker);\n }, [onUnfaveClick, sticker]);\n\n const handleContextFave = useCallback(() => {\n onFaveClick!(sticker);\n }, [onFaveClick, sticker]);\n\n const handleSendQuiet = useCallback(() => {\n onClick?.(clickArg, true);\n }, [clickArg, onClick]);\n\n const handleSendScheduled = useCallback(() => {\n onClick?.(clickArg, undefined, true);\n }, [clickArg, onClick]);\n\n const handleOpenSet = useCallback(() => {\n openStickerSet({ sticker });\n }, [openStickerSet, sticker]);\n\n const shouldShowCloseButton = !IS_TOUCH_ENV && onRemoveRecentClick;\n\n const fullClassName = buildClassName(\n 'StickerButton',\n onClick && 'interactive',\n stickerSelector,\n className,\n );\n\n const style = (thumbDataUri && !canLottiePlay && !canVideoPlay) ? `background-image: url('${thumbDataUri}');` : '';\n\n const contextMenuItems = useMemo(() => {\n const items: ReactNode[] = [];\n if (noContextMenu) return items;\n\n if (onUnfaveClick) {\n items.push(\n \n {lang('Stickers.RemoveFromFavorites')}\n ,\n );\n }\n\n if (onFaveClick) {\n items.push(\n \n {lang('Stickers.AddToFavorites')}\n ,\n );\n }\n\n if (!isLocked && onClick) {\n if (!isSavedMessages) {\n items.push({lang('SendWithoutSound')});\n }\n items.push(\n \n {lang(isSavedMessages ? 'SetReminder' : 'ScheduleMessage')}\n ,\n );\n }\n\n if (canViewSet) {\n items.push(\n \n {lang('ViewPackPreview')}\n ,\n );\n }\n if (onRemoveRecentClick) {\n items.push(\n \n {lang('DeleteFromRecent')}\n ,\n );\n }\n return items;\n }, [\n canViewSet, handleContextFave, handleContextRemoveRecent, handleContextUnfave, handleOpenSet, handleSendQuiet,\n handleSendScheduled, isLocked, isSavedMessages, lang, onFaveClick, onRemoveRecentClick, onUnfaveClick, onClick,\n noContextMenu,\n ]);\n\n return (\n \n {!canLottiePlay && !canVideoPlay && (\n // eslint-disable-next-line jsx-a11y/alt-text\n \n )}\n {isVideo && (\n \n )}\n {shouldPlay && lottieData && (\n \n )}\n {isLocked && (\n \n \n \n )}\n {isPremiumSticker && !isLocked && (\n
\n \n
\n )}\n {shouldShowCloseButton && (\n \n \n \n )}\n {Boolean(contextMenuItems.length) && contextMenuPosition !== undefined && (\n \n {contextMenuItems}\n \n )}\n \n );\n};\n\nexport default memo(StickerButton);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './StickerSetModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst StickerSetModalAsync: FC = (props) => {\n const { isOpen } = props;\n const StickerSetModal = useModuleLoader(Bundles.Extra, 'StickerSetModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return StickerSetModal ? : undefined;\n};\n\nexport default memo(StickerSetModalAsync);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { withGlobal } from '../../global';\n\nimport type { ApiUser, ApiTypingStatus } from '../../api/types';\n\nimport { selectUser } from '../../global/selectors';\nimport { getUserFirstOrLastName } from '../../global/helpers';\nimport renderText from './helpers/renderText';\nimport useLang from '../../hooks/useLang';\n\nimport DotAnimation from './DotAnimation';\n\nimport './TypingStatus.scss';\n\ntype OwnProps = {\n typingStatus: ApiTypingStatus;\n};\n\ntype StateProps = {\n typingUser?: ApiUser;\n};\n\nconst TypingStatus: FC = ({ typingStatus, typingUser }) => {\n const lang = useLang();\n const typingUserName = typingUser && !typingUser.isSelf && getUserFirstOrLastName(typingUser);\n const content = lang(typingStatus.action)\n // Fix for translation \"{user} is typing\"\n .replace('{user}', '')\n .replace('{emoji}', typingStatus.emoji).trim();\n\n return (\n

\n {typingUserName && (\n {renderText(typingUserName)}\n )}\n \n

\n );\n};\n\nexport default memo(withGlobal(\n (global, { typingStatus }): StateProps => {\n if (!typingStatus.userId) {\n return {};\n }\n\n const typingUser = selectUser(global, typingStatus.userId);\n\n return { typingUser };\n },\n)(TypingStatus));\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\n\nimport './VerifiedIcon.scss';\n\n// eslint-disable-next-line max-len\nconst VERIFIED_ICON = { __html: '' };\n\nconst VerifiedIcon: FC = () => {\n return (\n // eslint-disable-next-line react/no-danger\n \n );\n};\n\nexport default VerifiedIcon;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\n\nimport type { ApiMessage, ApiWebPage } from '../../api/types';\nimport type { TextPart } from '../../types';\nimport type { ObserveFn } from '../../hooks/useIntersectionObserver';\n\nimport {\n getFirstLinkInMessage, getMessageText,\n getMessageWebPage,\n} from '../../global/helpers';\nimport buildClassName from '../../util/buildClassName';\nimport trimText from '../../util/trimText';\nimport renderText from './helpers/renderText';\nimport { formatPastTimeShort } from '../../util/dateFormat';\nimport useLang from '../../hooks/useLang';\nimport { renderMessageSummary } from './helpers/renderMessageText';\n\nimport Media from './Media';\nimport Link from '../ui/Link';\nimport SafeLink from './SafeLink';\n\nimport './WebLink.scss';\n\nconst MAX_TEXT_LENGTH = 170; // symbols\n\ntype OwnProps = {\n message: ApiMessage;\n senderTitle?: string;\n isProtected?: boolean;\n observeIntersection?: ObserveFn;\n onMessageClick: (messageId: number, chatId: string) => void;\n};\n\ntype ApiWebPageWithFormatted =\n ApiWebPage\n & { formattedDescription?: TextPart[] };\n\nconst WebLink: FC = ({\n message, senderTitle, isProtected, observeIntersection, onMessageClick,\n}) => {\n const lang = useLang();\n\n let linkData: ApiWebPageWithFormatted | undefined = getMessageWebPage(message);\n\n if (!linkData) {\n const link = getFirstLinkInMessage(message);\n if (link) {\n const { url, domain } = link;\n\n linkData = {\n siteName: domain.replace(/^www./, ''),\n url: url.includes('://') ? url : url.includes('@') ? `mailto:${url}` : `http://${url}`,\n formattedDescription: getMessageText(message) !== url\n ? renderMessageSummary(lang, message, undefined, undefined, MAX_TEXT_LENGTH)\n : undefined,\n } as ApiWebPageWithFormatted;\n }\n }\n\n const handleMessageClick = useCallback(() => {\n onMessageClick(message.id, message.chatId);\n }, [onMessageClick, message.id, message.chatId]);\n\n if (!linkData) {\n return undefined;\n }\n\n const {\n siteName,\n url,\n displayUrl,\n title,\n description,\n formattedDescription,\n photo,\n video,\n } = linkData;\n\n const truncatedDescription = !senderTitle && description && trimText(description, MAX_TEXT_LENGTH);\n\n const className = buildClassName(\n 'WebLink scroll-item',\n (!photo && !video) && 'without-media',\n );\n\n return (\n \n {photo && (\n \n )}\n
\n \n {renderText(title || siteName || displayUrl)}\n \n {(truncatedDescription || formattedDescription) && (\n \n {formattedDescription || (truncatedDescription && renderText(truncatedDescription))}\n \n )}\n \n {url.replace('mailto:', '') || displayUrl}\n \n {senderTitle &&
{renderText(senderTitle)}
}\n
\n {senderTitle && (\n
\n \n {formatPastTimeShort(lang, message.date * 1000)}\n \n
\n )}\n \n );\n};\n\nexport default memo(WebLink);\n","import type {\n ApiPhoto, ApiVideo, ApiSticker, ApiDimensions,\n} from '../../../api/types';\n\nimport { STICKER_SIZE_INLINE_DESKTOP_FACTOR, STICKER_SIZE_INLINE_MOBILE_FACTOR } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV } from '../../../util/environment';\nimport windowSize from '../../../util/windowSize';\nimport { getPhotoInlineDimensions, getVideoDimensions } from '../../../global/helpers';\n\nexport const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)';\nexport const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10);\nexport const ROUND_VIDEO_DIMENSIONS_PX = 240;\nexport const GIF_MIN_WIDTH = 300;\nexport const AVATAR_FULL_DIMENSIONS = { width: 640, height: 640 };\nexport const VIDEO_AVATAR_FULL_DIMENSIONS = { width: 800, height: 800 };\nexport const LIKE_STICKER_ID = '4986041492570112461';\n\nconst DEFAULT_MEDIA_DIMENSIONS: ApiDimensions = { width: 100, height: 100 };\nconst MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM = 4.5;\nconst MOBILE_SCREEN_MESSAGE_EXTRA_WIDTH_REM = 7;\nconst MESSAGE_MAX_WIDTH_REM = 29;\nconst MESSAGE_OWN_MAX_WIDTH_REM = 30;\n\nlet cachedMaxWidthOwn: number | undefined;\nlet cachedMaxWidth: number | undefined;\nlet cachedMaxWidthNoAvatar: number | undefined;\n\nfunction getMaxMessageWidthRem(fromOwnMessage: boolean, noAvatars?: boolean) {\n const regularMaxWidth = fromOwnMessage ? MESSAGE_OWN_MAX_WIDTH_REM : MESSAGE_MAX_WIDTH_REM;\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n return regularMaxWidth;\n }\n\n const { width: windowWidth } = windowSize.get();\n\n // @optimization Limitation: changing device screen width not supported\n if (!cachedMaxWidthOwn) {\n cachedMaxWidthOwn = Math.min(\n MESSAGE_OWN_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n if (!cachedMaxWidth) {\n cachedMaxWidth = Math.min(\n MESSAGE_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n if (!cachedMaxWidthNoAvatar) {\n cachedMaxWidthNoAvatar = Math.min(\n MESSAGE_MAX_WIDTH_REM,\n windowWidth / REM - MOBILE_SCREEN_NO_AVATARS_MESSAGE_EXTRA_WIDTH_REM,\n );\n }\n\n return fromOwnMessage\n ? cachedMaxWidthOwn\n : (noAvatars ? cachedMaxWidthNoAvatar : cachedMaxWidth);\n}\n\nexport function getAvailableWidth(\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n isWebPagePhoto?: boolean,\n noAvatars?: boolean,\n) {\n const extraPaddingRem = isForwarded || isWebPagePhoto ? 1.625 : 0;\n const availableWidthRem = getMaxMessageWidthRem(fromOwnMessage, noAvatars) - extraPaddingRem;\n\n return availableWidthRem * REM;\n}\n\nfunction getAvailableHeight(isGif?: boolean, aspectRatio?: number) {\n if (\n isGif && aspectRatio\n && aspectRatio >= 0.75 && aspectRatio <= 1.25\n ) {\n return 20 * REM;\n }\n\n return 27 * REM;\n}\n\nfunction calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isWebPagePhoto,\n isGif,\n noAvatars,\n}: {\n width: number;\n height: number;\n fromOwnMessage: boolean;\n isForwarded?: boolean;\n isWebPagePhoto?: boolean;\n isGif?: boolean;\n noAvatars?: boolean;\n}): ApiDimensions {\n const aspectRatio = height / width;\n const availableWidth = getAvailableWidth(fromOwnMessage, isForwarded, isWebPagePhoto, noAvatars);\n const availableHeight = getAvailableHeight(isGif, aspectRatio);\n const mediaWidth = isGif ? Math.max(GIF_MIN_WIDTH, width) : width;\n const mediaHeight = isGif ? height * (mediaWidth / width) : height;\n\n return calculateDimensions(availableWidth, availableHeight, mediaWidth, mediaHeight);\n}\n\nexport function getMediaViewerAvailableDimensions(withFooter: boolean, isVideo: boolean): ApiDimensions {\n const mql = window.matchMedia(MEDIA_VIEWER_MEDIA_QUERY);\n const { width: windowWidth, height: windowHeight } = windowSize.get();\n let occupiedHeightRem = isVideo && mql.matches ? 10 : 8.25;\n if (withFooter && !IS_TOUCH_ENV) {\n occupiedHeightRem = mql.matches ? 10 : 12.5;\n }\n return {\n width: windowWidth,\n height: windowHeight - occupiedHeightRem * REM,\n };\n}\n\nexport function calculateInlineImageDimensions(\n photo: ApiPhoto,\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n isWebPagePhoto?: boolean,\n noAvatars?: boolean,\n) {\n const { width, height } = getPhotoInlineDimensions(photo) || DEFAULT_MEDIA_DIMENSIONS;\n\n return calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isWebPagePhoto,\n noAvatars,\n });\n}\n\nexport function calculateVideoDimensions(\n video: ApiVideo,\n fromOwnMessage: boolean,\n isForwarded?: boolean,\n noAvatars?: boolean,\n) {\n const { width, height } = getVideoDimensions(video) || DEFAULT_MEDIA_DIMENSIONS;\n\n return calculateDimensionsForMessageMedia({\n width,\n height,\n fromOwnMessage,\n isForwarded,\n isGif: video.isGif,\n noAvatars,\n });\n}\n\nexport function getPictogramDimensions(): ApiDimensions {\n return {\n width: 2 * REM,\n height: 2 * REM,\n };\n}\n\nexport function getDocumentThumbnailDimensions(smaller?: boolean): ApiDimensions {\n if (smaller) {\n return {\n width: 3 * REM,\n height: 3 * REM,\n };\n }\n\n return {\n width: 3.375 * REM,\n height: 3.375 * REM,\n };\n}\n\nexport function getStickerDimensions(sticker: ApiSticker): ApiDimensions {\n const { width } = sticker;\n let { height } = sticker;\n\n // For some reason this sticker has some weird `height` value\n if (sticker.id === LIKE_STICKER_ID) {\n height = width;\n }\n\n const aspectRatio = (height && width) && height / width;\n const baseWidth = REM * (\n IS_SINGLE_COLUMN_LAYOUT\n ? STICKER_SIZE_INLINE_MOBILE_FACTOR\n : STICKER_SIZE_INLINE_DESKTOP_FACTOR\n );\n const calculatedHeight = aspectRatio ? baseWidth * aspectRatio : baseWidth;\n\n if (aspectRatio && calculatedHeight > baseWidth) {\n return {\n width: Math.round(baseWidth / aspectRatio),\n height: baseWidth,\n };\n }\n\n return {\n width: baseWidth,\n height: calculatedHeight,\n };\n}\n\nexport function calculateMediaViewerDimensions(\n { width, height }: ApiDimensions, withFooter: boolean, isVideo: boolean = false,\n): ApiDimensions {\n const { width: availableWidth, height: availableHeight } = getMediaViewerAvailableDimensions(withFooter, isVideo);\n\n return calculateDimensions(availableWidth, availableHeight, width, height);\n}\n\nexport function calculateDimensions(\n availableWidth: number,\n availableHeight: number,\n mediaWidth: number,\n mediaHeight: number,\n): ApiDimensions {\n const aspectRatio = mediaHeight / mediaWidth;\n const calculatedWidth = Math.min(mediaWidth, availableWidth);\n const calculatedHeight = Math.round(calculatedWidth * aspectRatio);\n\n if (calculatedHeight > availableHeight) {\n return {\n width: Math.round(availableHeight / aspectRatio),\n height: availableHeight,\n };\n }\n\n return {\n width: calculatedWidth,\n height: Math.round(calculatedWidth * aspectRatio),\n };\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport { Bundles } from '../../util/moduleLoader';\nimport type { OwnProps } from './ChatFolderModal';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst ChatFolderModalAsync: FC = (props) => {\n const { isOpen } = props;\n const ChatFolderModal = useModuleLoader(Bundles.Extra, 'ChatFolderModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return ChatFolderModal ? : undefined;\n};\n\nexport default memo(ChatFolderModalAsync);\n","import { useMemo } from '../../../../lib/teact/teact';\n\nexport enum ChatAnimationTypes {\n Move,\n Opacity,\n None,\n}\n\nexport function useChatAnimationType(orderDiffById: Record) {\n return useMemo(() => {\n const orderDiffs = Object.values(orderDiffById);\n const numberOfUp = orderDiffs.filter((diff) => diff < 0).length;\n const numberOfDown = orderDiffs.filter((diff) => diff > 0).length;\n\n return (chatId: string): ChatAnimationTypes => {\n const orderDiff = orderDiffById[chatId];\n if (orderDiff === 0) {\n return ChatAnimationTypes.None;\n }\n\n if (\n orderDiff === Infinity\n || orderDiff === -Infinity\n || (numberOfUp <= numberOfDown && orderDiff < 0)\n || (numberOfDown < numberOfUp && orderDiff > 0)\n ) {\n return ChatAnimationTypes.Opacity;\n }\n\n return ChatAnimationTypes.Move;\n };\n }, [orderDiffById]);\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport type { ApiChat } from '../../../api/types';\n\nimport { formatIntegerCompact } from '../../../util/textFormat';\nimport buildClassName from '../../../util/buildClassName';\n\nimport ShowTransition from '../../ui/ShowTransition';\n\nimport './Badge.scss';\n\ntype OwnProps = {\n chat: ApiChat;\n isPinned?: boolean;\n isMuted?: boolean;\n};\n\nconst Badge: FC = ({ chat, isPinned, isMuted }) => {\n const isShown = Boolean(\n chat.unreadCount || chat.unreadMentionsCount || chat.hasUnreadMark || isPinned || chat.unreadReactionsCount,\n );\n const isUnread = Boolean(chat.unreadCount || chat.hasUnreadMark);\n const className = buildClassName(\n 'Badge',\n isMuted && 'muted',\n !isUnread && isPinned && 'pinned',\n isUnread && 'unread',\n );\n\n function renderContent() {\n const unreadReactionsElement = chat.unreadReactionsCount && (\n
\n \n
\n );\n\n const unreadMentionsElement = chat.unreadMentionsCount && (\n
\n \n
\n );\n\n const unreadCountElement = (chat.hasUnreadMark || chat.unreadCount) ? (\n
\n {!chat.hasUnreadMark && formatIntegerCompact(chat.unreadCount!)}\n
\n ) : undefined;\n\n const pinnedElement = isPinned && !unreadCountElement && !unreadMentionsElement && !unreadReactionsElement && (\n
\n \n
\n );\n\n const elements = [unreadReactionsElement, unreadMentionsElement, unreadCountElement, pinnedElement].filter(Boolean);\n\n if (elements.length === 0) return undefined;\n\n if (elements.length === 1) return elements[0];\n\n return (\n
\n {elements}\n
\n );\n }\n\n return (\n \n {renderContent()}\n \n );\n};\n\nexport default memo(Badge);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport buildClassName from '../../../util/buildClassName';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\n\nimport './ChatCallStatus.scss';\n\ntype OwnProps = {\n isSelected?: boolean;\n isActive?: boolean;\n};\n\nconst ChatCallStatus: FC = ({\n isSelected,\n isActive,\n}) => {\n return (\n
\n
\n
\n
\n
\n
\n
\n );\n};\n\nexport default memo(ChatCallStatus);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useLayoutEffect, useMemo, useRef,\n} from '../../../lib/teact/teact';\nimport { getActions, getGlobal, withGlobal } from '../../../global';\n\nimport type { LangFn } from '../../../hooks/useLang';\nimport type { ObserveFn } from '../../../hooks/useIntersectionObserver';\nimport type {\n ApiChat, ApiUser, ApiMessage, ApiMessageOutgoingStatus, ApiFormattedText, ApiUserStatus,\n} from '../../../api/types';\nimport { MAIN_THREAD_ID } from '../../../api/types';\n\nimport { ANIMATION_END_DELAY } from '../../../config';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport {\n getChatTitle,\n isUserId,\n isActionMessage,\n getPrivateChatUserId,\n getMessageAction,\n getMessageSenderName,\n isChatChannel,\n getMessageMediaHash,\n getMessageMediaThumbDataUri,\n getMessageVideo,\n getMessageSticker,\n selectIsChatMuted,\n getMessageRoundVideo,\n} from '../../../global/helpers';\nimport {\n selectChat, selectUser, selectChatMessage, selectOutgoingStatus, selectDraft, selectCurrentMessageList,\n selectNotifySettings, selectNotifyExceptions, selectUserStatus,\n} from '../../../global/selectors';\nimport { renderActionMessageText } from '../../common/helpers/renderActionMessageText';\nimport renderText from '../../common/helpers/renderText';\nimport { fastRaf } from '../../../util/schedulers';\nimport buildClassName from '../../../util/buildClassName';\nimport { renderMessageSummary } from '../../common/helpers/renderMessageText';\n\nimport useEnsureMessage from '../../../hooks/useEnsureMessage';\nimport useChatContextActions from '../../../hooks/useChatContextActions';\nimport useFlag from '../../../hooks/useFlag';\nimport useMedia from '../../../hooks/useMedia';\nimport { ChatAnimationTypes } from './hooks';\nimport useLang from '../../../hooks/useLang';\n\nimport Avatar from '../../common/Avatar';\nimport VerifiedIcon from '../../common/VerifiedIcon';\nimport TypingStatus from '../../common/TypingStatus';\nimport LastMessageMeta from '../../common/LastMessageMeta';\nimport DeleteChatModal from '../../common/DeleteChatModal';\nimport ListItem from '../../ui/ListItem';\nimport Badge from './Badge';\nimport ChatFolderModal from '../ChatFolderModal.async';\nimport ChatCallStatus from './ChatCallStatus';\nimport ReportModal from '../../common/ReportModal';\nimport FakeIcon from '../../common/FakeIcon';\nimport PremiumIcon from '../../common/PremiumIcon';\n\nimport './Chat.scss';\n\ntype OwnProps = {\n style?: string;\n chatId: string;\n folderId?: number;\n orderDiff: number;\n animationType: ChatAnimationTypes;\n isPinned?: boolean;\n observeIntersection?: ObserveFn;\n onDragEnter?: (chatId: string) => void;\n};\n\ntype StateProps = {\n chat?: ApiChat;\n isMuted?: boolean;\n user?: ApiUser;\n userStatus?: ApiUserStatus;\n actionTargetUserIds?: string[];\n actionTargetMessage?: ApiMessage;\n actionTargetChatId?: string;\n lastMessageSender?: ApiUser;\n lastMessageOutgoingStatus?: ApiMessageOutgoingStatus;\n draft?: ApiFormattedText;\n animationLevel?: number;\n isSelected?: boolean;\n canScrollDown?: boolean;\n canChangeFolder?: boolean;\n lastSyncTime?: number;\n};\n\nconst ANIMATION_DURATION = 200;\n\nconst Chat: FC = ({\n style,\n chatId,\n folderId,\n orderDiff,\n animationType,\n isPinned,\n observeIntersection,\n chat,\n isMuted,\n user,\n userStatus,\n actionTargetUserIds,\n lastMessageSender,\n lastMessageOutgoingStatus,\n actionTargetMessage,\n actionTargetChatId,\n draft,\n animationLevel,\n isSelected,\n canScrollDown,\n canChangeFolder,\n lastSyncTime,\n onDragEnter,\n}) => {\n const {\n openChat,\n focusLastMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const ref = useRef(null);\n\n const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();\n const [isChatFolderModalOpen, openChatFolderModal, closeChatFolderModal] = useFlag();\n const [isReportModalOpen, openReportModal, closeReportModal] = useFlag();\n const [shouldRenderDeleteModal, markRenderDeleteModal, unmarkRenderDeleteModal] = useFlag();\n const [shouldRenderChatFolderModal, markRenderChatFolderModal, unmarkRenderChatFolderModal] = useFlag();\n const [shouldRenderReportModal, markRenderReportModal, unmarkRenderReportModal] = useFlag();\n\n const { lastMessage, typingStatus } = chat || {};\n const isAction = lastMessage && isActionMessage(lastMessage);\n\n useEnsureMessage(chatId, isAction ? lastMessage!.replyToMessageId : undefined, actionTargetMessage);\n\n const mediaThumbnail = lastMessage && !getMessageSticker(lastMessage)\n ? getMessageMediaThumbDataUri(lastMessage)\n : undefined;\n const mediaBlobUrl = useMedia(lastMessage ? getMessageMediaHash(lastMessage, 'micro') : undefined);\n const isRoundVideo = Boolean(lastMessage && getMessageRoundVideo(lastMessage));\n\n const actionTargetUsers = useMemo(() => {\n if (!actionTargetUserIds) {\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 return actionTargetUserIds.map((userId) => usersById[userId]).filter(Boolean as any);\n }, [actionTargetUserIds]);\n\n // Sets animation excess values when `orderDiff` changes and then resets excess values to animate.\n useLayoutEffect(() => {\n const element = ref.current;\n\n if (animationLevel === 0 || !element) {\n return;\n }\n\n // TODO Refactor animation: create `useListAnimation` that owns `orderDiff` and `animationType`\n if (animationType === ChatAnimationTypes.Opacity) {\n element.style.opacity = '0';\n\n fastRaf(() => {\n element.classList.add('animate-opacity');\n element.style.opacity = '1';\n });\n } else if (animationType === ChatAnimationTypes.Move) {\n element.style.transform = `translate3d(0, ${-orderDiff * 100}%, 0)`;\n\n fastRaf(() => {\n element.classList.add('animate-transform');\n element.style.transform = '';\n });\n } else {\n return;\n }\n\n setTimeout(() => {\n fastRaf(() => {\n element.classList.remove('animate-opacity', 'animate-transform');\n element.style.opacity = '';\n element.style.transform = '';\n });\n }, ANIMATION_DURATION + ANIMATION_END_DELAY);\n }, [animationLevel, orderDiff, animationType]);\n\n const handleClick = useCallback(() => {\n openChat({ id: chatId, shouldReplaceHistory: true });\n\n if (isSelected && canScrollDown) {\n focusLastMessage();\n }\n }, [\n isSelected,\n canScrollDown,\n openChat,\n chatId,\n focusLastMessage,\n ]);\n\n const handleDragEnter = useCallback((e) => {\n e.preventDefault();\n onDragEnter?.(chatId);\n }, [chatId, onDragEnter]);\n\n const handleDelete = useCallback(() => {\n markRenderDeleteModal();\n openDeleteModal();\n }, [markRenderDeleteModal, openDeleteModal]);\n\n const handleChatFolderChange = useCallback(() => {\n markRenderChatFolderModal();\n openChatFolderModal();\n }, [markRenderChatFolderModal, openChatFolderModal]);\n\n const handleReport = useCallback(() => {\n markRenderReportModal();\n openReportModal();\n }, [markRenderReportModal, openReportModal]);\n\n const contextActions = useChatContextActions({\n chat,\n user,\n handleDelete,\n handleChatFolderChange,\n handleReport,\n folderId,\n isPinned,\n isMuted,\n canChangeFolder,\n });\n\n const lang = useLang();\n\n if (!chat) {\n return undefined;\n }\n\n function renderLastMessageOrTyping() {\n if (typingStatus && lastMessage && typingStatus.timestamp > lastMessage.date * 1000) {\n return ;\n }\n\n if (draft?.text.length) {\n return (\n

\n {lang('Draft')}\n {renderText(draft.text)}\n

\n );\n }\n\n if (!lastMessage) {\n return undefined;\n }\n\n if (isAction) {\n const isChat = chat && (isChatChannel(chat) || lastMessage.senderId === lastMessage.chatId);\n\n return (\n

\n {renderActionMessageText(\n lang,\n lastMessage,\n !isChat ? lastMessageSender : undefined,\n isChat ? chat : undefined,\n actionTargetUsers,\n actionTargetMessage,\n actionTargetChatId,\n { asTextWithSpoilers: true },\n )}\n

\n );\n }\n\n const senderName = getMessageSenderName(lang, chatId, lastMessageSender);\n\n return (\n

\n {senderName && (\n <>\n {renderText(senderName)}\n :\n \n )}\n {renderSummary(lang, lastMessage!, mediaBlobUrl || mediaThumbnail, isRoundVideo)}\n

\n );\n }\n\n const className = buildClassName(\n 'Chat chat-item-clickable',\n isUserId(chatId) ? 'private' : 'group',\n isSelected && 'selected',\n );\n\n return (\n \n
\n \n {chat.isCallActive && chat.isCallNotEmpty && (\n \n )}\n
\n
\n
\n

{renderText(getChatTitle(lang, chat, user))}

\n {chat.isVerified && }\n {user?.isPremium && !user.isSelf && }\n {chat.fakeType && }\n {isMuted && }\n {chat.lastMessage && (\n \n )}\n
\n
\n {renderLastMessageOrTyping()}\n \n
\n
\n {shouldRenderDeleteModal && (\n \n )}\n {shouldRenderChatFolderModal && (\n \n )}\n {shouldRenderReportModal && (\n \n )}\n \n );\n};\n\nfunction renderSummary(lang: LangFn, message: ApiMessage, blobUrl?: string, isRoundVideo?: boolean) {\n if (!blobUrl) {\n return renderMessageSummary(lang, message);\n }\n\n return (\n \n \"\"\n {getMessageVideo(message) && }\n {renderMessageSummary(lang, message, true)}\n \n );\n}\n\nexport default memo(withGlobal(\n (global, { chatId }): StateProps => {\n const chat = selectChat(global, chatId);\n if (!chat || !chat.lastMessage) {\n return {};\n }\n\n const { senderId, replyToMessageId, isOutgoing } = chat.lastMessage;\n const lastMessageSender = senderId ? selectUser(global, senderId) : undefined;\n const lastMessageAction = getMessageAction(chat.lastMessage);\n const actionTargetMessage = lastMessageAction && replyToMessageId\n ? selectChatMessage(global, chat.id, replyToMessageId)\n : undefined;\n const { targetUserIds: actionTargetUserIds, targetChatId: actionTargetChatId } = lastMessageAction || {};\n const privateChatUserId = getPrivateChatUserId(chat);\n const {\n chatId: currentChatId,\n threadId: currentThreadId,\n type: messageListType,\n } = selectCurrentMessageList(global) || {};\n const isSelected = chatId === currentChatId && currentThreadId === MAIN_THREAD_ID;\n\n return {\n chat,\n isMuted: selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)),\n lastMessageSender,\n actionTargetUserIds,\n actionTargetChatId,\n actionTargetMessage,\n draft: selectDraft(global, chatId, MAIN_THREAD_ID),\n animationLevel: global.settings.byKey.animationLevel,\n isSelected,\n canScrollDown: isSelected && messageListType === 'thread',\n canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,\n lastSyncTime: global.lastSyncTime,\n ...(isOutgoing && { lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage) }),\n ...(privateChatUserId && {\n user: selectUser(global, privateChatUserId),\n userStatus: selectUserStatus(global, privateChatUserId),\n }),\n };\n },\n)(Chat));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../../lib/teact/teact';\nimport { withGlobal } from '../../../global';\n\nimport type { ApiChatFolder, ApiSticker } from '../../../api/types';\nimport { SettingsScreens } from '../../../types';\nimport type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../../../util/environment';\nimport { selectAnimatedEmoji, selectChatFolder } from '../../../global/selectors';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\nimport AnimatedIconFromSticker from '../../common/AnimatedIconFromSticker';\n\nimport './EmptyFolder.scss';\n\ntype OwnProps = {\n folderId?: number;\n folderType: 'all' | 'archived' | 'folder';\n foldersDispatch?: FolderEditDispatch;\n onScreenSelect?: (screen: SettingsScreens) => void;\n};\n\ntype StateProps = {\n chatFolder?: ApiChatFolder;\n animatedEmoji?: ApiSticker;\n};\n\nconst ICON_SIZE = 128;\n\nconst EmptyFolder: FC = ({\n chatFolder, animatedEmoji, foldersDispatch, onScreenSelect,\n}) => {\n const lang = useLang();\n\n const handleEditFolder = useCallback(() => {\n foldersDispatch!({ type: 'editFolder', payload: chatFolder });\n onScreenSelect!(SettingsScreens.FoldersEditFolderFromChatList);\n }, [chatFolder, foldersDispatch, onScreenSelect]);\n\n return (\n
\n
\n {animatedEmoji && }\n
\n

{lang('FilterNoChatsToDisplay')}

\n

\n {lang(chatFolder ? 'ChatList.EmptyChatListFilterText' : 'Chat.EmptyChat')}\n

\n {chatFolder && foldersDispatch && onScreenSelect && (\n \n \n {lang('ChatList.EmptyChatListEditFilter')}\n \n )}\n
\n );\n};\n\nexport default memo(withGlobal((global, { folderId, folderType }): StateProps => {\n const chatFolder = folderId && folderType === 'folder' ? selectChatFolder(global, folderId) : undefined;\n\n return {\n chatFolder,\n animatedEmoji: selectAnimatedEmoji(global, '📂'),\n };\n})(EmptyFolder));\n","import React, {\n memo, useMemo, useEffect, useRef, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions } from '../../../global';\n\nimport type { FC } from '../../../lib/teact/teact';\nimport type { SettingsScreens } from '../../../types';\nimport type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer';\n\nimport {\n ALL_FOLDER_ID,\n ARCHIVED_FOLDER_ID,\n CHAT_HEIGHT_PX,\n CHAT_LIST_SLICE,\n} from '../../../config';\nimport { IS_MAC_OS, IS_PWA } from '../../../util/environment';\nimport { mapValues } from '../../../util/iteratees';\nimport { getPinnedChatsCount, getOrderKey } from '../../../util/folderManager';\n\nimport usePrevious from '../../../hooks/usePrevious';\nimport useInfiniteScroll from '../../../hooks/useInfiniteScroll';\nimport { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager';\nimport { useChatAnimationType } from './hooks';\nimport { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';\nimport { useHotkeys } from '../../../hooks/useHotkeys';\nimport useDebouncedCallback from '../../../hooks/useDebouncedCallback';\n\nimport InfiniteScroll from '../../ui/InfiniteScroll';\nimport Loading from '../../ui/Loading';\nimport Chat from './Chat';\nimport EmptyFolder from './EmptyFolder';\n\ntype OwnProps = {\n folderType: 'all' | 'archived' | 'folder';\n folderId?: number;\n isActive: boolean;\n lastSyncTime?: number;\n foldersDispatch?: FolderEditDispatch;\n onScreenSelect?: (screen: SettingsScreens) => void;\n};\n\nconst INTERSECTION_THROTTLE = 200;\nconst DRAG_ENTER_DEBOUNCE = 500;\n\nconst ChatList: FC = ({\n folderType,\n folderId,\n isActive,\n foldersDispatch,\n onScreenSelect,\n}) => {\n const { openChat, openNextChat } = getActions();\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef(null);\n const shouldIgnoreDragRef = useRef(false);\n\n const resolvedFolderId = (\n folderType === 'all' ? ALL_FOLDER_ID : folderType === 'archived' ? ARCHIVED_FOLDER_ID : folderId!\n );\n\n const orderedIds = useFolderManagerForOrderedIds(resolvedFolderId);\n\n const orderById = useMemo(() => {\n if (!orderedIds) {\n return undefined;\n }\n\n return orderedIds.reduce((acc, id, i) => {\n acc[id] = i;\n return acc;\n }, {} as Record);\n }, [orderedIds]);\n\n const prevOrderById = usePrevious(orderById);\n\n const orderDiffById = useMemo(() => {\n if (!orderById || !prevOrderById) {\n return {};\n }\n\n return mapValues(orderById, (order, id) => {\n return prevOrderById[id] !== undefined ? order - prevOrderById[id] : -Infinity;\n });\n }, [orderById, prevOrderById]);\n\n const [viewportIds, getMore] = useInfiniteScroll(undefined, orderedIds, undefined, CHAT_LIST_SLICE);\n\n // Support + to navigate between chats\n useHotkeys(isActive && orderedIds?.length ? {\n 'Alt+ArrowUp': (e: KeyboardEvent) => {\n e.preventDefault();\n openNextChat({ targetIndexDelta: -1, orderedIds });\n },\n 'Alt+ArrowDown': (e: KeyboardEvent) => {\n e.preventDefault();\n openNextChat({ targetIndexDelta: 1, orderedIds });\n },\n } : undefined);\n\n // Support + to navigate between chats\n useEffect(() => {\n if (!isActive || !orderedIds || !IS_PWA) {\n return undefined;\n }\n\n function handleKeyDown(e: KeyboardEvent) {\n if (((IS_MAC_OS && e.metaKey) || (!IS_MAC_OS && e.ctrlKey)) && e.code.startsWith('Digit')) {\n const [, digit] = e.code.match(/Digit(\\d)/) || [];\n if (!digit) return;\n\n const position = Number(digit) - 1;\n if (position > orderedIds!.length - 1 || position < 0) return;\n\n openChat({ id: orderedIds![position], shouldReplaceHistory: true });\n }\n }\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isActive, openChat, openNextChat, orderedIds]);\n\n const getAnimationType = useChatAnimationType(orderDiffById);\n\n const { observe } = useIntersectionObserver({\n rootRef: containerRef,\n throttleMs: INTERSECTION_THROTTLE,\n });\n\n const handleDragEnter = useDebouncedCallback((chatId: string) => {\n if (shouldIgnoreDragRef.current) {\n shouldIgnoreDragRef.current = false;\n return;\n }\n openChat({ id: chatId, shouldReplaceHistory: true });\n }, [], DRAG_ENTER_DEBOUNCE, true);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n const rect = e.currentTarget.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n if (x < rect.width || y < rect.y) return;\n shouldIgnoreDragRef.current = true;\n }, []);\n\n function renderChats() {\n const viewportOffset = orderedIds!.indexOf(viewportIds![0]);\n const pinnedCount = getPinnedChatsCount(resolvedFolderId) || 0;\n\n return viewportIds!.map((id, i) => {\n const isPinned = viewportOffset + i < pinnedCount;\n\n return (\n \n );\n });\n }\n\n return (\n \n {viewportIds?.length ? (\n renderChats()\n ) : viewportIds && !viewportIds.length ? (\n (\n \n )\n ) : (\n \n )}\n \n );\n};\n\nexport default memo(ChatList);\n","import type { ApiChat, ApiMessage, ApiUser } from '../../../../api/types';\nimport {\n getChatTitle,\n getSenderTitle,\n isUserId,\n isChatGroup,\n} from '../../../../global/helpers';\nimport type { LangFn } from '../../../../hooks/useLang';\n\nexport function getSenderName(\n lang: LangFn, message: ApiMessage, chatsById: Record, usersById: Record,\n) {\n const { senderId } = message;\n if (!senderId) {\n return undefined;\n }\n\n const sender = isUserId(senderId) ? usersById[senderId] : chatsById[senderId];\n\n let senderName = getSenderTitle(lang, sender);\n\n const chat = chatsById[message.chatId];\n if (chat) {\n if (isUserId(senderId) && (sender as ApiUser).isSelf) {\n senderName = `${lang('FromYou')} → ${getChatTitle(lang, chat)}`;\n } else if (isChatGroup(chat)) {\n senderName += ` → ${getChatTitle(lang, chat)}`;\n }\n }\n\n return senderName;\n}\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './CustomSendMenu';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst CustomSendMenuAsync: FC = (props) => {\n const { isOpen } = props;\n const CustomSend = useModuleLoader(Bundles.Extra, 'CustomSendMenu', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return CustomSend ? : undefined;\n};\n\nexport default memo(CustomSendMenuAsync);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\n\nimport useFlag from '../../../hooks/useFlag';\nimport buildClassName from '../../../util/buildClassName';\n\nimport './DropTarget.scss';\n\nexport type OwnProps = {\n isQuick?: boolean;\n onFileSelect: (e: React.DragEvent) => void;\n};\n\nconst DropTarget: FC = ({ isQuick, onFileSelect }) => {\n const [isHovered, markHovered, unmarkHovered] = useFlag();\n\n const handleDragLeave = (e: React.DragEvent) => {\n const { relatedTarget: toTarget } = e;\n\n if (toTarget) {\n e.stopPropagation();\n }\n\n unmarkHovered();\n };\n\n const className = buildClassName(\n 'DropTarget',\n isHovered && 'hovered',\n );\n\n return (\n \n
\n
\n
Drop files here to send them
\n
{isQuick ? 'in a quick way' : 'without compression'}
\n
\n
\n );\n};\n\nexport default memo(DropTarget);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef,\n} from '../../../lib/teact/teact';\n\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport buildClassName from '../../../util/buildClassName';\nimport getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems';\n\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport usePrevious from '../../../hooks/usePrevious';\n\nimport Portal from '../../ui/Portal';\nimport DropTarget from './DropTarget';\n\nimport './DropArea.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n withQuick?: boolean;\n onHide: NoneToVoidFunction;\n onFileSelect: (files: File[], isQuick: boolean) => void;\n};\n\nexport enum DropAreaState {\n None = 'none',\n Document = 'document',\n QuickFile = 'quick_file',\n}\n\nconst DROP_LEAVE_TIMEOUT_MS = 150;\n\nconst DropArea: FC = ({\n isOpen, withQuick, onHide, onFileSelect,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const hideTimeoutRef = useRef(null);\n const prevWithQuick = usePrevious(withQuick);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen);\n\n useEffect(() => (isOpen ? captureEscKeyListener(onHide) : undefined), [isOpen, onHide]);\n\n const handleFilesDrop = useCallback(async (e: React.DragEvent) => {\n const { dataTransfer: dt } = e;\n let files: File[] = [];\n\n if (dt.files && dt.files.length > 0 && (!dt.items || !dt.items.length)) {\n files = files.concat(Array.from(dt.files));\n } else if (dt.items && dt.items.length > 0) {\n const folderFiles = await getFilesFromDataTransferItems(dt.items);\n if (folderFiles.length) {\n files = files.concat(folderFiles);\n }\n }\n\n onHide();\n onFileSelect(files, false);\n }, [onFileSelect, onHide]);\n\n const handleQuickFilesDrop = useCallback((e: React.DragEvent) => {\n const { dataTransfer: dt } = e;\n\n if (dt.files && dt.files.length > 0) {\n onHide();\n onFileSelect(Array.from(dt.files), true);\n }\n }, [onFileSelect, onHide]);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.stopPropagation();\n\n const { target: fromTarget, relatedTarget: toTarget } = e;\n\n // Esc button pressed during drag event\n if ((fromTarget as HTMLDivElement).matches('.DropTarget, .DropArea') && !toTarget) {\n hideTimeoutRef.current = window.setTimeout(() => {\n onHide();\n }, DROP_LEAVE_TIMEOUT_MS);\n }\n }, [onHide]);\n\n const handleDragOver = () => {\n if (hideTimeoutRef.current) {\n window.clearTimeout(hideTimeoutRef.current);\n }\n };\n\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'DropArea',\n transitionClassNames,\n );\n\n return (\n \n \n \n {(withQuick || prevWithQuick) && }\n
\n \n );\n};\n\nexport default memo(DropArea);\n","import type { FC } from '../../../lib/teact/teact';\nimport React, { memo } from '../../../lib/teact/teact';\nimport type { OwnProps } from './EmojiTooltip';\nimport { Bundles } from '../../../util/moduleLoader';\n\nimport useModuleLoader from '../../../hooks/useModuleLoader';\n\nconst EmojiTooltipAsync: FC = (props) => {\n const { isOpen } = props;\n const EmojiTooltip = useModuleLoader(Bundles.Extra, 'EmojiTooltip', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return EmojiTooltip ? : undefined;\n};\n\nexport default memo(EmojiTooltipAsync);\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../../lib/teact/teact';\nimport React, {\n useEffect, useRef, memo, useState, useCallback,\n} from '../../../lib/teact/teact';\nimport { getActions, withGlobal } from '../../../global';\n\nimport type { IAnchorPosition, ISettings } from '../../../types';\n\nimport { EDITABLE_INPUT_ID } from '../../../config';\nimport { selectReplyingToId } from '../../../global/selectors';\nimport { debounce } from '../../../util/schedulers';\nimport focusEditableElement from '../../../util/focusEditableElement';\nimport buildClassName from '../../../util/buildClassName';\nimport {\n IS_ANDROID, IS_EMOJI_SUPPORTED, IS_IOS, IS_SINGLE_COLUMN_LAYOUT, IS_TOUCH_ENV,\n} from '../../../util/environment';\nimport captureKeyboardListeners from '../../../util/captureKeyboardListeners';\nimport useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps';\nimport useFlag from '../../../hooks/useFlag';\nimport { isHeavyAnimating } from '../../../hooks/useHeavyAnimationCheck';\nimport useSendMessageAction from '../../../hooks/useSendMessageAction';\nimport useLang from '../../../hooks/useLang';\nimport parseEmojiOnlyString from '../../common/helpers/parseEmojiOnlyString';\nimport { isSelectionInsideInput } from './helpers/selection';\nimport renderText from '../../common/helpers/renderText';\n\nimport TextFormatter from './TextFormatter';\n\nconst CONTEXT_MENU_CLOSE_DELAY_MS = 100;\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 350;\nconst TRANSITION_DURATION_FACTOR = 50;\n\ntype OwnProps = {\n id: string;\n chatId: string;\n threadId: number;\n isAttachmentModalInput?: boolean;\n editableInputId?: string;\n html: string;\n placeholder: string;\n forcedPlaceholder?: string;\n canAutoFocus: boolean;\n shouldSuppressFocus?: boolean;\n shouldSuppressTextFormatter?: boolean;\n onUpdate: (html: string) => void;\n onSuppressedFocus?: () => void;\n onSend: () => void;\n captionLimit?: number;\n};\n\ntype StateProps = {\n replyingToId?: number;\n noTabCapture?: boolean;\n messageSendKeyCombo?: ISettings['messageSendKeyCombo'];\n};\n\nconst MAX_INPUT_HEIGHT = IS_SINGLE_COLUMN_LAYOUT ? 256 : 416;\nconst TAB_INDEX_PRIORITY_TIMEOUT = 2000;\n// Heuristics allowing the user to make a triple click\nconst SELECTION_RECALCULATE_DELAY_MS = 260;\nconst TEXT_FORMATTER_SAFE_AREA_PX = 90;\n// For some reason Safari inserts `
` after user removes text from input\nconst SAFARI_BR = '
';\n\nfunction clearSelection() {\n const selection = window.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.removeAllRanges) {\n selection.removeAllRanges();\n } else if (selection.empty) {\n selection.empty();\n }\n}\n\nconst MessageInput: FC = ({\n id,\n chatId,\n threadId,\n captionLimit,\n isAttachmentModalInput,\n editableInputId,\n html,\n placeholder,\n forcedPlaceholder,\n canAutoFocus,\n shouldSuppressFocus,\n shouldSuppressTextFormatter,\n replyingToId,\n noTabCapture,\n messageSendKeyCombo,\n onUpdate,\n onSuppressedFocus,\n onSend,\n}) => {\n const {\n editLastMessage,\n replyToNextMessage,\n } = getActions();\n\n // eslint-disable-next-line no-null/no-null\n const inputRef = useRef(null);\n // eslint-disable-next-line no-null/no-null\n const selectionTimeoutRef = useRef(null);\n // eslint-disable-next-line no-null/no-null\n const cloneRef = useRef(null);\n\n const lang = useLang();\n const isContextMenuOpenRef = useRef(false);\n const [isTextFormatterOpen, openTextFormatter, closeTextFormatter] = useFlag();\n const [textFormatterAnchorPosition, setTextFormatterAnchorPosition] = useState();\n const [selectedRange, setSelectedRange] = useState();\n\n const sendMessageAction = useSendMessageAction(chatId, threadId);\n\n useEffect(() => {\n if (!isAttachmentModalInput) return;\n updateInputHeight(false);\n }, [isAttachmentModalInput]);\n\n useLayoutEffectWithPrevDeps(([prevHtml]) => {\n if (html !== inputRef.current!.innerHTML) {\n inputRef.current!.innerHTML = html;\n }\n\n if (html !== cloneRef.current!.innerHTML) {\n cloneRef.current!.innerHTML = html;\n }\n\n if (prevHtml !== undefined && prevHtml !== html) {\n updateInputHeight(!html.length);\n }\n }, [html]);\n\n const chatIdRef = useRef(chatId);\n chatIdRef.current = chatId;\n const focusInput = useCallback(() => {\n if (!inputRef.current) {\n return;\n }\n\n if (isHeavyAnimating()) {\n setTimeout(focusInput, FOCUS_DELAY_MS);\n return;\n }\n\n focusEditableElement(inputRef.current!);\n }, []);\n\n const handleCloseTextFormatter = useCallback(() => {\n closeTextFormatter();\n clearSelection();\n }, [closeTextFormatter]);\n\n function checkSelection() {\n // Disable the formatter on iOS devices for now.\n if (IS_IOS) {\n return false;\n }\n\n const selection = window.getSelection();\n if (!selection || !selection.rangeCount || isContextMenuOpenRef.current) {\n closeTextFormatter();\n return false;\n }\n\n const selectionRange = selection.getRangeAt(0);\n const selectedText = selectionRange.toString().trim();\n if (\n shouldSuppressTextFormatter\n || !isSelectionInsideInput(selectionRange, editableInputId || EDITABLE_INPUT_ID)\n || !selectedText\n || parseEmojiOnlyString(selectedText)\n || !selectionRange.START_TO_END\n ) {\n closeTextFormatter();\n return false;\n }\n\n return true;\n }\n\n function processSelection() {\n if (!checkSelection()) {\n return;\n }\n\n const selectionRange = window.getSelection()!.getRangeAt(0);\n const selectionRect = selectionRange.getBoundingClientRect();\n const inputRect = inputRef.current!.getBoundingClientRect();\n\n let x = (selectionRect.left + selectionRect.width / 2) - inputRect.left;\n\n if (x < TEXT_FORMATTER_SAFE_AREA_PX) {\n x = TEXT_FORMATTER_SAFE_AREA_PX;\n } else if (x > inputRect.width - TEXT_FORMATTER_SAFE_AREA_PX) {\n x = inputRect.width - TEXT_FORMATTER_SAFE_AREA_PX;\n }\n\n setTextFormatterAnchorPosition({\n x,\n y: selectionRect.top - inputRect.top,\n });\n\n setSelectedRange(selectionRange);\n openTextFormatter();\n }\n\n function processSelectionWithTimeout() {\n if (selectionTimeoutRef.current) {\n window.clearTimeout(selectionTimeoutRef.current);\n }\n // Small delay to allow browser properly recalculate selection\n selectionTimeoutRef.current = window.setTimeout(processSelection, SELECTION_RECALCULATE_DELAY_MS);\n }\n\n function handleMouseDown(e: React.MouseEvent) {\n if (e.button !== 2) {\n e.target.addEventListener('mouseup', processSelectionWithTimeout, { once: true });\n return;\n }\n\n if (isContextMenuOpenRef.current) {\n return;\n }\n\n isContextMenuOpenRef.current = true;\n\n function handleCloseContextMenu(e2: KeyboardEvent | MouseEvent) {\n if (e2 instanceof KeyboardEvent && e2.key !== 'Esc' && e2.key !== 'Escape') {\n return;\n }\n\n setTimeout(() => {\n isContextMenuOpenRef.current = false;\n }, CONTEXT_MENU_CLOSE_DELAY_MS);\n\n window.removeEventListener('keydown', handleCloseContextMenu);\n window.removeEventListener('mousedown', handleCloseContextMenu);\n }\n\n document.addEventListener('mousedown', handleCloseContextMenu);\n document.addEventListener('keydown', handleCloseContextMenu);\n }\n\n function handleKeyDown(e: React.KeyboardEvent) {\n // https://levelup.gitconnected.com/javascript-events-handlers-keyboard-and-load-events-1b3e46a6b0c3#1960\n const { isComposing } = e;\n\n if (!isComposing && !html.length && (e.metaKey || e.ctrlKey)) {\n const targetIndexDelta = e.key === 'ArrowDown' ? 1 : e.key === 'ArrowUp' ? -1 : undefined;\n if (targetIndexDelta) {\n e.preventDefault();\n\n replyToNextMessage({ targetIndexDelta });\n return;\n }\n }\n\n if (!isComposing && e.key === 'Enter' && !e.shiftKey) {\n if (\n !(IS_IOS || IS_ANDROID)\n && (\n (messageSendKeyCombo === 'enter' && !e.shiftKey)\n || (messageSendKeyCombo === 'ctrl-enter' && (e.ctrlKey || e.metaKey))\n )\n ) {\n e.preventDefault();\n\n closeTextFormatter();\n onSend();\n }\n } else if (!isComposing && e.key === 'ArrowUp' && !html.length && !e.metaKey && !e.ctrlKey && !e.altKey) {\n e.preventDefault();\n editLastMessage();\n } else {\n e.target.addEventListener('keyup', processSelectionWithTimeout, { once: true });\n }\n }\n\n function handleChange(e: ChangeEvent) {\n const { innerHTML, textContent } = e.currentTarget;\n\n onUpdate(innerHTML === SAFARI_BR ? '' : innerHTML);\n sendMessageAction({ type: 'typing' });\n\n // Reset focus on the input to remove any active styling when input is cleared\n if (\n !IS_TOUCH_ENV\n && (!textContent || !textContent.length)\n // When emojis are not supported, innerHTML contains an emoji img tag that doesn't exist in the textContext\n && !(!IS_EMOJI_SUPPORTED && innerHTML.includes('emoji-small'))\n ) {\n const selection = window.getSelection()!;\n if (selection) {\n inputRef.current!.blur();\n selection.removeAllRanges();\n focusEditableElement(inputRef.current!, true);\n }\n }\n }\n\n function stopEvent(e: React.MouseEvent) {\n if (!checkSelection()) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n }\n\n function updateInputHeight(willSend = false) {\n const input = inputRef.current!;\n const clone = cloneRef.current!;\n const currentHeight = Number(input.style.height.replace('px', ''));\n const newHeight = Math.min(clone.scrollHeight, MAX_INPUT_HEIGHT);\n if (newHeight === currentHeight) {\n return;\n }\n\n const transitionDuration = Math.round(\n TRANSITION_DURATION_FACTOR * Math.log(Math.abs(newHeight - currentHeight)),\n );\n\n const exec = () => {\n input.style.height = `${newHeight}px`;\n input.style.transitionDuration = `${transitionDuration}ms`;\n input.classList.toggle('overflown', clone.scrollHeight > MAX_INPUT_HEIGHT);\n };\n\n if (willSend) {\n // Sync with sending animation\n requestAnimationFrame(exec);\n } else {\n exec();\n }\n }\n\n useEffect(() => {\n if (IS_TOUCH_ENV) {\n return;\n }\n\n if (canAutoFocus) {\n focusInput();\n }\n }, [chatId, focusInput, replyingToId, canAutoFocus]);\n\n useEffect(() => {\n if (noTabCapture) {\n return undefined;\n }\n\n const captureFirstTab = debounce((e: KeyboardEvent) => {\n if (e.key === 'Tab') {\n e.preventDefault();\n requestAnimationFrame(focusInput);\n }\n }, TAB_INDEX_PRIORITY_TIMEOUT, true, false);\n\n return captureKeyboardListeners({ onTab: captureFirstTab });\n }, [focusInput, noTabCapture]);\n\n useEffect(() => {\n const input = inputRef.current!;\n\n function suppressFocus() {\n input.blur();\n }\n\n if (shouldSuppressFocus) {\n input.addEventListener('focus', suppressFocus);\n }\n\n return () => {\n input.removeEventListener('focus', suppressFocus);\n };\n }, [shouldSuppressFocus]);\n\n const className = buildClassName(\n 'form-control custom-scroll',\n html.length > 0 && 'touched',\n shouldSuppressFocus && 'focus-disabled',\n );\n\n return (\n
\n \n {captionLimit && (\n
\n {captionLimit}\n
\n )}\n\n
\n {!forcedPlaceholder && {placeholder}}\n \n {forcedPlaceholder && {renderText(forcedPlaceholder!)}}\n
\n );\n};\n\nexport default memo(withGlobal(\n (global, { chatId, threadId }: OwnProps): StateProps => {\n const { messageSendKeyCombo } = global.settings.byKey;\n\n return {\n messageSendKeyCombo,\n replyingToId: chatId && threadId ? selectReplyingToId(global, chatId, threadId) : undefined,\n noTabCapture: global.pollModal.isOpen || global.payment.isPaymentModalOpen,\n };\n },\n)(MessageInput));\n","import type { FC } from '../../../lib/teact/teact';\nimport React, {\n memo, useCallback, useEffect, useRef, useState,\n} from '../../../lib/teact/teact';\n\nimport type { IAnchorPosition } from '../../../types';\nimport { ApiMessageEntityTypes } from '../../../api/types';\n\nimport { EDITABLE_INPUT_ID } from '../../../config';\nimport buildClassName from '../../../util/buildClassName';\nimport { ensureProtocol } from '../../../util/ensureProtocol';\nimport captureEscKeyListener from '../../../util/captureEscKeyListener';\nimport getKeyFromEvent from '../../../util/getKeyFromEvent';\nimport useShowTransition from '../../../hooks/useShowTransition';\nimport useVirtualBackdrop from '../../../hooks/useVirtualBackdrop';\nimport useFlag from '../../../hooks/useFlag';\nimport useLang from '../../../hooks/useLang';\n\nimport Button from '../../ui/Button';\n\nimport './TextFormatter.scss';\n\nexport type OwnProps = {\n isOpen: boolean;\n anchorPosition?: IAnchorPosition;\n selectedRange?: Range;\n setSelectedRange: (range: Range) => void;\n onClose: () => void;\n};\n\ninterface ISelectedTextFormats {\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n monospace?: boolean;\n spoiler?: boolean;\n}\n\nconst TEXT_FORMAT_BY_TAG_NAME: Record = {\n B: 'bold',\n STRONG: 'bold',\n I: 'italic',\n EM: 'italic',\n U: 'underline',\n DEL: 'strikethrough',\n CODE: 'monospace',\n SPAN: 'spoiler',\n};\nconst fragmentEl = document.createElement('div');\n\nconst TextFormatter: FC = ({\n isOpen,\n anchorPosition,\n selectedRange,\n setSelectedRange,\n onClose,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef(null);\n // eslint-disable-next-line no-null/no-null\n const linkUrlInputRef = useRef(null);\n const { shouldRender, transitionClassNames } = useShowTransition(isOpen);\n const [isLinkControlOpen, openLinkControl, closeLinkControl] = useFlag();\n const [linkUrl, setLinkUrl] = useState('');\n const [isEditingLink, setIsEditingLink] = useState(false);\n const [inputClassName, setInputClassName] = useState();\n const [selectedTextFormats, setSelectedTextFormats] = useState({});\n\n useEffect(() => (isOpen ? captureEscKeyListener(onClose) : undefined), [isOpen, onClose]);\n useVirtualBackdrop(\n isOpen,\n containerRef,\n onClose,\n );\n\n useEffect(() => {\n if (isLinkControlOpen) {\n linkUrlInputRef.current!.focus();\n } else {\n setLinkUrl('');\n setIsEditingLink(false);\n }\n }, [isLinkControlOpen]);\n\n useEffect(() => {\n if (!shouldRender) {\n closeLinkControl();\n setSelectedTextFormats({});\n setInputClassName(undefined);\n }\n }, [closeLinkControl, shouldRender]);\n\n useEffect(() => {\n if (!isOpen || !selectedRange) {\n return;\n }\n\n const selectedFormats: ISelectedTextFormats = {};\n let { parentElement } = selectedRange.commonAncestorContainer;\n while (parentElement && parentElement.id !== EDITABLE_INPUT_ID) {\n const textFormat = TEXT_FORMAT_BY_TAG_NAME[parentElement.tagName];\n if (textFormat) {\n selectedFormats[textFormat] = true;\n }\n\n parentElement = parentElement.parentElement;\n }\n\n setSelectedTextFormats(selectedFormats);\n }, [isOpen, selectedRange, openLinkControl]);\n\n const restoreSelection = useCallback(() => {\n if (!selectedRange) {\n return;\n }\n\n const selection = window.getSelection();\n if (selection) {\n selection.removeAllRanges();\n selection.addRange(selectedRange);\n }\n }, [selectedRange]);\n\n const updateSelectedRange = useCallback(() => {\n const selection = window.getSelection();\n if (selection) {\n setSelectedRange(selection.getRangeAt(0));\n }\n }, [setSelectedRange]);\n\n const getSelectedText = useCallback(() => {\n if (!selectedRange) {\n return undefined;\n }\n fragmentEl.replaceChildren(selectedRange.cloneContents());\n return fragmentEl.innerHTML;\n }, [selectedRange]);\n\n const getSelectedElement = useCallback(() => {\n if (!selectedRange) {\n return undefined;\n }\n\n return selectedRange.commonAncestorContainer.parentElement;\n }, [selectedRange]);\n\n function updateInputStyles() {\n const input = linkUrlInputRef.current;\n if (!input) {\n return;\n }\n\n const { offsetWidth, scrollWidth, scrollLeft } = input;\n if (scrollWidth <= offsetWidth) {\n setInputClassName(undefined);\n return;\n }\n\n let className = '';\n if (scrollLeft < scrollWidth - offsetWidth) {\n className = 'mask-right';\n }\n if (scrollLeft > 0) {\n className += ' mask-left';\n }\n\n setInputClassName(className);\n }\n\n function handleLinkUrlChange(e: React.ChangeEvent) {\n setLinkUrl(e.target.value);\n updateInputStyles();\n }\n\n function getFormatButtonClassName(key: keyof ISelectedTextFormats) {\n if (selectedTextFormats[key]) {\n return 'active';\n }\n\n if (key === 'monospace' || key === 'strikethrough') {\n if (Object.keys(selectedTextFormats).some(\n (fKey) => fKey !== key && Boolean(selectedTextFormats[fKey as keyof ISelectedTextFormats]),\n )) {\n return 'disabled';\n }\n } else if (selectedTextFormats.monospace || selectedTextFormats.strikethrough) {\n return 'disabled';\n }\n\n return undefined;\n }\n\n const handleSpoilerText = useCallback(() => {\n if (selectedTextFormats.spoiler) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.dataset.entityType !== ApiMessageEntityTypes.Spoiler\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n spoiler: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand(\n 'insertHTML', false, `${text}`,\n );\n onClose();\n }, [getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.spoiler]);\n\n const handleBoldText = useCallback(() => {\n setSelectedTextFormats((selectedFormats) => {\n // Somehow re-applying 'bold' command to already bold text doesn't work\n document.execCommand(selectedFormats.bold ? 'removeFormat' : 'bold');\n Object.keys(selectedFormats).forEach((key) => {\n if ((key === 'italic' || key === 'underline') && Boolean(selectedFormats[key])) {\n document.execCommand(key);\n }\n });\n\n updateSelectedRange();\n return {\n ...selectedFormats,\n bold: !selectedFormats.bold,\n };\n });\n }, [updateSelectedRange]);\n\n const handleItalicText = useCallback(() => {\n document.execCommand('italic');\n updateSelectedRange();\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n italic: !selectedFormats.italic,\n }));\n }, [updateSelectedRange]);\n\n const handleUnderlineText = useCallback(() => {\n document.execCommand('underline');\n updateSelectedRange();\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n underline: !selectedFormats.underline,\n }));\n }, [updateSelectedRange]);\n\n const handleStrikethroughText = useCallback(() => {\n if (selectedTextFormats.strikethrough) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.tagName !== 'DEL'\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n strikethrough: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand('insertHTML', false, `${text}`);\n onClose();\n }, [\n getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.strikethrough,\n ]);\n\n const handleMonospaceText = useCallback(() => {\n if (selectedTextFormats.monospace) {\n const element = getSelectedElement();\n if (\n !selectedRange\n || !element\n || element.tagName !== 'CODE'\n || !element.textContent\n ) {\n return;\n }\n\n element.replaceWith(element.textContent);\n setSelectedTextFormats((selectedFormats) => ({\n ...selectedFormats,\n monospace: false,\n }));\n\n return;\n }\n\n const text = getSelectedText();\n document.execCommand('insertHTML', false, `${text}`);\n onClose();\n }, [\n getSelectedElement, getSelectedText, onClose, selectedRange, selectedTextFormats.monospace,\n ]);\n\n const handleLinkUrlConfirm = useCallback(() => {\n const formattedLinkUrl = (ensureProtocol(linkUrl) || '').split('%').map(encodeURI).join('%');\n\n if (isEditingLink) {\n const element = getSelectedElement();\n if (!element || element.tagName !== 'A') {\n return;\n }\n\n (element as HTMLAnchorElement).href = formattedLinkUrl;\n\n onClose();\n\n return;\n }\n\n const text = getSelectedText();\n restoreSelection();\n document.execCommand(\n 'insertHTML',\n false,\n `${text}`,\n );\n onClose();\n }, [getSelectedElement, getSelectedText, isEditingLink, linkUrl, onClose, restoreSelection]);\n\n const handleKeyDown = useCallback((e: KeyboardEvent) => {\n const HANDLERS_BY_KEY: Record = {\n k: openLinkControl,\n b: handleBoldText,\n u: handleUnderlineText,\n i: handleItalicText,\n m: handleMonospaceText,\n s: handleStrikethroughText,\n p: handleSpoilerText,\n };\n\n const handler = HANDLERS_BY_KEY[getKeyFromEvent(e)];\n\n if (\n e.altKey\n || !(e.ctrlKey || e.metaKey)\n || !handler\n ) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n handler();\n }, [\n openLinkControl, handleBoldText, handleUnderlineText, handleItalicText, handleMonospaceText,\n handleStrikethroughText, handleSpoilerText,\n ]);\n\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('keydown', handleKeyDown);\n }\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, handleKeyDown]);\n\n const lang = useLang();\n\n function handleContainerKeyDown(e: React.KeyboardEvent) {\n if (e.key === 'Enter' && isLinkControlOpen) {\n handleLinkUrlConfirm();\n e.preventDefault();\n }\n }\n\n if (!shouldRender) {\n return undefined;\n }\n\n const className = buildClassName(\n 'TextFormatter',\n transitionClassNames,\n isLinkControlOpen && 'link-control-shown',\n );\n\n const linkUrlConfirmClassName = buildClassName(\n 'TextFormatter-link-url-confirm',\n Boolean(linkUrl.length) && 'shown',\n );\n\n const style = anchorPosition\n ? `left: ${anchorPosition.x}px; top: ${anchorPosition.y}px;--text-formatter-left: ${anchorPosition.x}px;`\n : '';\n\n return (\n \n
\n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n\n
\n
\n \n
\n\n \n \n
\n\n
\n
\n \n \n \n
\n
\n
\n
\n );\n};\n\nexport default memo(TextFormatter);\n","export default function getKeyFromEvent(e: KeyboardEvent) {\n const key = 'key' in e ? e.key : e.code;\n\n return key.startsWith('Key') ? key.slice(3).toLowerCase() : key;\n}\n","export default async function getFilesFromDataTransferItems(dataTransferItems: DataTransferItemList) {\n const files: File[] = [];\n\n function traverseFileTreePromise(entry: FileSystemEntry | File, item: DataTransferItem) {\n return new Promise((resolve) => {\n if (entry instanceof File) {\n files.push(entry);\n resolve(entry);\n } else if (entry.isFile) {\n const itemFile = item.getAsFile();\n (entry as FileSystemFileEntry).file((file) => {\n files.push(file);\n resolve(file);\n }, () => {\n // iOS Safari throws an error \"NotFoundError: Path does not exist\" for files from the clipboard\n // https://stackoverflow.com/a/50059309\n if (itemFile) {\n files.push(itemFile);\n }\n resolve(itemFile);\n });\n } else if (entry.isDirectory) {\n const dirReader = (entry as FileSystemDirectoryEntry).createReader();\n dirReader.readEntries((entries) => {\n const entriesPromises = [];\n for (let i = 0; i < entries.length; i++) {\n entriesPromises.push(traverseFileTreePromise(entries[i], item));\n }\n resolve(Promise.all(entriesPromises));\n });\n }\n });\n }\n\n const entriesPromises = [];\n for (let i = 0; i < dataTransferItems.length; i++) {\n const item = dataTransferItems[i];\n if (item.kind === 'file') {\n const entry = item.webkitGetAsEntry() || item.getAsFile();\n if (entry) {\n entriesPromises.push(traverseFileTreePromise(entry, item));\n }\n }\n }\n\n await Promise.all(entriesPromises);\n\n return files.map(fixMovMime);\n}\n\n// .mov MIME type not reported sometimes https://developer.mozilla.org/en-US/docs/Web/API/File/type#sect1\nfunction fixMovMime(file: File) {\n const ext = file.name.split('.').pop()!;\n if (!file.type && ext.toLowerCase() === 'mov') {\n return new File([file], file.name, { type: 'video/quicktime' });\n }\n return file;\n}\n","const RE_BR = /(
|)/g;\nconst RE_SPACE = /( |\\u00A0)/g;\nconst RE_CLEAN_HTML = /(
|<\\/div>)/gi;\nconst RE_EXTRA_NEW_LINE = /\\n$/i;\n\nexport function prepareForRegExp(html: string) {\n return html\n .replace(RE_SPACE, ' ')\n .replace(RE_BR, '\\n')\n .replace(RE_CLEAN_HTML, '')\n .replace(RE_EXTRA_NEW_LINE, '');\n}\n","const MAX_NESTING_PARENTS = 5;\n\nexport function isSelectionInsideInput(selectionRange: Range, inputId: string) {\n const { commonAncestorContainer } = selectionRange;\n let parentNode: HTMLElement | null = commonAncestorContainer as HTMLElement;\n let iterations = 1;\n while (parentNode && parentNode.id !== inputId && iterations < MAX_NESTING_PARENTS) {\n parentNode = parentNode.parentElement;\n iterations++;\n }\n\n return Boolean(parentNode && parentNode.id === inputId);\n}\n","import { areSortedArraysEqual } from './iteratees';\n\nconst cache = new WeakMap();\n\nexport default function memoized(fn: T) {\n return (...args: Parameters): ReturnType => {\n const cached = cache.get(fn);\n if (cached && areSortedArraysEqual(cached.lastArgs, args)) {\n return cached.lastResult;\n }\n\n const result = fn(...args);\n cache.set(fn, { lastArgs: args, lastResult: result });\n return result;\n };\n}\n","import {\n useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\n\nimport { EDITABLE_INPUT_CSS_SELECTOR, EDITABLE_INPUT_ID } from '../../../../config';\nimport { MEMO_EMPTY_ARRAY } from '../../../../util/memo';\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\nimport type { EmojiData, EmojiModule, EmojiRawData } from '../../../../util/emoji';\nimport { uncompressEmoji } from '../../../../util/emoji';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport {\n buildCollectionByKey, mapValues, pickTruthy, unique,\n} from '../../../../util/iteratees';\nimport memoized from '../../../../util/memoized';\nimport useFlag from '../../../../hooks/useFlag';\nimport renderText from '../../../common/helpers/renderText';\n\ninterface Library {\n keywords: string[];\n byKeyword: Record;\n names: string[];\n byName: Record;\n}\n\nlet emojiDataPromise: Promise;\nlet emojiRawData: EmojiRawData;\nlet emojiData: EmojiData;\n\nlet RE_EMOJI_SEARCH: RegExp;\nconst EMOJIS_LIMIT = 36;\nconst FILTER_MIN_LENGTH = 2;\n\nconst prepareRecentEmojisMemo = memoized(prepareRecentEmojis);\nconst prepareLibraryMemo = memoized(prepareLibrary);\nconst searchInLibraryMemo = memoized(searchInLibrary);\n\ntry {\n RE_EMOJI_SEARCH = /(^|\\s):[-+_:\\p{L}\\p{N}]*$/gui;\n} catch (e) {\n // Support for older versions of firefox\n RE_EMOJI_SEARCH = /(^|\\s):[-+_:\\d\\wа-яё]*$/gi;\n}\n\nexport default function useEmojiTooltip(\n isAllowed: boolean,\n htmlRef: { current: string },\n recentEmojiIds: string[],\n inputId = EDITABLE_INPUT_ID,\n onUpdateHtml: (html: string) => void,\n baseEmojiKeywords?: Record,\n emojiKeywords?: Record,\n isDisabled = false,\n) {\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const [byId, setById] = useState | undefined>();\n const [shouldForceInsertEmoji, setShouldForceInsertEmoji] = useState(false);\n const [filteredEmojis, setFilteredEmojis] = useState(MEMO_EMPTY_ARRAY);\n\n // Initialize data on first render.\n useEffect(() => {\n if (isDisabled) return;\n const exec = () => {\n setById(emojiData.emojis);\n };\n\n if (emojiData) {\n exec();\n } else {\n ensureEmojiData()\n .then(exec);\n }\n }, [isDisabled]);\n\n const html = htmlRef.current;\n useEffect(() => {\n if (!isAllowed || !html || !byId || isDisabled) {\n unmarkIsOpen();\n return;\n }\n\n const code = html.includes(':') && getEmojiCode(html);\n if (!code) {\n setFilteredEmojis(MEMO_EMPTY_ARRAY);\n unmarkIsOpen();\n return;\n }\n\n const forceSend = code.length > 2 && code.endsWith(':');\n const filter = code.substr(1, forceSend ? code.length - 2 : undefined);\n let matched: Emoji[] = MEMO_EMPTY_ARRAY;\n\n setShouldForceInsertEmoji(forceSend);\n\n if (!filter) {\n matched = prepareRecentEmojisMemo(byId, recentEmojiIds, EMOJIS_LIMIT);\n } else if (filter.length >= FILTER_MIN_LENGTH) {\n const library = prepareLibraryMemo(byId, baseEmojiKeywords, emojiKeywords);\n matched = searchInLibraryMemo(library, filter, EMOJIS_LIMIT);\n }\n\n if (matched.length) {\n if (!forceSend) {\n markIsOpen();\n }\n setFilteredEmojis(matched);\n } else {\n unmarkIsOpen();\n }\n }, [\n byId, html, isAllowed, markIsOpen, recentEmojiIds, unmarkIsOpen, setShouldForceInsertEmoji,\n isDisabled, baseEmojiKeywords, emojiKeywords,\n ]);\n\n const insertEmoji = useCallback((textEmoji: string, isForce?: boolean) => {\n const currentHtml = htmlRef.current;\n const atIndex = currentHtml.lastIndexOf(':', isForce ? currentHtml.lastIndexOf(':') - 1 : undefined);\n if (atIndex !== -1) {\n onUpdateHtml(`${currentHtml.substr(0, atIndex)}${renderText(textEmoji, ['emoji_html'])}`);\n let messageInput: HTMLDivElement;\n if (inputId === EDITABLE_INPUT_ID) {\n messageInput = document.querySelector(EDITABLE_INPUT_CSS_SELECTOR)!;\n } else {\n messageInput = document.getElementById(inputId) as HTMLDivElement;\n }\n requestAnimationFrame(() => {\n focusEditableElement(messageInput, true, true);\n });\n }\n\n unmarkIsOpen();\n }, [htmlRef, inputId, onUpdateHtml, unmarkIsOpen]);\n\n useEffect(() => {\n if (isOpen && shouldForceInsertEmoji && filteredEmojis.length) {\n insertEmoji(filteredEmojis[0].native, true);\n }\n }, [filteredEmojis, insertEmoji, isOpen, shouldForceInsertEmoji]);\n\n return {\n isEmojiTooltipOpen: isOpen,\n closeEmojiTooltip: unmarkIsOpen,\n filteredEmojis,\n insertEmoji,\n };\n}\n\nfunction getEmojiCode(html: string) {\n const emojis = prepareForRegExp(html).match(RE_EMOJI_SEARCH);\n\n return emojis ? emojis[0].trim() : undefined;\n}\n\nasync function ensureEmojiData() {\n if (!emojiDataPromise) {\n emojiDataPromise = import('emoji-data-ios/emoji-data.json') as unknown as Promise;\n emojiRawData = (await emojiDataPromise).default;\n\n emojiData = uncompressEmoji(emojiRawData);\n }\n\n return emojiDataPromise;\n}\n\nfunction prepareRecentEmojis(byId: Record, recentEmojiIds: string[], limit: number) {\n if (!byId || !recentEmojiIds.length) {\n return MEMO_EMPTY_ARRAY;\n }\n\n return Object.values(pickTruthy(byId, recentEmojiIds)).slice(0, limit);\n}\n\nfunction prepareLibrary(\n byId: Record,\n baseEmojiKeywords?: Record,\n emojiKeywords?: Record,\n): Library {\n const emojis = Object.values(byId);\n\n const byNative = buildCollectionByKey(emojis, 'native');\n const baseEmojisByKeyword = baseEmojiKeywords\n ? mapValues(baseEmojiKeywords, (natives) => {\n return Object.values(pickTruthy(byNative, natives));\n })\n : {};\n const emojisByKeyword = emojiKeywords\n ? mapValues(emojiKeywords, (natives) => {\n return Object.values(pickTruthy(byNative, natives));\n })\n : {};\n\n const byKeyword = { ...baseEmojisByKeyword, ...emojisByKeyword };\n const keywords = ([] as string[]).concat(Object.keys(baseEmojisByKeyword), Object.keys(emojisByKeyword));\n\n const byName = emojis.reduce((result, emoji) => {\n emoji.names.forEach((name) => {\n if (!result[name]) {\n result[name] = [];\n }\n\n result[name].push(emoji);\n });\n\n return result;\n }, {} as Record);\n\n const names = Object.keys(byName);\n\n return {\n byKeyword,\n keywords,\n byName,\n names,\n };\n}\n\nfunction searchInLibrary(library: Library, filter: string, limit: number) {\n const {\n byKeyword, keywords, byName, names,\n } = library;\n\n let matched: Emoji[] = MEMO_EMPTY_ARRAY;\n\n const matchedKeywords = keywords.filter((keyword) => keyword.startsWith(filter)).sort();\n matched = matched.concat(Object.values(pickTruthy(byKeyword!, matchedKeywords)).flat());\n\n // Also search by names, which is useful for non-English languages\n const matchedNames = names.filter((name) => name.startsWith(filter));\n matched = matched.concat(Object.values(pickTruthy(byName, matchedNames)).flat());\n\n matched = unique(matched);\n\n return matched.slice(0, limit);\n}\n","import {\n useCallback, useEffect, useState,\n} from '../../../../lib/teact/teact';\nimport { getGlobal } from '../../../../global';\n\nimport type { ApiChatMember, ApiUser } from '../../../../api/types';\nimport { ApiMessageEntityTypes } from '../../../../api/types';\nimport { EDITABLE_INPUT_ID } from '../../../../config';\nimport { filterUsersByName, getUserFirstOrLastName } from '../../../../global/helpers';\nimport { prepareForRegExp } from '../helpers/prepareForRegExp';\nimport focusEditableElement from '../../../../util/focusEditableElement';\nimport useFlag from '../../../../hooks/useFlag';\nimport { pickTruthy, unique } from '../../../../util/iteratees';\nimport { throttle } from '../../../../util/schedulers';\n\nconst runThrottled = throttle((cb) => cb(), 500, true);\nlet RE_USERNAME_SEARCH: RegExp;\n\ntry {\n RE_USERNAME_SEARCH = /(^|\\s)@[-_\\p{L}\\p{M}\\p{N}]*$/gui;\n} catch (e) {\n // Support for older versions of firefox\n RE_USERNAME_SEARCH = /(^|\\s)@[-_\\d\\wа-яё]*$/gi;\n}\n\nexport default function useMentionTooltip(\n canSuggestMembers: boolean | undefined,\n htmlRef: { current: string },\n onUpdateHtml: (html: string) => void,\n inputId: string = EDITABLE_INPUT_ID,\n groupChatMembers?: ApiChatMember[],\n topInlineBotIds?: string[],\n currentUserId?: string,\n) {\n const [isOpen, markIsOpen, unmarkIsOpen] = useFlag();\n const [usersToMention, setUsersToMention] = useState();\n\n const updateFilteredUsers = useCallback((filter, withInlineBots: boolean) => {\n // No need for expensive global updates on users, so we avoid them\n const usersById = getGlobal().users.byId;\n\n if (!(groupChatMembers || topInlineBotIds) || !usersById) {\n setUsersToMention(undefined);\n\n return;\n }\n\n runThrottled(() => {\n const memberIds = groupChatMembers?.reduce((acc: string[], member) => {\n if (member.userId !== currentUserId) {\n acc.push(member.userId);\n }\n\n return acc;\n }, []);\n\n const filteredIds = filterUsersByName(unique([\n ...((withInlineBots && topInlineBotIds) || []),\n ...(memberIds || []),\n ]), usersById, filter);\n\n setUsersToMention(Object.values(pickTruthy(usersById, filteredIds)));\n });\n }, [currentUserId, groupChatMembers, topInlineBotIds]);\n\n const html = htmlRef.current;\n useEffect(() => {\n if (!canSuggestMembers || !html.length) {\n unmarkIsOpen();\n return;\n }\n\n const usernameFilter = html.includes('@') && getUsernameFilter(html);\n\n if (usernameFilter) {\n const filter = usernameFilter ? usernameFilter.substr(1) : '';\n updateFilteredUsers(filter, canSuggestInlineBots(html));\n } else {\n unmarkIsOpen();\n }\n }, [canSuggestMembers, updateFilteredUsers, markIsOpen, unmarkIsOpen, html]);\n\n useEffect(() => {\n if (usersToMention?.length) {\n markIsOpen();\n } else {\n unmarkIsOpen();\n }\n }, [markIsOpen, unmarkIsOpen, usersToMention]);\n\n const insertMention = useCallback((user: ApiUser, forceFocus = false) => {\n if (!user.username && !getUserFirstOrLastName(user)) {\n return;\n }\n\n const insertedHtml = user.username\n ? `@${user.username}`\n : `${getUserFirstOrLastName(user)}`;\n\n const currentHtml = htmlRef.current;\n const atIndex = currentHtml.lastIndexOf('@');\n if (atIndex !== -1) {\n onUpdateHtml(`${currentHtml.substr(0, atIndex)}${insertedHtml} `);\n const messageInput = document.getElementById(inputId)!;\n requestAnimationFrame(() => {\n focusEditableElement(messageInput, forceFocus);\n });\n }\n\n unmarkIsOpen();\n }, [htmlRef, inputId, onUpdateHtml, unmarkIsOpen]);\n\n return {\n isMentionTooltipOpen: isOpen,\n closeMentionTooltip: unmarkIsOpen,\n insertMention,\n mentionFilteredUsers: usersToMention,\n };\n}\n\nfunction getUsernameFilter(html: string) {\n const username = prepareForRegExp(html).match(RE_USERNAME_SEARCH);\n\n return username ? username[0].trim() : undefined;\n}\n\nfunction canSuggestInlineBots(html: string) {\n return html.startsWith('@');\n}\n","import { useEffect, useRef } from '../../../lib/teact/teact';\n\nimport useOnChange from '../../../hooks/useOnChange';\nimport useForceUpdate from '../../../hooks/useForceUpdate';\n\nexport default function useAsyncRendering(dependencies: T, delay?: number) {\n const isDisabled = delay === undefined;\n const shouldRenderRef = useRef(isDisabled);\n const timeoutRef = useRef();\n const forceUpdate = useForceUpdate();\n\n useOnChange(() => {\n if (isDisabled) {\n return;\n }\n\n shouldRenderRef.current = false;\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n }, dependencies);\n\n useEffect(() => {\n if (isDisabled || shouldRenderRef.current) {\n return;\n }\n\n const exec = () => {\n shouldRenderRef.current = true;\n forceUpdate();\n };\n\n if (delay! > 0) {\n timeoutRef.current = window.setTimeout(exec, delay);\n } else {\n exec();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return shouldRenderRef.current;\n}\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, memo, useState } from '../../lib/teact/teact';\n\nimport Checkbox from './Checkbox';\n\ntype IRadioOption = {\n label: string;\n subLabel?: string;\n value: string;\n};\n\ntype OwnProps = {\n id?: string;\n options: IRadioOption[];\n selected?: string[];\n disabled?: boolean;\n round?: boolean;\n loadingOptions?: string[];\n onChange: (value: string[]) => void;\n};\n\nconst CheckboxGroup: FC = ({\n id,\n options,\n selected = [],\n disabled,\n round,\n loadingOptions,\n onChange,\n}) => {\n const [values, setValues] = useState(selected || []);\n\n const handleChange = useCallback((event: ChangeEvent) => {\n const { value, checked } = event.currentTarget;\n let newValues: string[];\n if (checked) {\n newValues = [...values, value];\n } else {\n newValues = values.filter((v) => v !== value);\n }\n\n setValues(newValues);\n onChange(newValues);\n }, [onChange, values]);\n\n return (\n
\n {options.map((option) => (\n \n ))}\n
\n );\n};\n\nexport default memo(CheckboxGroup);\n","import type { FC, TeactNode } from '../../lib/teact/teact';\nimport React, { memo, useCallback, useRef } from '../../lib/teact/teact';\n\nimport type { TextPart } from '../../types';\n\nimport useLang from '../../hooks/useLang';\nimport useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation';\n\nimport Modal from './Modal';\nimport Button from './Button';\n\ntype OwnProps = {\n isOpen: boolean;\n onClose: () => void;\n onCloseAnimationEnd?: () => void;\n title?: string;\n header?: TeactNode;\n textParts?: TextPart[];\n text?: string;\n confirmLabel?: string;\n confirmHandler: () => void;\n confirmIsDestructive?: boolean;\n isButtonsInOneRow?: boolean;\n children?: React.ReactNode;\n};\n\nconst ConfirmDialog: FC = ({\n isOpen,\n onClose,\n onCloseAnimationEnd,\n title,\n header,\n text,\n textParts,\n confirmLabel = 'Confirm',\n confirmHandler,\n confirmIsDestructive,\n isButtonsInOneRow,\n children,\n}) => {\n const lang = useLang();\n\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef(null);\n\n const handleSelectWithEnter = useCallback((index: number) => {\n if (index === -1) confirmHandler();\n }, [confirmHandler]);\n\n const handleKeyDown = useKeyboardListNavigation(containerRef, isOpen, handleSelectWithEnter, '.Button');\n\n return (\n \n {text && text.split('\\\\n').map((textPart) => (\n

{textPart}

\n ))}\n {textParts || children}\n
\n \n {confirmLabel}\n \n \n
\n \n );\n};\n\nexport default memo(ConfirmDialog);\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport type { OwnProps as ButtonProps } from './Button';\nimport Button from './Button';\n\nimport './FloatingActionButton.scss';\n\ntype OwnProps = {\n isShown: boolean;\n className?: string;\n color?: ButtonProps['color'];\n ariaLabel?: ButtonProps['ariaLabel'];\n disabled?: boolean;\n onClick: () => void;\n children: React.ReactNode;\n};\n\nconst FloatingActionButton: FC = ({\n isShown,\n className,\n color = 'primary',\n ariaLabel,\n disabled,\n onClick,\n children,\n}) => {\n const buttonClassName = buildClassName(\n 'FloatingActionButton',\n isShown && 'revealed',\n className,\n );\n\n return (\n \n {children}\n \n );\n};\n\nexport default FloatingActionButton;\n","import type { RefObject } from 'react';\nimport type { FC, TeactNode } from '../../lib/teact/teact';\nimport React, { useRef, useCallback } from '../../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../../util/environment';\nimport { fastRaf } from '../../util/schedulers';\nimport buildClassName from '../../util/buildClassName';\nimport useContextMenuHandlers from '../../hooks/useContextMenuHandlers';\nimport useContextMenuPosition from '../../hooks/useContextMenuPosition';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\n\nimport RippleEffect from './RippleEffect';\nimport Menu from './Menu';\nimport MenuItem from './MenuItem';\nimport Button from './Button';\n\nimport './ListItem.scss';\n\ninterface MenuItemContextAction {\n title: string;\n icon: string;\n destructive?: boolean;\n handler?: () => void;\n}\n\ninterface OwnProps {\n ref?: RefObject;\n buttonRef?: RefObject;\n icon?: string;\n leftElement?: TeactNode;\n secondaryIcon?: string;\n buttonClassName?: string;\n className?: string;\n style?: string;\n children: React.ReactNode;\n disabled?: boolean;\n ripple?: boolean;\n narrow?: boolean;\n inactive?: boolean;\n focus?: boolean;\n destructive?: boolean;\n multiline?: boolean;\n isStatic?: boolean;\n contextActions?: MenuItemContextAction[];\n onMouseDown?: (e: React.MouseEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n onSecondaryIconClick?: (e: React.MouseEvent) => void;\n onDragEnter?: (e: React.DragEvent) => void;\n}\n\nconst ListItem: FC = ({\n ref,\n buttonRef,\n icon,\n leftElement,\n buttonClassName,\n secondaryIcon,\n className,\n style,\n children,\n disabled,\n ripple,\n narrow,\n inactive,\n focus,\n destructive,\n multiline,\n isStatic,\n contextActions,\n onMouseDown,\n onClick,\n onSecondaryIconClick,\n onDragEnter,\n}) => {\n // eslint-disable-next-line no-null/no-null\n let containerRef = useRef(null);\n if (ref) {\n containerRef = ref;\n }\n const [isTouched, markIsTouched, unmarkIsTouched] = useFlag();\n\n const {\n isContextMenuOpen, contextMenuPosition,\n handleBeforeContextMenu, handleContextMenu,\n handleContextMenuClose, handleContextMenuHide,\n } = useContextMenuHandlers(containerRef, !contextActions);\n\n const getTriggerElement = useCallback(() => containerRef.current, []);\n\n const getRootElement = useCallback(\n () => containerRef.current!.closest('.custom-scroll'),\n [],\n );\n\n const getMenuElement = useCallback(\n () => containerRef.current!.querySelector('.ListItem-context-menu .bubble'),\n [],\n );\n\n const {\n positionX, positionY, transformOriginX, transformOriginY, style: menuStyle,\n } = useContextMenuPosition(\n contextMenuPosition,\n getTriggerElement,\n getRootElement,\n getMenuElement,\n );\n\n const handleClick = useCallback((e: React.MouseEvent) => {\n if (disabled || !onClick) {\n return;\n }\n onClick(e);\n\n if (IS_TOUCH_ENV && !ripple) {\n markIsTouched();\n fastRaf(unmarkIsTouched);\n }\n }, [disabled, markIsTouched, onClick, ripple, unmarkIsTouched]);\n\n const handleSecondaryIconClick = (e: React.MouseEvent) => {\n if (disabled || e.button !== 0 || (!onSecondaryIconClick && !contextActions)) return;\n e.stopPropagation();\n if (onSecondaryIconClick) {\n onSecondaryIconClick(e);\n } else {\n handleContextMenu(e);\n }\n };\n\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n if (inactive || IS_TOUCH_ENV) {\n return;\n }\n if (contextActions && (e.button === 2 || !onClick)) {\n handleBeforeContextMenu(e);\n }\n if (e.button === 0) {\n if (!onClick) {\n handleContextMenu(e);\n } else {\n handleClick(e);\n }\n }\n }, [inactive, contextActions, onClick, handleBeforeContextMenu, handleContextMenu, handleClick]);\n\n const lang = useLang();\n\n const fullClassName = buildClassName(\n 'ListItem',\n className,\n !isStatic && 'no-selection',\n ripple && 'has-ripple',\n narrow && 'narrow',\n disabled && 'disabled',\n inactive && 'inactive',\n contextMenuPosition && 'has-menu-open',\n focus && 'focus',\n destructive && 'destructive',\n multiline && 'multiline',\n isStatic && 'is-static',\n );\n\n return (\n \n \n {leftElement}\n {icon && (\n \n )}\n {multiline && (
{children}
)}\n {!multiline && children}\n {!disabled && !inactive && ripple && (\n \n )}\n {secondaryIcon && (\n \n \n \n )}\n
\n {contextActions && contextMenuPosition !== undefined && (\n \n {contextActions.map((action) => (\n \n {action.title}\n \n ))}\n \n )}\n
\n );\n};\n\nexport default ListItem;\n","import type { FC } from '../../lib/teact/teact';\nimport React, {\n useCallback,\n useEffect,\n useRef,\n useState,\n} from '../../lib/teact/teact';\n\nimport type { TextPart } from '../../types';\n\nimport { ANIMATION_END_DELAY } from '../../config';\nimport useShowTransition from '../../hooks/useShowTransition';\nimport buildClassName from '../../util/buildClassName';\nimport captureEscKeyListener from '../../util/captureEscKeyListener';\n\nimport Portal from './Portal';\nimport Button from './Button';\n\nimport './Notification.scss';\n\ntype OwnProps = {\n title?: TextPart[];\n containerId?: string;\n message: TextPart[];\n duration?: number;\n onDismiss: () => void;\n action?: VoidFunction;\n actionText?: string;\n className?: string;\n};\n\nconst DEFAULT_DURATION = 3000;\nconst ANIMATION_DURATION = 150;\n\nconst Notification: FC = ({\n title, className,\n message, duration = DEFAULT_DURATION, containerId, onDismiss,\n action, actionText,\n}) => {\n const [isOpen, setIsOpen] = useState(true);\n // eslint-disable-next-line no-null/no-null\n const timerRef = useRef(null);\n\n const { transitionClassNames } = useShowTransition(isOpen);\n\n const closeAndDismiss = useCallback(() => {\n setIsOpen(false);\n setTimeout(onDismiss, ANIMATION_DURATION + ANIMATION_END_DELAY);\n }, [onDismiss]);\n\n function handleClick() {\n action?.();\n closeAndDismiss();\n }\n\n useEffect(() => (isOpen ? captureEscKeyListener(closeAndDismiss) : undefined), [isOpen, closeAndDismiss]);\n\n useEffect(() => {\n timerRef.current = window.setTimeout(closeAndDismiss, duration);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n };\n }, [duration, closeAndDismiss]);\n\n const handleMouseEnter = useCallback(() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n timerRef.current = window.setTimeout(closeAndDismiss, duration);\n }, [duration, closeAndDismiss]);\n\n return (\n \n \n
\n {title &&
{title}
}\n {message}\n
\n {action && actionText && (\n \n {actionText}\n \n )}\n
\n \n );\n};\n\nexport default Notification;\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useEffect, useRef, memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport './ProgressSpinner.scss';\n\nconst RADIUSES = {\n s: 22, m: 25, l: 28, xl: 20,\n};\nconst STROKE_WIDTH = 2;\nconst MIN_PROGRESS = 0.05;\nconst MAX_PROGRESS = 1;\n\nconst ProgressSpinner: FC<{\n progress?: number;\n size?: 's' | 'm' | 'l' | 'xl';\n square?: boolean;\n transparent?: boolean;\n noCross?: boolean;\n onClick?: (e: React.MouseEvent) => void;\n}> = ({\n progress = 0,\n size = 'l',\n square,\n transparent,\n noCross,\n onClick,\n}) => {\n const radius = RADIUSES[size];\n const circleRadius = radius - STROKE_WIDTH * 2;\n const borderRadius = radius - 1;\n const circumference = circleRadius * 2 * Math.PI;\n // eslint-disable-next-line no-null/no-null\n const container = useRef(null);\n\n useEffect(() => {\n if (!container.current) {\n return;\n }\n\n const svg = container.current.firstElementChild;\n const strokeDashOffset = circumference - Math.min(Math.max(MIN_PROGRESS, progress), MAX_PROGRESS) * circumference;\n\n if (!svg) {\n container.current.innerHTML = `\n \n `;\n } else {\n (svg.firstElementChild as SVGElement).setAttribute('stroke-dashoffset', strokeDashOffset.toString());\n }\n }, [container, circumference, borderRadius, circleRadius, progress]);\n\n const className = buildClassName(\n `ProgressSpinner size-${size}`,\n transparent && 'transparent',\n square && 'square',\n noCross && 'no-cross',\n );\n\n return (\n \n );\n};\n\nexport default memo(ProgressSpinner);\n","import type { ChangeEvent } from 'react';\nimport type { FC, TeactNode } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport Spinner from './Spinner';\n\nimport './Radio.scss';\n\ntype OwnProps = {\n id?: string;\n name: string;\n label: TeactNode;\n subLabel?: string;\n value: string;\n checked: boolean;\n disabled?: boolean;\n hidden?: boolean;\n isLoading?: boolean;\n onChange: (e: ChangeEvent) => void;\n};\n\nconst Radio: FC = ({\n id,\n label,\n subLabel,\n value,\n name,\n checked,\n disabled,\n hidden,\n isLoading,\n onChange,\n}) => {\n const lang = useLang();\n const className = buildClassName(\n 'Radio',\n disabled && 'disabled',\n hidden && 'hidden-widget',\n isLoading && 'loading',\n );\n\n return (\n \n );\n};\n\nexport default memo(Radio);\n","import type { ChangeEvent } from 'react';\nimport type { FC, TeactNode } from '../../lib/teact/teact';\nimport React, { useCallback, memo } from '../../lib/teact/teact';\n\nimport Radio from './Radio';\n\nexport type IRadioOption = {\n label: TeactNode;\n subLabel?: string;\n value: string;\n hidden?: boolean;\n};\n\ntype OwnProps = {\n id?: string;\n name: string;\n options: IRadioOption[];\n selected?: string;\n disabled?: boolean;\n loadingOption?: string;\n onChange: (value: string, event: ChangeEvent) => void;\n};\n\nconst RadioGroup: FC = ({\n id,\n name,\n options,\n selected,\n disabled,\n loadingOption,\n onChange,\n}) => {\n const handleChange = useCallback((event: ChangeEvent) => {\n const { value } = event.currentTarget;\n onChange(value, event);\n }, [onChange]);\n\n return (\n
\n {options.map((option) => (\n
\n );\n};\n\nexport default memo(RadioGroup);\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { useCallback, useMemo, memo } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useLang from '../../hooks/useLang';\n\nimport './RangeSlider.scss';\n\ntype OwnProps = {\n options?: string[];\n min?: number;\n max?: number;\n step?: number;\n label?: string;\n value: number;\n disabled?: boolean;\n bold?: boolean;\n className?: string;\n renderValue?: (value: number) => string;\n onChange: (value: number) => void;\n};\n\nconst RangeSlider: FC = ({\n options,\n min = 0,\n max = options ? options.length - 1 : 100,\n step = 1,\n label,\n value,\n disabled,\n bold,\n className,\n renderValue,\n onChange,\n}) => {\n const lang = useLang();\n const handleChange = useCallback((event: ChangeEvent) => {\n onChange(Number(event.currentTarget.value));\n }, [onChange]);\n\n const mainClassName = buildClassName(\n className,\n 'RangeSlider',\n disabled && 'disabled',\n bold && 'bold',\n );\n\n const trackWidth = useMemo(() => {\n if (options) {\n return (value / (options.length - 1)) * 100;\n } else {\n const possibleValuesLength = (max - min) / step;\n return ((value - min) / possibleValuesLength) * 100;\n }\n }, [options, value, max, min, step]);\n\n return (\n
\n {label && (\n
\n {label}\n {!options && (\n {renderValue ? renderValue(value) : value}\n )}\n
\n )}\n
\n \n \n {options && (\n
\n {options.map((option, index) => (\n onChange(index)}\n >\n {option}\n
\n ))}\n
\n )}\n
\n
\n );\n};\n\nexport default memo(RangeSlider);\n","import type { RefObject } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, {\n useRef, useEffect, memo, useCallback,\n} from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport useFlag from '../../hooks/useFlag';\nimport useLang from '../../hooks/useLang';\nimport useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen';\n\nimport Loading from './Loading';\nimport Button from './Button';\nimport ShowTransition from './ShowTransition';\n\nimport './SearchInput.scss';\n\ntype OwnProps = {\n ref?: RefObject;\n children?: React.ReactNode;\n parentContainerClassName?: string;\n className?: string;\n inputId?: string;\n value?: string;\n focused?: boolean;\n isLoading?: boolean;\n spinnerColor?: 'yellow';\n spinnerBackgroundColor?: 'light';\n placeholder?: string;\n disabled?: boolean;\n autoComplete?: string;\n canClose?: boolean;\n autoFocusSearch?: boolean;\n onChange: (value: string) => void;\n onReset?: NoneToVoidFunction;\n onFocus?: NoneToVoidFunction;\n onBlur?: NoneToVoidFunction;\n onSpinnerClick?: NoneToVoidFunction;\n};\n\nconst SearchInput: FC = ({\n ref,\n children,\n parentContainerClassName,\n value,\n inputId,\n className,\n focused,\n isLoading,\n spinnerColor,\n spinnerBackgroundColor,\n placeholder,\n disabled,\n autoComplete,\n canClose,\n autoFocusSearch,\n onChange,\n onReset,\n onFocus,\n onBlur,\n onSpinnerClick,\n}) => {\n // eslint-disable-next-line no-null/no-null\n let inputRef = useRef(null);\n if (ref) {\n inputRef = ref;\n }\n\n const [isInputFocused, markInputFocused, unmarkInputFocused] = useFlag(focused);\n\n useInputFocusOnOpen(inputRef, autoFocusSearch, unmarkInputFocused);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n\n if (focused) {\n inputRef.current.focus();\n } else {\n inputRef.current.blur();\n }\n }, [focused, placeholder]); // Trick for setting focus when selecting a contact to search for\n\n const lang = useLang();\n\n function handleChange(event: React.ChangeEvent) {\n const { currentTarget } = event;\n onChange(currentTarget.value);\n }\n\n function handleFocus() {\n markInputFocused();\n if (onFocus) {\n onFocus();\n }\n }\n\n function handleBlur() {\n unmarkInputFocused();\n if (onBlur) {\n onBlur();\n }\n }\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter') {\n const element = document.querySelector(`.${parentContainerClassName} .ListItem-button`) as HTMLElement;\n if (element) {\n element.focus();\n }\n }\n }, [parentContainerClassName]);\n\n return (\n \n {children}\n \n \n \n \n \n {!isLoading && (value || canClose) && onReset && (\n \n \n \n )}\n
\n );\n};\n\nexport default memo(SearchInput);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useRef } from '../../lib/teact/teact';\n\nimport useShowTransition from '../../hooks/useShowTransition';\nimport usePrevious from '../../hooks/usePrevious';\nimport buildClassName from '../../util/buildClassName';\n\ntype OwnProps = {\n isOpen: boolean;\n isCustom?: boolean;\n id?: string;\n className?: string;\n onClick?: (e: React.MouseEvent) => void;\n children: React.ReactNode;\n};\n\nconst ShowTransition: FC = ({\n isOpen, isCustom, id, className, onClick, children,\n}) => {\n const { shouldRender, transitionClassNames } = useShowTransition(\n isOpen, undefined, undefined, isCustom ? false : undefined,\n );\n const prevIsOpen = usePrevious(isOpen);\n const prevChildren = usePrevious(children);\n const fromChildrenRef = useRef();\n\n if (prevIsOpen && !isOpen) {\n fromChildrenRef.current = prevChildren;\n }\n\n return (\n shouldRender && (\n
\n {isOpen ? children : fromChildrenRef.current!}\n
\n )\n );\n};\n\nexport default ShowTransition;\n","import type { FC } from '../../lib/teact/teact';\nimport React from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport buildStyle from '../../util/buildStyle';\n\nimport './Skeleton.scss';\n\ntype OwnProps = {\n variant?: 'rectangular' | 'rounded-rect' | 'round';\n animation?: 'wave' | 'pulse';\n width?: number;\n height?: number;\n forceAspectRatio?: boolean;\n className?: string;\n};\n\nconst Skeleton: FC = ({\n variant = 'rectangular',\n animation = 'wave',\n width,\n height,\n forceAspectRatio,\n className,\n}) => {\n const classNames = buildClassName('Skeleton', variant, animation, className);\n const aspectRatio = (width && height) ? `aspect-ratio: ${width}/${height}` : undefined;\n const style = forceAspectRatio ? aspectRatio\n : buildStyle(Boolean(width) && `width: ${width}px`, Boolean(height) && `height: ${height}px`);\n return (\n
\n );\n};\n\nexport default Skeleton;\n","import type { ChangeEvent } from 'react';\nimport type { FC } from '../../lib/teact/teact';\nimport React, { memo, useCallback } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\n\nimport './Switcher.scss';\n\ntype OwnProps = {\n id?: string;\n name?: string;\n value?: string;\n label: string;\n checked?: boolean;\n disabled?: boolean;\n inactive?: boolean;\n noAnimation?: boolean;\n onChange?: (e: ChangeEvent) => void;\n onCheck?: (isChecked: boolean) => void;\n};\n\nconst Switcher: FC = ({\n id,\n name,\n value,\n label,\n checked = false,\n disabled,\n inactive,\n noAnimation,\n onChange,\n onCheck,\n}) => {\n const handleChange = useCallback((e: ChangeEvent) => {\n if (onChange) {\n onChange(e);\n }\n\n if (onCheck) {\n onCheck(e.currentTarget.checked);\n }\n }, [onChange, onCheck]);\n\n const className = buildClassName(\n 'Switcher',\n disabled && 'disabled',\n inactive && 'inactive',\n noAnimation && 'no-animation',\n );\n\n return (\n \n );\n};\n\nexport default memo(Switcher);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { useRef, memo, useEffect } from '../../lib/teact/teact';\n\nimport buildClassName from '../../util/buildClassName';\nimport forceReflow from '../../util/forceReflow';\nimport renderText from '../common/helpers/renderText';\n\nimport './Tab.scss';\n\ntype OwnProps = {\n className?: string;\n title: string;\n isActive?: boolean;\n isBlocked?: boolean;\n badgeCount?: number;\n isBadgeActive?: boolean;\n previousActiveTab?: number;\n onClick: (arg: number) => void;\n clickArg: number;\n};\n\nconst classNames = {\n active: 'Tab--active',\n badgeActive: 'Tab__badge--active',\n};\n\nconst Tab: FC = ({\n className,\n title,\n isActive,\n isBlocked,\n badgeCount,\n isBadgeActive,\n previousActiveTab,\n onClick,\n clickArg,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const tabRef = useRef(null);\n\n useEffect(() => {\n // Set initial active state\n if (isActive && previousActiveTab === undefined && tabRef.current) {\n tabRef.current.classList.add(classNames.active);\n }\n\n if (!isActive || previousActiveTab === undefined) {\n return;\n }\n\n const tabEl = tabRef.current!;\n const prevTabEl = tabEl.parentElement!.children[previousActiveTab];\n if (!prevTabEl) {\n return;\n }\n\n const platformEl = tabEl.querySelector('.platform')!;\n const prevPlatformEl = prevTabEl.querySelector('.platform')!;\n\n // We move and resize the platform, so it repeats the position and size of the previous one\n const shiftLeft = prevPlatformEl.parentElement!.offsetLeft - platformEl.parentElement!.offsetLeft;\n const scaleFactor = prevPlatformEl.clientWidth / platformEl.clientWidth;\n\n prevPlatformEl.classList.remove('animate');\n platformEl.classList.remove('animate');\n platformEl.style.transform = `translate3d(${shiftLeft}px, 0, 0) scale3d(${scaleFactor}, 1, 1)`;\n forceReflow(platformEl);\n platformEl.classList.add('animate');\n platformEl.style.transform = 'none';\n\n prevTabEl.classList.remove(classNames.active);\n tabEl.classList.add(classNames.active);\n }, [isActive, previousActiveTab]);\n\n return (\n onClick(clickArg)}\n ref={tabRef}\n >\n \n {renderText(title)}\n {Boolean(badgeCount) && (\n {badgeCount}\n )}\n {isBlocked && }\n \n \n
\n );\n};\n\nexport default memo(Tab);\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo, useRef, useEffect } from '../../lib/teact/teact';\n\nimport { ALL_FOLDER_ID } from '../../config';\nimport { IS_ANDROID, IS_IOS } from '../../util/environment';\nimport fastSmoothScrollHorizontal from '../../util/fastSmoothScrollHorizontal';\n\nimport usePrevious from '../../hooks/usePrevious';\nimport useHorizontalScroll from '../../hooks/useHorizontalScroll';\nimport useLang from '../../hooks/useLang';\n\nimport Tab from './Tab';\n\nimport './TabList.scss';\n\nexport type TabWithProperties = {\n id?: number;\n title: string;\n badgeCount?: number;\n isBlocked?: boolean;\n isBadgeActive?: boolean;\n};\n\ntype OwnProps = {\n tabs: readonly TabWithProperties[];\n areFolders?: boolean;\n activeTab: number;\n big?: boolean;\n onSwitchTab: (index: number) => void;\n};\n\nconst TAB_SCROLL_THRESHOLD_PX = 16;\n// Should match duration from `--slide-transition` CSS variable\nconst SCROLL_DURATION = IS_IOS ? 450 : IS_ANDROID ? 400 : 300;\n\nconst TabList: FC = ({\n tabs, areFolders, activeTab, big, onSwitchTab,\n}) => {\n // eslint-disable-next-line no-null/no-null\n const containerRef = useRef(null);\n const previousActiveTab = usePrevious(activeTab);\n\n useHorizontalScroll(containerRef.current, undefined, true);\n\n // Scroll container to place active tab in the center\n useEffect(() => {\n const container = containerRef.current!;\n const { scrollWidth, offsetWidth, scrollLeft } = container;\n if (scrollWidth <= offsetWidth) {\n return;\n }\n\n const activeTabElement = container.childNodes[activeTab] as HTMLElement | null;\n if (!activeTabElement) {\n return;\n }\n\n const { offsetLeft: activeTabOffsetLeft, offsetWidth: activeTabOffsetWidth } = activeTabElement;\n const newLeft = activeTabOffsetLeft - (offsetWidth / 2) + (activeTabOffsetWidth / 2);\n\n // Prevent scrolling by only a couple of pixels, which doesn't look smooth\n if (Math.abs(newLeft - scrollLeft) < TAB_SCROLL_THRESHOLD_PX) {\n return;\n }\n\n fastSmoothScrollHorizontal(container, newLeft, SCROLL_DURATION);\n }, [activeTab]);\n\n const lang = useLang();\n\n return (\n \n {tabs.map((tab, i) => (\n \n ))}\n
\n );\n};\n\nexport default memo(TabList);\n","import type { StateReducer, Dispatch } from '../useReducer';\nimport useReducer from '../useReducer';\nimport type { ApiChatFolder } from '../../api/types';\nimport { pick, omit } from '../../util/iteratees';\n\nexport type FolderChatType = {\n icon: string;\n title: string;\n key: keyof Pick;\n};\n\nexport const INCLUDED_CHAT_TYPES: FolderChatType[] = [\n { icon: 'user', title: 'FilterContacts', key: 'contacts' },\n { icon: 'non-contacts', title: 'FilterNonContacts', key: 'nonContacts' },\n { icon: 'group', title: 'FilterGroups', key: 'groups' },\n { icon: 'channel', title: 'FilterChannels', key: 'channels' },\n { icon: 'bots', title: 'FilterBots', key: 'bots' },\n];\n\nexport const EXCLUDED_CHAT_TYPES: FolderChatType[] = [\n { icon: 'mute', title: 'FilterMuted', key: 'excludeMuted' },\n { icon: 'archive', title: 'FilterArchived', key: 'excludeArchived' },\n { icon: 'readchats', title: 'FilterRead', key: 'excludeRead' },\n];\n\nconst INCLUDE_FILTER_FIELDS: Array = [\n 'includedChatIds', 'bots', 'channels', 'groups', 'contacts', 'nonContacts',\n];\nconst EXCLUDE_FILTER_FIELDS: Array = [\n 'excludedChatIds', 'excludeArchived', 'excludeMuted', 'excludeRead',\n];\n\nexport function selectChatFilters(state: FoldersState, mode: 'included' | 'excluded', selectTemp?: boolean) {\n let selectedChatIds: string[] = [];\n let selectedChatTypes: FolderChatType['key'][] = [];\n\n if (mode === 'included') {\n const {\n includedChatIds,\n ...includeFilters\n } = selectTemp\n ? state.includeFilters || {}\n : pick(\n state.folder,\n INCLUDE_FILTER_FIELDS,\n );\n\n selectedChatIds = includedChatIds || [];\n selectedChatTypes = (Object.keys(includeFilters) as Array)\n .filter((key) => Boolean(includeFilters[key]));\n } else {\n const {\n excludedChatIds,\n ...excludeFilters\n } = selectTemp\n ? state.excludeFilters || {}\n : pick(\n state.folder,\n EXCLUDE_FILTER_FIELDS,\n );\n\n selectedChatIds = excludedChatIds || [];\n selectedChatTypes = (Object.keys(excludeFilters) as Array)\n .filter((key) => Boolean(excludeFilters[key]));\n }\n\n return {\n selectedChatIds,\n selectedChatTypes,\n };\n}\n\nfunction getSuggestedFolderName(includeFilters?: FolderIncludeFilters) {\n if (includeFilters) {\n const {\n includedChatIds,\n ...filters\n } = includeFilters;\n\n if (\n Object.values(filters).filter(Boolean).length > 1\n || (includedChatIds?.length)\n ) {\n return '';\n }\n\n if (filters.bots) {\n return 'Bots';\n } else if (filters.groups) {\n return 'Groups';\n } else if (filters.channels) {\n return 'Channels';\n } else if (filters.contacts) {\n return 'Contacts';\n } else if (filters.nonContacts) {\n return 'Non-Contacts';\n }\n }\n\n return '';\n}\n\ntype FolderIncludeFilters = Pick;\ntype FolderExcludeFilters = Pick;\n\nexport type FoldersState = {\n mode: 'create' | 'edit';\n isLoading?: boolean;\n isTouched?: boolean;\n error?: string;\n folderId?: number;\n chatFilter: string;\n folder: Omit;\n includeFilters?: FolderIncludeFilters;\n excludeFilters?: FolderExcludeFilters;\n};\nexport type FoldersActions = (\n 'setTitle' | 'saveFilters' | 'editFolder' | 'reset' | 'setChatFilter' | 'setIsLoading' | 'setError' |\n 'editIncludeFilters' | 'editExcludeFilters' | 'setIncludeFilters' | 'setExcludeFilters'\n);\nexport type FolderEditDispatch = Dispatch;\n\nconst INITIAL_STATE: FoldersState = {\n mode: 'create',\n chatFilter: '',\n folder: {\n title: '',\n includedChatIds: [],\n excludedChatIds: [],\n },\n};\n\nconst foldersReducer: StateReducer = (\n state,\n action,\n) => {\n switch (action.type) {\n case 'setTitle':\n return {\n ...state,\n folder: {\n ...state.folder,\n title: action.payload,\n },\n isTouched: true,\n };\n case 'editIncludeFilters':\n return {\n ...state,\n includeFilters: pick(\n state.folder,\n INCLUDE_FILTER_FIELDS,\n ),\n };\n case 'editExcludeFilters':\n return {\n ...state,\n excludeFilters: pick(\n state.folder,\n EXCLUDE_FILTER_FIELDS,\n ),\n };\n case 'setIncludeFilters':\n return {\n ...state,\n includeFilters: action.payload,\n chatFilter: '',\n };\n case 'setExcludeFilters':\n return {\n ...state,\n excludeFilters: action.payload,\n chatFilter: '',\n };\n case 'saveFilters':\n if (state.includeFilters) {\n return {\n ...state,\n folder: {\n ...omit(state.folder, INCLUDE_FILTER_FIELDS),\n title: state.folder.title ? state.folder.title : getSuggestedFolderName(state.includeFilters),\n ...state.includeFilters,\n },\n includeFilters: undefined,\n chatFilter: '',\n isTouched: true,\n };\n } else if (state.excludeFilters) {\n return {\n ...state,\n folder: {\n ...omit(state.folder, EXCLUDE_FILTER_FIELDS),\n ...state.excludeFilters,\n },\n excludeFilters: undefined,\n chatFilter: '',\n isTouched: true,\n };\n } else {\n return state;\n }\n case 'editFolder': {\n const { id: folderId, description, ...folder } = action.payload;\n\n return {\n mode: 'edit',\n folderId,\n folder,\n chatFilter: '',\n };\n }\n case 'setChatFilter': {\n return {\n ...state,\n chatFilter: action.payload,\n };\n }\n case 'setIsLoading': {\n return {\n ...state,\n isLoading: action.payload,\n };\n }\n case 'setError': {\n return {\n ...state,\n error: action.payload,\n };\n }\n case 'reset':\n return INITIAL_STATE;\n default:\n return state;\n }\n};\n\nconst useFoldersReducer = () => {\n return useReducer(foldersReducer, INITIAL_STATE);\n};\n\nexport default useFoldersReducer;\n","import {\n useCallback, useEffect, useRef, useState,\n} from '../lib/teact/teact';\nimport { getActions, getGlobal } from '../global';\n\nimport { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../config';\nimport type { Track, TrackId } from '../util/audioPlayer';\nimport { register } from '../util/audioPlayer';\nimport { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio';\nimport type { MediaSessionHandlers } from '../util/mediaSession';\nimport {\n registerMediaSession, setPlaybackState, setPositionState, updateMetadata,\n} from '../util/mediaSession';\n\nimport useEffectWithPrevDeps from './useEffectWithPrevDeps';\nimport useOnChange from './useOnChange';\n\ntype Handler = (e: Event) => void;\n\nconst DEFAULT_SKIP_TIME = 10;\n\nconst useAudioPlayer = (\n trackId: TrackId,\n originalDuration: number, // Sometimes incorrect for voice messages\n trackType: Track['type'],\n src?: string,\n handlers?: Record,\n metadata?: MediaMetadata,\n onInit?: (element: HTMLAudioElement) => void,\n shouldPlay = false,\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n noPlaylist = false,\n noProgressUpdates = false,\n) => {\n // eslint-disable-next-line no-null/no-null\n const controllerRef = useRef>(null);\n\n const [isPlaying, setIsPlaying] = useState(false);\n let isPlayingSync = isPlaying;\n\n const [playProgress, setPlayProgress] = useState(0);\n\n const handleTrackChange = useCallback(() => {\n setIsPlaying(false);\n if (onTrackChange) onTrackChange();\n }, [onTrackChange]);\n\n useOnChange(() => {\n controllerRef.current = register(trackId, trackType, (eventName, e) => {\n switch (eventName) {\n case 'onPlay': {\n const {\n setVolume, setPlaybackRate, toggleMuted, proxy,\n } = controllerRef.current!;\n setIsPlaying(true);\n\n registerMediaSession(metadata, makeMediaHandlers(controllerRef));\n setPlaybackState('playing');\n setVolume(getGlobal().audioPlayer.volume);\n toggleMuted(Boolean(getGlobal().audioPlayer.isMuted));\n const duration = proxy.duration && Number.isFinite(proxy.duration) ? proxy.duration : originalDuration;\n if (trackType === 'voice' || duration > PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION) {\n setPlaybackRate(getGlobal().audioPlayer.playbackRate);\n }\n\n setPositionState({\n duration: proxy.duration || 0,\n playbackRate: proxy.playbackRate,\n position: proxy.currentTime,\n });\n break;\n }\n case 'onRateChange': {\n const { proxy } = controllerRef.current!;\n setPositionState({\n duration: proxy.duration || 0,\n playbackRate: proxy.playbackRate,\n position: proxy.currentTime,\n });\n break;\n }\n case 'onPause':\n setIsPlaying(false);\n setPlaybackState('paused');\n break;\n case 'onTimeUpdate': {\n const { proxy } = controllerRef.current!;\n const duration = proxy.duration && Number.isFinite(proxy.duration) ? proxy.duration : originalDuration;\n if (!noProgressUpdates) setPlayProgress(proxy.currentTime / duration);\n break;\n }\n case 'onEnded': {\n setPlaybackState('paused');\n break;\n }\n }\n\n handlers?.[eventName]?.(e);\n }, onForcePlay, handleTrackChange);\n\n const { proxy } = controllerRef.current!;\n\n if (!isPlaying && !proxy.paused) {\n setIsPlaying(true);\n isPlayingSync = true;\n }\n\n if (onInit) {\n onInit(proxy);\n }\n }, [trackId]);\n\n useEffect(() => {\n if (isPlaying && metadata) updateMetadata(metadata);\n }, [metadata, isPlaying]);\n\n const {\n play,\n pause,\n setCurrentTime,\n proxy,\n destroy,\n setVolume,\n stop,\n isFirst,\n isLast,\n requestNextTrack,\n requestPreviousTrack,\n setPlaybackRate,\n toggleMuted,\n } = controllerRef.current!;\n const duration = proxy.duration && Number.isFinite(proxy.duration) ? proxy.duration : originalDuration;\n\n // RAF progress\n useEffect(() => {\n if (duration && !isSafariPatchInProgress(proxy) && !noProgressUpdates) {\n setPlayProgress(proxy.currentTime / duration);\n }\n }, [duration, playProgress, proxy, noProgressUpdates]);\n\n // Cleanup\n useEffect(() => () => {\n destroy(noPlaylist);\n }, [destroy, noPlaylist]);\n\n // Autoplay once `src` is present\n useEffectWithPrevDeps(([prevShouldPlay, prevSrc]) => {\n if (prevShouldPlay === shouldPlay && src === prevSrc) {\n return;\n }\n\n // When paused by another player\n if (proxy.src && proxy.paused) {\n return;\n }\n\n if (shouldPlay && src && !isPlaying) {\n play(src);\n }\n }, [shouldPlay, src, isPlaying, play, proxy.src, proxy.paused]);\n\n const playIfPresent = useCallback(() => {\n if (src) {\n play(src);\n }\n }, [src, play]);\n\n const playPause = useCallback(() => {\n if (isPlaying) {\n pause();\n } else {\n playIfPresent();\n }\n }, [pause, playIfPresent, isPlaying]);\n\n const setTime = useCallback((time: number) => {\n setCurrentTime(time);\n if (duration) {\n setPlayProgress(proxy.currentTime / duration);\n }\n }, [duration, proxy, setCurrentTime]);\n\n return {\n isPlaying: isPlayingSync,\n playProgress,\n playPause,\n pause,\n play: playIfPresent,\n stop,\n setCurrentTime: setTime,\n setVolume,\n audioProxy: proxy,\n duration,\n requestNextTrack,\n requestPreviousTrack,\n isFirst,\n isLast,\n setPlaybackRate,\n toggleMuted,\n };\n};\n\nfunction makeMediaHandlers(controllerRef: React.RefObject>) {\n let mediaHandlers: MediaSessionHandlers = {};\n if (controllerRef && controllerRef.current) {\n const {\n play, pause, setCurrentTime, proxy, requestNextTrack, requestPreviousTrack, isFirst, isLast,\n } = controllerRef.current;\n mediaHandlers = {\n play: () => {\n play(proxy.src);\n },\n pause: () => {\n pause();\n },\n stop: () => {\n pause();\n setCurrentTime(0);\n getActions().closeAudioPlayer();\n },\n seekbackward: (event) => {\n const skipTime = event.seekOffset || DEFAULT_SKIP_TIME;\n setCurrentTime(Math.max(proxy.currentTime - skipTime, 0));\n },\n seekforward: (event) => {\n const skipTime = event.seekOffset || DEFAULT_SKIP_TIME;\n setCurrentTime(Math.min(proxy.currentTime + skipTime, proxy.duration));\n },\n seekTo: (event) => {\n if (event.seekTime) {\n setCurrentTime(event.seekTime);\n }\n },\n };\n\n if (!isLast()) {\n mediaHandlers.nexttrack = () => {\n requestNextTrack();\n };\n }\n if (!isFirst()) {\n mediaHandlers.previoustrack = () => {\n requestPreviousTrack();\n };\n }\n }\n return mediaHandlers;\n}\n\nexport default useAudioPlayer;\n","import type React from '../lib/teact/teact';\nimport { useCallback, useMemo, useState } from '../lib/teact/teact';\nimport { debounce } from '../util/schedulers';\nimport { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio';\n\ntype BufferingEvent = (e: Event | React.SyntheticEvent) => void;\n\nconst MIN_READY_STATE = 3;\n// Avoid flickering when re-mounting previously buffered video\nconst DEBOUNCE = 200;\n\n/**\n * Time range relative to the duration [0, 1]\n */\nexport type BufferedRange = { start: number; end: number };\n\nconst useBuffering = (noInitiallyBuffered = false) => {\n const [isBuffered, setIsBuffered] = useState(!noInitiallyBuffered);\n const [bufferedProgress, setBufferedProgress] = useState(0);\n const [bufferedRanges, setBufferedRanges] = useState([]);\n\n const setIsBufferedDebounced = useMemo(() => {\n return debounce(setIsBuffered, DEBOUNCE, false, true);\n }, []);\n\n const handleBuffering = useCallback((e) => {\n const media = e.currentTarget as HTMLMediaElement;\n\n if (!isSafariPatchInProgress(media)) {\n if (media.buffered.length) {\n const ranges = getTimeRanges(media.buffered, media.duration);\n setBufferedRanges(ranges);\n const bufferedLength = ranges.reduce((acc, { start, end }) => acc + end - start, 0);\n setBufferedProgress(bufferedLength / media.duration);\n }\n\n setIsBufferedDebounced(media.readyState >= MIN_READY_STATE || media.currentTime > 0);\n }\n }, [setIsBufferedDebounced]);\n\n const bufferingHandlers = {\n onLoadedData: handleBuffering,\n onPlaying: handleBuffering,\n onLoadStart: handleBuffering, // Needed for Safari to start\n onPause: handleBuffering, // Needed for Chrome when seeking\n onTimeUpdate: handleBuffering, // Needed for audio buffering progress\n onProgress: handleBuffering, // Needed for video buffering progress\n };\n\n return {\n isBuffered,\n bufferedProgress,\n bufferedRanges,\n bufferingHandlers,\n checkBuffering(element: HTMLMediaElement) {\n setIsBufferedDebounced(element.readyState >= MIN_READY_STATE);\n },\n };\n};\n\nfunction getTimeRanges(ranges: TimeRanges, duration: number) {\n const result: BufferedRange[] = [];\n for (let i = 0; i < ranges.length; i++) {\n result.push({\n start: ranges.start(i) / duration,\n end: ranges.end(i) / duration,\n });\n }\n return result;\n}\n\nexport default useBuffering;\n","import { useEffect, useRef } from '../lib/teact/teact';\n\nimport fastBlur from '../lib/fastBlur';\nimport useForceUpdate from './useForceUpdate';\nimport { IS_CANVAS_FILTER_SUPPORTED } from '../util/environment';\n\nconst RADIUS = 2;\nconst ITERATIONS = 2;\n\nexport default function useCanvasBlur(dataUri?: string, isDisabled = false, withRaf?: boolean) {\n // eslint-disable-next-line no-null/no-null\n const canvasRef = useRef(null);\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n const canvas = canvasRef.current;\n\n if (!dataUri || !canvas || isDisabled) {\n return;\n }\n\n const img = new Image();\n\n const processBlur = () => {\n canvas.width = img.width;\n canvas.height = img.height;\n\n const ctx = canvas.getContext('2d', { alpha: false })!;\n\n if (IS_CANVAS_FILTER_SUPPORTED) {\n ctx.filter = `blur(${RADIUS}px)`;\n }\n\n ctx.drawImage(img, -RADIUS * 2, -RADIUS * 2, canvas.width + RADIUS * 4, canvas.height + RADIUS * 4);\n\n if (!IS_CANVAS_FILTER_SUPPORTED) {\n fastBlur(ctx, 0, 0, canvas.width, canvas.height, RADIUS, ITERATIONS);\n }\n };\n\n img.onload = () => {\n if (withRaf) {\n requestAnimationFrame(processBlur);\n } else {\n processBlur();\n }\n };\n\n img.src = dataUri;\n }, [canvasRef, dataUri, forceUpdate, isDisabled, withRaf]);\n\n return canvasRef;\n}\n","import { useMemo } from '../lib/teact/teact';\nimport { getActions } from '../global';\n\nimport type { ApiChat, ApiUser } from '../api/types';\n\nimport { SERVICE_NOTIFICATIONS_USER_ID } from '../config';\nimport {\n isChatArchived, getCanDeleteChat, isUserId, isChatChannel, isChatGroup,\n} from '../global/helpers';\nimport { compact } from '../util/iteratees';\nimport useLang from './useLang';\n\nconst useChatContextActions = ({\n chat,\n user,\n folderId,\n isPinned,\n isMuted,\n canChangeFolder,\n handleDelete,\n handleChatFolderChange,\n handleReport,\n}: {\n chat: ApiChat | undefined;\n user: ApiUser | undefined;\n folderId?: number;\n isPinned?: boolean;\n isMuted?: boolean;\n canChangeFolder?: boolean;\n handleDelete: () => void;\n handleChatFolderChange: () => void;\n handleReport?: () => void;\n}, isInSearch = false) => {\n const lang = useLang();\n\n const { isSelf } = user || {};\n const isServiceNotifications = user?.id === SERVICE_NOTIFICATIONS_USER_ID;\n\n return useMemo(() => {\n if (!chat) {\n return undefined;\n }\n\n const {\n toggleChatPinned,\n updateChatMutedState,\n toggleChatArchived,\n toggleChatUnread,\n } = getActions();\n\n const actionAddToFolder = canChangeFolder ? {\n title: lang('ChatList.Filter.AddToFolder'),\n icon: 'folder',\n handler: handleChatFolderChange,\n } : undefined;\n\n const actionPin = isPinned\n ? {\n title: lang('UnpinFromTop'),\n icon: 'unpin',\n handler: () => toggleChatPinned({ id: chat.id, folderId }),\n }\n : { title: lang('PinToTop'), icon: 'pin', handler: () => toggleChatPinned({ id: chat.id, folderId }) };\n\n if (isInSearch) {\n return compact([actionPin, actionAddToFolder]);\n }\n\n const actionUnreadMark = chat.unreadCount || chat.hasUnreadMark\n ? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => toggleChatUnread({ id: chat.id }) }\n : { title: lang('MarkAsUnread'), icon: 'unread', handler: () => toggleChatUnread({ id: chat.id }) };\n\n const actionMute = isMuted\n ? {\n title: lang('ChatList.Unmute'),\n icon: 'unmute',\n handler: () => updateChatMutedState({ chatId: chat.id, isMuted: false }),\n }\n : {\n title: lang('ChatList.Mute'),\n icon: 'mute',\n handler: () => updateChatMutedState({ chatId: chat.id, isMuted: true }),\n };\n\n const actionArchive = isChatArchived(chat)\n ? { title: lang('Unarchive'), icon: 'unarchive', handler: () => toggleChatArchived({ id: chat.id }) }\n : { title: lang('Archive'), icon: 'archive', handler: () => toggleChatArchived({ id: chat.id }) };\n\n const canReport = handleReport && (isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf));\n const actionReport = canReport\n ? { title: lang('ReportPeer.Report'), icon: 'flag', handler: handleReport }\n : undefined;\n\n const actionDelete = {\n title: isUserId(chat.id)\n ? lang('Delete')\n : lang(getCanDeleteChat(chat)\n ? 'DeleteChat'\n : (isChatChannel(chat) ? 'LeaveChannel' : 'Group.LeaveGroup')),\n icon: 'delete',\n destructive: true,\n handler: handleDelete,\n };\n\n const isInFolder = folderId !== undefined;\n\n return compact([\n actionAddToFolder,\n actionUnreadMark,\n actionPin,\n !isSelf && actionMute,\n !isSelf && !isServiceNotifications && !isInFolder && actionArchive,\n actionReport,\n actionDelete,\n ]);\n }, [\n chat, user, canChangeFolder, lang, handleChatFolderChange, isPinned, isInSearch, isMuted,\n handleDelete, handleReport, folderId, isSelf, isServiceNotifications,\n ]);\n};\n\nexport default useChatContextActions;\n","import type { RefObject } from 'react';\nimport { useState, useEffect, useCallback } from '../lib/teact/teact';\n\nimport type { IAnchorPosition } from '../types';\nimport {\n IS_TOUCH_ENV, IS_PWA, IS_IOS,\n} from '../util/environment';\n\nconst LONG_TAP_DURATION_MS = 200;\n\nfunction stopEvent(e: Event) {\n e.stopImmediatePropagation();\n e.preventDefault();\n e.stopPropagation();\n}\n\nconst useContextMenuHandlers = (\n elementRef: RefObject,\n isMenuDisabled?: boolean,\n shouldDisableOnLink?: boolean,\n shouldDisableOnLongTap?: boolean,\n) => {\n const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);\n const [contextMenuPosition, setContextMenuPosition] = useState(undefined);\n\n const handleBeforeContextMenu = useCallback((e: React.MouseEvent) => {\n if (!isMenuDisabled && e.button === 2) {\n (e.target as HTMLElement).classList.add('no-selection');\n }\n }, [isMenuDisabled]);\n\n const handleContextMenu = useCallback((e: React.MouseEvent) => {\n (e.target as HTMLElement).classList.remove('no-selection');\n\n if (isMenuDisabled || (shouldDisableOnLink && (e.target as HTMLElement).matches('a[href]'))) {\n return;\n }\n e.preventDefault();\n\n if (contextMenuPosition) {\n return;\n }\n\n setIsContextMenuOpen(true);\n setContextMenuPosition({ x: e.clientX, y: e.clientY });\n }, [isMenuDisabled, shouldDisableOnLink, contextMenuPosition]);\n\n const handleContextMenuClose = useCallback(() => {\n setIsContextMenuOpen(false);\n }, []);\n\n const handleContextMenuHide = useCallback(() => {\n setContextMenuPosition(undefined);\n }, []);\n\n // Support context menu on touch devices\n useEffect(() => {\n if (isMenuDisabled || !IS_TOUCH_ENV || shouldDisableOnLongTap) {\n return undefined;\n }\n\n const element = elementRef.current;\n if (!element) {\n return undefined;\n }\n\n let timer: number | undefined;\n\n const clearLongPressTimer = () => {\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n }\n };\n\n const emulateContextMenuEvent = (originalEvent: TouchEvent) => {\n clearLongPressTimer();\n\n const { clientX, clientY, target } = originalEvent.touches[0];\n\n if (contextMenuPosition || (shouldDisableOnLink && (target as HTMLElement).matches('a[href]'))) {\n return;\n }\n\n // Temporarily intercept and clear the next click\n element.addEventListener('touchend', function cancelClickOnce(e) {\n element.removeEventListener('touchend', cancelClickOnce, true);\n stopEvent(e);\n }, true);\n\n // On iOS15, in PWA mode, the context menu immediately closes after opening\n if (IS_PWA && IS_IOS) {\n element.addEventListener('mousedown', function cancelClickOnce(e) {\n element.removeEventListener('mousedown', cancelClickOnce, true);\n stopEvent(e);\n }, true);\n }\n\n setIsContextMenuOpen(true);\n setContextMenuPosition({ x: clientX, y: clientY });\n };\n\n const startLongPressTimer = (e: TouchEvent) => {\n if (isMenuDisabled) {\n return;\n }\n clearLongPressTimer();\n\n timer = window.setTimeout(() => emulateContextMenuEvent(e), LONG_TAP_DURATION_MS);\n };\n\n // @perf Consider event delegation\n element.addEventListener('touchstart', startLongPressTimer, { passive: true });\n element.addEventListener('touchcancel', clearLongPressTimer, true);\n element.addEventListener('touchend', clearLongPressTimer, true);\n element.addEventListener('touchmove', clearLongPressTimer, { passive: true });\n\n return () => {\n clearLongPressTimer();\n element.removeEventListener('touchstart', startLongPressTimer);\n element.removeEventListener('touchcancel', clearLongPressTimer, true);\n element.removeEventListener('touchend', clearLongPressTimer, true);\n element.removeEventListener('touchmove', clearLongPressTimer);\n };\n }, [contextMenuPosition, isMenuDisabled, shouldDisableOnLongTap, elementRef, shouldDisableOnLink]);\n\n return {\n isContextMenuOpen,\n contextMenuPosition,\n handleBeforeContextMenu,\n handleContextMenu,\n handleContextMenuClose,\n handleContextMenuHide,\n };\n};\n\nexport default useContextMenuHandlers;\n","import { useState, useEffect } from '../lib/teact/teact';\nimport type { IAnchorPosition } from '../types';\n\ninterface Layout {\n extraPaddingX?: number;\n extraTopPadding?: number;\n marginSides?: number;\n extraMarginTop?: number;\n}\n\nconst MENU_POSITION_VISUAL_COMFORT_SPACE_PX = 16;\nconst MENU_POSITION_BOTTOM_MARGIN = 12;\nconst EMPTY_RECT = {\n width: 0, left: 0, height: 0, top: 0,\n};\n\nexport default function useContextMenuPosition(\n anchor: IAnchorPosition | undefined,\n getTriggerElement: () => HTMLElement | null,\n getRootElement: () => HTMLElement | null,\n getMenuElement: () => HTMLElement | null,\n getLayout?: () => Layout,\n) {\n const [positionX, setPositionX] = useState<'right' | 'left'>('right');\n const [positionY, setPositionY] = useState<'top' | 'bottom'>('bottom');\n const [transformOriginX, setTransformOriginX] = useState();\n const [transformOriginY, setTransformOriginY] = useState();\n const [withScroll, setWithScroll] = useState(false);\n const [style, setStyle] = useState('');\n const [menuStyle, setMenuStyle] = useState('opacity: 0;');\n\n useEffect(() => {\n const triggerEl = getTriggerElement();\n if (!anchor || !triggerEl) {\n return;\n }\n\n let { x, y } = anchor;\n const anchorX = x;\n const anchorY = y;\n\n const menuEl = getMenuElement();\n const rootEl = getRootElement();\n\n const {\n extraPaddingX = 0,\n extraTopPadding = 0,\n marginSides = 0,\n extraMarginTop = 0,\n } = getLayout?.() || {};\n\n const marginTop = menuEl ? parseInt(getComputedStyle(menuEl).marginTop, 10) + extraMarginTop : undefined;\n\n const menuRect = menuEl ? {\n width: menuEl.offsetWidth,\n height: menuEl.offsetHeight + marginTop!,\n } : EMPTY_RECT;\n\n const rootRect = rootEl ? rootEl.getBoundingClientRect() : EMPTY_RECT;\n\n let horizontalPosition: 'left' | 'right';\n let verticalPosition: 'top' | 'bottom';\n if (x + menuRect.width + extraPaddingX < rootRect.width + rootRect.left) {\n x += 3;\n horizontalPosition = 'left';\n } else if (x - menuRect.width > 0) {\n horizontalPosition = 'right';\n x -= 3;\n } else {\n horizontalPosition = 'left';\n x = 16;\n }\n setPositionX(horizontalPosition);\n\n if (marginSides\n && horizontalPosition === 'right' && (x + extraPaddingX + marginSides >= rootRect.width + rootRect.left)) {\n x -= marginSides;\n }\n\n if (marginSides && horizontalPosition === 'left') {\n if (x + extraPaddingX + marginSides + menuRect.width >= rootRect.width + rootRect.left) {\n x -= marginSides;\n } else if (x - marginSides <= 0) {\n x += marginSides;\n }\n }\n\n if (y + menuRect.height < rootRect.height + rootRect.top) {\n verticalPosition = 'top';\n } else {\n verticalPosition = 'bottom';\n\n if (y - menuRect.height < rootRect.top + extraTopPadding) {\n y = rootRect.top + rootRect.height;\n }\n }\n setPositionY(verticalPosition);\n\n const triggerRect = triggerEl.getBoundingClientRect();\n const left = horizontalPosition === 'left'\n ? Math.min(x - triggerRect.left, rootRect.width - menuRect.width - MENU_POSITION_VISUAL_COMFORT_SPACE_PX)\n : (x - triggerRect.left);\n const top = y - triggerRect.top;\n\n const menuMaxHeight = rootRect.height - MENU_POSITION_BOTTOM_MARGIN - (marginTop || 0);\n\n setWithScroll(menuMaxHeight < menuRect.height);\n setMenuStyle(`max-height: ${menuMaxHeight}px;`);\n setStyle(`left: ${left}px; top: ${top}px`);\n const offsetX = (anchorX - triggerRect.left) - left;\n const offsetY = (anchorY - triggerRect.top) - top - (marginTop || 0);\n setTransformOriginX(horizontalPosition === 'left' ? offsetX : menuRect.width + offsetX);\n setTransformOriginY(verticalPosition === 'bottom' ? menuRect.height + offsetY : offsetY);\n }, [\n anchor, getMenuElement, getRootElement, getTriggerElement, getLayout,\n ]);\n\n return {\n positionX,\n positionY,\n transformOriginX,\n transformOriginY,\n style,\n menuStyle,\n withScroll,\n };\n}\n","import { useEffect, useMemo } from '../lib/teact/teact';\nimport { getActions } from '../global';\n\nimport type { ApiMessage } from '../api/types';\n\nimport { throttle } from '../util/schedulers';\n\nconst useEnsureMessage = (\n chatId: string,\n messageId?: number,\n message?: ApiMessage,\n replyOriginForId?: number,\n) => {\n const { loadMessage } = getActions();\n const loadMessageThrottled = useMemo(() => {\n const throttled = throttle(loadMessage, 500, true);\n return () => {\n throttled({ chatId, messageId, replyOriginForId });\n };\n }, [loadMessage, chatId, messageId, replyOriginForId]);\n\n useEffect(() => {\n if (messageId && !message) {\n loadMessageThrottled();\n }\n });\n};\n\nexport default useEnsureMessage;\n","import { useEffect } from '../lib/teact/teact';\n\nimport {\n getOrderedIds,\n getUnreadCounters,\n getChatsCount,\n addOrderedIdsCallback,\n addUnreadCountersCallback,\n addChatsCountCallback,\n} from '../util/folderManager';\nimport useForceUpdate from './useForceUpdate';\n\nexport function useFolderManagerForOrderedIds(folderId: number) {\n const forceUpdate = useForceUpdate();\n\n useEffect(() => addOrderedIdsCallback(folderId, forceUpdate), [folderId, forceUpdate]);\n\n return getOrderedIds(folderId);\n}\n\nexport function useFolderManagerForUnreadCounters() {\n const forceUpdate = useForceUpdate();\n\n useEffect(() => addUnreadCountersCallback(forceUpdate), [forceUpdate]);\n\n return getUnreadCounters();\n}\n\nexport function useFolderManagerForChatsCount() {\n const forceUpdate = useForceUpdate();\n\n useEffect(() => addChatsCountCallback(forceUpdate), [forceUpdate]);\n\n return getChatsCount();\n}\n","import { useEffect } from '../lib/teact/teact';\n\nconst useHorizontalScroll = (container: HTMLElement | null, isDisabled?: boolean, shouldPreventDefault = false) => {\n useEffect(() => {\n if (!container || isDisabled) {\n return undefined;\n }\n\n function handleScroll(e: WheelEvent) {\n // Ignore horizontal scroll and let it work natively (e.g. on touchpad)\n if (!e.deltaX) {\n container!.scrollLeft += e.deltaY / 4;\n if (shouldPreventDefault) e.preventDefault();\n }\n }\n\n container.addEventListener('wheel', handleScroll, { passive: !shouldPreventDefault });\n\n return () => {\n container.removeEventListener('wheel', handleScroll);\n };\n }, [container, isDisabled, shouldPreventDefault]);\n};\n\nexport default useHorizontalScroll;\n","import { useEffect } from '../lib/teact/teact';\nimport { getHotkeyMatcher } from '../util/parseHotkey';\nimport { createCallbackManager } from '../util/callbacks';\n\nconst IGNORE_TAGS = new Set(['INPUT', 'TEXTAREA', 'SELECT']);\n\nconst handlers = createCallbackManager();\ndocument.documentElement.addEventListener('keydown', handlers.runCallbacks);\n\nexport function useHotkeys(hotkeys?: Record void>) {\n useEffect(() => {\n if (!hotkeys) {\n return undefined;\n }\n\n const entries = Object.entries(hotkeys);\n\n function handleKeyDown(e: KeyboardEvent) {\n if (!shouldFireEvent(e)) {\n return;\n }\n\n entries.forEach(([hotkey, handler]) => {\n if (getHotkeyMatcher(hotkey)(e)) {\n handler(e);\n }\n });\n }\n\n return handlers.addCallback(handleKeyDown);\n }, [hotkeys]);\n}\n\nfunction shouldFireEvent(e: KeyboardEvent) {\n if (e.target instanceof HTMLElement) {\n return !IGNORE_TAGS.has(e.target.tagName);\n }\n\n return true;\n}\n","// Original source from Mantine\n// https://github.com/mantinedev/mantine/blob/master/src/mantine-hooks/src/use-hotkeys/parse-hotkey.ts\n\nexport type KeyboardModifiers = {\n alt: boolean;\n ctrl: boolean;\n meta: boolean;\n mod: boolean;\n shift: boolean;\n};\n\nexport type Hotkey = KeyboardModifiers & {\n key?: string;\n};\n\ntype CheckHotkeyMatch = (event: KeyboardEvent) => boolean;\n\nexport function parseHotkey(hotkey: string): Hotkey {\n const keys = hotkey\n .toLowerCase()\n .split('+')\n .map((part) => part.trim());\n\n const modifiers: KeyboardModifiers = {\n alt: keys.includes('alt'),\n ctrl: keys.includes('ctrl'),\n meta: keys.includes('meta'),\n mod: keys.includes('mod'),\n shift: keys.includes('shift'),\n };\n\n const reservedKeys = ['alt', 'ctrl', 'meta', 'shift', 'mod'];\n\n const freeKey = keys.find((key) => !reservedKeys.includes(key));\n\n return {\n ...modifiers,\n key: freeKey,\n };\n}\n\nfunction isExactHotkey(hotkey: Hotkey, event: KeyboardEvent): boolean {\n const {\n alt, ctrl, meta, mod, shift, key,\n } = hotkey;\n const {\n altKey, ctrlKey, metaKey, shiftKey, key: pressedKey,\n } = event;\n\n if (alt !== altKey) {\n return false;\n }\n\n if (mod) {\n if (!ctrlKey && !metaKey) {\n return false;\n }\n } else {\n if (ctrl !== ctrlKey) {\n return false;\n }\n if (meta !== metaKey) {\n return false;\n }\n }\n if (shift !== shiftKey) {\n return false;\n }\n\n return Boolean(key\n && (pressedKey.toLowerCase() === key.toLowerCase()\n || event.code.replace('Key', '').toLowerCase() === key.toLowerCase()));\n}\n\nexport function getHotkeyMatcher(hotkey: string): CheckHotkeyMatch {\n return (event) => isExactHotkey(parseHotkey(hotkey), event);\n}\n","import type { RefObject } from 'react';\nimport { useEffect } from '../lib/teact/teact';\nimport { IS_SINGLE_COLUMN_LAYOUT } from '../util/environment';\n\n// Focus slows down animation, also it breaks transition layout in Chrome\nconst FOCUS_DELAY_MS = 500;\nconst MODAL_HIDE_DELAY_MS = 300;\n\nexport default function useInputFocusOnOpen(\n inputRef: RefObject,\n isOpen?: boolean,\n onClose?: NoneToVoidFunction,\n) {\n useEffect(() => {\n if (isOpen) {\n if (!IS_SINGLE_COLUMN_LAYOUT) {\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n });\n }, FOCUS_DELAY_MS);\n }\n } else {\n if (inputRef.current) {\n inputRef.current.blur();\n }\n\n if (onClose) {\n setTimeout(onClose, MODAL_HIDE_DELAY_MS);\n }\n }\n }, [inputRef, isOpen, onClose]);\n}\n","import { useLayoutEffect } from '../lib/teact/teact';\nimport usePrevious from './usePrevious';\n\nconst useLayoutEffectWithPrevDeps = (\n cb: (args: T | readonly []) => void, dependencies: T, debugKey?: string,\n) => {\n const prevDeps = usePrevious(dependencies);\n return useLayoutEffect(() => {\n return cb(prevDeps || []);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies, debugKey);\n};\n\nexport default useLayoutEffectWithPrevDeps;\n","import { useRef } from '../lib/teact/teact';\nimport generateIdFor from '../util/generateIdFor';\n\nconst store: Record = {};\n\nconst useUniqueId = () => {\n const idRef = useRef();\n\n if (!idRef.current) {\n idRef.current = generateIdFor(store);\n store[idRef.current] = true;\n }\n\n return idRef.current;\n};\n\nexport default useUniqueId;\n","import {\n useEffect, useMemo, useRef, useState,\n} from '../lib/teact/teact';\n\nimport { IS_PROGRESSIVE_SUPPORTED } from '../util/environment';\nimport { ApiMediaFormat } from '../api/types';\nimport { throttle } from '../util/schedulers';\nimport * as mediaLoader from '../util/mediaLoader';\nimport useForceUpdate from './useForceUpdate';\nimport useUniqueId from './useUniqueId';\n\nconst STREAMING_PROGRESS = 0.75;\nconst STREAMING_TIMEOUT = 1500;\nconst PROGRESS_THROTTLE = 500;\n\nexport default function useMediaWithLoadProgress(\n mediaHash: string | undefined,\n noLoad = false,\n mediaFormat = ApiMediaFormat.BlobUrl,\n cacheBuster?: number,\n delay?: number | false,\n isHtmlAllowed = false,\n) {\n const mediaData = mediaHash ? mediaLoader.getFromMemory(mediaHash) : undefined;\n const isStreaming = mediaFormat === ApiMediaFormat.Stream || (\n IS_PROGRESSIVE_SUPPORTED && mediaFormat === ApiMediaFormat.Progressive\n );\n const forceUpdate = useForceUpdate();\n const id = useUniqueId();\n const [loadProgress, setLoadProgress] = useState(mediaData && !isStreaming ? 1 : 0);\n const startedAtRef = useRef();\n\n const handleProgress = useMemo(() => {\n return throttle((progress: number) => {\n if (startedAtRef.current && (!delay || (Date.now() - startedAtRef.current > delay))) {\n setLoadProgress(progress);\n }\n }, PROGRESS_THROTTLE, true);\n }, [delay]);\n\n useEffect(() => {\n if (!noLoad && mediaHash) {\n if (!mediaData) {\n setLoadProgress(0);\n\n if (startedAtRef.current) {\n mediaLoader.cancelProgress(handleProgress);\n }\n\n startedAtRef.current = Date.now();\n\n mediaLoader.fetch(mediaHash, mediaFormat, isHtmlAllowed, handleProgress, id).then(() => {\n const spentTime = Date.now() - startedAtRef.current!;\n startedAtRef.current = undefined;\n\n if (!delay || spentTime >= delay) {\n forceUpdate();\n } else {\n setTimeout(forceUpdate, delay - spentTime);\n }\n });\n } else if (isStreaming) {\n setTimeout(() => {\n setLoadProgress(STREAMING_PROGRESS);\n }, STREAMING_TIMEOUT);\n }\n }\n }, [\n noLoad, mediaHash, mediaData, mediaFormat, cacheBuster, forceUpdate, isStreaming, delay, handleProgress,\n isHtmlAllowed, id,\n ]);\n\n useEffect(() => {\n if (noLoad && startedAtRef.current) {\n mediaLoader.cancelProgress(handleProgress);\n setLoadProgress(0);\n startedAtRef.current = undefined;\n }\n }, [handleProgress, noLoad]);\n\n useEffect(() => {\n return () => {\n if (mediaHash) {\n mediaLoader.removeCallback(mediaHash, id);\n }\n };\n }, [id, mediaHash]);\n\n return { mediaData, loadProgress };\n}\n","import { useCallback, useEffect, useRef } from '../lib/teact/teact';\n\nimport { IS_TOUCH_ENV } from '../util/environment';\n\nconst MENU_CLOSE_TIMEOUT = 250;\nlet closeTimeout: number | undefined;\n\nexport default function useMouseInside(\n isOpen: boolean, onClose: NoneToVoidFunction, menuCloseTimeout = MENU_CLOSE_TIMEOUT, isDisabled = false,\n) {\n const isMouseInside = useRef(false);\n\n const markMouseInside = useCallback(() => {\n isMouseInside.current = true;\n }, []);\n\n useEffect(() => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = undefined;\n }\n\n if (isOpen && !IS_TOUCH_ENV && !isDisabled) {\n closeTimeout = window.setTimeout(() => {\n if (!isMouseInside.current) {\n onClose();\n }\n }, menuCloseTimeout * 2);\n }\n }, [isDisabled, isOpen, menuCloseTimeout, onClose]);\n\n const handleMouseEnter = useCallback(() => {\n isMouseInside.current = true;\n }, []);\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 onClose();\n }\n }, menuCloseTimeout);\n }, [menuCloseTimeout, onClose]);\n\n return [handleMouseEnter, handleMouseLeave, markMouseInside];\n}\n","import { useRef } from '../lib/teact/teact';\n\nimport usePrevious from './usePrevious';\nimport useForceUpdate from './useForceUpdate';\nimport useOnChange from './useOnChange';\n\nexport default function usePrevDuringAnimation(current: any, duration?: number) {\n const prev = usePrevious(current, true);\n const timeoutRef = useRef();\n const forceUpdate = useForceUpdate();\n // eslint-disable-next-line no-null/no-null\n const isCurrentPresent = current !== undefined && current !== null;\n // eslint-disable-next-line no-null/no-null\n const isPrevPresent = prev !== undefined && prev !== null;\n\n if (isCurrentPresent && timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n\n useOnChange(() => {\n // When `current` becomes empty\n if (duration && !isCurrentPresent && isPrevPresent && !timeoutRef.current) {\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = undefined;\n forceUpdate();\n }, duration);\n }\n }, [current]);\n\n return !timeoutRef.current || !duration || isCurrentPresent ? current : prev;\n}\n","import { useCallback, useRef } from '../lib/teact/teact';\n\nimport useForceUpdate from './useForceUpdate';\n\nexport type ReducerAction = { type: Actions; payload?: any };\nexport type StateReducer = (state: State, action: ReducerAction) => State;\nexport type Dispatch = (action: ReducerAction) => void;\n\nexport default function useReducer(\n reducer: StateReducer,\n initialState: State,\n) {\n const forceUpdate = useForceUpdate();\n const reducerRef = useRef(reducer);\n const state = useRef(initialState);\n\n const dispatch = useCallback((action: ReducerAction) => {\n state.current = reducerRef.current(state.current, action);\n forceUpdate();\n }, [forceUpdate]);\n\n return [\n state.current,\n dispatch,\n ] as [State, Dispatch];\n}\n","import useDebouncedCallback from './useDebouncedCallback';\n\nexport default function useRunDebounced(ms: number, noFirst?: boolean, noLast?: boolean) {\n return useDebouncedCallback((cb: NoneToVoidFunction) => {\n cb();\n }, [], ms, noFirst, noLast);\n}\n","import type { FC } from '../../lib/teact/teact';\nimport React, { memo } from '../../lib/teact/teact';\nimport type { OwnProps } from './CalendarModal';\nimport { Bundles } from '../../util/moduleLoader';\n\nimport useModuleLoader from '../../hooks/useModuleLoader';\n\nconst CalendarModalAsync: FC = (props) => {\n const { isOpen } = props;\n const CalendarModal = useModuleLoader(Bundles.Extra, 'CalendarModal', !isOpen);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return CalendarModal ? : undefined;\n};\n\nexport default memo(CalendarModalAsync);\n","import React, { useCallback, useState } from '../lib/teact/teact';\nimport { getGlobal } from '../lib/teact/teactn';\n\nimport { SCHEDULED_WHEN_ONLINE } from '../config';\nimport { getDayStartAt } from '../util/dateFormat';\nimport useLang from './useLang';\n\nimport CalendarModal from '../components/common/CalendarModal.async';\n\ntype OnScheduledCallback = (scheduledAt: number) => void;\n\nconst useSchedule = (\n canScheduleUntilOnline?: boolean,\n onCancel?: () => void,\n) => {\n const lang = useLang();\n const [onScheduled, setOnScheduled] = useState();\n\n const handleMessageSchedule = useCallback((date: Date, isWhenOnline = false) => {\n const { serverTimeOffset } = getGlobal();\n // Scheduled time can not be less than 10 seconds in future\n const scheduledAt = Math.round(Math.max(date.getTime(), Date.now() + 60 * 1000) / 1000)\n + (isWhenOnline ? 0 : serverTimeOffset);\n onScheduled?.(scheduledAt);\n setOnScheduled(undefined);\n }, [onScheduled]);\n\n const handleMessageScheduleUntilOnline = useCallback(() => {\n handleMessageSchedule(new Date(SCHEDULED_WHEN_ONLINE * 1000), true);\n }, [handleMessageSchedule]);\n\n const handleCloseCalendar = useCallback(() => {\n setOnScheduled(undefined);\n onCancel?.();\n }, [onCancel]);\n\n const requestCalendar = useCallback((whenScheduled: OnScheduledCallback) => {\n setOnScheduled(() => whenScheduled);\n }, []);\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 const calendar = (\n \n );\n\n return [requestCalendar, calendar] as const;\n};\n\nexport default useSchedule;\n","import { useMemo } from '../lib/teact/teact';\nimport { getActions } from '../global';\n\nimport type { ApiSendMessageAction } from '../api/types';\n\nimport { SEND_MESSAGE_ACTION_INTERVAL } from '../config';\nimport { throttle } from '../util/schedulers';\n\nconst useSendMessageAction = (chatId?: string, threadId?: number) => {\n return useMemo(() => {\n return throttle((action: ApiSendMessageAction) => {\n getActions().sendMessageAction({ chatId, threadId, action });\n }, SEND_MESSAGE_ACTION_INTERVAL);\n }, [chatId, threadId]);\n};\n\nexport default useSendMessageAction;\n","import { useRef } from '../lib/teact/teact';\n\nimport useOnChange from './useOnChange';\n\n// Allows to use state value as \"silent\" dependency in hooks (not causing updates).\n// Useful for state values that update frequently (such as controlled input value).\nexport function useStateRef(value: T) {\n const ref = useRef(value);\n\n useOnChange(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n","import { useEffect, useLayoutEffect, useRef } from '../lib/teact/teact';\n\nfunction useTimeout(callback: () => void, delay?: number) {\n const savedCallback = useRef(callback);\n\n useLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n useEffect(() => {\n if (typeof delay !== 'number') {\n return undefined;\n }\n const id = setTimeout(() => savedCallback.current(), delay);\n return () => clearTimeout(id);\n }, [delay]);\n}\n\nexport default useTimeout;\n","import type { RefObject } from 'react';\nimport { useEffect } from '../lib/teact/teact';\nimport { fastRaf } from '../util/schedulers';\n\n// Fix for memory leak when unmounting video element\nexport default function useVideoCleanup(videoRef: RefObject, dependencies: any[]) {\n useEffect(() => {\n const videoEl = videoRef.current;\n\n return () => {\n if (videoEl) {\n fastRaf(() => {\n videoEl.pause();\n videoEl.src = '';\n videoEl.load();\n });\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n","/* eslint-disable no-nested-ternary */\n/* eslint-disable no-bitwise */\n/* eslint-disable no-multi-assign */\n/* eslint-disable no-cond-assign */\n/* eslint-disable no-param-reassign */\n/* eslint-disable prefer-const */\n/* eslint-disable eqeqeq */\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/*\nSuperfast Blur - a fast Box Blur For Canvas\n\nVersion: 0.5\nAuthor: Mario Klingemann\nContact: mario@quasimondo.com\nWebsite: http://www.quasimondo.com/BoxBlurForCanvas\nTwitter: @quasimondo\n\nIn case you find this class useful - especially in commercial projects -\nI am not totally unhappy for a small donation to my PayPal account\nmario@quasimondo.de\n\nOr support me on flattr:\nhttps://flattr.com/thing/140066/Superfast-Blur-a-pretty-fast-Box-Blur-Effect-for-CanvasJavascript\n\nCopyright (c) 2011 Mario Klingemann\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// eslint-disable-next-line max-len\nconst mul_table = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];\n// eslint-disable-next-line max-len\nconst shg_table = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];\n\nexport default function boxBlurCanvasRGB(context, top_x, top_y, width, height, radius, iterations) {\n if (Number.isNaN(radius) || radius < 1) return;\n\n radius |= 0;\n\n if (Number.isNaN(iterations)) iterations = 1;\n iterations |= 0;\n if (iterations > 3) iterations = 3;\n if (iterations < 1) iterations = 1;\n\n const imageData = context.getImageData(top_x, top_y, width, height);\n\n const pixels = imageData.data;\n\n let rsum;\n let gsum;\n let bsum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let wm = width - 1;\n let hm = height - 1;\n let rad1 = radius + 1;\n\n let r = [];\n let g = [];\n let b = [];\n\n let mul_sum = mul_table[radius];\n let shg_sum = shg_table[radius];\n\n let vmin = [];\n let vmax = [];\n\n while (iterations-- > 0) {\n yw = yi = 0;\n\n for (y = 0; y < height; y++) {\n rsum = pixels[yw] * rad1;\n gsum = pixels[yw + 1] * rad1;\n bsum = pixels[yw + 2] * rad1;\n\n for (i = 1; i <= radius; i++) {\n p = yw + (((i > wm ? wm : i)) << 2);\n rsum += pixels[p++];\n gsum += pixels[p++];\n bsum += pixels[p++];\n }\n\n for (x = 0; x < width; x++) {\n r[yi] = rsum;\n g[yi] = gsum;\n b[yi] = bsum;\n\n if (y == 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = ((p = x - radius) > 0 ? p << 2 : 0);\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += pixels[p1++] - pixels[p2++];\n gsum += pixels[p1++] - pixels[p2++];\n bsum += pixels[p1++] - pixels[p2++];\n\n yi++;\n }\n yw += (width << 2);\n }\n\n for (x = 0; x < width; x++) {\n yp = x;\n rsum = r[yp] * rad1;\n gsum = g[yp] * rad1;\n bsum = b[yp] * rad1;\n\n for (i = 1; i <= radius; i++) {\n yp += (i > hm ? 0 : width);\n rsum += r[yp];\n gsum += g[yp];\n bsum += b[yp];\n }\n\n yi = x << 2;\n for (y = 0; y < height; y++) {\n pixels[yi] = (rsum * mul_sum) >>> shg_sum;\n pixels[yi + 1] = (gsum * mul_sum) >>> shg_sum;\n pixels[yi + 2] = (bsum * mul_sum) >>> shg_sum;\n\n if (x == 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * width;\n vmax[y] = ((p = y - radius) > 0 ? p * width : 0);\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += r[p1] - r[p2];\n gsum += g[p1] - g[p2];\n bsum += b[p1] - b[p2];\n\n yi += width << 2;\n }\n }\n }\n\n context.putImageData(imageData, top_x, top_y);\n}\n","import { getActions, getGlobal } from '../global';\n\nimport { AudioOrigin, GlobalSearchContent } from '../types';\nimport type { ApiMessage } from '../api/types';\n\nimport { IS_SAFARI } from './environment';\nimport safePlay from './safePlay';\nimport { patchSafariProgressiveAudio, isSafariPatchInProgress } from './patchSafariProgressiveAudio';\nimport type { MessageKey } from '../global/helpers';\nimport { getMessageKey, parseMessageKey } from '../global/helpers';\nimport { fastRaf } from './schedulers';\nimport { selectCurrentMessageList } from '../global/selectors';\n\ntype Handler = (eventName: string, e: Event) => void;\nexport type TrackId = `${MessageKey}-${number}`;\n\nexport interface Track {\n audio: HTMLAudioElement;\n proxy: HTMLAudioElement;\n type: 'voice' | 'audio';\n handlers: Handler[];\n onForcePlay?: NoneToVoidFunction;\n onTrackChange?: NoneToVoidFunction;\n}\n\nconst tracks = new Map();\nlet voiceQueue: TrackId[] = [];\nlet musicQueue: TrackId[] = [];\n\nlet currentTrackId: TrackId | undefined;\n\nfunction createAudio(\n trackId: TrackId,\n type: Track['type'],\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n): Track {\n const audio = new Audio();\n\n function handleEvent(eventName: string) {\n return (e: Event) => {\n if (!tracks.has(trackId)) {\n return;\n }\n\n if (isSafariPatchInProgress(audio)) {\n return;\n }\n\n tracks.get(trackId)!.handlers.forEach((handler) => {\n handler(eventName, e);\n });\n };\n }\n\n audio.addEventListener('timeupdate', handleEvent('onTimeUpdate'));\n audio.addEventListener('play', handleEvent('onPlay'));\n audio.addEventListener('pause', handleEvent('onPause'));\n audio.addEventListener('loadstart', handleEvent('onLoadStart'));\n audio.addEventListener('loadeddata', handleEvent('onLoadedData'));\n audio.addEventListener('playing', handleEvent('onPlaying'));\n audio.addEventListener('ended', () => {\n if (!tracks.has(trackId)) {\n return;\n }\n\n if (isSafariPatchInProgress(audio)) {\n return;\n }\n\n playNext(trackId);\n });\n\n return {\n audio,\n type,\n proxy: new Proxy(audio, {\n get: (target, key: keyof HTMLAudioElement) => target[key],\n }),\n handlers: [],\n onForcePlay,\n onTrackChange,\n };\n}\n\nfunction playNext(trackId: TrackId, isReverseOrder?: boolean) {\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack) {\n currentTrack.audio.pause();\n currentTrack.audio.currentTime = 0;\n if (currentTrack.onTrackChange) currentTrack.onTrackChange();\n }\n\n const origin = getGlobal().audioPlayer.origin || AudioOrigin.Inline;\n\n const nextTrackId = findNextInQueue(trackId, origin, isReverseOrder);\n if (!nextTrackId) {\n return;\n }\n\n if (!tracks.has(nextTrackId)) {\n // A bit hacky way to continue playlist when switching chat\n getActions().openAudioPlayer(parseMessageKey(splitTrackId(nextTrackId).messageKey));\n\n return;\n }\n\n const nextTrack = tracks.get(nextTrackId)!;\n\n if (nextTrack.onForcePlay) {\n nextTrack.onForcePlay();\n }\n\n currentTrackId = nextTrackId;\n\n if (nextTrack.audio.src) {\n safePlay(nextTrack.audio);\n }\n}\n\nexport function stopCurrentAudio() {\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack) {\n currentTrack.audio.pause();\n }\n}\n\nexport function register(\n trackId: TrackId,\n trackType: Track['type'],\n handler: Handler,\n onForcePlay?: NoneToVoidFunction,\n onTrackChange?: NoneToVoidFunction,\n) {\n if (!tracks.has(trackId)) {\n const track = createAudio(trackId, trackType, onForcePlay, onTrackChange);\n tracks.set(trackId, track);\n addTrackToQueue(track, trackId);\n }\n const { audio, proxy, handlers } = tracks.get(trackId)!;\n\n handlers.push(handler);\n\n return {\n play(src: string) {\n if (!audio.paused) return;\n const currentTrack = currentTrackId && tracks.get(currentTrackId);\n if (currentTrack && currentTrackId !== trackId) {\n currentTrack.audio.pause();\n currentTrack.audio.currentTime = 0;\n if (isSafariPatchInProgress(currentTrack.audio)) {\n currentTrack.audio.dataset.preventPlayAfterPatch = 'true';\n }\n if (currentTrack.onTrackChange) currentTrack.onTrackChange();\n }\n\n currentTrackId = trackId;\n\n if (!audio.src) {\n audio.src = src;\n audio.preload = 'auto';\n\n if (src.includes('/progressive/') && IS_SAFARI) {\n delete audio.dataset.preventPlayAfterPatch;\n patchSafariProgressiveAudio(audio);\n }\n }\n\n safePlay(audio);\n cleanUpQueue(trackType, trackId);\n },\n\n pause() {\n if (currentTrackId === trackId) {\n audio.pause();\n }\n },\n\n stop() {\n if (currentTrackId === trackId) {\n // Hack, reset src to remove default media session notification\n const prevSrc = audio.src;\n audio.pause();\n // onPause not called otherwise, but required to sync UI\n fastRaf(() => {\n audio.src = '';\n audio.src = prevSrc;\n });\n }\n },\n\n setCurrentTime(time: number) {\n if (currentTrackId === trackId) {\n if (audio.fastSeek) {\n audio.fastSeek(time);\n } else {\n audio.currentTime = time;\n }\n }\n },\n\n setVolume(volume: number) {\n if (currentTrackId === trackId) {\n audio.volume = volume;\n audio.muted = false;\n }\n },\n\n setPlaybackRate(rate: number) {\n if (currentTrackId === trackId) {\n audio.playbackRate = rate;\n }\n },\n\n toggleMuted(muted?: boolean) {\n if (muted === undefined) {\n audio.muted = !audio.muted;\n } else {\n audio.muted = muted;\n }\n },\n\n proxy,\n\n requestNextTrack() {\n playNext(trackId);\n },\n\n isLast() {\n return !findNextInQueue(trackId, getGlobal().audioPlayer.origin);\n },\n\n isFirst() {\n return !findNextInQueue(trackId, getGlobal().audioPlayer.origin, true);\n },\n\n requestPreviousTrack() {\n playNext(trackId, true);\n },\n\n destroy(shouldRemoveFromQueue = false) {\n const track = tracks.get(trackId);\n if (!track) {\n return;\n }\n\n track.handlers = track.handlers.filter((h) => h !== handler);\n\n if (!track.handlers.length) {\n track.audio.pause();\n tracks.delete(trackId);\n\n if (shouldRemoveFromQueue) {\n removeFromQueue(track, trackId);\n }\n\n if (trackId === currentTrackId) {\n currentTrackId = undefined;\n }\n }\n },\n };\n}\n\nfunction getTrackQueue(track: Track) {\n switch (track.type) {\n case 'audio': return musicQueue;\n case 'voice': return voiceQueue;\n default: return undefined;\n }\n}\n\nfunction addTrackToQueue(track: Track, trackId: TrackId) {\n if (track.type === 'audio' && !musicQueue.includes(trackId)) {\n musicQueue.push(trackId);\n musicQueue.sort(trackIdComparator);\n }\n\n if (track.type === 'voice' && !voiceQueue.includes(trackId)) {\n voiceQueue.push(trackId);\n voiceQueue.sort(trackIdComparator);\n }\n}\n\nfunction removeFromQueue(track: Track, trackId: TrackId) {\n const trackIdFilter = (el: TrackId) => el !== trackId;\n if (track.type === 'audio') {\n musicQueue = musicQueue.filter(trackIdFilter);\n }\n\n if (track.type === 'voice') {\n voiceQueue = voiceQueue.filter(trackIdFilter);\n }\n}\n\nfunction cleanUpQueue(type: Track['type'], trackId: TrackId) {\n if (getGlobal().globalSearch.currentContent === GlobalSearchContent.Music) return;\n const { chatId } = parseMessageKey(splitTrackId(trackId).messageKey);\n const openedChatId = selectCurrentMessageList(getGlobal())?.chatId;\n const queueFilter = (id: string) => (\n id.startsWith(`msg${chatId}`) || (openedChatId && id.startsWith(`msg${openedChatId}`))\n );\n\n if (type === 'audio') {\n musicQueue = musicQueue.filter(queueFilter);\n }\n\n if (type === 'voice') {\n voiceQueue = voiceQueue.filter(queueFilter);\n }\n}\n\nfunction findNextInQueue(currentId: TrackId, origin = AudioOrigin.Inline, isReverseOrder?: boolean) {\n const track = tracks.get(currentId)!;\n const queue = getTrackQueue(track);\n if (!queue) return undefined;\n\n if (origin === AudioOrigin.Search) {\n const index = queue.indexOf(currentId);\n if (index < 0) return undefined;\n const direction = isReverseOrder ? -1 : 1;\n return queue[index + direction];\n }\n\n const { chatId } = parseMessageKey(splitTrackId(currentId).messageKey);\n const chatAudio = queue.filter((id) => id.startsWith(`msg${chatId}`));\n const index = chatAudio.indexOf(currentId);\n if (index < 0) return undefined;\n let direction = origin === AudioOrigin.Inline ? -1 : 1;\n if (isReverseOrder) direction *= -1;\n return chatAudio[index + direction];\n}\n\nexport function makeTrackId(message: ApiMessage): TrackId {\n return `${getMessageKey(message)}-${message.date}`;\n}\n\nfunction splitTrackId(trackId: TrackId) {\n const messageKey = trackId.match(/^msg(-?\\d+)-(\\d+)/)![0] as MessageKey;\n const date = Number(trackId.split('-').pop());\n return {\n messageKey,\n date,\n };\n}\n\n// Descending order by date\nfunction trackIdComparator(one?: TrackId, two?: TrackId) {\n if (!one || !two) return 0;\n const { date: dateOne, messageKey: keyOne } = splitTrackId(one);\n const { date: dateTwo, messageKey: keyTwo } = splitTrackId(two);\n const diff = dateTwo - dateOne;\n return diff === 0 ? keyTwo.localeCompare(keyOne) : diff;\n}\n","import { IS_IOS } from './environment';\nimport { Lethargy } from './lethargy';\nimport { clamp, round } from './math';\nimport { debounce } from './schedulers';\n\nexport enum SwipeDirection {\n Up,\n Down,\n Left,\n Right,\n}\n\ninterface CaptureOptions {\n onCapture?: (e: MouseEvent | TouchEvent | WheelEvent) => void;\n onRelease?: (e: MouseEvent | TouchEvent | WheelEvent) => void;\n onDrag?: (\n e: MouseEvent | TouchEvent | WheelEvent,\n captureEvent: MouseEvent | TouchEvent | WheelEvent,\n params: {\n dragOffsetX: number;\n dragOffsetY: number;\n },\n cancelDrag?: (x: boolean, y: boolean) => void,\n ) => void;\n onSwipe?: (e: Event, direction: SwipeDirection) => boolean;\n onZoom?: (e: TouchEvent | WheelEvent, params: {\n // Absolute zoom level\n zoom?: number;\n // Relative zoom factor\n zoomFactor?: number;\n\n // center coordinate of the initial pinch\n initialCenterX: number;\n initialCenterY: number;\n\n // offset of the pinch center (current from initial)\n dragOffsetX: number;\n dragOffsetY: number;\n\n // center coordinate of the current pinch\n currentCenterX: number;\n currentCenterY: number;\n }) => void;\n onClick?: (e: MouseEvent | TouchEvent) => void;\n onDoubleClick?: (e: MouseEvent | RealTouchEvent | WheelEvent, params: { centerX: number; centerY: number }) => void;\n excludedClosestSelector?: string;\n selectorToPreventScroll?: string;\n withNativeDrag?: boolean;\n maxZoom?: number;\n minZoom?: number;\n doubleTapZoom?: number;\n initialZoom?: number;\n isNotPassive?: boolean;\n withCursor?: boolean;\n}\n\n// https://stackoverflow.com/questions/11287877/how-can-i-get-e-offsetx-on-mobile-ipad\n// Android does not have this value, and iOS has it but as read-only\nexport interface RealTouchEvent extends TouchEvent {\n pageX?: number;\n pageY?: number;\n}\n\ntype TSwipeAxis =\n 'x'\n | 'y'\n | undefined;\n\nexport const IOS_SCREEN_EDGE_THRESHOLD = 20;\nconst MOVED_THRESHOLD = 15;\nconst SWIPE_THRESHOLD = 50;\nconst RELEASE_WHEEL_ZOOM_DELAY = 150;\nconst RELEASE_WHEEL_DRAG_DELAY = 150;\n\nfunction getDistance(a: Touch, b?: Touch) {\n if (!b) return 0;\n return Math.hypot((b.pageX - a.pageX), (b.pageY - a.pageY));\n}\n\nfunction getTouchCenter(a: Touch, b: Touch) {\n return {\n x: (a.pageX + b.pageX) / 2,\n y: (a.pageY + b.pageY) / 2,\n };\n}\n\nlet lastClickTime = 0;\nconst lethargy = new Lethargy({\n stability: 5,\n sensitivity: 25,\n tolerance: 0.6,\n delay: 150,\n});\n\nexport function captureEvents(element: HTMLElement, options: CaptureOptions) {\n let captureEvent: MouseEvent | RealTouchEvent | WheelEvent | undefined;\n let hasMoved = false;\n let hasSwiped = false;\n let isZooming = false;\n let initialDistance = 0;\n let wheelZoom = options.initialZoom ?? 1;\n let initialDragOffset = {\n x: 0,\n y: 0,\n };\n let isDragCanceled = {\n x: false,\n y: false,\n };\n let initialTouchCenter = {\n x: window.innerWidth / 2,\n y: window.innerHeight / 2,\n };\n let initialSwipeAxis: TSwipeAxis | undefined;\n const minZoom = options.minZoom ?? 1;\n const maxZoom = options.maxZoom ?? 4;\n\n function onCapture(e: MouseEvent | RealTouchEvent) {\n if (options.excludedClosestSelector && (\n (e.target as HTMLElement).matches(options.excludedClosestSelector)\n || (e.target as HTMLElement).closest(options.excludedClosestSelector)\n )) {\n return;\n }\n\n captureEvent = e;\n\n if (e.type === 'mousedown') {\n if (!options.withNativeDrag && options.onDrag) {\n e.preventDefault();\n }\n\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onRelease);\n } else if (e.type === 'touchstart') {\n // We need to always listen on `touchstart` target:\n // https://stackoverflow.com/questions/33298828/touch-move-event-dont-fire-after-touch-start-target-is-removed\n const target = e.target as HTMLElement;\n target.addEventListener('touchmove', onMove, { passive: true });\n target.addEventListener('touchend', onRelease);\n target.addEventListener('touchcancel', onRelease);\n\n if ('touches' in e) {\n if (e.pageX === undefined) {\n e.pageX = e.touches[0].pageX;\n }\n\n if (e.pageY === undefined) {\n e.pageY = e.touches[0].pageY;\n }\n\n if (e.touches.length === 2) {\n initialDistance = getDistance(e.touches[0], e.touches[1]);\n initialTouchCenter = getTouchCenter(e.touches[0], e.touches[1]);\n }\n }\n }\n\n if (options.withCursor) {\n document.body.classList.add('cursor-grabbing');\n }\n\n if (options.onCapture) {\n options.onCapture(e);\n }\n }\n\n function onRelease(e?: MouseEvent | TouchEvent) {\n if (captureEvent) {\n if (options.withCursor) {\n document.body.classList.remove('cursor-grabbing');\n }\n\n document.removeEventListener('mouseup', onRelease);\n document.removeEventListener('mousemove', onMove);\n (captureEvent.target as HTMLElement).removeEventListener('touchcancel', onRelease);\n (captureEvent.target as HTMLElement).removeEventListener('touchend', onRelease);\n (captureEvent.target as HTMLElement).removeEventListener('touchmove', onMove);\n\n if (IS_IOS && options.selectorToPreventScroll) {\n Array.from(document.querySelectorAll(options.selectorToPreventScroll))\n .forEach((scrollable) => {\n scrollable.style.overflow = '';\n });\n }\n\n if (e) {\n if (hasMoved) {\n if (options.onRelease) {\n options.onRelease(e);\n }\n } else if (e.type === 'mouseup') {\n if (options.onDoubleClick && Date.now() - lastClickTime < 300) {\n options.onDoubleClick(e, {\n centerX: captureEvent!.pageX!,\n centerY: captureEvent!.pageY!,\n });\n } else if (options.onClick && (!('button' in e) || e.button === 0)) {\n options.onClick(e);\n }\n lastClickTime = Date.now();\n }\n }\n }\n\n hasMoved = false;\n hasSwiped = false;\n isZooming = false;\n initialDistance = 0;\n wheelZoom = clamp(wheelZoom, minZoom, maxZoom);\n initialSwipeAxis = undefined;\n initialDragOffset = {\n x: 0,\n y: 0,\n };\n isDragCanceled = {\n x: false,\n y: false,\n };\n initialTouchCenter = {\n x: window.innerWidth / 2,\n y: window.innerHeight / 2,\n };\n captureEvent = undefined;\n }\n\n function onMove(e: MouseEvent | RealTouchEvent) {\n if (captureEvent) {\n if (e.type === 'touchmove' && ('touches' in e)) {\n if (e.pageX === undefined) {\n e.pageX = e.touches[0].pageX;\n }\n\n if (e.pageY === undefined) {\n e.pageY = e.touches[0].pageY;\n }\n\n if (options.onZoom && initialDistance > 0 && e.touches.length === 2) {\n const endDistance = getDistance(e.touches[0], e.touches[1]);\n const touchCenter = getTouchCenter(e.touches[0], e.touches[1]);\n const dragOffsetX = touchCenter.x - initialTouchCenter.x;\n const dragOffsetY = touchCenter.y - initialTouchCenter.y;\n const zoomFactor = endDistance / initialDistance;\n options.onZoom(e, {\n zoomFactor,\n initialCenterX: initialTouchCenter.x,\n initialCenterY: initialTouchCenter.y,\n dragOffsetX,\n dragOffsetY,\n currentCenterX: touchCenter.x,\n currentCenterY: touchCenter.y,\n });\n if (zoomFactor !== 1) hasMoved = true;\n }\n }\n\n const dragOffsetX = e.pageX! - captureEvent.pageX!;\n const dragOffsetY = e.pageY! - captureEvent.pageY!;\n\n if (Math.abs(dragOffsetX) >= MOVED_THRESHOLD || Math.abs(dragOffsetY) >= MOVED_THRESHOLD) {\n hasMoved = true;\n }\n\n let shouldPreventScroll = false;\n\n if (options.onDrag) {\n options.onDrag(e, captureEvent, {\n dragOffsetX,\n dragOffsetY,\n });\n shouldPreventScroll = true;\n }\n\n if (options.onSwipe && !hasSwiped) {\n hasSwiped = onSwipe(e, dragOffsetX, dragOffsetY);\n shouldPreventScroll = hasSwiped;\n }\n\n if (IS_IOS && shouldPreventScroll && options.selectorToPreventScroll) {\n Array.from(document.querySelectorAll(options.selectorToPreventScroll))\n .forEach((scrollable) => {\n scrollable.style.overflow = 'hidden';\n });\n }\n }\n }\n\n function onSwipe(e: MouseEvent | RealTouchEvent, dragOffsetX: number, dragOffsetY: number) {\n // Avoid conflicts with swipe-to-back gestures\n if (IS_IOS) {\n const x = (e as RealTouchEvent).touches[0].pageX;\n if (x <= IOS_SCREEN_EDGE_THRESHOLD || x >= window.innerWidth - IOS_SCREEN_EDGE_THRESHOLD) {\n return false;\n }\n }\n\n const xAbs = Math.abs(dragOffsetX);\n const yAbs = Math.abs(dragOffsetY);\n\n if (dragOffsetX && dragOffsetY) {\n const ratio = Math.max(xAbs, yAbs) / Math.min(xAbs, yAbs);\n // Diagonal swipe\n if (ratio < 2) {\n return false;\n }\n }\n\n let axis: TSwipeAxis | undefined;\n if (xAbs >= SWIPE_THRESHOLD) {\n axis = 'x';\n } else if (yAbs >= SWIPE_THRESHOLD) {\n axis = 'y';\n }\n\n if (!axis) {\n return false;\n }\n\n if (!initialSwipeAxis) {\n initialSwipeAxis = axis;\n } else if (initialSwipeAxis !== axis) {\n // Prevent horizontal swipe after vertical to prioritize scroll\n return false;\n }\n\n return processSwipe(e, axis, dragOffsetX, dragOffsetY, options.onSwipe!);\n }\n\n const releaseWheelDrag = debounce(onRelease, RELEASE_WHEEL_DRAG_DELAY, false);\n const releaseWheelZoom = debounce(onRelease, RELEASE_WHEEL_ZOOM_DELAY, false);\n\n function onWheelCapture(e: WheelEvent) {\n if (hasMoved) return;\n onCapture(e);\n hasMoved = true;\n initialTouchCenter = { x: e.x, y: e.y };\n }\n\n function onWheelZoom(e: WheelEvent) {\n if (!options.onZoom) return;\n onWheelCapture(e);\n const dragOffsetX = e.x - initialTouchCenter.x;\n const dragOffsetY = e.y - initialTouchCenter.y;\n const delta = clamp(e.deltaY, -25, 25);\n wheelZoom -= delta * 0.01;\n wheelZoom = clamp(wheelZoom, minZoom * 0.5, maxZoom * 3);\n options.onZoom(e, {\n zoom: round(wheelZoom, 2),\n initialCenterX: initialTouchCenter.x,\n initialCenterY: initialTouchCenter.y,\n dragOffsetX,\n dragOffsetY,\n currentCenterX: e.x,\n currentCenterY: e.y,\n });\n releaseWheelZoom(e);\n }\n\n function onWheelDrag(e: WheelEvent) {\n if (!options.onDrag) return;\n onWheelCapture(e);\n // Ignore wheel inertia if drag is canceled in this direction\n if (!isDragCanceled.x || Math.sign(initialDragOffset.x) === Math.sign(e.deltaX)) {\n initialDragOffset.x -= e.deltaX;\n }\n if (!isDragCanceled.y || Math.sign(initialDragOffset.y) === Math.sign(e.deltaY)) {\n initialDragOffset.y -= e.deltaY;\n }\n const { x, y } = initialDragOffset;\n options.onDrag(e, captureEvent!, {\n dragOffsetX: x,\n dragOffsetY: y,\n }, (dx, dy) => {\n isDragCanceled = { x: dx, y: dy };\n });\n releaseWheelDrag(e);\n }\n\n function onWheel(e: WheelEvent) {\n if (!options.onZoom && !options.onDrag) return;\n if (options.excludedClosestSelector && (\n (e.target as HTMLElement).matches(options.excludedClosestSelector)\n || (e.target as HTMLElement).closest(options.excludedClosestSelector)\n )) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n const { doubleTapZoom = 3 } = options;\n if (options.onDoubleClick && Object.is(e.deltaX, -0) && Object.is(e.deltaY, -0) && e.ctrlKey) {\n onWheelCapture(e);\n wheelZoom = wheelZoom > 1 ? 1 : doubleTapZoom;\n options.onDoubleClick(e, { centerX: e.pageX, centerY: e.pageY });\n hasMoved = false;\n return;\n }\n const metaKeyPressed = e.metaKey || e.ctrlKey || e.shiftKey;\n if (metaKeyPressed) {\n onWheelZoom(e);\n }\n if (!metaKeyPressed && !isZooming) {\n // Check if this event produced by user scroll and not by inertia\n const isUserEvent = lethargy.check(e);\n if (wheelZoom !== 1) {\n onWheelDrag(e);\n } else if (isUserEvent) {\n onWheelDrag(e);\n }\n }\n }\n\n element.addEventListener('wheel', onWheel);\n element.addEventListener('mousedown', onCapture);\n element.addEventListener('touchstart', onCapture, { passive: !options.isNotPassive });\n\n return () => {\n onRelease();\n element.removeEventListener('wheel', onWheel);\n element.removeEventListener('touchstart', onCapture);\n element.removeEventListener('mousedown', onCapture);\n };\n}\n\nfunction processSwipe(\n e: Event,\n currentSwipeAxis: TSwipeAxis,\n dragOffsetX: number,\n dragOffsetY: number,\n onSwipe: (e: Event, direction: SwipeDirection) => boolean,\n) {\n if (currentSwipeAxis === 'x') {\n if (dragOffsetX < 0) {\n return onSwipe(e, SwipeDirection.Left);\n } else {\n return onSwipe(e, SwipeDirection.Right);\n }\n } else if (currentSwipeAxis === 'y') {\n if (dragOffsetY < 0) {\n return onSwipe(e, SwipeDirection.Up);\n } else {\n return onSwipe(e, SwipeDirection.Down);\n }\n }\n\n return false;\n}\n","/**\n * Lethargy help distinguish between scroll events initiated by the user, and those by inertial scrolling.\n * Lethargy does not have external dependencies.\n *\n * @param stability - Specifies the length of the rolling average.\n * In effect, the larger the value, the smoother the curve will be.\n * This attempts to prevent anomalies from firing 'real' events. Valid values are all positive integers,\n * but in most cases, you would need to stay between 5 and around 30.\n *\n * @param sensitivity - Specifies the minimum value for wheelDelta for it to register as a valid scroll event.\n * Because the tail of the curve have low wheelDelta values,\n * this will stop them from registering as valid scroll events.\n * The unofficial standard wheelDelta is 120, so valid values are positive integers below 120.\n *\n * @param tolerance - Prevent small fluctuations from affecting results.\n * Valid values are decimals from 0, but should ideally be between 0.05 and 0.3.\n *\n * Based on https://github.com/d4nyll/lethargy\n */\n\nexport type LethargyConfig = {\n stability?: number;\n sensitivity?: number;\n tolerance?: number;\n delay?: number;\n};\n\nexport class Lethargy {\n stability: number;\n\n sensitivity: number;\n\n tolerance: number;\n\n delay: number;\n\n lastUpDeltas: Array;\n\n lastDownDeltas: Array;\n\n deltasTimestamp: Array;\n\n constructor({\n stability = 8,\n sensitivity = 100,\n tolerance = 1.1,\n delay = 150,\n }: LethargyConfig = {}) {\n this.stability = stability;\n this.sensitivity = sensitivity;\n this.tolerance = tolerance;\n this.delay = delay;\n this.lastUpDeltas = new Array(this.stability * 2).fill(0);\n this.lastDownDeltas = new Array(this.stability * 2).fill(0);\n this.deltasTimestamp = new Array(this.stability * 2).fill(0);\n }\n\n check(e: any) {\n let lastDelta;\n e = e.originalEvent || e;\n if (e.wheelDelta !== undefined) {\n lastDelta = e.wheelDelta;\n } else if (e.deltaY !== undefined) {\n lastDelta = e.deltaY * -40;\n } else if (e.detail !== undefined || e.detail === 0) {\n lastDelta = e.detail * -40;\n }\n this.deltasTimestamp.push(Date.now());\n this.deltasTimestamp.shift();\n if (lastDelta > 0) {\n this.lastUpDeltas.push(lastDelta);\n this.lastUpDeltas.shift();\n return this.isInertia(1);\n } else {\n this.lastDownDeltas.push(lastDelta);\n this.lastDownDeltas.shift();\n return this.isInertia(-1);\n }\n }\n\n isInertia(direction: number) {\n const lastDeltas = direction === -1 ? this.lastDownDeltas : this.lastUpDeltas;\n if (lastDeltas[0] === undefined) return direction;\n if (\n this.deltasTimestamp[this.stability * 2 - 2] + this.delay > Date.now()\n && lastDeltas[0] === lastDeltas[this.stability * 2 - 1]\n ) {\n return false;\n }\n const lastDeltasOld = lastDeltas.slice(0, this.stability);\n const lastDeltasNew = lastDeltas.slice(this.stability, this.stability * 2);\n const oldSum = lastDeltasOld.reduce((t, s) => t + s);\n const newSum = lastDeltasNew.reduce((t, s) => t + s);\n const oldAverage = oldSum / lastDeltasOld.length;\n const newAverage = newSum / lastDeltasNew.length;\n return Math.abs(oldAverage) < Math.abs(newAverage * this.tolerance)\n && this.sensitivity < Math.abs(newAverage);\n }\n}\n","/* eslint-disable eqeqeq */\n/* eslint-disable prefer-template */\n/* eslint-disable prefer-const */\n/* eslint-disable prefer-destructuring */\n/* eslint-disable one-var */\n/* eslint-disable one-var-declaration-per-line */\n\nimport { preloadImage } from './files';\n\n/**\n * HEX > RGB\n * input: 'xxxxxx' (ex. 'ed15fa') case-insensitive\n * output: [r, g, b] ([0-255, 0-255, 0-255])\n */\nexport function hex2rgb(param: string): [number, number, number] {\n return [\n parseInt(param.substring(0, 2), 16),\n parseInt(param.substring(2, 4), 16),\n parseInt(param.substring(4, 6), 16),\n ];\n}\n\n/**\n * RGB > HEX\n * input: [r, g, b] ([0-255, 0-255, 0-255])\n * output: 'xxxxxx' (ex. 'ff0000')\n */\nexport function rgb2hex(param: [number, number, number]) {\n const p0 = param[0].toString(16);\n const p1 = param[1].toString(16);\n const p2 = param[2].toString(16);\n return (p0.length == 1 ? '0' + p0 : p0) + (p1.length == 1 ? '0' + p1 : p1) + (p2.length == 1 ? '0' + p2 : p2);\n}\n\n/**\n * Converts an RGB color value to HSV. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h, s, and v in the set [0, 1].\n *\n * @param Number r The red color value\n * @param Number g The green color value\n * @param Number b The blue color value\n * @return Array The HSV representation\n */\nexport function rgb2hsb([r, g, b]: [number, number, number]): [number, number, number] {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h!: number, s: number, v: number = max;\n\n let d = max - min;\n s = max == 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return [h, s, v];\n}\n\n/**\n * Converts an HSV color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSV_color_space.\n * Assumes h, s, and v are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number v The value\n * @return Array The RGB representation\n */\nexport function hsb2rgb([h, s, v]: [number, number, number]): [number, number, number] {\n let r!: number, g!: number, b!: number;\n\n let i = Math.floor(h * 6);\n let f = h * 6 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n }\n\n return [\n Math.round(r * 255),\n Math.round(g * 255),\n Math.round(b * 255),\n ];\n}\n\nexport async function getAverageColor(url: string): Promise<[number, number, number]> {\n // Only visit every 5 pixels\n const blockSize = 5;\n const defaultRGB: [number, number, number] = [0, 0, 0];\n let data;\n let width;\n let height;\n let i = -4;\n let length;\n let rgb: [number, number, number] = [0, 0, 0];\n let count = 0;\n\n const canvas = document.createElement('canvas');\n const context = canvas.getContext && canvas.getContext('2d');\n if (!context) {\n return defaultRGB;\n }\n\n const image = await preloadImage(url);\n height = image.naturalHeight || image.offsetHeight || image.height;\n width = image.naturalWidth || image.offsetWidth || image.width;\n canvas.height = height;\n canvas.width = width;\n\n context.drawImage(image, 0, 0);\n\n try {\n data = context.getImageData(0, 0, width, height);\n } catch (e) {\n return defaultRGB;\n }\n\n length = data.data.length;\n\n // eslint-disable-next-line no-cond-assign\n while ((i += blockSize * 4) < length) {\n if (data.data[i + 3] === 0) continue; // Ignore fully transparent pixels\n ++count;\n rgb[0] += data.data[i];\n rgb[1] += data.data[i + 1];\n rgb[2] += data.data[i + 2];\n }\n\n rgb[0] = Math.floor(rgb[0] / count);\n rgb[1] = Math.floor(rgb[1] / count);\n rgb[2] = Math.floor(rgb[2] / count);\n\n return rgb;\n}\n\nexport function getColorLuma(rgbColor: [number, number, number]) {\n const [r, g, b] = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n return luma;\n}\n\n// eslint-disable-next-line max-len\n// Function was adapted from https://github.com/telegramdesktop/tdesktop/blob/35ff621b5b52f7e3553fb0f990ea13ade7101b8e/Telegram/SourceFiles/data/data_wall_paper.cpp#L518\nexport function getPatternColor(rgbColor: [number, number, number]) {\n let [hue, saturation, value] = rgb2hsb(rgbColor);\n\n saturation = Math.min(1, saturation + 0.05 + 0.1 * (1 - saturation));\n value = value > 0.5\n ? Math.max(0, value * 0.65)\n : Math.max(0, Math.min(1, 1 - value * 0.65));\n\n return `hsla(${hue * 360}, ${saturation * 100}%, ${value * 100}%, .4)`;\n}\n","export default function cycleRestrict(length: number, index: number) {\n return index - Math.floor(index / length) * length;\n}\n","import { getGlobal } from '../global';\n\nimport { FocusDirection } from '../types';\n\nimport {\n ANIMATION_LEVEL_MIN,\n FAST_SMOOTH_MAX_DISTANCE, FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MIN_DURATION,\n FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE,\n} from '../config';\nimport { IS_ANDROID } from './environment';\nimport { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck';\nimport { animateSingle } from './animation';\nimport { fastRaf } from './schedulers';\n\nlet isAnimating = false;\n\nexport default function fastSmoothScroll(\n container: HTMLElement,\n element: HTMLElement,\n position: ScrollLogicalPosition | 'centerOrTop',\n margin = 0,\n maxDistance = FAST_SMOOTH_MAX_DISTANCE,\n forceDirection?: FocusDirection,\n forceDuration?: number,\n forceNormalContainerHeight?: boolean,\n) {\n const scrollFrom = calculateScrollFrom(container, element, maxDistance, forceDirection);\n\n if (forceDirection === FocusDirection.Static) {\n scrollWithJs(container, element, scrollFrom, position, margin, 0);\n return;\n }\n\n if (getGlobal().settings.byKey.animationLevel === ANIMATION_LEVEL_MIN) {\n forceDuration = 0;\n }\n\n scrollWithJs(container, element, scrollFrom, position, margin, forceDuration, forceNormalContainerHeight);\n}\n\nexport function isAnimatingScroll() {\n return isAnimating;\n}\n\nfunction calculateScrollFrom(\n container: HTMLElement,\n element: HTMLElement,\n maxDistance = FAST_SMOOTH_MAX_DISTANCE,\n forceDirection?: FocusDirection,\n) {\n const { offsetTop: elementTop } = element;\n const { scrollTop } = container;\n\n if (forceDirection === undefined) {\n const offset = elementTop - container.scrollTop;\n\n if (offset < -maxDistance) {\n return scrollTop + (offset + maxDistance);\n } else if (offset > maxDistance) {\n return scrollTop + (offset - maxDistance);\n }\n } else if (forceDirection === FocusDirection.Up) {\n return elementTop + maxDistance;\n } else if (forceDirection === FocusDirection.Down) {\n return Math.max(0, elementTop - maxDistance);\n }\n\n return scrollTop;\n}\n\nfunction scrollWithJs(\n container: HTMLElement,\n element: HTMLElement,\n scrollFrom: number,\n position: ScrollLogicalPosition | 'centerOrTop',\n margin = 0,\n forceDuration?: number,\n forceNormalContainerHeight?: boolean,\n) {\n const { offsetTop: elementTop, offsetHeight: elementHeight } = element;\n const { scrollTop: currentScrollTop, offsetHeight: containerHeight, scrollHeight } = container;\n const targetContainerHeight = forceNormalContainerHeight && container.dataset.normalHeight\n ? Number(container.dataset.normalHeight)\n : containerHeight;\n\n if (currentScrollTop !== scrollFrom) {\n container.scrollTop = scrollFrom;\n }\n\n let path!: number;\n\n switch (position) {\n case 'start':\n path = (elementTop - margin) - scrollFrom + (IS_ANDROID ? 1 : 0);\n break;\n case 'end':\n path = (elementTop + elementHeight + margin) - (scrollFrom + targetContainerHeight);\n break;\n // 'nearest' is not supported yet\n case 'nearest':\n case 'center':\n case 'centerOrTop':\n path = elementHeight < targetContainerHeight\n ? (elementTop + elementHeight / 2) - (scrollFrom + targetContainerHeight / 2)\n : (elementTop - margin) - scrollFrom;\n break;\n }\n\n if (path < 0) {\n const remainingPath = -scrollFrom;\n path = Math.max(path, remainingPath);\n } else if (path > 0) {\n const remainingPath = scrollHeight - (scrollFrom + targetContainerHeight);\n path = Math.min(path, remainingPath);\n }\n\n if (path === 0) {\n return;\n }\n\n const target = scrollFrom + path;\n\n if (forceDuration === 0) {\n container.scrollTop = target;\n return;\n }\n\n isAnimating = true;\n\n const absPath = Math.abs(path);\n const transition = absPath < FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE ? shortTransition : longTransition;\n const duration = forceDuration || (\n FAST_SMOOTH_MIN_DURATION\n + (absPath / FAST_SMOOTH_MAX_DISTANCE) * (FAST_SMOOTH_MAX_DURATION - FAST_SMOOTH_MIN_DURATION)\n );\n const startAt = Date.now();\n const onHeavyAnimationStop = dispatchHeavyAnimationEvent();\n\n fastRaf(() => {\n animateSingle(() => {\n const t = Math.min((Date.now() - startAt) / duration, 1);\n const currentPath = path * (1 - transition(t));\n\n container.scrollTop = Math.round(target - currentPath);\n\n isAnimating = t < 1;\n\n if (!isAnimating) {\n onHeavyAnimationStop();\n }\n\n return isAnimating;\n });\n });\n}\n\nfunction longTransition(t: number) {\n return 1 - ((1 - t) ** 5);\n}\n\nfunction shortTransition(t: number) {\n return 1 - ((1 - t) ** 3.5);\n}\n","import { getGlobal } from '../global';\n\nimport { ANIMATION_LEVEL_MIN } from '../config';\nimport { animate } from './animation';\nimport { fastRaf } from './schedulers';\n\nconst DEFAULT_DURATION = 300;\n\nconst stopById: Map = new Map();\n\nexport default function fastSmoothScrollHorizontal(container: HTMLElement, left: number, duration = DEFAULT_DURATION) {\n if (getGlobal().settings.byKey.animationLevel === ANIMATION_LEVEL_MIN) {\n duration = 0;\n }\n\n return scrollWithJs(container, left, duration);\n}\n\nfunction scrollWithJs(container: HTMLElement, left: number, duration: number) {\n const isRtl = container.getAttribute('dir') === 'rtl';\n const {\n scrollLeft, offsetWidth: containerWidth, scrollWidth, dataset: { scrollId },\n } = container;\n\n let path = left - scrollLeft;\n\n if (path < 0) {\n const remainingPath = -scrollLeft * (isRtl ? -1 : 1);\n path = Math.max(path, remainingPath);\n } else if (path > 0) {\n const remainingPath = scrollWidth - (scrollLeft + containerWidth);\n path = Math.min(path, remainingPath);\n }\n\n if (path === 0) {\n return Promise.resolve();\n }\n\n if (scrollId && stopById.has(scrollId)) {\n stopById.get(scrollId)!();\n }\n\n const target = scrollLeft + path;\n\n if (duration === 0) {\n container.scrollLeft = target;\n return Promise.resolve();\n }\n\n let isStopped = false;\n const id = Math.random().toString();\n container.dataset.scrollId = id;\n stopById.set(id, () => {\n isStopped = true;\n });\n\n container.style.scrollSnapType = 'none';\n\n let resolve: VoidFunction;\n const promise = new Promise((r) => {\n resolve = r;\n });\n const startAt = Date.now();\n\n fastRaf(() => {\n animate(() => {\n if (isStopped) return false;\n\n const t = Math.min((Date.now() - startAt) / duration, 1);\n\n const currentPath = path * (1 - transition(t));\n container.scrollLeft = Math.round(target - currentPath);\n\n if (t >= 1) {\n container.style.scrollSnapType = '';\n container.dataset.scrollId = undefined;\n stopById.delete(id);\n resolve();\n }\n return t < 1;\n });\n });\n\n return promise;\n}\n\nfunction transition(t: number) {\n return 1 - ((1 - t) ** 3.5);\n}\n","import { IS_TOUCH_ENV } from './environment';\n\nexport default function focusEditableElement(element: HTMLElement, force?: boolean, forcePlaceCaretAtEnd?: boolean) {\n if (!force && element === document.activeElement) {\n return;\n }\n\n const selection = window.getSelection()!;\n const range = document.createRange();\n const lastChild = element.lastChild || element;\n\n if (!IS_TOUCH_ENV && !forcePlaceCaretAtEnd && (!lastChild || !lastChild.nodeValue)) {\n element.focus();\n return;\n }\n\n range.selectNodeContents(forcePlaceCaretAtEnd ? element : lastChild);\n // `false` means collapse to the end rather than the start\n range.collapse(false);\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","const ELEMENT_NODE = 1;\n\nexport default function getMessageIdsForSelectedText() {\n const selection = window.getSelection();\n let selectedFragments = selection && selection.rangeCount ? selection.getRangeAt(0).cloneContents() : undefined;\n if (!selectedFragments || selectedFragments.childElementCount === 0) {\n return undefined;\n }\n\n const messageIds = Array.from(selectedFragments.children)\n .reduce((result, node) => {\n if (node.nodeType === ELEMENT_NODE && node.classList.contains('message-date-group')) {\n return Array.from(node.querySelectorAll('.Message'))\n .reduce((acc, messageEl) => acc.concat(Number((messageEl as HTMLElement).dataset.messageId)), result);\n } else if (node.nodeType === ELEMENT_NODE && node.classList.contains('Message')) {\n return result.concat(Number((node as HTMLElement).dataset.messageId));\n }\n\n return result;\n }, [] as number[]);\n\n // Cleanup a document fragment because it is playing media content in the background\n while (selectedFragments.firstChild) {\n selectedFragments.removeChild(selectedFragments.firstChild);\n }\n selectedFragments = undefined;\n\n return messageIds;\n}\n","import windowSize from './windowSize';\n\nexport function isElementInViewport(el: HTMLElement) {\n if (el.style.display === 'none') {\n return false;\n }\n\n const rect = el.getBoundingClientRect();\n const { height: windowHeight } = windowSize.get();\n\n return (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n}\n","export type MediaSessionHandlers = {\n play?: () => void;\n pause?: () => void;\n stop?: () => void;\n\n previoustrack?: () => void;\n nexttrack?: () => void;\n\n togglemicrophone?: () => void;\n togglecamera?: () => void;\n hangup?: () => void;\n\n seekbackward?: (details: MediaSessionActionDetails) => void;\n seekforward?: (details: MediaSessionActionDetails) => void;\n seekTo?: ((details: MediaSessionActionDetails) => void);\n};\n\ninterface MediaMetadataParameters {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: MediaImage[];\n}\n\nconst DEFAULT_HANDLERS = {\n play: undefined,\n pause: undefined,\n seekbackward: undefined,\n seekforward: undefined,\n previoustrack: undefined,\n nexttrack: undefined,\n stop: undefined,\n seekTo: undefined,\n};\n\nexport function registerMediaSession(metadata?: MediaMetadata, handlers?: MediaSessionHandlers) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n if (metadata) updateMetadata(metadata);\n if (handlers) setMediaSessionHandlers(handlers);\n } else {\n // eslint-disable-next-line no-console\n console.warn('MediaSession API not supported in this browser');\n }\n}\n\nexport function updateMetadata(metadata?: MediaMetadata) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n // eslint-disable-next-line no-null/no-null\n mediaSession.metadata = metadata ?? null;\n }\n}\n\nexport function setMediaSessionHandlers(handlers: MediaSessionHandlers) {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n Object.entries({ ...DEFAULT_HANDLERS, ...handlers }).forEach(([key, handler]) => {\n try {\n // @ts-ignore API not standardized yet\n mediaSession.setActionHandler(key, handler);\n } catch (err) {\n // Handler not supported, ignoring\n }\n });\n }\n}\n\nexport function clearMediaSession() {\n const { mediaSession } = window.navigator;\n if (mediaSession) {\n // eslint-disable-next-line no-null/no-null\n mediaSession.metadata = null;\n setMediaSessionHandlers(DEFAULT_HANDLERS);\n if (mediaSession.playbackState) mediaSession.playbackState = 'none';\n mediaSession.setPositionState?.();\n }\n}\n\nexport function setPlaybackState(state: 'none' | 'paused' | 'playing' = 'none') {\n const { mediaSession } = window.navigator;\n if (mediaSession && mediaSession.playbackState) {\n mediaSession.playbackState = state;\n }\n}\n\nexport function setPositionState(state?: MediaPositionState) {\n if (!state || state.position === undefined || state.duration === undefined) return;\n state.position = Math.min(state.position, state.duration);\n\n const { mediaSession } = window.navigator;\n mediaSession?.setPositionState?.(state);\n}\n\nexport function setMicrophoneActive(active: boolean) {\n const { mediaSession } = window.navigator;\n mediaSession?.setMicrophoneActive?.(active);\n}\n\nexport function setCameraActive(active: boolean) {\n const { mediaSession } = window.navigator;\n mediaSession?.setCameraActive?.(active);\n}\n\nexport function buildMediaMetadata({\n title, artist, album, artwork,\n}: MediaMetadataParameters) {\n if ('MediaMetadata' in window) {\n return new window.MediaMetadata({\n title,\n artist,\n album,\n artwork,\n });\n }\n return undefined;\n}\n","import type { ApiMessageEntity, ApiFormattedText } from '../api/types';\nimport { ApiMessageEntityTypes } from '../api/types';\nimport { IS_EMOJI_SUPPORTED } from './environment';\nimport { RE_LINK_TEMPLATE } from '../config';\n\nconst ENTITY_CLASS_BY_NODE_NAME: Record = {\n B: ApiMessageEntityTypes.Bold,\n STRONG: ApiMessageEntityTypes.Bold,\n I: ApiMessageEntityTypes.Italic,\n EM: ApiMessageEntityTypes.Italic,\n U: ApiMessageEntityTypes.Underline,\n S: ApiMessageEntityTypes.Strike,\n STRIKE: ApiMessageEntityTypes.Strike,\n DEL: ApiMessageEntityTypes.Strike,\n CODE: ApiMessageEntityTypes.Code,\n PRE: ApiMessageEntityTypes.Pre,\n BLOCKQUOTE: ApiMessageEntityTypes.Blockquote,\n};\n\nconst MAX_TAG_DEEPNESS = 3;\n\nexport default function parseMessageInput(html: string, withMarkdownLinks = false): ApiFormattedText {\n const fragment = document.createElement('div');\n fragment.innerHTML = withMarkdownLinks ? parseMarkdown(parseMarkdownLinks(html)) : parseMarkdown(html);\n const text = fragment.innerText.trim().replace(/\\u200b+/g, '');\n let textIndex = 0;\n let recursionDeepness = 0;\n const entities: ApiMessageEntity[] = [];\n\n function addEntity(node: ChildNode) {\n const { index, entity } = getEntityDataFromNode(node, text, textIndex);\n\n if (entity) {\n textIndex = index;\n entities.push(entity);\n } else if (node.textContent) {\n // Skip newlines on the beginning\n if (index === 0 && node.textContent.trim() === '') {\n return;\n }\n textIndex += node.textContent.length;\n }\n\n if (node.hasChildNodes() && recursionDeepness <= MAX_TAG_DEEPNESS) {\n recursionDeepness += 1;\n Array.from(node.childNodes).forEach(addEntity);\n }\n }\n\n Array.from(fragment.childNodes).forEach((node) => {\n recursionDeepness = 1;\n addEntity(node);\n });\n\n return {\n text,\n entities: entities.length ? entities : undefined,\n };\n}\n\nfunction parseMarkdown(html: string) {\n let parsedHtml = html.slice(0);\n\n if (!IS_EMOJI_SUPPORTED) {\n // Emojis\n parsedHtml = parsedHtml.replace(/]+alt=\"([^\"]+)\"[^>]*>/gm, '$1');\n }\n\n // Strip redundant nbsp's\n parsedHtml = parsedHtml.replace(/ /g, ' ');\n\n // Replace

with newline (new line in Safari)\n parsedHtml = parsedHtml.replace(/
]*)?><\\/div>/g, '\\n');\n // Replace
with newline\n parsedHtml = parsedHtml.replace(/]*)?>/g, '\\n');\n\n // Strip redundant
tags\n parsedHtml = parsedHtml.replace(/<\\/div>(\\s*)
/g, '\\n');\n parsedHtml = parsedHtml.replace(/
/g, '\\n');\n parsedHtml = parsedHtml.replace(/<\\/div>/g, '');\n\n // Pre\n parsedHtml = parsedHtml.replace(/^`{3}(.*?)[\\n\\r](.*?[\\n\\r]?)`{3}/gms, '
$2
');\n parsedHtml = parsedHtml.replace(/^`{3}[\\n\\r]?(.*?)[\\n\\r]?`{3}/gms, '
$1
');\n parsedHtml = parsedHtml.replace(/[`]{3}([^`]+)[`]{3}/g, '
$1
');\n\n // Code\n parsedHtml = parsedHtml.replace(\n /(?!<(code|pre)[^<]*|<\\/)[`]{1}([^`\\n]+)[`]{1}(?![^<]*<\\/(code|pre)>)/g,\n '$2',\n );\n\n // Other simple markdown\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<(code|pre)[^<]*|<\\/)[*]{2}([^*\\n]+)[*]{2}(?![^<]*<\\/(code|pre)>)(\\s|$)/g,\n '$1$3$5',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<(code|pre)[^<]*|<\\/)[_]{2}([^_\\n]+)[_]{2}(?![^<]*<\\/(code|pre)>)(\\s|$)/g,\n '$1$3$5',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<(code|pre)[^<]*|<\\/)[~]{2}([^~\\n]+)[~]{2}(?![^<]*<\\/(code|pre)>)(\\s|$)/g,\n '$1$3$5',\n );\n parsedHtml = parsedHtml.replace(\n /(^|\\s)(?!<(code|pre)[^<]*|<\\/)[|]{2}([^|\\n]+)[|]{2}(?![^<]*<\\/(code|pre)>)(\\s|$)/g,\n `$1$3$5`,\n );\n\n return parsedHtml;\n}\n\nfunction parseMarkdownLinks(html: string) {\n return html.replace(new RegExp(`\\\\[([^\\\\]]+?)]\\\\((${RE_LINK_TEMPLATE}+?)\\\\)`, 'g'), (_, text, link) => {\n const url = link.includes('://') ? link : link.includes('@') ? `mailto:${link}` : `http://${link}`;\n return `${text}`;\n });\n}\n\nfunction getEntityDataFromNode(\n node: ChildNode,\n rawText: string,\n textIndex: number,\n): { index: number; entity?: ApiMessageEntity } {\n const type = getEntityTypeFromNode(node);\n if (!type || !node.textContent) {\n return {\n index: textIndex,\n entity: undefined,\n };\n }\n\n const rawIndex = rawText.indexOf(node.textContent, textIndex);\n // In some cases, last text entity ends with a newline (which gets trimmed from `rawText`).\n // In this case, `rawIndex` would return `-1`, so we use `textIndex` instead.\n const index = rawIndex >= 0 ? rawIndex : textIndex;\n const offset = rawText.substring(0, index).length;\n const { length } = rawText.substring(index, index + node.textContent.length);\n\n let url: string | undefined;\n let userId: string | undefined;\n let language: string | undefined;\n if (type === ApiMessageEntityTypes.TextUrl) {\n url = (node as HTMLAnchorElement).href;\n }\n if (type === ApiMessageEntityTypes.MentionName) {\n userId = (node as HTMLAnchorElement).dataset.userId;\n }\n\n if (type === ApiMessageEntityTypes.Pre) {\n language = (node as HTMLPreElement).dataset.language;\n }\n\n return {\n index,\n entity: {\n type,\n offset,\n length,\n ...(url && { url }),\n ...(userId && { userId }),\n ...(language && { language }),\n },\n };\n}\n\nfunction getEntityTypeFromNode(node: ChildNode) {\n if (ENTITY_CLASS_BY_NODE_NAME[node.nodeName]) {\n return ENTITY_CLASS_BY_NODE_NAME[node.nodeName];\n }\n\n if (node.nodeName === 'A') {\n const anchor = node as HTMLAnchorElement;\n if (anchor.dataset.entityType === ApiMessageEntityTypes.MentionName) {\n return ApiMessageEntityTypes.MentionName;\n }\n if (anchor.dataset.entityType === ApiMessageEntityTypes.Url) {\n return ApiMessageEntityTypes.Url;\n }\n if (anchor.href.startsWith('mailto:')) {\n return ApiMessageEntityTypes.Email;\n }\n if (anchor.href.startsWith('tel:')) {\n return ApiMessageEntityTypes.Phone;\n }\n if (anchor.href !== anchor.textContent) {\n return ApiMessageEntityTypes.TextUrl;\n }\n\n return ApiMessageEntityTypes.Url;\n }\n\n if (node.nodeName === 'SPAN') {\n return (node as HTMLElement).dataset.entityType;\n }\n\n return undefined;\n}\n","/*\n * Thanks to Ace Monkey for this mind-blowing patch.\n */\n\nexport function patchSafariProgressiveAudio(audioEl: HTMLAudioElement) {\n if (audioEl.dataset.patchedForSafari) {\n return;\n }\n\n audioEl.addEventListener('play', () => {\n const t = audioEl.currentTime;\n\n audioEl.dataset.patchForSafariInProgress = 'true';\n function onProgress() {\n if (!audioEl.buffered.length) {\n return;\n }\n audioEl.currentTime = audioEl.duration - 1;\n audioEl.addEventListener('progress', () => {\n delete audioEl.dataset.patchForSafariInProgress;\n audioEl.currentTime = t;\n if (audioEl.paused && !audioEl.dataset.preventPlayAfterPatch) {\n audioEl.play();\n }\n }, { once: true });\n\n audioEl.removeEventListener('progress', onProgress);\n }\n\n audioEl.addEventListener('progress', onProgress);\n }, { once: true });\n\n audioEl.dataset.patchedForSafari = 'true';\n}\n\nexport function isSafariPatchInProgress(audioEl: HTMLAudioElement) {\n return Boolean(audioEl.dataset.patchForSafariInProgress);\n}\n","import type React from '../lib/teact/teact';\n\nconst stopEvent = (e: React.UIEvent | Event) => {\n e.stopPropagation();\n e.preventDefault();\n};\n\nexport default stopEvent;\n","let fileSelector: HTMLInputElement;\n\nexport function openSystemFilesDialog(accept = '*', callback: (e: Event) => void, noMultiple = false) {\n if (!fileSelector) {\n fileSelector = document.createElement('input');\n fileSelector.setAttribute('type', 'file');\n }\n\n fileSelector.setAttribute('accept', accept);\n\n if (noMultiple) {\n fileSelector.removeAttribute('multiple');\n } else {\n fileSelector.setAttribute('multiple', 'multiple');\n }\n\n // eslint-disable-next-line no-null/no-null\n fileSelector.onchange = null;\n fileSelector.value = '';\n fileSelector.onchange = callback;\n\n fileSelector.click();\n}\n","import type { ApiThemeParameters } from '../api/types';\n\nexport function extractCurrentThemeParams(): ApiThemeParameters {\n const style = getComputedStyle(document.documentElement);\n const backgroundColor = getPropertyWrapped(style, '--color-background');\n const textColor = getPropertyWrapped(style, '--color-text');\n const buttonColor = getPropertyWrapped(style, '--color-primary');\n const buttonTextColor = getPropertyWrapped(style, '--color-white');\n const linkColor = getPropertyWrapped(style, '--color-links');\n const hintColor = getPropertyWrapped(style, '--color-text-secondary');\n const secondaryBgColor = getPropertyWrapped(style, '--color-background-secondary');\n return {\n bg_color: backgroundColor,\n text_color: textColor,\n hint_color: hintColor,\n link_color: linkColor,\n button_color: buttonColor,\n button_text_color: buttonTextColor,\n secondary_bg_color: secondaryBgColor,\n };\n}\n\nexport function validateHexColor(color: string) {\n return /^#[0-9A-F]{6}$/i.test(color);\n}\n\nfunction getPropertyWrapped(style: CSSStyleDeclaration, property: string) {\n const value = style.getPropertyValue(property);\n return wrapColor(value.trim());\n}\n\nfunction wrapColor(color: string) {\n if (validateHexColor(color)) return color;\n return `#${color.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+\\.{0,1}\\d*))?\\)$/)!\n .slice(1)\n .map((n: string, i: number) => (i === 3 ? Math.round(parseFloat(n) * 255) : parseFloat(n))\n .toString(16)\n .padStart(2, '0')\n .replace('NaN', ''))\n .join('')}`;\n}\n"],"names":["memo","props","sticker","noLoad","forcePreview","lastSyncTime","otherProps","thumbDataUri","thumbnail","dataUri","localMediaHash","id","previewBlobUrl","useMedia","undefined","ApiMediaFormat","tgsUrl","previewUrl","className","transitionClassNames","useMediaTransition","isAnimationReady","markAnimationReady","useFlag","size","buildClassName","style","buildStyle","src","styles","AnimatedIcon","onLoad","noTransition","renderWaveform","canvas","spikes","progress","peak","fillStyle","progressFillStyle","width","length","height","ctx","getContext","scale","forEach","item","i","globalAlpha","spikeHeight","Math","max","x","y","radius","beginPath","moveTo","arcTo","closePath","roundedRectangle","fill","decodeWaveform","encoded5bit","bitsCount","valuesCount","floor","result","Array","bitsData","l","byteIndex","bitShift","value","lastByteIndex","lastBitShift","lastValue","interpolateArray","data","fitCount","newData","springFactor","leftFiller","rightFiller","idx","val","TINY_SCREEN_WIDTH_MQL","window","matchMedia","WITH_AVATAR_TINY_SCREEN_WIDTH_MQL","getSeeklineSpikeAmounts","withAvatar","MIN_SPIKES","IS_SINGLE_COLUMN_LAYOUT","matches","MAX_SPIKES","renderSeekline","playProgress","bufferedRanges","seekerRef","ref","map","start","end","theme","message","senderTitle","uploadProgress","origin","date","noAvatars","isSelectable","isSelected","isDownloading","isTranscribing","isTranscriptionHidden","isTranscribed","isTranscriptionError","canDownload","canTranscribe","onHideTranscription","onPlay","onReadMedia","onCancelUpload","onDateClick","cancelMessageMediaDownload","downloadMessageMedia","transcribeAudio","getActions","content","audio","voice","video","isMediaUnread","isVoice","Boolean","isSeeking","useRef","lang","useLang","isRtl","isActivated","setIsActivated","useState","shouldLoad","coverHash","getMessageMediaHash","coverBlobUrl","mediaData","getMessageMediaFormat","loadProgress","downloadProgress","useMediaWithLoadProgress","handleForcePlay","useCallback","chatId","handleTrackChange","isBuffered","bufferingHandlers","checkBuffering","useBuffering","isPlaying","playPause","setCurrentTime","duration","useAudioPlayer","makeTrackId","getMediaDuration","isMessageLocal","isOwn","isOwnMessage","waveformCanvasRef","canvasRef","useMemo","waveform","min","durationFactor","spikesCount","round","Uint8Array","useLayoutEffect","current","useWaveformCanvas","withSeekline","useEffect","isLoadingForPlaying","isUploading","isTransferring","transferProgress","getMediaTransferState","shouldRender","shouldRenderSpinner","spinnerClassNames","useShowTransition","shouldRenderCross","handleButtonClick","setAudioPlayerOrigin","handleDownloadClick","handleSeek","e","left","getBoundingClientRect","clientX","MouseEvent","targetTouches","stopPropagation","handleStartSeek","button","handleStopSeek","handleDateClick","handleTranscribe","messageId","captureEvents","onCapture","onRelease","onClick","onDrag","transcribeSvgMemo","dangerouslySetInnerHTML","__html","renderFirstLine","title","fileName","fullClassName","AudioOrigin","buttonClassNames","push","contentClassName","renderWithTitle","dir","renderText","Link","formatPastTimeShort","formatMediaDuration","performer","renderSecondLine","Button","ripple","color","join","ariaLabel","backgroundImage","ProgressSpinner","transparent","noCross","showProgress","showSeekline","getTranslation","getFileSizeString","formatMediaDateTime","renderAudio","svgMemo","onClickTranscribe","draggable","renderVoice","withGlobal","global","chatOrUserId","countryList","phoneCodes","phoneCodeList","chat","selectChat","user","isUserId","selectUser","isMuted","selectIsChatMuted","selectNotifySettings","selectNotifyExceptions","canInviteUsers","isChatChannel","isUserRightBanned","getHasAdminRight","forceShowSelf","loadFullUser","showNotification","updateChatMutedState","userId","fullInfo","username","phoneNumber","isSelf","handleNotificationChange","isRestricted","copy","text","entity","copyTextToClipboard","formattedNumber","formatPhoneNumberWithCode","link","getChatLink","description","bio","getChatDescription","icon","multiline","narrow","isStatic","label","checked","inactive","isPrivateChat","isChatWithSelf","selectIsChatWithSelf","getPrivateChatUserId","isBot","isUserBot","isSupport","canDeleteForAll","contactName","getUserFirstOrLastName","isChannel","isBasicGroup","isChatBasicGroup","isSuperGroup","isChatSuperGroup","currentUserId","isOpen","onClose","onCloseAnimationEnd","leaveChannel","deleteHistory","deleteChannel","deleteChatUser","blockContact","chatTitle","getChatTitle","handleDeleteMessageForAll","shouldDeleteForAll","handleDeleteAndStop","contactId","accessHash","handleDeleteChat","isCreator","handleLeaveChat","header","isSavedMessages","isText","observeIntersection","smaller","canAutoLoad","autoLoadFileMaxSizeMb","withDate","datetime","sender","onMediaClick","dispatch","document","timestamp","extension","getDocumentExtension","isIntersecting","useIsIntersecting","wasIntersected","markIntersected","isLoadAllowed","setIsLoadAllowed","shouldDownload","documentHash","isLoaded","hasPreview","getDocumentHasPreview","getMessageMediaThumbDataUri","localBlobUrl","previewData","withMediaViewer","mediaType","handleClick","name","thumbnailDataUri","actionIcon","isMessageDocumentVideo","fakeType","elementRef","shouldSpinnerRender","getColorFromExtension","sizeString","getDocumentThumbnailDimensions","alt","onlineCount","selectChatOnlineCount","areMessagesLoaded","selectChatMessages","typingStatus","avatarSize","status","withDots","withUsername","withFullInfo","withUpdatingStatus","withChatType","withVideoAvatar","noRtl","loadFullChat","openMediaViewer","loadProfilePhotos","isMin","profileId","handleAvatarViewerOpen","hasMedia","avatarOwnerId","mediaId","MediaViewerOrigin","key","noVideo","isVerified","getChatTypeString","handle","groupStatus","chatTypeString","membersCount","getGroupStatus","onlineStatus","renderStatusOrTyping","outgoingStatus","idPrefix","isProtected","mediaBlobUrl","getMessageVideo","getMessageHtmlId","decoding","onContextMenu","stopEvent","isGif","Keys","activeKey","DEFAULT_TEXT","FOCUS_DELAY_TIMEOUT_MS","isLoading","isPasswordVisible","error","hint","placeholder","submitLabel","shouldShowSubmit","shouldResetValue","shouldDisablePasswordManager","noRipple","clearError","onChangePasswordVisibility","onInputChange","onSubmit","inputRef","password","setPassword","canSubmit","setCanSubmit","useTimeout","IS_TOUCH_ENV","focus","requestAnimationFrame","select","action","event","preventDefault","autoComplete","type","tabIndex","onChange","target","MIN_PASSWORD_LENGTH","maxLength","role","disabled","itemIds","selectedIds","filterValue","filterPlaceholder","notFoundText","searchInputId","noScrollRestore","onSelectedIdsChange","onFilterChange","onLoadMore","shouldMinimize","setTimeout","handleItemClick","newSelectedIds","includes","splice","indexOf","handleFilterChange","currentTarget","viewportIds","getMore","useInfiniteScroll","isMinimized","canClose","clickArg","items","iconElement","titleText","PREMIUM_ICON","store","withGradient","big","html","generateIdFor","getPremiumIconGradient","serverTimeOffset","userStatus","selectUserStatus","noStatusOrTyping","fullName","getUserFullName","isPremium","isUserOnline","getUserStatus","photo","isFirstPhoto","notActive","videoRef","isDeleted","isDeletedUser","isRepliesChat","isChatWithRepliesBot","getMediaHash","userOrChat","profilePhoto","hasVideo","isVideo","forceAvatar","getVideoAvatarMediaHash","getChatAvatarHash","pause","currentTime","safePlay","photoHash","photoBlobUrl","videoHash","videoBlobUrl","imageSrc","muted","disablePictureInPicture","autoPlay","loop","playsInline","userFullName","getFirstLetters","Spinner","getUserColorKey","connectionState","animationLevel","settings","byKey","mediaViewer","openPremiumModal","photos","MEMO_EMPTY_ARRAY","prevMediaId","usePrevious","prevAvatarOwnerId","hasSlideAnimation","setHasSlideAnimation","slideAnimation","currentPhotoIndex","setCurrentPhotoIndex","isFirst","isLast","profile","currentIndex","slice","mediaLoader","usePhotosPreload","handleProfilePhotoClick","handleClickPremium","fromUserId","selectPreviousMedia","selectNextMedia","element","querySelector","selectorToPreventScroll","onSwipe","direction","SwipeDirection","renderPhoto","isActive","isVerifiedIconShown","isPremiumIconShown","_","renderPhotoTabs","Transition","VerifiedIcon","PremiumIcon","FakeIcon","reaction","staticIconId","getGlobal","availableReactions","find","staticIcon","subject","messageIds","reportMessages","reportPeer","reportProfilePhoto","exitMessageSelectMode","selectedReason","setSelectedReason","setDescription","handleReport","reason","handleSelectReason","handleDescriptionChange","REPORT_OPTIONS","onEnter","options","selected","noAnimate","noContextMenu","canViewSet","onFaveClick","onUnfaveClick","onRemoveRecentClick","isCurrentUserPremium","openStickerSet","stickerSelector","shouldPlay","lottieData","isLottie","isLottieLoaded","markLoaded","unmarkLoaded","canLottiePlay","IS_WEBM_SUPPORTED","canVideoPlay","isPremiumSticker","hasEffect","isLocked","previewTransitionClassNames","isContextMenuOpen","contextMenuPosition","handleBeforeContextMenu","handleContextMenu","handleContextMenuClose","handleContextMenuHide","useContextMenuHandlers","getTriggerElement","getRootElement","closest","getMenuElement","positionX","positionY","transformOriginX","transformOriginY","menuStyle","useContextMenuPosition","handleRemoveClick","handleContextRemoveRecent","handleContextUnfave","handleContextFave","handleSendQuiet","handleSendScheduled","handleOpenSet","shouldShowCloseButton","contextMenuItems","emoji","onMouseDown","preventMessageInputBlurWithBubbling","initialSection","play","isLowPriority","autoClose","StickerSetModal","useModuleLoader","Bundles","typingUser","typingUserName","replace","trim","VERIFIED_ICON","onMessageClick","linkData","getMessageWebPage","getFirstLinkInMessage","url","domain","siteName","formattedDescription","getMessageText","renderMessageSummary","handleMessageClick","displayUrl","truncatedDescription","trimText","MEDIA_VIEWER_MEDIA_QUERY","REM","parseInt","getComputedStyle","documentElement","fontSize","ROUND_VIDEO_DIMENSIONS_PX","AVATAR_FULL_DIMENSIONS","VIDEO_AVATAR_FULL_DIMENSIONS","LIKE_STICKER_ID","DEFAULT_MEDIA_DIMENSIONS","cachedMaxWidthOwn","cachedMaxWidth","cachedMaxWidthNoAvatar","getAvailableWidth","fromOwnMessage","isForwarded","isWebPagePhoto","extraPaddingRem","availableWidthRem","regularMaxWidth","windowWidth","windowSize","getMaxMessageWidthRem","calculateDimensionsForMessageMedia","aspectRatio","availableWidth","availableHeight","getAvailableHeight","mediaWidth","calculateDimensions","getMediaViewerAvailableDimensions","withFooter","mql","windowHeight","occupiedHeightRem","calculateInlineImageDimensions","getPhotoInlineDimensions","calculateVideoDimensions","getVideoDimensions","getPictogramDimensions","getStickerDimensions","baseWidth","STICKER_SIZE_INLINE_MOBILE_FACTOR","STICKER_SIZE_INLINE_DESKTOP_FACTOR","calculatedHeight","calculateMediaViewerDimensions","mediaHeight","calculatedWidth","ChatFolderModal","ChatAnimationTypes","isPinned","isShown","unreadCount","unreadMentionsCount","hasUnreadMark","unreadReactionsCount","isUnread","ShowTransition","isCustom","unreadReactionsElement","unreadMentionsElement","unreadCountElement","formatIntegerCompact","elements","filter","renderContent","lastMessage","senderId","replyToMessageId","isOutgoing","lastMessageSender","lastMessageAction","getMessageAction","actionTargetMessage","selectChatMessage","targetUserIds","actionTargetUserIds","targetChatId","actionTargetChatId","privateChatUserId","currentChatId","threadId","currentThreadId","messageListType","selectCurrentMessageList","MAIN_THREAD_ID","draft","selectDraft","canScrollDown","canChangeFolder","chatFolders","orderedIds","lastMessageOutgoingStatus","selectOutgoingStatus","folderId","orderDiff","animationType","onDragEnter","openChat","focusLastMessage","isDeleteModalOpen","openDeleteModal","closeDeleteModal","isChatFolderModalOpen","openChatFolderModal","closeChatFolderModal","isReportModalOpen","openReportModal","closeReportModal","shouldRenderDeleteModal","markRenderDeleteModal","unmarkRenderDeleteModal","shouldRenderChatFolderModal","markRenderChatFolderModal","unmarkRenderChatFolderModal","shouldRenderReportModal","markRenderReportModal","unmarkRenderReportModal","isAction","isActionMessage","useEnsureMessage","mediaThumbnail","getMessageSticker","isRoundVideo","getMessageRoundVideo","actionTargetUsers","usersById","users","byId","Opacity","opacity","fastRaf","classList","add","Move","transform","remove","ANIMATION_END_DELAY","shouldReplaceHistory","handleDragEnter","handleDelete","handleChatFolderChange","contextActions","useChatContextActions","ListItem","Avatar","isCallActive","isCallNotEmpty","LastMessageMeta","TypingStatus","isChat","renderActionMessageText","asTextWithSpoilers","senderName","getMessageSenderName","blobUrl","renderSummary","renderLastMessageOrTyping","DeleteChatModal","ReportModal","folderType","chatFolder","selectChatFolder","animatedEmoji","selectAnimatedEmoji","foldersDispatch","onScreenSelect","handleEditFolder","payload","SettingsScreens","AnimatedIconFromSticker","fluid","pill","openNextChat","containerRef","shouldIgnoreDragRef","resolvedFolderId","ALL_FOLDER_ID","ARCHIVED_FOLDER_ID","useFolderManagerForOrderedIds","orderById","reduce","acc","prevOrderById","orderDiffById","mapValues","order","CHAT_LIST_SLICE","useHotkeys","targetIndexDelta","IS_PWA","addEventListener","handleKeyDown","removeEventListener","IS_MAC_OS","metaKey","ctrlKey","code","startsWith","digit","match","position","Number","getAnimationType","orderDiffs","Object","values","numberOfUp","diff","numberOfDown","None","Infinity","useChatAnimationType","observe","useIntersectionObserver","rootRef","throttleMs","useDebouncedCallback","handleDragLeave","rect","clientY","top","InfiniteScroll","preloadBackwards","withAbsolutePositioning","maxHeight","CHAT_HEIGHT_PX","onDragLeave","viewportOffset","pinnedCount","getPinnedChatsCount","teactOrderKey","getOrderKey","renderChats","Loading","getSenderName","chatsById","getSenderTitle","isChatGroup","CustomSend","isQuick","onFileSelect","isHovered","markHovered","unmarkHovered","onDrop","relatedTarget","toTarget","DropAreaState","withQuick","onHide","hideTimeoutRef","prevWithQuick","captureEscKeyListener","handleFilesDrop","async","dataTransfer","dt","files","folderFiles","getFilesFromDataTransferItems","concat","from","handleQuickFilesDrop","fromTarget","Portal","containerId","onDragOver","clearTimeout","EmojiTooltip","MAX_INPUT_HEIGHT","messageSendKeyCombo","replyingToId","selectReplyingToId","noTabCapture","pollModal","payment","isPaymentModalOpen","captionLimit","isAttachmentModalInput","editableInputId","forcedPlaceholder","canAutoFocus","shouldSuppressFocus","shouldSuppressTextFormatter","onUpdate","onSuppressedFocus","onSend","editLastMessage","replyToNextMessage","selectionTimeoutRef","cloneRef","isContextMenuOpenRef","isTextFormatterOpen","openTextFormatter","closeTextFormatter","textFormatterAnchorPosition","setTextFormatterAnchorPosition","selectedRange","setSelectedRange","sendMessageAction","useSendMessageAction","updateInputHeight","useLayoutEffectWithPrevDeps","prevHtml","innerHTML","focusInput","isHeavyAnimating","focusEditableElement","handleCloseTextFormatter","selection","getSelection","removeAllRanges","empty","clearSelection","checkSelection","IS_IOS","rangeCount","selectionRange","getRangeAt","selectedText","toString","isSelectionInsideInput","EDITABLE_INPUT_ID","parseEmojiOnlyString","START_TO_END","processSelection","selectionRect","inputRect","processSelectionWithTimeout","willSend","input","clone","currentHeight","newHeight","scrollHeight","transitionDuration","log","abs","exec","toggle","captureFirstTab","debounce","captureKeyboardListeners","onTab","suppressFocus","blur","contentEditable","textContent","IS_EMOJI_SUPPORTED","onKeyDown","isComposing","shiftKey","altKey","once","IS_ANDROID","handleCloseContextMenu","e2","KeyboardEvent","onTouchCancel","anchorPosition","TEXT_FORMAT_BY_TAG_NAME","B","STRONG","I","EM","U","DEL","CODE","SPAN","fragmentEl","createElement","linkUrlInputRef","isLinkControlOpen","openLinkControl","closeLinkControl","linkUrl","setLinkUrl","isEditingLink","setIsEditingLink","inputClassName","setInputClassName","selectedTextFormats","setSelectedTextFormats","useVirtualBackdrop","selectedFormats","parentElement","commonAncestorContainer","textFormat","tagName","restoreSelection","addRange","updateSelectedRange","getSelectedText","replaceChildren","cloneContents","getSelectedElement","updateInputStyles","offsetWidth","scrollWidth","scrollLeft","getFormatButtonClassName","keys","some","fKey","monospace","strikethrough","handleSpoilerText","spoiler","dataset","entityType","ApiMessageEntityTypes","replaceWith","execCommand","handleBoldText","bold","handleItalicText","italic","handleUnderlineText","underline","handleStrikethroughText","handleMonospaceText","handleLinkUrlConfirm","formattedLinkUrl","ensureProtocol","split","encodeURI","href","handler","k","b","u","m","s","p","toLowerCase","getKeyFromEvent","linkUrlConfirmClassName","inputMode","onScroll","dataTransferItems","traverseFileTreePromise","entry","Promise","resolve","File","isFile","itemFile","getAsFile","file","isDirectory","createReader","readEntries","entries","entriesPromises","all","kind","webkitGetAsEntry","fixMovMime","ext","pop","RE_BR","RE_SPACE","RE_CLEAN_HTML","RE_EXTRA_NEW_LINE","prepareForRegExp","inputId","parentNode","iterations","cache","WeakMap","memoized","fn","cached","get","args","areSortedArraysEqual","lastArgs","lastResult","set","emojiDataPromise","emojiRawData","emojiData","RE_EMOJI_SEARCH","prepareRecentEmojisMemo","recentEmojiIds","limit","pickTruthy","prepareLibraryMemo","baseEmojiKeywords","emojiKeywords","emojis","byNative","buildCollectionByKey","baseEmojisByKeyword","natives","emojisByKeyword","byKeyword","keywords","byName","names","searchInLibraryMemo","library","matched","matchedKeywords","keyword","sort","flat","matchedNames","unique","useEmojiTooltip","isAllowed","htmlRef","onUpdateHtml","isDisabled","markIsOpen","unmarkIsOpen","setById","shouldForceInsertEmoji","setShouldForceInsertEmoji","filteredEmojis","setFilteredEmojis","ensureEmojiData","then","getEmojiCode","forceSend","endsWith","substr","insertEmoji","textEmoji","isForce","currentHtml","atIndex","lastIndexOf","messageInput","EDITABLE_INPUT_CSS_SELECTOR","getElementById","native","isEmojiTooltipOpen","closeEmojiTooltip","default","uncompressEmoji","runThrottled","throttle","cb","RE_USERNAME_SEARCH","useMentionTooltip","canSuggestMembers","groupChatMembers","topInlineBotIds","usersToMention","setUsersToMention","updateFilteredUsers","withInlineBots","memberIds","member","filteredIds","filterUsersByName","usernameFilter","getUsernameFilter","canSuggestInlineBots","insertMention","forceFocus","insertedHtml","isMentionTooltipOpen","closeMentionTooltip","mentionFilteredUsers","useAsyncRendering","dependencies","delay","shouldRenderRef","timeoutRef","forceUpdate","useForceUpdate","useOnChange","loadingOptions","setValues","handleChange","newValues","v","option","subLabel","textParts","confirmLabel","confirmHandler","confirmIsDestructive","isButtonsInOneRow","children","handleSelectWithEnter","index","useKeyboardListNavigation","textPart","buttonClassName","buttonRef","leftElement","secondaryIcon","destructive","onSecondaryIconClick","isTouched","markIsTouched","unmarkIsTouched","handleSecondaryIconClick","handleMouseDown","DEFAULT_DURATION","onDismiss","actionText","setIsOpen","timerRef","closeAndDismiss","handleMouseEnter","handleMouseLeave","onMouseEnter","onMouseLeave","RADIUSES","xl","square","circleRadius","STROKE_WIDTH","borderRadius","circumference","PI","container","svg","firstElementChild","strokeDashOffset","setAttribute","hidden","loadingOption","step","renderValue","mainClassName","trackWidth","parentContainerClassName","focused","spinnerColor","spinnerBackgroundColor","autoFocusSearch","onReset","onFocus","onBlur","onSpinnerClick","isInputFocused","markInputFocused","unmarkInputFocused","useInputFocusOnOpen","backgroundColor","prevIsOpen","prevChildren","fromChildrenRef","variant","animation","forceAspectRatio","classNames","noAnimation","onCheck","isBlocked","badgeCount","isBadgeActive","previousActiveTab","tabRef","tabEl","prevTabEl","platformEl","prevPlatformEl","shiftLeft","offsetLeft","scaleFactor","clientWidth","forceReflow","SCROLL_DURATION","tabs","areFolders","activeTab","onSwitchTab","useHorizontalScroll","activeTabElement","childNodes","activeTabOffsetLeft","activeTabOffsetWidth","newLeft","fastSmoothScrollHorizontal","tab","INCLUDED_CHAT_TYPES","EXCLUDED_CHAT_TYPES","INCLUDE_FILTER_FIELDS","EXCLUDE_FILTER_FIELDS","selectChatFilters","state","mode","selectTemp","selectedChatIds","selectedChatTypes","includedChatIds","includeFilters","pick","folder","excludedChatIds","excludeFilters","getSuggestedFolderName","filters","bots","groups","channels","contacts","nonContacts","INITIAL_STATE","chatFilter","foldersReducer","omit","useReducer","makeMediaHandlers","controllerRef","mediaHandlers","proxy","requestNextTrack","requestPreviousTrack","stop","closeAudioPlayer","seekbackward","skipTime","seekOffset","seekforward","seekTo","seekTime","nexttrack","previoustrack","trackId","originalDuration","trackType","handlers","metadata","onInit","onForcePlay","onTrackChange","noPlaylist","noProgressUpdates","setIsPlaying","isPlayingSync","setPlayProgress","register","eventName","setVolume","setPlaybackRate","toggleMuted","registerMediaSession","setPlaybackState","audioPlayer","volume","isFinite","PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION","playbackRate","setPositionState","paused","updateMetadata","destroy","isSafariPatchInProgress","useEffectWithPrevDeps","prevShouldPlay","prevSrc","playIfPresent","setTime","time","audioProxy","getTimeRanges","ranges","noInitiallyBuffered","setIsBuffered","bufferedProgress","setBufferedProgress","setBufferedRanges","setIsBufferedDebounced","handleBuffering","media","buffered","bufferedLength","readyState","onLoadedData","onPlaying","onLoadStart","onPause","onTimeUpdate","onProgress","useCanvasBlur","withRaf","img","Image","processBlur","alpha","IS_CANVAS_FILTER_SUPPORTED","drawImage","RADIUS","fastBlur","onload","isInSearch","isServiceNotifications","SERVICE_NOTIFICATIONS_USER_ID","toggleChatPinned","toggleChatArchived","toggleChatUnread","actionAddToFolder","actionPin","compact","actionUnreadMark","actionMute","actionArchive","isChatArchived","actionReport","actionDelete","getCanDeleteChat","isInFolder","stopImmediatePropagation","isMenuDisabled","shouldDisableOnLink","shouldDisableOnLongTap","setIsContextMenuOpen","setContextMenuPosition","timer","clearLongPressTimer","startLongPressTimer","originalEvent","touches","cancelClickOnce","emulateContextMenuEvent","passive","EMPTY_RECT","anchor","getLayout","setPositionX","setPositionY","setTransformOriginX","setTransformOriginY","withScroll","setWithScroll","setStyle","setMenuStyle","triggerEl","anchorX","anchorY","menuEl","rootEl","extraPaddingX","extraTopPadding","marginSides","extraMarginTop","marginTop","menuRect","offsetHeight","rootRect","horizontalPosition","verticalPosition","triggerRect","menuMaxHeight","offsetX","offsetY","replyOriginForId","loadMessage","loadMessageThrottled","throttled","addOrderedIdsCallback","getOrderedIds","useFolderManagerForUnreadCounters","addUnreadCountersCallback","getUnreadCounters","useFolderManagerForChatsCount","addChatsCountCallback","getChatsCount","shouldPreventDefault","handleScroll","deltaX","deltaY","IGNORE_TAGS","Set","createCallbackManager","hotkeys","addCallback","HTMLElement","has","shouldFireEvent","hotkey","ctrl","meta","mod","shift","pressedKey","isExactHotkey","part","modifiers","reservedKeys","parseHotkey","getHotkeyMatcher","runCallbacks","debugKey","prevDeps","idRef","mediaHash","mediaFormat","cacheBuster","isHtmlAllowed","isStreaming","IS_PROGRESSIVE_SUPPORTED","useUniqueId","setLoadProgress","startedAtRef","handleProgress","Date","now","spentTime","closeTimeout","useMouseInside","menuCloseTimeout","isMouseInside","markMouseInside","usePrevDuringAnimation","prev","isCurrentPresent","isPrevPresent","reducer","initialState","reducerRef","useRunDebounced","ms","noFirst","noLast","CalendarModal","canScheduleUntilOnline","onCancel","onScheduled","setOnScheduled","handleMessageSchedule","isWhenOnline","scheduledAt","getTime","handleMessageScheduleUntilOnline","SCHEDULED_WHEN_ONLINE","handleCloseCalendar","requestCalendar","whenScheduled","scheduledDefaultDate","setSeconds","setMilliseconds","scheduledMaxDate","setFullYear","getFullYear","withTimePicker","selectedAt","maxAt","getDayStartAt","isFutureMode","secondButtonLabel","onSecondButtonClick","SEND_MESSAGE_ACTION_INTERVAL","useStateRef","callback","savedCallback","useVideoCleanup","videoEl","load","mul_table","shg_table","boxBlurCanvasRGB","context","top_x","top_y","isNaN","imageData","getImageData","pixels","rsum","gsum","bsum","p1","p2","yp","yi","yw","wm","hm","rad1","r","g","mul_sum","shg_sum","vmin","vmax","putImageData","tracks","Map","currentTrackId","voiceQueue","musicQueue","playNext","isReverseOrder","currentTrack","nextTrackId","findNextInQueue","openAudioPlayer","parseMessageKey","splitTrackId","messageKey","nextTrack","stopCurrentAudio","track","Audio","handleEvent","Proxy","createAudio","trackIdComparator","addTrackToQueue","preventPlayAfterPatch","preload","IS_SAFARI","patchSafariProgressiveAudio","globalSearch","currentContent","GlobalSearchContent","openedChatId","queueFilter","cleanUpQueue","fastSeek","rate","shouldRemoveFromQueue","h","delete","trackIdFilter","el","removeFromQueue","getTrackQueue","currentId","queue","chatAudio","getMessageKey","one","two","dateOne","keyOne","dateTwo","keyTwo","localeCompare","IOS_SCREEN_EDGE_THRESHOLD","getDistance","a","hypot","pageX","pageY","getTouchCenter","lastClickTime","lethargy","constructor","stability","sensitivity","tolerance","this","lastUpDeltas","lastDownDeltas","deltasTimestamp","check","lastDelta","wheelDelta","detail","isInertia","lastDeltas","lastDeltasOld","lastDeltasNew","oldSum","t","newSum","oldAverage","newAverage","captureEvent","initialSwipeAxis","hasMoved","hasSwiped","isZooming","initialDistance","wheelZoom","initialZoom","initialDragOffset","isDragCanceled","initialTouchCenter","innerWidth","innerHeight","minZoom","maxZoom","excludedClosestSelector","withNativeDrag","onMove","withCursor","body","querySelectorAll","scrollable","overflow","onDoubleClick","centerX","centerY","clamp","onZoom","endDistance","touchCenter","dragOffsetX","dragOffsetY","zoomFactor","initialCenterX","initialCenterY","currentCenterX","currentCenterY","shouldPreventScroll","xAbs","yAbs","axis","currentSwipeAxis","Left","Right","Up","Down","processSwipe","releaseWheelDrag","releaseWheelZoom","onWheelCapture","onWheel","doubleTapZoom","is","metaKeyPressed","delta","zoom","onWheelZoom","isUserEvent","sign","dx","dy","onWheelDrag","isNotPassive","hex2rgb","param","substring","rgb2hex","p0","rgb2hsb","d","hsb2rgb","f","q","getAverageColor","defaultRGB","rgb","count","image","preloadImage","naturalHeight","naturalWidth","blockSize","getColorLuma","rgbColor","getPatternColor","hue","saturation","cycleRestrict","isAnimating","fastSmoothScroll","margin","maxDistance","FAST_SMOOTH_MAX_DISTANCE","forceDirection","forceDuration","forceNormalContainerHeight","scrollFrom","calculateScrollFrom","FocusDirection","ANIMATION_LEVEL_MIN","scrollWithJs","isAnimatingScroll","offsetTop","elementTop","scrollTop","offset","elementHeight","currentScrollTop","containerHeight","targetContainerHeight","normalHeight","path","remainingPath","absPath","transition","FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE","shortTransition","longTransition","FAST_SMOOTH_MIN_DURATION","FAST_SMOOTH_MAX_DURATION","startAt","onHeavyAnimationStop","dispatchHeavyAnimationEvent","animateSingle","currentPath","stopById","getAttribute","containerWidth","scrollId","isStopped","random","scrollSnapType","promise","animate","force","forcePlaceCaretAtEnd","activeElement","range","createRange","lastChild","nodeValue","selectNodeContents","collapse","getMessageIdsForSelectedText","selectedFragments","childElementCount","node","nodeType","contains","messageEl","firstChild","removeChild","isElementInViewport","display","DEFAULT_HANDLERS","mediaSession","navigator","setMediaSessionHandlers","console","warn","setActionHandler","err","clearMediaSession","playbackState","buildMediaMetadata","artist","album","artwork","MediaMetadata","ENTITY_CLASS_BY_NODE_NAME","S","STRIKE","PRE","BLOCKQUOTE","parseMessageInput","withMarkdownLinks","fragment","parseMarkdown","parseMarkdownLinks","innerText","textIndex","recursionDeepness","entities","addEntity","getEntityDataFromNode","hasChildNodes","parsedHtml","RegExp","RE_LINK_TEMPLATE","rawText","nodeName","getEntityTypeFromNode","rawIndex","language","audioEl","patchedForSafari","patchForSafariInProgress","fileSelector","openSystemFilesDialog","accept","noMultiple","removeAttribute","onchange","click","extractCurrentThemeParams","getPropertyWrapped","textColor","buttonColor","buttonTextColor","linkColor","bg_color","text_color","hint_color","link_color","button_color","button_text_color","secondary_bg_color","validateHexColor","test","property","getPropertyValue","n","parseFloat","padStart"],"sourceRoot":""}