import { shouldUpdateFacetSearchComponent } from "./facet-search-utils.js";
function announceFacetSearchResultsWithAriaLive(facet, label, setAriaLive, i18n) {
    let prevState = facet.state.facetSearch;
    facet.subscribe(()=>{
        const nextState = facet.state.facetSearch;
        if (shouldUpdateFacetSearchComponent(nextState, prevState) && nextState.query) setAriaLive(i18n.t('facet-search-results-count', {
            count: nextState.values.length,
            label
        }));
        prevState = nextState;
    });
}
export { announceFacetSearchResultsWithAriaLive };
