import { attachInternals as e } from "../utils/a11y.js";
//#region src/internal/controllers/state-current.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.ariaCurrent = null, this.host._internals.states.delete("current");
			return;
		}
		if (this.host._internals?.states.has("anchor") && this.host.current) {
			this.host._internals.ariaCurrent = null, this.host._internals.states.add("current"), this.host.querySelector("a")?.setAttribute("aria-current", "page");
			return;
		}
		this.host.current !== null && this.host.current !== void 0 && (this.host._internals.ariaCurrent = `${this.host.current}`), this.host.current ? this.host._internals.states.add("current") : this.host._internals.states.delete("current");
	}
};
//#endregion
export { n as StateCurrentController, t as stateCurrent };

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