Liferay.Loader.define("style-book-web@1.0.46/js/style-book-editor/Toolbar", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/button', '@frontend-taglib-clay$clayui/icon', 'frontend-js-react-web$classnames', 'frontend-js-react-web$react', './StyleBookContext', './config', './constants/draftStatusConstants'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = Toolbar;

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

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

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

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

    var _StyleBookContext = require("./StyleBookContext");

    var _config = require("./config");

    var _draftStatusConstants = require("./constants/draftStatusConstants");

    var _STATUS_TO_LABEL;

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var STATUS_TO_LABEL = (_STATUS_TO_LABEL = {}, _defineProperty(_STATUS_TO_LABEL, _draftStatusConstants.DRAFT_STATUS.draftSaved, Liferay.Language.get('draft-saved')), _defineProperty(_STATUS_TO_LABEL, _draftStatusConstants.DRAFT_STATUS.notSaved, ''), _defineProperty(_STATUS_TO_LABEL, _draftStatusConstants.DRAFT_STATUS.saving, "".concat(Liferay.Language.get('saving'), "...")), _STATUS_TO_LABEL);

    function Toolbar() {
      var _useContext = (0, _react.useContext)(_StyleBookContext.StyleBookContext),
          draftStatus = _useContext.draftStatus;

      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "p-3 style-book-editor__toolbar"
        }, /*#__PURE__*/_react.default.createElement("div", null, draftStatus === _draftStatusConstants.DRAFT_STATUS.draftSaved && /*#__PURE__*/_react.default.createElement(_icon.default, {
          className: "mt-0 style-book-editor__status-icon",
          symbol: "check-circle"
        }), /*#__PURE__*/_react.default.createElement("span", {
          className: (0, _classnames.default)('ml-1 style-book-editor__status-text', {
            'text-success': draftStatus === _draftStatusConstants.DRAFT_STATUS.draftSaved
          })
        }, STATUS_TO_LABEL[draftStatus])), /*#__PURE__*/_react.default.createElement("form", {
          action: _config.config.publishURL,
          method: "POST"
        }, /*#__PURE__*/_react.default.createElement("input", {
          name: "".concat(_config.config.namespace, "redirect"),
          type: "hidden",
          value: _config.config.redirectURL
        }), /*#__PURE__*/_react.default.createElement("input", {
          name: "".concat(_config.config.namespace, "styleBookEntryId"),
          type: "hidden",
          value: _config.config.styleBookEntryId
        }), /*#__PURE__*/_react.default.createElement(_button.default, {
          disabled: _config.config.pending,
          displayType: "primary",
          onClick: function handleSubmit(event) {
            if (!confirm(Liferay.Language.get('once-published,-these-changes-will-affect-all-instances-of-the-site-using-these-properties'))) {
              event.preventDefault();
            }
          },
          small: true,
          type: "submit"
        }, Liferay.Language.get('publish'))))
      );
    }
    //# sourceMappingURL=Toolbar.js.map
  }
});
//# sourceMappingURL=Toolbar.js.map