//#region node_modules/media-captions/dist/prod/index.js
var e = {
	LoadFail: 0,
	BadSignature: 1,
	BadTimestamp: 2,
	BadSettingValue: 3,
	BadFormat: 4,
	UnknownSetting: 5
}, t = class extends Error {
	code;
	line;
	constructor(e) {
		super(e.reason), this.code = e.code, this.line = e.line;
	}
}, n = /\r?\n|\r/gm, r = class {
	writable;
	readable;
	constructor(e) {
		let t = new i(e);
		this.writable = new WritableStream({
			write(e) {
				t.transform(e);
			},
			close() {
				t.close();
			}
		}), this.readable = new ReadableStream({ start(e) {
			t.onLine = (t) => e.enqueue(t), t.onClose = () => e.close();
		} });
	}
}, i = class {
	a = "";
	b;
	onLine;
	onClose;
	constructor(e) {
		this.b = new TextDecoder(e);
	}
	transform(e) {
		this.a += this.b.decode(e, { stream: !0 });
		let t = this.a.split(n);
		this.a = t.pop() || "";
		for (let e = 0; e < t.length; e++) this.onLine(t[e].trim());
	}
	close() {
		this.a && this.onLine(this.a.trim()), this.a = "", this.onClose();
	}
};
async function a(e, t) {
	return o(new ReadableStream({ start(t) {
		let r = e.split(n);
		for (let e of r) t.enqueue(e);
		t.close();
	} }), t);
}
async function o(e, t) {
	let n = t?.type ?? "vtt", r;
	if (typeof n == "string") switch (n) {
		case "srt":
			r = (await import("./srt-parser-DdH5U08c.js")).default;
			break;
		case "ssa":
		case "ass":
			r = (await import("./ssa-parser-Bjs7yDD1.js")).default;
			break;
		default: r = (await Promise.resolve().then(function() {
			return fe;
		})).default;
	}
	else r = n;
	let i, a = e.getReader(), o = r(), s = !!t?.strict || !!t?.errors;
	await o.init({
		strict: !1,
		...t,
		errors: s,
		type: n,
		cancel() {
			a.cancel(), i = o.done(!0);
		}
	});
	let c = 1;
	for (;;) {
		let { value: e, done: t } = await a.read();
		if (t) {
			o.parse("", c), i = o.done(!1);
			break;
		}
		o.parse(e, c), c++;
	}
	return i;
}
async function s(e, t) {
	let n = await e;
	if (!n.ok || !n.body) return {
		metadata: {},
		cues: [],
		regions: [],
		errors: [void 0]
	};
	let r = n.headers.get("content-type") || "", i = r.match(/text\/(.*?)(?:;|$)/)?.[1], a = r.match(/charset=(.*?)(?:;|$)/)?.[1];
	return c(n.body, {
		type: i,
		encoding: a,
		...t
	});
}
async function c(e, { encoding: t = "utf-8", ...n } = {}) {
	return o(e.pipeThrough(new r(t)), n);
}
var l = class extends EventTarget {
	id = "";
	startTime;
	endTime;
	text;
	pauseOnExit = !1;
	constructor(e, t, n) {
		super(), this.startTime = e, this.endTime = t, this.text = n;
	}
	addEventListener(e, t, n) {
		super.addEventListener(e, t, n);
	}
	removeEventListener(e, t, n) {
		super.removeEventListener(e, t, n);
	}
}, u = typeof document > "u", d = u ? l : window.VTTCue, f = class extends d {
	region = null;
	vertical = "";
	snapToLines = !0;
	line = "auto";
	lineAlign = "start";
	position = "auto";
	positionAlign = "auto";
	size = 100;
	align = "center";
	style;
}, p = class {
	id = "";
	width = 100;
	lines = 3;
	regionAnchorX = 0;
	regionAnchorY = 100;
	viewportAnchorX = 0;
	viewportAnchorY = 100;
	scroll = "";
}, m = ",", ee = "%";
function te(e) {
	let t = parseInt(e, 10);
	return Number.isNaN(t) ? null : t;
}
function h(e) {
	let t = parseInt(e.replace(ee, ""), 10);
	return !Number.isNaN(t) && t >= 0 && t <= 100 ? t : null;
}
function g(e) {
	if (!e.includes(m)) return null;
	let [t, n] = e.split(m).map(h);
	return t !== null && n !== null ? [t, n] : null;
}
function ne(e) {
	let t = parseFloat(e);
	return Number.isNaN(t) ? null : t;
}
var re = "WEBVTT", _ = ",", ie = "%", v = /[:=]/, y = /^[\s\t]*(region|vertical|line|position|size|align)[:=]/, b = "NOTE", x = "REGION", S = /^REGION:?[\s\t]+/, C = /[\s\t]+/, ae = "-->", oe = /[\s\t]*-->[\s\t]+/, se = /start|center|end|left|right/, ce = /start|center|end/, le = /line-(?:left|right)|center|auto/, ue = /^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/, w = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Header = 1] = "Header", e[e.Cue = 2] = "Cue", e[e.Region = 3] = "Region", e[e.Note = 4] = "Note", e))(w || {}), T = class {
	h;
	e = 0;
	i = {};
	j = {};
	l = [];
	c = null;
	d = null;
	m = [];
	f;
	n = "";
	async init(e) {
		this.h = e, e.strict && (this.e = 1), e.errors && (this.f = (await import("./errors-SUXKojVW.js")).ParseErrorBuilder);
	}
	parse(e, t) {
		if (e === "") this.c ? (this.l.push(this.c), this.h.onCue?.(this.c), this.c = null) : this.d ? (this.j[this.d.id] = this.d, this.h.onRegion?.(this.d), this.d = null) : this.e === 1 && (this.k(e, t), this.h.onHeaderMetadata?.(this.i)), this.e = 0;
		else if (this.e) switch (this.e) {
			case 1:
				this.k(e, t);
				break;
			case 2:
				if (this.c) {
					let n = this.c.text.length > 0;
					!n && y.test(e) ? this.o(e.split(C), t) : this.c.text += (n ? "\n" : "") + e;
				}
				break;
			case 3:
				this.p(e.split(C), t);
				break;
		}
		else if (e.startsWith(b)) this.e = 4;
		else if (e.startsWith(x)) this.e = 3, this.d = new p(), this.p(e.replace(S, "").split(C), t);
		else if (e.includes(ae)) {
			let n = this.q(e, t);
			n && (this.c = new f(n[0], n[1], ""), this.c.id = this.n, this.o(n[2], t)), this.e = 2;
		} else t === 1 && this.k(e, t);
		this.n = e;
	}
	done() {
		return {
			metadata: this.i,
			cues: this.l,
			regions: Object.values(this.j),
			errors: this.m
		};
	}
	k(e, t) {
		if (t > 1) {
			if (v.test(e)) {
				let [t, n] = e.split(v);
				t && (this.i[t] = (n || "").replace(C, ""));
			}
		} else e.startsWith(re) ? this.e = 1 : this.g(this.f?.r());
	}
	q(e, t) {
		let [n, r = ""] = e.split(oe), [i, ...a] = r.split(C), o = E(n), s = E(i);
		if (o !== null && s !== null && s > o) return [
			o,
			s,
			a
		];
		o === null && this.g(this.f?.s(n, t)), s === null && this.g(this.f?.t(i, t)), o != null && s !== null && s > o && this.g(this.f?.u(o, s, t));
	}
	p(e, t) {
		let n;
		for (let r = 0; r < e.length; r++) if (v.test(e[r])) {
			n = !1;
			let [i, a] = e[r].split(v);
			switch (i) {
				case "id":
					this.d.id = a;
					break;
				case "width":
					let e = h(a);
					e === null ? n = !0 : this.d.width = e;
					break;
				case "lines":
					let r = te(a);
					r === null ? n = !0 : this.d.lines = r;
					break;
				case "regionanchor":
					let o = g(a);
					o === null ? n = !0 : (this.d.regionAnchorX = o[0], this.d.regionAnchorY = o[1]);
					break;
				case "viewportanchor":
					let s = g(a);
					s === null ? n = !0 : (this.d.viewportAnchorX = s[0], this.d.viewportAnchorY = s[1]);
					break;
				case "scroll":
					a === "up" ? this.d.scroll = "up" : n = !0;
					break;
				default: this.g(this.f?.v(i, a, t));
			}
			n && this.g(this.f?.w(i, a, t));
		}
	}
	o(e, t) {
		let n;
		for (let r = 0; r < e.length; r++) if (n = !1, v.test(e[r])) {
			let [i, a] = e[r].split(v);
			switch (i) {
				case "region":
					let e = this.j[a];
					e && (this.c.region = e);
					break;
				case "vertical":
					a === "lr" || a === "rl" ? (this.c.vertical = a, this.c.region = null) : n = !0;
					break;
				case "line":
					let [r, o] = a.split(_);
					if (r.includes(ie)) {
						let e = h(r);
						e === null ? n = !0 : (this.c.line = e, this.c.snapToLines = !1);
					} else {
						let e = ne(r);
						e === null ? n = !0 : this.c.line = e;
					}
					ce.test(o) ? this.c.lineAlign = o : o && (n = !0), this.c.line !== "auto" && (this.c.region = null);
					break;
				case "position":
					let [s, c] = a.split(_), l = h(s);
					l === null ? n = !0 : this.c.position = l, c && le.test(c) ? this.c.positionAlign = c : c && (n = !0);
					break;
				case "size":
					let u = h(a);
					u === null ? n = !0 : (this.c.size = u, u < 100 && (this.c.region = null));
					break;
				case "align":
					se.test(a) ? this.c.align = a : n = !0;
					break;
				default: this.g(this.f?.x(i, a, t));
			}
			n && this.g(this.f?.y(i, a, t));
		}
	}
	g(e) {
		if (e) {
			if (this.m.push(e), this.h.strict) throw this.h.cancel(), e;
			this.h.onError?.(e);
		}
	}
};
function E(e) {
	let t = e.match(ue);
	if (!t) return null;
	let n = t[1] ? parseInt(t[1], 10) : 0, r = parseInt(t[2], 10), i = parseInt(t[3], 10), a = t[4] ? parseInt(t[4].padEnd(3, "0"), 10) : 0, o = n * 3600 + r * 60 + i + a / 1e3;
	return n < 0 || r < 0 || i < 0 || a < 0 || r > 59 || i > 59 ? null : o;
}
function de() {
	return new T();
}
var fe = /*#__PURE__*/ Object.freeze({
	__proto__: null,
	VTTBlock: w,
	VTTParser: T,
	default: de,
	parseVTTTimestamp: E
}), pe = /[0-9]/, me = /[\s\t]+/, D = {
	c: "span",
	i: "i",
	b: "b",
	u: "u",
	ruby: "ruby",
	rt: "rt",
	v: "span",
	lang: "span",
	timestamp: "span"
}, O = {
	"&amp;": "&",
	"&lt;": "<",
	"&gt;": ">",
	"&quot;": "\"",
	"&#39;": "'",
	"&nbsp;": "\xA0",
	"&lrm;": "‎",
	"&rlm;": "‏"
}, k = /&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g, A = /* @__PURE__ */ new Set([
	"white",
	"lime",
	"cyan",
	"red",
	"yellow",
	"magenta",
	"blue",
	"black"
]), j = /* @__PURE__ */ new Set(Object.keys(D));
function M(e) {
	let t = "", n = 1, r = [], i = [], a;
	for (let r = 0; r < e.text.length; r++) {
		let l = e.text[r];
		switch (n) {
			case 1:
				l === "<" ? (c(), n = 2) : t += l;
				break;
			case 2:
				switch (l) {
					case "\n":
					case "	":
					case " ":
						o(), n = 4;
						break;
					case ".":
						o(), n = 3;
						break;
					case "/":
						n = 5;
						break;
					case ">":
						o(), n = 1;
						break;
					default:
						!t && pe.test(l) && (n = 6), t += l;
						break;
				}
				break;
			case 3:
				switch (l) {
					case "	":
					case " ":
					case "\n":
						s(), a && a.class?.trim(), n = 4;
						break;
					case ".":
						s();
						break;
					case ">":
						s(), a && a.class?.trim(), n = 1;
						break;
					default: t += l;
				}
				break;
			case 4:
				l === ">" ? (t = t.replace(me, " "), a?.type === "v" ? a.voice = P(t) : a?.type === "lang" && (a.lang = P(t)), t = "", n = 1) : t += l;
				break;
			case 5:
				l === ">" && (t = "", a = i.pop(), n = 1);
				break;
			case 6:
				if (l === ">") {
					let r = E(t);
					r !== null && r >= e.startTime && r <= e.endTime && (t = "timestamp", o(), a.time = r), t = "", n = 1;
				} else t += l;
				break;
		}
	}
	function o() {
		if (j.has(t)) {
			let e = a;
			a = N(t), e ? (i[i.length - 1] !== e && i.push(e), e.children.push(a)) : r.push(a);
		}
		t = "", n = 1;
	}
	function s() {
		if (a && t) {
			let e = t.replace("bg_", "");
			A.has(e) ? a[t.startsWith("bg_") ? "bgColor" : "color"] = e : a.class = a.class ? a.class + " " + t : t;
		}
		t = "";
	}
	function c() {
		if (!t) return;
		let e = {
			type: "text",
			data: P(t)
		};
		a ? a.children.push(e) : r.push(e), t = "";
	}
	return n === 1 && c(), r;
}
function N(e) {
	return {
		tagName: D[e],
		type: e,
		children: []
	};
}
function P(e) {
	return e.replace(k, (e) => O[e] || "'");
}
function F(e, t, n) {
	e.style.setProperty(`--${t}`, n + "");
}
function I(e, t, n = !0) {
	e.setAttribute(`data-${t}`, n === !0 ? "" : n + "");
}
function L(e, t) {
	e.setAttribute("data-part", t);
}
function R(e) {
	return parseFloat(getComputedStyle(e).lineHeight) || 0;
}
function z(e) {
	if (u) throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");
	let t = document.createElement("template");
	return t.innerHTML = B(e), {
		cue: e,
		content: t.content
	};
}
function B(e, t = 0) {
	return V(M(e), t);
}
function V(e, t = 0) {
	let n, r = "";
	for (let i of e) if (i.type === "text") r += i.data;
	else {
		let e = i.type === "timestamp";
		n = {}, n.class = i.class, n.title = i.type === "v" && i.voice, n.lang = i.type === "lang" && i.lang, n["data-part"] = i.type === "v" && "voice", e && (n["data-part"] = "timed", n["data-time"] = i.time, n["data-future"] = i.time > t, n["data-past"] = i.time < t), n.style = `${i.color ? `color: ${i.color};` : ""}${i.bgColor ? `background-color: ${i.bgColor};` : ""}`;
		let a = Object.entries(n).filter((e) => e[1]).map((e) => `${e[0]}="${e[1] === !0 ? "" : e[1]}"`).join(" ");
		r += `<${i.tagName}${a ? " " + a : ""}>${V(i.children)}</${i.tagName}>`;
	}
	return r;
}
function H(e, t) {
	if (!u) for (let n of e.querySelectorAll("[data-part=\"timed\"]")) {
		let e = Number(n.getAttribute("data-time"));
		Number.isNaN(e) || (e > t ? I(n, "future") : n.removeAttribute("data-future"), e < t ? I(n, "past") : n.removeAttribute("data-past"));
	}
}
function he(e, t) {
	let n = null, r;
	function i() {
		a(), e(...r), r = void 0;
	}
	function a() {
		clearTimeout(n), n = null;
	}
	function o() {
		r = [].slice.call(arguments), a(), n = setTimeout(i, t);
	}
	return o;
}
var U = Symbol(0);
function W(e) {
	return e instanceof HTMLElement ? {
		top: e.offsetTop,
		width: e.clientWidth,
		height: e.clientHeight,
		left: e.offsetLeft,
		right: e.offsetLeft + e.clientWidth,
		bottom: e.offsetTop + e.clientHeight
	} : { ...e };
}
function G(e, t, n) {
	switch (t) {
		case "+x":
			e.left += n, e.right += n;
			break;
		case "-x":
			e.left -= n, e.right -= n;
			break;
		case "+y":
			e.top += n, e.bottom += n;
			break;
		case "-y":
			e.top -= n, e.bottom -= n;
			break;
	}
}
function ge(e, t) {
	return e.left <= t.right && e.right >= t.left && e.top <= t.bottom && e.bottom >= t.top;
}
function _e(e, t) {
	for (let n = 0; n < t.length; n++) if (ge(e, t[n])) return t[n];
	return null;
}
function K(e, t) {
	return t.top >= 0 && t.bottom <= e.height && t.left >= 0 && t.right <= e.width;
}
function ve(e, t, n) {
	switch (n) {
		case "+x": return t.left < 0;
		case "-x": return t.right > e.width;
		case "+y": return t.top < 0;
		case "-y": return t.bottom > e.height;
	}
}
function ye(e, t) {
	return Math.max(0, Math.min(e.width, t.right) - Math.max(0, t.left)) * Math.max(0, Math.min(e.height, t.bottom) - Math.max(0, t.top)) / (e.height * e.width);
}
function q(e, t) {
	return {
		top: t.top / e.height,
		left: t.left / e.width,
		right: (e.width - t.right) / e.width,
		bottom: (e.height - t.bottom) / e.height
	};
}
function J(e, t) {
	return t.top *= e.height, t.left *= e.width, t.right = e.width - t.right * e.width, t.bottom = e.height - t.bottom * e.height, t;
}
var Y = [
	"top",
	"left",
	"right",
	"bottom"
];
function X(e, t, n, r) {
	let i = q(t, n);
	for (let t of Y) F(e, `${r}-${t}`, i[t] * 100 + "%");
}
function Z(e, t, n, r) {
	let i = 1, a, o = { ...t };
	for (let s = 0; s < r.length; s++) {
		for (; ve(e, t, r[s]) || K(e, t) && _e(t, n);) G(t, r[s], 1);
		if (K(e, t)) return t;
		let c = ye(e, t);
		i > c && (a = { ...t }, i = c), t = { ...o };
	}
	return a || o;
}
var Q = Symbol(0);
function be(e, t, n, r) {
	let i = n.firstElementChild, a = Ce(t), o, s = [];
	if (n[U] || (n[U] = xe(e, n)), o = J(e, { ...n[U] }), n[Q]) s = [
		n[Q] === "top" ? "+y" : "-y",
		"+x",
		"-x"
	];
	else if (t.snapToLines) {
		let n;
		switch (t.vertical) {
			case "":
				s = ["+y", "-y"], n = "height";
				break;
			case "rl":
				s = ["+x", "-x"], n = "width";
				break;
			case "lr":
				s = ["-x", "+x"], n = "width";
				break;
		}
		let r = R(i), c = r * Math.round(a), l = e[n] + r, u = s[0];
		Math.abs(c) > l && (c = c < 0 ? -1 : 1, c *= Math.ceil(l / r) * r), a < 0 && (c += t.vertical === "" ? e.height : e.width, s = s.reverse()), G(o, u, c);
	} else {
		let n = t.vertical === "", r = n ? "+y" : "+x", i = n ? o.height : o.width;
		G(o, r, (n ? e.height : e.width) * a / 100), G(o, r, t.lineAlign === "center" ? i / 2 : t.lineAlign === "end" ? i : 0), s = n ? [
			"-y",
			"+y",
			"-x",
			"+x"
		] : [
			"-x",
			"+x",
			"-y",
			"+y"
		];
	}
	return o = Z(e, o, r, s), X(n, e, o, "cue"), o;
}
function xe(e, t) {
	let n = W(t), r = Se(t);
	if (t[Q] = !1, r.top && (n.top = r.top, n.bottom = r.top + n.height, t[Q] = "top"), r.bottom) {
		let i = e.height - r.bottom;
		n.top = i - n.height, n.bottom = i, t[Q] = "bottom";
	}
	return r.left && (n.left = r.left), r.right && (n.right = e.width - r.right), q(e, n);
}
function Se(e) {
	let t = {};
	for (let n of Y) t[n] = parseFloat(e.style.getPropertyValue(`--cue-${n}`));
	return t;
}
function Ce(e) {
	return e.line === "auto" ? e.snapToLines ? -1 : 100 : e.line;
}
function $(e) {
	if (e.position === "auto") switch (e.align) {
		case "start":
		case "left": return 0;
		case "right":
		case "end": return 100;
		default: return 50;
	}
	return e.position;
}
function we(e, t) {
	if (e.positionAlign === "auto") switch (e.align) {
		case "start": return t === "ltr" ? "line-left" : "line-right";
		case "end": return t === "ltr" ? "line-right" : "line-left";
		case "center": return "center";
		default: return `line-${e.align}`;
	}
	return e.positionAlign;
}
var Te = [
	"-y",
	"+y",
	"-x",
	"+x"
];
function Ee(e, t, n, r) {
	let i = Array.from(n.querySelectorAll("[data-part=\"cue-display\"]")), a = 0, o = Math.max(0, i.length - t.lines);
	for (let e = i.length - 1; e >= o; e--) a += i[e].offsetHeight;
	F(n, "region-height", a + "px"), n[U] || (n[U] = q(e, W(n)));
	let s = { ...n[U] };
	return s = J(e, s), s.width = n.clientWidth, s.height = a, s.right = s.left + s.width, s.bottom = s.top + a, s = Z(e, s, r, Te), X(n, e, s, "region"), s;
}
var De = class {
	overlay;
	z;
	A = 0;
	C = "ltr";
	B = [];
	D = !1;
	E;
	j = /* @__PURE__ */ new Map();
	l = /* @__PURE__ */ new Map();
	get dir() {
		return this.C;
	}
	set dir(e) {
		this.C = e, I(this.overlay, "dir", e);
	}
	get currentTime() {
		return this.A;
	}
	set currentTime(e) {
		this.A = e, this.update();
	}
	constructor(e, t) {
		this.overlay = e, this.dir = t?.dir ?? "ltr", e.setAttribute("translate", "yes"), e.setAttribute("aria-live", "off"), e.setAttribute("aria-atomic", "true"), L(e, "captions"), this.G(), this.E = new ResizeObserver(this.I.bind(this)), this.E.observe(e);
	}
	changeTrack({ regions: e, cues: t }) {
		this.reset(), this.J(e);
		for (let e of t) this.l.set(e, null);
		this.update();
	}
	addCue(e) {
		this.l.set(e, null), this.update();
	}
	removeCue(e) {
		this.l.delete(e), this.update();
	}
	update(e = !1) {
		this.H(e);
	}
	reset() {
		this.l.clear(), this.j.clear(), this.B = [], this.overlay.textContent = "";
	}
	destroy() {
		this.reset(), this.E.disconnect();
	}
	I() {
		this.D = !0, this.K();
	}
	K = he(() => {
		this.D = !1, this.G();
		for (let e of this.j.values()) e[U] = null;
		for (let e of this.l.values()) e && (e[U] = null);
		this.H(!0);
	}, 50);
	G() {
		this.z = W(this.overlay), F(this.overlay, "overlay-width", this.z.width + "px"), F(this.overlay, "overlay-height", this.z.height + "px");
	}
	H(e = !1) {
		if (!this.l.size || this.D) return;
		let t, n = [...this.l.keys()].filter((e) => this.A >= e.startTime && this.A <= e.endTime).sort((e, t) => e.startTime === t.startTime ? e.endTime - t.endTime : e.startTime - t.startTime), r = n.map((e) => e.region);
		for (let i = 0; i < this.B.length; i++) {
			if (t = this.B[i], n[i] === t) continue;
			if (t.region && !r.includes(t.region)) {
				let n = this.j.get(t.region.id);
				n && (n.removeAttribute("data-active"), e = !0);
			}
			let a = this.l.get(t);
			a && (a.remove(), e = !0);
		}
		for (let r = 0; r < n.length; r++) {
			t = n[r];
			let i = this.l.get(t);
			i || this.l.set(t, i = this.L(t));
			let a = this.F(t) && this.j.get(t.region.id);
			a && !a.hasAttribute("data-active") && (requestAnimationFrame(() => I(a, "active")), e = !0), i.isConnected || ((a || this.overlay).append(i), e = !0);
		}
		if (e) {
			let e = [], r = /* @__PURE__ */ new Set();
			for (let i = n.length - 1; i >= 0; i--) {
				if (t = n[i], r.has(t.region || t)) continue;
				let a = this.F(t), o = a ? this.j.get(t.region.id) : this.l.get(t);
				a ? e.push(Ee(this.z, t.region, o, e)) : e.push(be(this.z, t, o, e)), r.add(a ? t.region : t);
			}
		}
		H(this.overlay, this.A), this.B = n;
	}
	J(e) {
		if (e) for (let t of e) {
			let e = this.M(t);
			this.j.set(t.id, e), this.overlay.append(e);
		}
	}
	M(e) {
		let t = document.createElement("div");
		return L(t, "region"), I(t, "id", e.id), I(t, "scroll", e.scroll), F(t, "region-width", e.width + "%"), F(t, "region-anchor-x", e.regionAnchorX), F(t, "region-anchor-y", e.regionAnchorY), F(t, "region-viewport-anchor-x", e.viewportAnchorX), F(t, "region-viewport-anchor-y", e.viewportAnchorY), F(t, "region-lines", e.lines), t;
	}
	L(e) {
		let t = document.createElement("div"), n = $(e), r = we(e, this.C);
		if (L(t, "cue-display"), e.vertical !== "" && I(t, "vertical"), F(t, "cue-text-align", e.align), e.style) for (let n of Object.keys(e.style)) t.style.setProperty(n, e.style[n]);
		if (this.F(e)) F(t, "cue-offset", `${n - (r === "line-right" ? 100 : r === "center" ? 50 : 0)}%`);
		else if (F(t, "cue-writing-mode", e.vertical === "" ? "horizontal-tb" : e.vertical === "lr" ? "vertical-lr" : "vertical-rl"), !e.style?.["--cue-width"]) {
			let i = n;
			r === "line-left" ? i = 100 - n : r === "center" && n <= 50 ? i = n * 2 : r === "center" && n > 50 && (i = (100 - n) * 2);
			let a = e.size < i ? e.size : i;
			e.vertical === "" ? F(t, "cue-width", a + "%") : F(t, "cue-height", a + "%");
		}
		let i = document.createElement("div");
		return L(i, "cue"), e.id && I(i, "id", e.id), i.innerHTML = B(e), t.append(i), t;
	}
	F(e) {
		return e.region && e.size === 100 && e.vertical === "" && e.line === "auto";
	}
};
//#endregion
export { M as _, w as a, p as c, s as d, a as f, V as g, B as h, l as i, z as l, E as m, t as n, f as o, o as p, e as r, T as s, De as t, c as u, H as v };
