import { t as e } from "../../utils-C_mWfcFX.js";
//#region src/form/direction/index.ts
var t = class {
	container;
	config;
	observer = null;
	constructor(t) {
		this.container = e(t.container), this.config = t, t.direction !== void 0 && this.container.setAttribute("dir", t.direction), this.observeRootChanges();
	}
	setDirection(e) {
		this.container.setAttribute("dir", e), this.config.onChange?.(e);
	}
	getDirection() {
		return this.container.getAttribute("dir") ?? getComputedStyle(this.container).direction;
	}
	destroy() {
		this.observer !== null && (this.observer.disconnect(), this.observer = null);
	}
	observeRootChanges() {
		let e = document.documentElement, t = document.body;
		this.observer = new MutationObserver(() => {
			let e = this.getDirection();
			this.config.onChange?.(e);
		}), this.observer.observe(e, {
			attributes: !0,
			attributeFilter: ["dir"]
		}), this.observer.observe(t, {
			attributes: !0,
			attributeFilter: ["dir"]
		});
	}
};
//#endregion
export { t as Direction };

//# sourceMappingURL=index.js.map