import { YfmHeadingAttr, headingNodeName } from "./const.js";
export { headingType } from "../../markdown/Heading/HeadingSpecs/index.js";
export const insideHeading = ({ $anchor, $head }) => $anchor.sameParent($head) && isHeading($head.parent);
export const hasFolding = (sel) => insideHeading(sel) && sel.$head.parent.attrs[YfmHeadingAttr.Folding] !== null;
export function isHeading(node) {
    return node.type.name === headingNodeName;
}
export function isFoldingHeading(node) {
    return isHeading(node) && typeof node.attrs[YfmHeadingAttr.Folding] === 'boolean';
}
export function isFoldedHeading(node) {
    return isHeading(node) && node.attrs[YfmHeadingAttr.Folding] === true;
}
export function isUnfoldedHeading(node) {
    return isHeading(node) && node.attrs[YfmHeadingAttr.Folding] === false;
}
export function parseLevel(node) {
    return Number.parseInt(node.attrs[YfmHeadingAttr.Level], 10);
}
//# sourceMappingURL=utils.js.map
