Liferay.Loader.define('segments-experiment-web$dom-helpers@5.2.0/esm/closest', ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    import matches from './matches';
    export default function closest(node, selector, stopAt) {
      if (node.closest && !stopAt) node.closest(selector);
      var nextNode = node;

      do {
        if (matches(nextNode, selector)) return nextNode;
        nextNode = nextNode.parentElement;
      } while (nextNode && nextNode !== stopAt && nextNode.nodeType === document.ELEMENT_NODE);

      return null;
    }
  }
});
//# sourceMappingURL=closest.js.map