import { playerContext } from "../../player/context.js";
import { MediaElement } from "../media-element.js";
import { PlayerController } from "../../player/player-controller.js";
import { controlsContext } from "./context.js";
import { applyStateDataAttrs, selectControls } from "@videojs/core/dom";
import { ContextProvider } from "@videojs/element/context";
import { ControlsCore, ControlsDataAttrs } from "@videojs/core";

//#region src/ui/controls/controls-element.ts
var ControlsElement = class extends MediaElement {
	static {
		this.tagName = "media-controls";
	}
	#core = new ControlsCore();
	#mediaState = new PlayerController(this, playerContext, selectControls);
	#provider = new ContextProvider(this, { context: controlsContext });
	connectedCallback() {
		super.connectedCallback();
	}
	update(_changed) {
		super.update(_changed);
		const media = this.#mediaState.value;
		if (!media) return;
		this.#core.setMedia(media);
		const state = this.#core.getState();
		applyStateDataAttrs(this, state, ControlsDataAttrs);
		this.#provider.setValue({
			state,
			stateAttrMap: ControlsDataAttrs
		});
	}
};

//#endregion
export { ControlsElement };
//# sourceMappingURL=controls-element.js.map