'use strict';

System.register(['reactive-jsx', 'src/components/widgets/lively-morph.js', 'src/client/lively.js'], function (_export, _context) {
  "use strict";

  var _addSourceLocation, Morph, lively;

  return {
    setters: [function (_reactiveJsx) {
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }, function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_srcClientLivelyJs) {
      lively = _srcClientLivelyJs.default;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_components_widgets_lively_notification_list_js = _recorder_._src_components_widgets_lively_notification_list_js || {};
      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_list_js, 'Morph', {
        get() {
          return Morph;
        },

        set(thisIsVererySecretVariableName) {
          Morph = thisIsVererySecretVariableName;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_list_js, 'lively', {
        get() {
          return lively;
        },

        set(thisIsVererySecretVariableName) {
          lively = thisIsVererySecretVariableName;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      class NotificationList extends Morph {

        addNotification(title, message, timeout, moreCallBack, color) {
          var notification = _addSourceLocation(document.createElement("lively-notification"), {
            file: 'https://lively-kernel.org/lively4/lively4-portal/src/components/widgets/lively-notification-list.js',
            end: {
              column: 68,
              line: 9
            },
            start: {
              column: 23,
              line: 9
            }
          });
          notification.title = title;
          notification.message = message;
          notification.more = moreCallBack;
          notification.color = color;

          lively.components.openIn(this, notification).then(() => {
            this.hidden = false;
            if (timeout === undefined) timeout = 7;
            setTimeout(() => notification.onClose(), timeout * 1000);
          });
        }

        clear() {
          Array.from(this.childNodes).forEach(ea => this.removeChild(ea));
        }

        hideIfEmpty() {
          if (this.childNodes.length === 0) {
            this.hidden = true;
          } else {
            this.hidden = false;
          }
        }
      }

      _export('default', NotificationList);

      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_list_js, 'NotificationList', {
        get() {
          return NotificationList;
        },

        set(thisIsVererySecretVariableName) {
          _export('default', NotificationList = thisIsVererySecretVariableName);

          return true;
        },

        enumerable: true,
        configurable: true
      });
    }
  };
});