"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hasValidListIndentationLevel = void 0;
var _numberNestedLists = require("./numberNestedLists");
var hasValidListIndentationLevel = exports.hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
  var tr = _ref.tr,
    maxIndentation = _ref.maxIndentation;
  var initialIndentationLevel = (0, _numberNestedLists.numberNestedLists)(tr.selection.$from);
  var currentIndentationLevel;
  var currentPos = tr.selection.$to.pos;
  do {
    var resolvedPos = tr.doc.resolve(currentPos);
    currentIndentationLevel = (0, _numberNestedLists.numberNestedLists)(resolvedPos);
    if (currentIndentationLevel > maxIndentation) {
      return false;
    }
    currentPos++;
  } while (currentIndentationLevel >= initialIndentationLevel);
  return true;
};