import { attachInternals as e } from "../utils/a11y.js";
//#region src/internal/controllers/state-selected.controller.ts
function t() {
	return (e) => e.addInitializer((e) => new n(e));
}
var n = class {
	constructor(e) {
		this.host = e, this.host.addController(this);
	}
	hostConnected() {
		e(this.host);
	}
	hostUpdated() {
		if (this.host.readOnly) {
			this.host._internals.ariaSelected = null, this.host._internals.states.delete("selected");
			return;
		}
		if (this.host._internals?.states.has("anchor") && this.host.selected) {
			this.host._internals.ariaSelected = null, this.host._internals.states.add("selected"), this.host.querySelector("a")?.setAttribute("aria-current", "page");
			return;
		}
		this.host.selected !== null && this.host.selected !== void 0 && (this.host._internals.ariaSelected = `${this.host.selected}`), this.host.selected ? this.host._internals.states.add("selected") : this.host._internals.states.delete("selected");
	}
};
//#endregion
export { n as StateSelectedController, t as stateSelected };

//# sourceMappingURL=state-selected.controller.js.map