import { LogService as e } from "../internal/services/log.service.js";
import { typeSSR as t } from "../internal/controllers/type-ssr.controller.js";
import { useStyles as n } from "../internal/styles/index.js";
import { __decorate as r } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.js";
import i from "./format-number.js";
import { LitElement as a, html as o } from "lit";
import { property as s } from "lit/decorators/property.js";
//#region src/format-number/format-number.ts
var c = [
	["currency", "currency"],
	["currencyDisplay", "currencyDisplay"],
	["currencySign", "currencySign"],
	["notation", "notation"],
	["compactDisplay", "compactDisplay"],
	["unit", "unit"],
	["unitDisplay", "unitDisplay"],
	["signDisplay", "signDisplay"]
], l = [
	["minimumFractionDigits", "minimumFractionDigits"],
	["maximumFractionDigits", "maximumFractionDigits"],
	["minimumIntegerDigits", "minimumIntegerDigits"]
], u = class extends a {
	constructor(...e) {
		super(...e), this.formatStyle = "decimal";
	}
	static {
		this.styles = n([i]);
	}
	static {
		this.metadata = {
			tag: "nve-format-number",
			version: "2.0.2"
		};
	}
	get #e() {
		return this.number ?? this.textContent?.trim() ?? "";
	}
	get #t() {
		return this.locale ?? (globalThis.document?.documentElement?.lang || void 0);
	}
	get #n() {
		let t = this.#e;
		if (!t) return null;
		let n = Number(t);
		return Number.isFinite(n) ? n : (e.warn(`format-number: invalid numeric value "${t}"`), null);
	}
	get #r() {
		let e = { style: this.formatStyle };
		for (let [t, n] of c) {
			let r = this[t];
			r !== void 0 && (e[n] = r);
		}
		for (let [t, n] of l) {
			let r = this[t];
			r !== void 0 && (e[n] = r);
		}
		return this.useGrouping !== void 0 && (e.useGrouping = this.useGrouping === "false" ? !1 : this.useGrouping === "true" ? !0 : this.useGrouping), e;
	}
	get #i() {
		let t = this.#e;
		if (!t) return "";
		let n = this.#n;
		if (n === null) return t;
		try {
			return new Intl.NumberFormat(this.#t, this.#r).format(n);
		} catch (n) {
			return e.warn(`format-number: ${n.message}`), t;
		}
	}
	render() {
		return o`<data internal-host value="${this.#e}">${this.#i}<slot @slotchange="${this.#a}" hidden></slot></data>`;
	}
	#a() {
		this.requestUpdate();
	}
};
r([s({ type: String })], u.prototype, "number", void 0), r([s({ type: String })], u.prototype, "locale", void 0), r([s({
	type: String,
	attribute: "format-style"
})], u.prototype, "formatStyle", void 0), r([s({ type: String })], u.prototype, "currency", void 0), r([s({
	type: String,
	attribute: "currency-sign"
})], u.prototype, "currencySign", void 0), r([s({
	type: String,
	attribute: "currency-display"
})], u.prototype, "currencyDisplay", void 0), r([s({ type: String })], u.prototype, "unit", void 0), r([s({
	type: String,
	attribute: "unit-display"
})], u.prototype, "unitDisplay", void 0), r([s({ type: String })], u.prototype, "notation", void 0), r([s({
	type: String,
	attribute: "compact-display"
})], u.prototype, "compactDisplay", void 0), r([s({
	type: String,
	attribute: "sign-display"
})], u.prototype, "signDisplay", void 0), r([s({
	type: String,
	attribute: "use-grouping"
})], u.prototype, "useGrouping", void 0), r([s({
	type: Number,
	attribute: "minimum-fraction-digits"
})], u.prototype, "minimumFractionDigits", void 0), r([s({
	type: Number,
	attribute: "maximum-fraction-digits"
})], u.prototype, "maximumFractionDigits", void 0), r([s({
	type: Number,
	attribute: "minimum-integer-digits"
})], u.prototype, "minimumIntegerDigits", void 0), u = r([t()], u);
//#endregion
export { u as FormatNumber };

//# sourceMappingURL=format-number2.js.map