import { forEachChangedNode } from "../../../../utils/transaction.js";
import { CodeBlockNodeAttr, codeBlockNodeName } from "../CodeBlockSpecs/index.js";
/** @internal */
export function isLineNumbersVisible(node) {
    return node.attrs[CodeBlockNodeAttr.ShowLineNumbers] === 'true';
}
/** @internal */
export function processChangedCodeBlocks(tr, decoSet, onCodeBlock) {
    decoSet = decoSet.map(tr.mapping, tr.doc);
    forEachChangedNode(tr, (node, pos) => {
        if (node.type.name !== codeBlockNodeName) {
            if (node.isTextblock) {
                // Remove stale decorations from non-code_block textblocks
                // (e.g. when a code_block is converted to a paragraph)
                decoSet = decoSet.remove(decoSet.find(pos, pos + node.nodeSize));
                return false;
            }
            return true;
        }
        decoSet = onCodeBlock(node, pos, decoSet);
        return false;
    });
    return decoSet;
}
//# sourceMappingURL=utils.js.map
