"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isMarkAllowedInRange = void 0;
var isMarkAllowedInRange = exports.isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
  var _loop = function _loop() {
      var _ranges$i = ranges[i],
        $from = _ranges$i.$from,
        $to = _ranges$i.$to;
      var can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
      doc.nodesBetween($from.pos, $to.pos, function (node) {
        if (can) {
          return false;
        }
        can = node.inlineContent && node.type.allowsMarkType(type);
        return;
      });
      if (can) {
        return {
          v: can
        };
      }
    },
    _ret;
  for (var i = 0; i < ranges.length; i++) {
    _ret = _loop();
    if (_ret) return _ret.v;
  }
  return false;
};