import { MediaElement } from "../media-element.js";
import { sliderContext } from "./context.js";
import { applyStateDataAttrs } from "@videojs/core/dom";
import { ContextConsumer } from "@videojs/element/context";

//#region src/ui/slider/slider-value-element.ts
var SliderValueElement = class extends MediaElement {
	constructor(..._args) {
		super(..._args);
		this.type = "current";
	}
	static {
		this.tagName = "media-slider-value";
	}
	static {
		this.properties = { type: { type: String } };
	}
	#ctx = new ContextConsumer(this, {
		context: sliderContext,
		subscribe: true
	});
	connectedCallback() {
		super.connectedCallback();
		this.setAttribute("aria-live", "off");
	}
	update(_changed) {
		super.update(_changed);
		const ctx = this.#ctx.value;
		if (!ctx) return;
		const value = this.type === "pointer" ? ctx.pointerValue : ctx.state.value;
		this.textContent = ctx.formatValue ? ctx.formatValue(value, this.type) : String(Math.round(value));
		applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
	}
};

//#endregion
export { SliderValueElement };
//# sourceMappingURL=slider-value-element.js.map