import { r as registerInstance, h } from './core-8e73947d.js';
import './_commonjsHelpers-97e6d7b1.js';
import { e as dist_10 } from './index-b7fefe31.js';
var Notifier = /** @class */ (function () {
    function Notifier(hostRef) {
        registerInstance(this, hostRef);
    }
    Notifier.prototype.onTrigger = function (event) {
        if (event.detail.name == "close") {
            event.stopPropagation();
            this.notice = undefined;
        }
    };
    Notifier.prototype.onUpdatedNotice = function (newValue) {
        var _this = this;
        if (this.timer) {
            window.clearTimeout(this.timer);
            this.timer = undefined;
        }
        if (newValue != undefined && !(dist_10.is(newValue) && newValue.remain)) {
            this.timer = window.setTimeout(function () {
                _this.notice = undefined;
                _this.timer = undefined;
            }, dist_10.is(newValue) && newValue.timeout ? newValue.timeout : 5000);
        }
    };
    Notifier.prototype.onNotice = function (event) {
        this.notice = event.detail;
    };
    Notifier.prototype.render = function () {
        var notice = !this.notice ? undefined : typeof (this.notice) == "string" ? JSON.parse(this.notice) : this.notice;
        var color = notice && notice.type != "default" ? notice.type : "primary";
        return notice == undefined ? h("slot", null) :
            [
                h("slot", null),
                h("aside", { class: notice.type }, h("p", null, notice.message, h("smoothly-trigger", { color: color, fill: "clear", name: "close" }, h("smoothly-icon", { name: "close-circle", color: color })))),
            ];
    };
    Object.defineProperty(Notifier, "watchers", {
        get: function () {
            return {
                "notice": ["onUpdatedNotice"]
            };
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Notifier, "style", {
        get: function () { return ".sc-smoothly-notifier-h{display:block}[hidden].sc-smoothly-notifier-h{display:none}smoothly-trigger.sc-smoothly-notifier{display:inline-block;vertical-align:middle}aside.sc-smoothly-notifier{text-align:center;vertical-align:middle;width:100%-2em;padding-left:1em;padding-right:1em;border-style:solid;border-width:1px;border-radius:5px}aside.warning.sc-smoothly-notifier{background-color:rgb(var(--smoothly-warning-tint));border-color:rgb(var(--smoothly-warning-shade));color:rgb(var(--smoothly-warning-contrast))}aside.success.sc-smoothly-notifier{background-color:rgb(var(--smoothly-success-color));border-color:rgb(var(--smoothly-success-shade));color:rgb(var(--smoothly-success-contrast))}aside.danger.sc-smoothly-notifier{background-color:rgb(var(--smoothly-danger-tint));border-color:rgb(var(--smoothly-danger-shade));color:rgb(var(--smoothly-danger-contrast))}aside.default.sc-smoothly-notifier{background-color:rgb(var(--smoothly-primary-tint));border-color:rgb(var(--smoothly-primary-shade));color:rgb(var(--smoothly-primary-contrast))}"; },
        enumerable: true,
        configurable: true
    });
    return Notifier;
}());
export { Notifier as smoothly_notifier };
