import { I18nController as e } from "../internal/controllers/i18n.controller.js";
import { typeTouch as t } from "../internal/controllers/type-touch.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 "./resize-handle.js";
import { LitElement as a, html as o } from "lit";
import { property as s } from "lit/decorators/property.js";
import { FormControlMixin as c } from "@nvidia-elements/forms/mixins";
import { ifDefined as l } from "lit/directives/if-defined.js";
//#region src/resize-handle/resize-handle.ts
var u = class extends c(a) {
	static {
		this.styles = n([i]);
	}
	get #e() {
		return this.shadowRoot.querySelector("input");
	}
	static {
		this.metadata = {
			tag: "nve-resize-handle",
			version: "2.0.2",
			valueSchema: { type: "number" }
		};
	}
	#t;
	#n;
	render() {
		return o`<div internal-host><div class="line" part="_line"></div><input aria-label="${l(this.ariaLabel ?? this.i18n.resize)}" type="range" min="${this.min}" max="${this.max}" .valueAsNumber="${this.valueAsNumber}" @input="${(e) => this.#s(e.target.valueAsNumber)}" @change="${(e) => this.#c(e.target.valueAsNumber)}" step="${this.step}"></div>`;
	}
	constructor() {
		super(), this.orientation = "horizontal", this.min = 0, this.max = 100, this.step = 10, this.#t = new e(this), this.i18n = this.#t.i18n, this.#n = 0, this.value = this.value ?? 50, this.#n = this.valueAsNumber;
	}
	connectedCallback() {
		super.connectedCallback(), this._internals.role = "none";
	}
	firstUpdated(e) {
		super.firstUpdated(e), this.addEventListener("nve-touch-start", () => this.#i()), this.addEventListener("nve-touch-end", () => this.#o()), this.addEventListener("nve-touch-move", ((e) => this.#a(e))), this.addEventListener("dblclick", () => {
			this.dispatchEvent(new CustomEvent("toggle", {
				cancelable: !0,
				bubbles: !0,
				composed: !0
			})) && this.#r();
		});
	}
	#r() {
		let e = this.valueAsNumber <= this.max && this.valueAsNumber !== this.min ? this.min : this.max;
		this.#s(e), this.#c(e);
	}
	#i() {
		this.#e.step = "1", this._internals.states.add("active"), this.#n = this.valueAsNumber;
	}
	#a(e) {
		let t = (this.orientation === "vertical" ? e.offsetX : -e.offsetY) * (this.dir === "rtl" ? -1 : 1);
		this.#n += t, this.#s(this.#n);
	}
	#o() {
		this.#n = this.valueAsNumber, this.#e.step = `${this.step}`, this.#c(this.#n), this._internals.states.delete("active");
	}
	#s(e) {
		this.#l(e), this.dispatchInputEvent();
	}
	#c(e) {
		this.#l(e), this.dispatchChangeEvent();
	}
	#l(e) {
		e <= this.max && e >= this.min && (this.valueAsNumber = e);
	}
};
r([s({
	type: String,
	reflect: !0
})], u.prototype, "orientation", void 0), r([s({
	type: Number,
	reflect: !0
})], u.prototype, "min", void 0), r([s({
	type: Number,
	reflect: !0
})], u.prototype, "max", void 0), r([s({
	type: Number,
	reflect: !0
})], u.prototype, "step", void 0), r([s({ type: Object })], u.prototype, "i18n", void 0), u = r([t()], u);
//#endregion
export { u as ResizeHandle };

//# sourceMappingURL=resize-handle2.js.map