"use strict";

Liferay.Loader.define("sharing-web$dom-helpers@5.2.0/cjs/filterEventHandler", ['module', 'exports', 'require', '@sharing-web$babel/runtime/helpers/interopRequireDefault', './contains', './querySelectorAll'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    var _interopRequireDefault = require("@sharing-web$babel/runtime/helpers/interopRequireDefault");

    exports.__esModule = true;
    exports.default = filterEvents;

    var _contains = _interopRequireDefault(require("./contains"));

    var _querySelectorAll = _interopRequireDefault(require("./querySelectorAll"));

    function filterEvents(selector, handler) {
      return function filterHandler(e) {
        var top = e.currentTarget;
        var target = e.target;
        var matches = (0, _querySelectorAll.default)(top, selector);
        if (matches.some(function (match) {
          return (0, _contains.default)(match, target);
        })) handler.call(this, e);
      };
    }

    module.exports = exports["default"];
  }
});
//# sourceMappingURL=filterEventHandler.js.map