import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
import { EFMedia } from "./EFMedia.js";
import { TWMixin } from "../gui/TWMixin2.js";
import { Task } from "@lit/task";
import { html } from "lit";
import { customElement, property } from "lit/decorators.js";
import _decorate from "@oxc-project/runtime/helpers/decorate";
import { createRef, ref } from "lit/directives/ref.js";
let EFAudio = class EFAudio$1 extends TWMixin(EFMedia) {
	constructor(..._args) {
		super(..._args);
		this._propertyHack = false;
		this.audioElementRef = createRef();
		this.frameTask = new Task(this, {
			autoRun: EF_INTERACTIVE,
			args: () => [
				this.audioBufferTask.status,
				this.audioSeekTask.status,
				this.audioSegmentFetchTask.status,
				this.mediaEngineTask.status
			],
			task: async () => {
				await this.mediaEngineTask.taskComplete;
				await this.audioSegmentFetchTask.taskComplete;
				await this.audioSeekTask.taskComplete;
				await this.audioBufferTask.taskComplete;
				this.rootTimegroup?.requestUpdate();
			}
		});
	}
	render() {
		return html`<audio ${ref(this.audioElementRef)}></audio>`;
	}
	/**
	* Legacy getter for fragment index task (maps to audioSegmentIdTask)
	* Still used by EFCaptions
	*/
	get fragmentIndexTask() {
		return this.audioSegmentIdTask;
	}
};
_decorate([property({
	type: Boolean,
	attribute: "dummy-property"
})], EFAudio.prototype, "_propertyHack", void 0);
EFAudio = _decorate([customElement("ef-audio")], EFAudio);
export { EFAudio };
