import { F as e, G as t, Q as n, V as r, v as i } from "./vidstack-D9mvYVIz-DesuYgKV.js";
import { t as a } from "./vidstack-mvRkf9tF-CoFf7dS9.js";
//#region node_modules/vidstack/prod/chunks/vidstack-CceZzgm4.js
var o = class {
	#e;
	src = n("");
	referrerPolicy = null;
	get iframe() {
		return this.#e;
	}
	constructor(e) {
		this.#e = e, e.setAttribute("frameBorder", "0"), e.setAttribute("aria-hidden", "true"), e.setAttribute("allow", "autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"), this.referrerPolicy !== null && e.setAttribute("referrerpolicy", this.referrerPolicy);
	}
	setup() {
		r(window, "message", this.#n.bind(this)), r(this.#e, "load", this.onLoad.bind(this)), i(this.#t.bind(this));
	}
	#t() {
		let e = this.src();
		if (!e.length) {
			this.#e.setAttribute("src", "");
			return;
		}
		let n = t(() => this.buildParams());
		this.#e.setAttribute("src", a(e, n));
	}
	postMessage(e, t) {
		this.#e.contentWindow?.postMessage(JSON.stringify(e), t ?? "*");
	}
	#n(t) {
		let n = this.getOrigin();
		if ((t.source === null || t.source === this.#e?.contentWindow) && (!e(n) || n === t.origin)) {
			try {
				let e = JSON.parse(t.data);
				e && this.onMessage(e, t);
				return;
			} catch {}
			t.data && this.onMessage(t.data, t);
		}
	}
};
//#endregion
export { o as t };
