import { LegendItem } from '../../../../common/legend' ; import { GlobalChartState } from '../../../../state/chart_state' ; import { createCustomCachedSelector } from '../../../../state/create_selector' ; import { computeLegendSelector } from './compute_legend' ; const getHighlightedLegendPath = ( state ) => state . interactions . highlightedLegendPath ; internal export const getHighlightedSeriesSelector = createCustomCachedSelector ( [ getHighlightedLegendPath , computeLegendSelector ] , ( highlightedLegendPaths , legendItems ) : LegendItem | undefined => { if ( highlightedLegendPaths . length > 0 ) { const lookup = new Set ( highlightedLegendPaths . map ( ( { value } ) => value ) ) ; return legendItems . find ( ( { seriesIdentifiers } ) => seriesIdentifiers . some ( ( { key } ) => lookup . has ( key ) ) ) ; } } ) ;