"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findTableCells = exports.findTableRows = exports.findParentCell = exports.findParentRow = exports.findParentBody = exports.findParentTable = exports.isIntoTable = void 0;
const prosemirror_utils_1 = require("prosemirror-utils");
const const_1 = require("./const.js");
const isIntoTable = (state) => (0, prosemirror_utils_1.hasParentNodeOfType)(state.schema.nodes[const_1.TableNode.Table])(state.selection);
exports.isIntoTable = isIntoTable;
const findParentTable = (state) => (0, prosemirror_utils_1.findParentNodeOfType)(state.schema.nodes[const_1.TableNode.Table])(state.selection);
exports.findParentTable = findParentTable;
const findParentBody = (state) => (0, prosemirror_utils_1.findParentNodeOfType)(state.schema.nodes[const_1.TableNode.Body])(state.selection);
exports.findParentBody = findParentBody;
const findParentRow = (state) => (0, prosemirror_utils_1.findParentNodeOfType)(state.schema.nodes[const_1.TableNode.Row])(state.selection);
exports.findParentRow = findParentRow;
const findParentCell = (state) => (0, prosemirror_utils_1.findParentNodeOfType)([
    state.schema.nodes[const_1.TableNode.HeaderCell],
    state.schema.nodes[const_1.TableNode.DataCell],
])(state.selection);
exports.findParentCell = findParentCell;
const findTableRows = (table, schema) => (0, prosemirror_utils_1.findChildrenByType)(table, schema.nodes[const_1.TableNode.Row]);
exports.findTableRows = findTableRows;
const findTableCells = (table, schema) => (0, prosemirror_utils_1.findChildren)(table, (node) => [schema.nodes[const_1.TableNode.HeaderCell].name, schema.nodes[const_1.TableNode.DataCell].name].includes(node.type.name));
exports.findTableCells = findTableCells;
//# sourceMappingURL=helpers.js.map
