/*
 * Returns true if the schema supports nesting tables inside table cells.
 * This is determined by checking if table cells can contain table nodes in their content model.
 *
 * ```typescript
 * const supportsNestedTables = isNestedTablesSupported(state.schema);
 * ```
 */
export var isNestedTablesSupported = function isNestedTablesSupported(schema) {
  var _tableCell$contentMat, _tableHeader$contentM;
  var _schema$nodes = schema.nodes,
    table = _schema$nodes.table,
    tableCell = _schema$nodes.tableCell,
    tableHeader = _schema$nodes.tableHeader;
  if (!table || !tableCell || !tableHeader) {
    return false;
  }

  // Check if table cells can contain table nodes by testing their content match
  var tableCellCanContainTable = ((_tableCell$contentMat = tableCell.contentMatch.matchType(table)) === null || _tableCell$contentMat === void 0 ? void 0 : _tableCell$contentMat.validEnd) === true;
  var tableHeaderCanContainTable = ((_tableHeader$contentM = tableHeader.contentMatch.matchType(table)) === null || _tableHeader$contentM === void 0 ? void 0 : _tableHeader$contentM.validEnd) === true;
  return tableCellCanContainTable || tableHeaderCanContainTable;
};