/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 * 
 * @emails oncall+draft_js
 */

var isSelectionAtLeafStart_1;
var hasRequiredIsSelectionAtLeafStart;

function requireIsSelectionAtLeafStart () {
	if (hasRequiredIsSelectionAtLeafStart) return isSelectionAtLeafStart_1;
	hasRequiredIsSelectionAtLeafStart = 1;

	function isSelectionAtLeafStart(editorState) {
	  var selection = editorState.getSelection();
	  var anchorKey = selection.getAnchorKey();
	  var blockTree = editorState.getBlockTree(anchorKey);
	  var offset = selection.getStartOffset();
	  var isAtStart = false;
	  blockTree.some(function (leafSet) {
	    if (offset === leafSet.get('start')) {
	      isAtStart = true;
	      return true;
	    }

	    if (offset < leafSet.get('end')) {
	      return leafSet.get('leaves').some(function (leaf) {
	        var leafStart = leaf.get('start');

	        if (offset === leafStart) {
	          isAtStart = true;
	          return true;
	        }

	        return false;
	      });
	    }

	    return false;
	  });
	  return isAtStart;
	}

	isSelectionAtLeafStart_1 = isSelectionAtLeafStart;
	return isSelectionAtLeafStart_1;
}

export { requireIsSelectionAtLeafStart as __require };
//# sourceMappingURL=isSelectionAtLeafStart.js.map
