Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/components/router/routerUtil.es", ['module', 'exports', 'require', 'portal-workflow-metrics-web$path-to-regexp', 'frontend-js-react-web$react', '../filter/FilterContext.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.getPathname = getPathname;
    exports.withParams = void 0;

    var _pathToRegexp = _interopRequireDefault(require("portal-workflow-metrics-web$path-to-regexp"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _FilterContext = require("../filter/FilterContext.es");

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    var withParams = function withParams() {
      for (var _len = arguments.length, components = new Array(_len), _key = 0; _key < _len; _key++) {
        components[_key] = arguments[_key];
      }

      return function (_ref) {
        var history = _ref.history,
            search = _ref.location.search,
            params = _ref.match.params;
        return (/*#__PURE__*/_react.default.createElement(_FilterContext.FilterContextProvider, null, components.map(function (Component, index) {
            if (params.sort) {
              params.sort = decodeURIComponent(params.sort);
            }

            return (/*#__PURE__*/_react.default.createElement(Component, _extends({}, params, {
                history: history,
                key: index,
                query: search,
                routeParams: params
              }))
            );
          }))
        );
      };
    };

    exports.withParams = withParams;

    function getPathname(params, path) {
      return _pathToRegexp.default.compile(path)(params);
    }
    //# sourceMappingURL=routerUtil.es.js.map
  }
});
//# sourceMappingURL=routerUtil.es.js.map