"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isSelectionTableNestedInTable = void 0;
var _editorTables = require("@atlaskit/editor-tables");
/*
 * Returns true if the current selection is inside a table nested within a table.
 *
 * ```typescript
 * const isNestedTable = isSelectionTableNestedInTable(state);
 * ```
 */
var isSelectionTableNestedInTable = exports.isSelectionTableNestedInTable = function isSelectionTableNestedInTable(state) {
  var table = (0, _editorTables.findTable)(state.selection);
  if (!table) {
    return false;
  }
  var parent = state.doc.resolve(table.pos).parent;
  var nodeTypes = state.schema.nodes;
  return [nodeTypes.tableHeader, nodeTypes.tableCell].includes(parent.type);
};