import { efContext } from "./efContext.js";
import { playingContext } from "./playingContext.js";
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.95.0/helpers/decorate.js";
import { attachContextRoot } from "../attachContextRoot.js";
import { TargetOrContextMixin } from "./TargetOrContextMixin.js";
import { consume } from "@lit/context";
import { LitElement, css, html } from "lit";
import { customElement, state } from "lit/decorators.js";

//#region src/gui/EFPlay.ts
attachContextRoot();
let EFPlay = class EFPlay$1 extends TargetOrContextMixin(LitElement, efContext) {
	constructor(..._args) {
		super(..._args);
		this.playing = false;
		this.handleClick = () => {
			if (this.efContext) this.efContext.play();
		};
	}
	static {
		this.styles = [css`
      :host {
        display: block;
      }
      :host([hidden]) {
        display: none;
      }
      div {
        all: inherit;
      }
    `];
	}
	get efContext() {
		return this.effectiveContext;
	}
	connectedCallback() {
		super.connectedCallback();
		this.addEventListener("click", this.handleClick);
	}
	disconnectedCallback() {
		super.disconnectedCallback();
		this.removeEventListener("click", this.handleClick);
	}
	updated(changedProperties) {
		super.updated(changedProperties);
		if (changedProperties.has("playing")) this.style.display = this.playing ? "none" : "";
	}
	render() {
		return html`
      <div>
        <slot></slot>
      </div>
    `;
	}
};
__decorate([consume({
	context: playingContext,
	subscribe: true
}), state()], EFPlay.prototype, "playing", void 0);
EFPlay = __decorate([customElement("ef-play")], EFPlay);

//#endregion
export { EFPlay };
//# sourceMappingURL=EFPlay.js.map