import { baseUniDriverFactory, } from '@wix/wix-ui-test-utils/unidriver';
export const SearchableCollectionContentUniDriver = (base, _body) => {
    return {
        ...baseUniDriverFactory(base),
        getMatchAtIndex: async (index) => {
            // Find all spans with highlighter classes (contains "Highlighter" in the class name)
            // Based on the HTML structure: <span class="wds_1_181_0_Highlighter__root wds_1_181_0_Highlighter---emphasize-10-background">a</span>
            const highlightedSpans = await base.$$('span[class*="Highlighter"]');
            const spanCount = await highlightedSpans.count();
            // Check if the index is valid
            if (index < 0 || index >= spanCount) {
                throw new Error(`Match index ${index} is out of range. Found ${spanCount} matches.`);
            }
            // Get the span at the specified index
            const span = await highlightedSpans.at(index);
            const text = await span.text();
            return text?.trim() || '';
        },
        getNumberOfMatches: async () => {
            // Count all spans with highlighter classes
            const highlightedSpans = await base.$$('span[class*="Highlighter"]');
            return highlightedSpans.count();
        },
    };
};
//# sourceMappingURL=SearchableCollectionContent.uni.driver.js.map