Liferay.Loader.define("dynamic-data-mapping-form-web@3.0.89/admin/js/util/Notifications.es", ['module', 'exports', 'require', 'frontend-taglib-clay$clay-alert'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.Notifications = exports.default = void 0;

    var _clayAlert = require("frontend-taglib-clay$clay-alert");

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }

    function _defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
      }
    }

    function _createClass(Constructor, protoProps, staticProps) {
      if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;
    }

    var Notifications = /*#__PURE__*/function () {
      function Notifications() {
        _classCallCheck(this, Notifications);
      }

      _createClass(Notifications, null, [{
        key: "closeAlert",
        value: function closeAlert() {
          if (this._alert && !this._alert.isDisposed()) {
            this._alert.emit('hide');

            this._alert = null;
          }

          clearTimeout(this._hideTimeout);
        }
      }, {
        key: "showAlert",
        value: function showAlert() {
          var _this = this;

          var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
          var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
          var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'success';
          var hideDelay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 3000;
          var _Liferay$DDM$FormSett = Liferay.DDM.FormSettings,
              portletNamespace = _Liferay$DDM$FormSett.portletNamespace,
              spritemap = _Liferay$DDM$FormSett.spritemap;
          this.closeAlert();
          this._alert = new _clayAlert.ClayAlert({
            closeable: true,
            destroyOnHide: true,
            message: message,
            spritemap: spritemap,
            style: style,
            title: title,
            visible: true
          }, document.querySelector("#p_p_id".concat(portletNamespace, " .lfr-alert-wrapper")));
          this._hideTimeout = setTimeout(function () {
            return _this.closeAlert();
          }, hideDelay);
        }
      }, {
        key: "showError",
        value: function showError(message) {
          this.showAlert(message, Liferay.Language.get('error'), 'danger');
        }
      }]);

      return Notifications;
    }();

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