import { C as e, L as t } from "./vidstack-D9mvYVIz-DesuYgKV.js";
//#region node_modules/vidstack/prod/chunks/vidstack-CdfyZegh.js
var n = class {
	#e;
	get length() {
		return this.#e.length;
	}
	constructor(n, r) {
		e(n) ? this.#e = n : !t(n) && !t(r) ? this.#e = [[n, r]] : this.#e = [];
	}
	start(e) {
		return this.#e[e][0] ?? Infinity;
	}
	end(e) {
		return this.#e[e][1] ?? Infinity;
	}
};
function r(e) {
	if (!e.length) return null;
	let t = e.start(0);
	for (let n = 1; n < e.length; n++) {
		let r = e.start(n);
		r < t && (t = r);
	}
	return t;
}
function i(e) {
	if (!e.length) return null;
	let t = e.end(0);
	for (let n = 1; n < e.length; n++) {
		let r = e.end(n);
		r > t && (t = r);
	}
	return t;
}
function a(e) {
	if (e.length <= 1) return e;
	e.sort((e, t) => e[0] - t[0]);
	let t = [], n = e[0];
	for (let r = 1; r < e.length; r++) {
		let i = e[r];
		n[1] >= i[0] - 1 ? n = [n[0], Math.max(n[1], i[1])] : (t.push(n), n = i);
	}
	return t.push(n), t;
}
function o(e, t, n) {
	let r = t[0], i = t[1];
	return n < r ? [n, -1] : n === r ? t : r === -1 ? (t[0] = n, t) : (n > r && (t[1] = n, i === -1 && e.push(t)), a(e), t);
}
//#endregion
export { o as i, i as n, r, n as t };
