import { I18nController as e } from "../internal/controllers/i18n.controller.js";
import { attachInternals as t } from "../internal/utils/a11y.js";
import { TypeNativePopoverController as n } from "../internal/controllers/type-native-popover.controller.js";
import { scopedRegistry as r } from "../internal/decorators/scoped-registry.js";
import { useStyles as i } from "../internal/styles/index.js";
import { popoverStyles as a } from "../internal/styles/popover2.js";
import { statusIcons as o } from "../internal/types/index.js";
import { __decorate as s } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.js";
import { Icon as c } from "../icon/icon2.js";
import { IconButton as l } from "../icon-button/icon-button2.js";
import u from "./notification.js";
import { LitElement as d, html as f } from "lit";
import { property as p } from "lit/decorators/property.js";
//#region src/notification/notification.ts
var m = class extends d {
	constructor(...t) {
		super(...t), this.anchor = globalThis.document?.body, this.closable = !1, this.closeTimeout = 0, this.#e = new e(this), this.i18n = this.#e.i18n, this.inline = !1;
	}
	#e;
	get popoverType() {
		return "manual";
	}
	get popoverInline() {
		return this.parentElement?.localName === "nve-notification-group" || this.inline || this.container === "flat";
	}
	#t;
	#n;
	get #r() {
		return f`<slot name="icon"><nve-icon .name="${o[this.status]}" .ariaLabel="${(this.status ? this.i18n[this.status] : void 0) ?? this.i18n.information}" part="status-icon"></nve-icon></slot>${this.closable ? f`<nve-icon-button part="icon-button" @click="${this.hidePopover}" icon-name="cancel" size="sm" container="flat" .ariaLabel="${this.i18n.close}"></nve-icon-button>` : ""}<slot></slot>`;
	}
	static {
		this.styles = i([a, u]);
	}
	static {
		this.metadata = {
			tag: "nve-notification",
			version: "2.0.2"
		};
	}
	static {
		this.elementDefinitions = {
			[c.metadata.tag]: c,
			[l.metadata.tag]: l
		};
	}
	render() {
		return f`<div internal-host>${this.#r}</div>`;
	}
	connectedCallback() {
		super.connectedCallback(), t(this), this.#n = new MutationObserver(() => this.#i()), this.#n.observe(this, { attributeFilter: ["hidden"] }), this._internals.role = "alert", this.#i();
	}
	disconnectedCallback() {
		this.#a(), this.#n?.disconnect(), this.#n = void 0, super.disconnectedCallback();
	}
	async firstUpdated(e) {
		super.firstUpdated(e), this.popoverInline ? this.setAttribute("nve-popover", "") : this.typeNativePopoverController = new n(this), this.#i();
	}
	updated(e) {
		super.updated(e), (e.has("closeTimeout") || e.has("container") || e.has("inline")) && this.#i();
	}
	hidePopover() {
		this.#a(), this.popoverInline ? this.dispatchEvent(new CustomEvent("close", {
			bubbles: !0,
			composed: !0
		})) : super.hidePopover();
	}
	#i() {
		this.#a(), this.popoverInline && this.closeTimeout && !this.hidden && (this.#t = setTimeout(() => this.hidePopover(), this.closeTimeout));
	}
	#a() {
		this.#t !== void 0 && (clearTimeout(this.#t), this.#t = void 0);
	}
};
s([p({ type: String })], m.prototype, "anchor", void 0), s([p({ type: String })], m.prototype, "trigger", void 0), s([p({
	type: String,
	reflect: !0
})], m.prototype, "position", void 0), s([p({
	type: String,
	reflect: !0
})], m.prototype, "alignment", void 0), s([p({
	type: Boolean,
	reflect: !0,
	attribute: "behavior-trigger"
})], m.prototype, "behaviorTrigger", void 0), s([p({ type: Boolean })], m.prototype, "closable", void 0), s([p({
	type: Number,
	attribute: "close-timeout"
})], m.prototype, "closeTimeout", void 0), s([p({
	type: String,
	reflect: !0
})], m.prototype, "status", void 0), s([p({
	type: String,
	reflect: !0
})], m.prototype, "container", void 0), s([p({ type: Object })], m.prototype, "i18n", void 0), s([p({ type: Boolean })], m.prototype, "inline", void 0), m = s([r()], m);
//#endregion
export { m as Notification };

//# sourceMappingURL=notification2.js.map