import { i as e, n as t, o as n, r } from "./floating-ui.dom-Ch9ml4Rx.js";
import { D as i, E as a, I as o, T as s, W as c, X as l, Y as u, Z as d, i as f, v as p, x as m } from "./vidstack-D9mvYVIz-DesuYgKV.js";
//#region node_modules/vidstack/prod/chunks/vidstack-CgfrU1hS.js
function h(e, t) {
	let n = t.composedPath()[0];
	return s(n) && e.contains(n);
}
var g = /* @__PURE__ */ new Set();
{
	function e() {
		for (let e of g) try {
			e();
		} catch {}
		window.requestAnimationFrame(e);
	}
	e();
}
function _(e) {
	return g.add(e), () => g.delete(e);
}
function v(e, t, n) {
	e.hasAttribute(t) || e.setAttribute(t, n);
}
function y(e, t) {
	if (e.hasAttribute("aria-label") || e.hasAttribute("data-no-label")) return;
	if (!a(t)) {
		l(e, "aria-label", t);
		return;
	}
	function n() {
		l(e, "aria-label", t());
	}
	p(n);
}
function b(e) {
	let t = getComputedStyle(e);
	return t.display !== "none" && parseInt(t.opacity) > 0;
}
function x(e) {
	return !!e && ("checkVisibility" in e ? e.checkVisibility({
		checkOpacity: !0,
		checkVisibilityCSS: !0
	}) : b(e));
}
function S(e, t) {
	return _(() => t(x(e)));
}
function C(e, t, n) {
	for (; t;) if (t === e) return !0;
	else if (n?.(t)) break;
	else t = t.parentElement;
	return !1;
}
function w(e, t) {
	return new f(e).add("pointerup", (e) => {
		e.button === 0 && !e.defaultPrevented && t(e);
	}).add("keydown", (e) => {
		i(e) && t(e);
	});
}
function T(e) {
	return o(e) && (e.touches.length > 1 || e.changedTouches.length > 1);
}
function E(e) {
	let t = m(), n = window.requestAnimationFrame(() => {
		u(e, t), n = -1;
	});
	return () => void window.cancelAnimationFrame(n);
}
function D(e, t, n) {
	let r, i = e, a = e.parentElement, o = e.content.firstElementChild, s = [];
	!o && e.firstElementChild && (e.innerHTML = e.firstElementChild.outerHTML, e.firstElementChild.remove(), o = e.content.firstElementChild);
	for (let e = 0; e < t; e++) r = document.importNode(o, !0), n?.(r, e), a.insertBefore(r, i.nextSibling), s.push(r), i = r;
	return c(() => {
		for (let e = 0; e < s.length; e++) s[e].remove();
	}), s;
}
function O(e) {
	let t = document.createElement("template");
	return t.innerHTML = e, t.content;
}
function k(e) {
	return e.cloneNode(!0).firstElementChild;
}
function A(i, a, o, { offsetVarName: s, xOffset: c, yOffset: l, ...u }) {
	if (!i) return;
	let f = o.replace(" ", "-").replace("-center", "");
	if (d(i, "visibility", a ? null : "hidden"), !a) return;
	let p = o.includes("top"), m = (e) => o.includes("left") ? `calc(-1 * ${e})` : e, h = (e) => p ? `calc(-1 * ${e})` : e;
	return t(a, i, () => {
		r(a, i, {
			placement: f,
			middleware: [
				...u.middleware ?? [],
				e({
					fallbackAxisSideDirection: "start",
					crossAxis: !1
				}),
				n()
			],
			...u
		}).then(({ x: e, y: t, middlewareData: n }) => {
			let r = !!n.flip?.index;
			p = o.includes(r ? "bottom" : "top"), i.setAttribute("data-placement", r ? o.startsWith("top") ? o.replace("top", "bottom") : o.replace("bottom", "top") : o), Object.assign(i.style, {
				top: `calc(${t + "px"} + ${h(l ? l + "px" : `var(--${s}-y-offset, 0px)`)})`,
				left: `calc(${e + "px"} + ${m(c ? c + "px" : `var(--${s}-x-offset, 0px)`)})`
			});
		});
	});
}
function j(e) {
	return getComputedStyle(e).animationName !== "none";
}
function M(e) {
	return e instanceof HTMLElement;
}
function N(e) {
	return e ? "true" : "false";
}
function P(e) {
	return () => N(e());
}
function F() {
	return typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
//#endregion
export { v as _, O as a, b as c, T as d, S as f, y as g, E as h, k as i, h as l, F as m, A as n, j as o, w as p, D as r, C as s, P as t, M as u };
