src/services/conflicts.mjs
BeforeProposed
+11−2
11export function conflicts(document) {
2 // Implement a complete same-track overlap report.
3 return [];
2 const activeByTrack = new Map();
3 const pairs = [];
4 for (const item of document.snapshot().cues) {
5 const active = (activeByTrack.get(item.track) ?? []).filter(other => other.end > item.start);
6 for (const other of active) {
7 pairs.push({ids: [other.id, item.id].sort(), start: item.start, end: Math.min(other.end, item.end)});
8 }
9 active.push(item);
10 activeByTrack.set(item.track, active);
11 }
12 return pairs.sort((a, b) => a.start - b.start || a.ids.join('/').localeCompare(b.ids.join('/'), 'en'));
413}