"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCounter = getCounter;
const prosemirror_search_1 = require("prosemirror-search");
const const_1 = require("../const.js");
function getCounter(state) {
    const decoSet = (0, prosemirror_search_1.getMatchHighlights)(state);
    const searchDecos = decoSet.find(undefined, undefined, () => true);
    const activeIndex = searchDecos.findIndex((deco) => {
        const d = deco;
        return d.type?.attrs?.class === const_1.SearchClassName.ActiveMatch;
    });
    return {
        total: searchDecos.length,
        current: activeIndex + 1,
    };
}
//# sourceMappingURL=search-counter.js.map
