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

  var _addSourceLocation, Morph, lively, Notification, __SystemJSRewritingHack;
  _export("default", void 0);
  return {
    setters: [function (_reactiveJsx) {
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }, function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_srcClientLivelyJs) {
      lively = _srcClientLivelyJs.default;
    }],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._src_components_widgets_lively_notification_js = _recorder_._src_components_widgets_lively_notification_js || {};
      /*MD # Notify
      
      Keywords: #Widget #Core
      
      Authors: @JensLincke
      
      ![](lively-notify.png){width=200px}
      
      ### Example
      
      ```javascript{.snippet}
      lively.notify("Notify", "something happend", 10, () => {}, "green")
      ```
      
      
      
      MD*/
      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_js, "Morph", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return Morph;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          Morph = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_js, "lively", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return lively;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          lively = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("default", Notification = class Notification extends Morph {
        initialize() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this.render();
          lively.addEventListener("lively", this.shadowRoot.querySelector("#closeButton"), "click", evt => this.onClose(evt));
          lively.addEventListener("lively", this.shadowRoot.querySelector("#moreButton"), "click", evt => this.onMore(evt));
          this.counter = 0;
        }

        // #TODO get rid of this and replace it with lively.bindings
        get title() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return this._title;
        }
        set title(text) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this._title = text;
          this.render();
        }
        get color() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return this.shadowRoot.querySelector("#notification").style.backgroundColor;
        }
        set color(colorString) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this.shadowRoot.querySelector("#notification").style.backgroundColor = colorString;
        }
        get message() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return this._message;
        }
        set message(text) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this._message = text;
          this.render();
        }
        get more() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return this._more;
        }
        set more(cb) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this._more = cb; // callback
          this.render();
        }
        livelyMigrate(oldInstance) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          // this is crucial state
          this.title = oldInstance.title;
          this.message = oldInstance.message;
          this.more = oldInstance.more;
        }
        onClose(evt) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          var owner = this.parentElement;
          this.remove();
          if (owner && owner.hideIfEmpty) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
            owner.hideIfEmpty();
          }
        }
        onMore(evt) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          if (this.more) this.more();
        }
        render() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          this.shadowRoot.querySelector("#title").textContent = this.title;
          if (this.message instanceof Error) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
            var messageContainer = this.shadowRoot.querySelector("#message");
            messageContainer.innerHTML = "";
            let widget = _addSourceLocation(document.createElement("lively-error"), {
              file: 'https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js',
              end: {
                column: 57,
                line: 95
              },
              start: {
                column: 19,
                line: 95
              }
            });
            lively.components.openIn(messageContainer, widget).then(() => {
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
              widget.stack = this.message.stack;
            });
          } else {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
            this.shadowRoot.querySelector("#message").textContent = this.message;
          }
          this.shadowRoot.querySelector("#moreButton").hidden = !this.more;
          if (this.counter > 1) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
            this.shadowRoot.querySelector("#counter").textContent = this.counter;
          }
        }
      });
      Object.defineProperty(_recorder_._src_components_widgets_lively_notification_js, "Notification", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          return Notification;
        },
        set(thisIsVererySecretVariableName) {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/widgets/lively-notification.js"]++;
          _export("default", Notification = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});