//#region src/polyfills/custom-state-set.ts
var e = CSS.supports("selector(:state(test))"), t = class extends Set {
	constructor(e, t) {
		super(), this._stateSet = e, this._element = t;
	}
	add(e) {
		super.add(e);
		try {
			this._stateSet?.add(e.replace("--", ""));
		} catch {
			this._element.setAttribute(`state--${e.replace("--", "")}`, "");
		}
		return this;
	}
	delete(e) {
		super.delete(e);
		try {
			this._stateSet?.delete(e);
		} catch {
			this._element.removeAttribute(`state--${e.replace("--", "")}`);
		}
		return !0;
	}
	clear() {
		for (let e of this) this.delete(e);
	}
};
n();
function n() {
	let e = HTMLElement.prototype.attachInternals;
	Object.defineProperty(HTMLElement.prototype, "attachInternals", { value: function(...n) {
		let r = e.call(this);
		return Object.defineProperty(r, "states", { value: new t(r.states, this) }), r;
	} });
	let n = Element.prototype.matches;
	Object.defineProperty(Element.prototype, "matches", { value: function(e) {
		return n.call(this, r(e));
	} });
	let i = CSSStyleSheet.prototype.replaceSync;
	Object.defineProperty(CSSStyleSheet.prototype, "replaceSync", { value: function(e) {
		i.call(this, r(e));
	} });
}
function r(t) {
	return e ? t.replace(/:--([^\)]+)/g, ":state($1)") : t.replace(/:--([^\)]+)/g, "[state--$1]").replace(/:state\(([^\)]+)\)/g, "[state--$1]");
}
//#endregion

//# sourceMappingURL=custom-state-set.js.map