Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/components/header/HeaderBackButton.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/icon', 'frontend-js-react-web$react', 'portal-workflow-metrics-web$react-router-dom', '../../hooks/useRouter.es', '../portal/Portal.es', '../router/queryString.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

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

    var _reactRouterDom = require("portal-workflow-metrics-web$react-router-dom");

    var _useRouter2 = require("../../hooks/useRouter.es");

    var _Portal = _interopRequireDefault(require("../portal/Portal.es"));

    var _queryString = require("../router/queryString.es");

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

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * The contents of this file are subject to the terms of the Liferay Enterprise
     * Subscription License ("License"). You may not use this file except in
     * compliance with the License. You can obtain a copy of the License by
     * contacting Liferay, Inc. See the License for the specific language governing
     * permissions and limitations under the License, including but not limited to
     * distribution rights of the Software.
     */
    var HeaderBackButton = function HeaderBackButton(_ref) {
      var basePath = _ref.basePath,
          container = _ref.container;

      var _useRouter = (0, _useRouter2.useRouter)(),
          _useRouter$location = _useRouter.location,
          pathname = _useRouter$location.pathname,
          search = _useRouter$location.search;

      var _parse = (0, _queryString.parse)(search),
          backPath = _parse.backPath;

      if (pathname === basePath || pathname === '/' || !backPath) {
        return null;
      }

      return (/*#__PURE__*/_react.default.createElement(_Portal.default, {
          className: "control-menu-nav-item",
          container: container,
          elementId: "backButton"
        }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
          className: "control-menu-icon",
          to: backPath
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "icon-monospaced"
        }, /*#__PURE__*/_react.default.createElement(_icon.default, {
          symbol: "angle-left"
        }))))
      );
    };

    var _default = HeaderBackButton;
    exports.default = _default;
    //# sourceMappingURL=HeaderBackButton.es.js.map
  }
});
//# sourceMappingURL=HeaderBackButton.es.js.map