Returns possible selection ranges for given HTML node, from outer to inner
@param  {Node} node
@return {Range[]}
426304
function selectionRangesForHTMLNode(node) {
	const ranges = [new Range(node.start, node.end)];
	if (node.close) {
		ranges.push(new Range(node.open.end, node.close.start));
	}

	return ranges;
}
832573
function bounds(node) {
		var clientRect = node.getBoundingClientRect();
		var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
		var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
		return { 
			left: clientRect.left + scrollLeft,
			top: clientRect.top + scrollTop,
			width: clientRect.width,
			height: clientRect.height
		};
	}
1182422
function isInRange(node, reference) {
    const or = node.range;
    const ir = reference.identifier.range;

    return or[0] <= ir[0] && ir[1] <= or[1];
}
1107685
def get_tokens(self, node, include_extra=False):
    
    return self.token_range(node.first_token, node.last_token, include_extra=include_extra)
1009659
function( range, start ) {
					// Creates a collapsed range at the requested boundary.
					range = range.duplicate();
					range.collapse( start );

					// Gets the element that encloses the range entirely.
					var parent = range.parentElement();

					// Empty parent element, e.g. <i>^</i>
					if ( !parent.hasChildNodes() )
						return { container: parent, offset: 0 };

					var siblings = parent.children,
						child, sibling,
						testRange = range.duplicate(),
						startIndex = 0,
						endIndex = siblings.length - 1,
						index = -1,
						position, distance, container;

					// Binary search over all element childs to test the range to see whether
					// range is right on the boundary of one element.
					while ( startIndex <= endIndex ) {
						index = Math.floor( ( startIndex + endIndex ) / 2 );
						child = siblings[ index ];
						testRange.moveToElementText( child );
						position = testRange.compareEndPoints( 'StartToStart', range );

						if ( position > 0 )
							endIndex = index - 1;
						else if ( position < 0 )
							startIndex = index + 1;
						else
							return { container: parent, offset: getNodeIndex( child ) };
					}

					// All childs are text nodes,
					// or to the right hand of test range are all text nodes. (#6992)
					if ( index == -1 || index == siblings.length - 1 && position < 0 ) {
						// Adapt test range to embrace the entire parent contents.
						testRange.moveToElementText( parent );
						testRange.setEndPoint( 'StartToStart', range );

						// IE report line break as CRLF with range.text but
						// only LF with textnode.nodeValue, normalize them to avoid
						// breaking character counting logic below. (#3949)
						distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;

						siblings = parent.childNodes;

						// Actual range anchor right beside test range at the boundary of text node.
						if ( !distance ) {
							child = siblings[ siblings.length - 1 ];

							if ( child.nodeType != CKEDITOR.NODE_TEXT )
								return { container: parent, offset: siblings.length };
							else
								return { container: child, offset: child.nodeValue.length };
						}

						// Start the measuring until distance overflows, meanwhile count the text nodes.
						var i = siblings.length;
						while ( distance > 0 && i > 0 ) {
							sibling = siblings[ --i ];
							if ( sibling.nodeType == CKEDITOR.NODE_TEXT ) {
								container = sibling;
								distance -= sibling.nodeValue.length;
							}
						}

						return { container: container, offset: -distance };
					}
					// Test range was one offset beyond OR behind the anchored text node.
					else {
						// Adapt one side of test range to the actual range
						// for measuring the offset between them.
						testRange.collapse( position > 0 ? true : false );
						testRange.setEndPoint( position > 0 ? 'StartToStart' : 'EndToStart', range );

						// IE report line break as CRLF with range.text but
						// only LF with textnode.nodeValue, normalize them to avoid
						// breaking character counting logic below. (#3949)
						distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;

						// Actual range anchor right beside test range at the inner boundary of text node.
						if ( !distance )
							return { container: parent, offset: getNodeIndex( child ) + ( position > 0 ? 0 : 1 ) };

						// Start the measuring until distance overflows, meanwhile count the text nodes.
						while ( distance > 0 ) {
							try {
								sibling = child[ position > 0 ? 'previousSibling' : 'nextSibling' ];
								if ( sibling.nodeType == CKEDITOR.NODE_TEXT ) {
									distance -= sibling.nodeValue.length;
									container = sibling;
								}
								child = sibling;
							}
							// Measurement in IE could be somtimes wrong because of <select> element. (#4611)
							catch ( e ) {
								return { container: parent, offset: getNodeIndex( child ) };
							}
						}

						return { container: container, offset: position > 0 ? -distance : container.nodeValue.length + distance };
					}
				}
1246614
function () {
            var node, sel, range;
            if (window.getSelection) {
                sel = window.getSelection();
                if (sel.rangeCount) {
                    range = sel.getRangeAt(0);
                    if (!range.collapsed) {
                        node = sel.anchorNode.parentNode;
                    }
                }
            } else if (document.selection) {
                node = document.selection.createRange().parentElement();
            }
            return node;
        }
182607
function getSelectorsFromProps(selectors, node) {
  const props = typeof node.props === 'function' ? node.props() : node.props
  if (!props) return []
  const className = props.className || props.class
  if (className) {
    selectors = selectors.concat(
      className
        .toString()
        .split(' ')
        .map(cn => `.${cn}`),
    )
  }
  const dataProps = Object.keys(props).reduce((dProps, key) => {
    if (key.startsWith('data-')) {
      dProps.push(`[${key}]`)
    }
    return dProps
  }, [])
  if (dataProps.length) {
    selectors = selectors.concat(dataProps)
  }
  return selectors
}
850045
function getEffectiveTextNodes(range, context) {
        return range.getNodes([3], function(node) {
            return isEffectivelyContained(node, range) && !isIgnoredNode(node, context.options);
        });
    }
959214
function() {

      var ranges, i, sel, len;

      if (window.getSelection) {
        sel = window.getSelection();
        if (sel.getRangeAt && sel.rangeCount) {
          ranges = [];
          len = sel.rangeCount;
          for (i = 0; i < len; i += 1) {
            ranges.push(sel.getRangeAt(i));
          }
          return ranges;
        }
      } else if (document.selection && document.selection.createRange) {
        return document.selection.createRange();
      }
      return null;
    }
146805
function getSelector(node)
{
	var name;
	var selector = [];
	
	while (node.nodeName !== "#document")
	{
		name = node.nodeName;
		
		// Only one of these are ever allowed -- so, index is unnecessary
		if (name!=="html" && name!=="body" & name!=="head")
		{
			name += ":nth-child("+ getNthIndex(node) +")";
		}
		
		// Building backwards
		selector.push(name);
		
		node = node.parentNode;
	}
	
	return selector.reverse().join(" > ");
}
1215852
public Range[] getRanges() {
		Range[] ranges = new Range[nodes.size()];
		for (int i = 0; i < ranges.length; i++) {
			ranges[i] = nodes.get(i).getRange();
		}
		return ranges;
	}
789967
function list(node) {
  var self = this
  var start = node.start
  var children = node.children
  var length = children.length
  var index = -1
  var values = []
  var bullet

  self.level++

  while (++index < length) {
    bullet = start ? start + index + '.' : '\\(bu'
    values.push(listItem.call(self, children[index], bullet, index))
  }

  self.level--

  return ['.RS ' + (this.level ? 4 : 0), values.join('\n'), '.RE 0\n'].join(
    '\n'
  )
}
108086
function (node) {
    var x = document.documentElement.offsetLeft,
        y = document.documentElement.offsetTop;

    if (node.offsetParent || document.body) {
        do {
            x += node.offsetLeft;
            y += node.offsetTop;
        } while (node = node.offsetParent);
    }

    return {x: x, y: y};
}
603166
function(node) {
      var range = rangy.createRange(this.doc);

      range.setStartAfter(node);
      range.setEndAfter(node);
      return this.setSelection(range);
    }
801941
function getItemsAtRange(
    opts: Options,
    value: Value,
    range?: Range
): List<Block> {
    range = range || value.selection;

    if (!range.startKey) {
        return List();
    }

    const { document } = value;

    const startBlock = document.getClosestBlock(range.startKey);
    const endBlock = document.getClosestBlock(range.endKey);

    if (startBlock === endBlock) {
        const item = getCurrentItem(opts, value, startBlock);
        return item ? List([item]) : List();
    }

    const ancestor = document.getCommonAncestor(startBlock.key, endBlock.key);

    if (isList(opts, ancestor)) {
        const startPath = ancestor.getPath(startBlock.key);
        const endPath = ancestor.getPath(endBlock.key);

        return ancestor.nodes.slice(startPath[0], endPath[0] + 1);
    } else if (ancestor.type === opts.typeItem) {
        // The ancestor is the highest list item that covers the range
        return List([ancestor]);
    }
    // No list of items can cover the range
    return List();
}
723732
function children(node) {
    var result = [];
    for (var k in node) {
        if (!node.hasOwnProperty(k))
            continue;
        if (k[0] === '$')
            continue;
        var val = node[k];
        if (!val)
            continue;
        if (typeof val === "object" && typeof val.type === "string") {
            result.push(val);
        }
        else if (val instanceof Array) {
            for (var i=0; i<val.length; i++) {
                var elm = val[i];
                if (typeof elm === "object" && typeof elm.type === "string") {
                    result.push(elm);
                }
            }
        } 
    }
    return result;
}
86783
function createRange(el, selection) {

  var start = selection.start;
  var end = selection.end;

  var range = document.createRange();

  var i = iterator(el.firstChild, el);

  var next = i.node;
  var isClosing = false;

  var count = 0;
  var length;

  while (next) {

    if (count === start) {
      if (isClosing) {
        range.setStartAfter(next);
      } else {
        range.setStartBefore(next);
      }
    }

    if (count === end) {
      if (isClosing) {
        range.setEndAfter(next);
      } else {
        range.setEndBefore(next);
      }

      return range;
    }

    if (!isClosing) {
      if (
        isBr(next) || (
          next.previousSibling && (
            isDiv(next) ||
            isParagraph(next)
          )
        )
      ) {
        count++;
      }
    }

    if (isText(next)) {

      length = next.textContent.length;

      if (count <= start && count + length > start) {
        range.setStart(next, start - count);
      }

      if (count + length > end) {
        range.setEnd(next, end - count);

        return range;
      }

      count += length;
    }

    next = i.next();
    isClosing = i.closingTag;
  }

  // out of range
  if (count <= start) {
    if (el.lastChild) {
      range.setStartAfter(el.lastChild);
    } else {
      range.setStart(el, 0);
    }
  }

  if (el.lastChild) {
    range.setEndAfter(el.lastChild);
  } else {
    range.setEnd(el, 0);
  }

  return range;
}