import _ from 'lodash' ; import { createSelector } from 'reselect' ; import { Shortcut , ShortcutDefinitions , ShortcutGroup , ShortcutType } from 'constants/shortcut' ; import { ApplicationState } from 'store/reducers' ; param state return const getSettingsState = ( state ) => state . settings ; param state return const getActionsById = ( state ) => state . settings . actions . byId ; param state return const getActionsAllIds = ( state ) => state . settings . actions . allIds ; param state return export const getTheme = createSelector ( [ getSettingsState ] , ( settings ) => settings . theme ) ; param state return export const getLastKnownVersion = createSelector ( [ getSettingsState ] , ( settings ) => settings . lastKnownVersion ) ; param state return export const getCopyMessageOnDoubleClick = createSelector ( [ getSettingsState ] , ( settings ) => settings . copyMessageOnDoubleClick ) ; param state return export const getShowContextMenu = createSelector ( [ getSettingsState ] , ( settings ) => settings . showContextMenu ) ; param state return export const getHighlights = createSelector ( [ getSettingsState ] , ( settings ) => settings . highlights ) ; param state return export const getHighlightsIgnoredUsers = createSelector ( [ getSettingsState ] , ( settings ) => settings . highlightsIgnoredUsers ) ; param state return export const getHighlightsPermanentUsers = createSelector ( [ getSettingsState ] , ( settings ) => settings . highlightsPermanentUsers ) ; param state return export const getActions = createSelector ( [ getActionsAllIds , getActionsById ] , ( allIds , byId ) => { return _ . map ( allIds , ( id ) => byId [ id ] ) ; } ) ; param state return export const getHideWhispers = createSelector ( [ getSettingsState ] , ( settings ) => settings . hideWhispers ) ; param state return export const getSettingsBackup = ( state ) => state . settings ; param state return export const getAutoFocusInput = createSelector ( [ getSettingsState ] , ( settings ) => settings . autoFocusInput ) ; param state return export const getShowViewerCount = createSelector ( [ getSettingsState ] , ( settings ) => settings . showViewerCount ) ; param state return export const getDisableDialogAnimations = createSelector ( [ getSettingsState ] , ( settings ) => settings . disableDialogAnimations ) ; param state return export const getAlternateMessageBackgrounds = createSelector ( [ getSettingsState ] , ( settings ) => settings . alternateMessageBackgrounds ) ; param state return export const getHighlightAllMentions = createSelector ( [ getSettingsState ] , ( settings ) => settings . highlightAllMentions ) ; param state return export const getPrioritizeUsernames = createSelector ( [ getSettingsState ] , ( settings ) => settings . prioritizeUsernames ) ; param state return export const getHostThreshold = createSelector ( [ getSettingsState ] , ( settings ) => settings . hostThreshold ) ; param state return export const getAutoHostThreshold = createSelector ( [ getSettingsState ] , ( settings ) => settings . autoHostThreshold ) ; param state return export const getFollowsSortOrder = createSelector ( [ getSettingsState ] , ( settings ) => settings . followsSortOrder ) ; param state return export const getHideOfflineFollows = createSelector ( [ getSettingsState ] , ( settings ) => settings . hideOfflineFollows ) ; param state return export const getShortcuts = createSelector ( [ getSettingsState ] , ( settings ) => { return _ . reduce ( ShortcutType , ( shortcuts , shortcut ) => { shortcuts [ shortcut ] = { ... ShortcutDefinitions [ shortcut ] , combo : settings . shortcuts [ shortcut ] } ; return shortcuts ; } , { } as Record < ShortcutType , Shortcut > ) ; } ) ; param state return export const getGroupedShortcuts = createSelector ( [ getShortcuts ] , ( shortcuts ) => { return _ . reduce ( ShortcutGroup , ( groupedShortcuts , group ) => { const groupShortcuts = _ . filter ( shortcuts , [ 'group' , group ] ) ; if ( groupShortcuts . length > 0 ) { groupedShortcuts [ group ] = groupShortcuts ; } return groupedShortcuts ; } , { } as Record < ShortcutGroup , Shortcut [ ] > ) ; } ) ; param state return export const getHideVIPBadges = createSelector ( [ getSettingsState ] , ( settings ) => settings . hideVIPBadges ) ; param state return export const getAddWhispersToHistory = createSelector ( [ getSettingsState ] , ( settings ) => settings . addWhispersToHistory ) ; param state return export const getSoundSettings = createSelector ( [ getSettingsState ] , ( settings ) => settings . sounds ) ; param state return export const getPlayMessageSoundOnlyInOwnChannel = createSelector ( [ getSettingsState ] , ( settings ) => settings . playMessageSoundOnlyInOwnChannel ) ; param state return export const getDelayBetweenThrottledSounds = createSelector ( [ getSettingsState ] , ( settings ) => settings . delayBetweenThrottledSounds ) ; param state return export const getHideHeader = createSelector ( [ getSettingsState ] , ( settings ) => settings . hideHeader ) ; param state return export const getMarkNewAsUnread = createSelector ( [ getSettingsState ] , ( settings ) => settings . markNewAsUnread ) ; param state return export const getIncreaseTwitchHighlight = createSelector ( [ getSettingsState ] , ( settings ) => settings . increaseTwitchHighlight ) ;