"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeFoldingIfCursorAtStartOfHeading = void 0;
const selection_1 = require("../../../../utils/selection.js");
const const_1 = require("../const.js");
const utils_1 = require("../utils.js");
const removeFoldingIfCursorAtStartOfHeading = (state, dispatch) => {
    const $cursor = (0, selection_1.get$Cursor)(state.selection);
    if (!$cursor)
        return false;
    if ($cursor.parentOffset === 0 && (0, utils_1.isFoldingHeading)($cursor.parent)) {
        dispatch?.(state.tr.setNodeAttribute($cursor.before(), const_1.YfmHeadingAttr.Folding, null));
        return true;
    }
    return false;
};
exports.removeFoldingIfCursorAtStartOfHeading = removeFoldingIfCursorAtStartOfHeading;
//# sourceMappingURL=removeFoldingIfCursorAtStartOfHeading.js.map
