()
| 865 | } |
| 866 | const rootTimeline = timelines[rootCompositionId] ?? null; |
| 867 | const collectRootChildCandidates = (): Array<{ |
| 868 | compositionId: string; |
| 869 | timeline: RuntimeTimelineLike; |
| 870 | durationSeconds: number; |
| 871 | }> => { |
| 872 | if (!rootCompositionNode) return []; |
| 873 | const seen = new Set<string>(); |
| 874 | const childNodes = Array.from(rootCompositionNode.querySelectorAll("[data-composition-id]")); |
| 875 | const candidates: Array<{ |
| 876 | compositionId: string; |
| 877 | timeline: RuntimeTimelineLike; |
| 878 | durationSeconds: number; |
| 879 | }> = []; |
| 880 | for (const childNode of childNodes) { |
| 881 | const childId = childNode.getAttribute("data-composition-id"); |
| 882 | if (!childId || childId === rootCompositionId) continue; |
| 883 | if (seen.has(childId)) continue; |
| 884 | seen.add(childId); |
| 885 | const candidateTimeline = timelines[childId] ?? null; |
| 886 | if (!candidateTimeline) continue; |
| 887 | if ( |
| 888 | typeof candidateTimeline.play !== "function" || |
| 889 | typeof candidateTimeline.pause !== "function" |
| 890 | ) { |
| 891 | continue; |
| 892 | } |
| 893 | const candidateDuration = getTimelineDurationSeconds(candidateTimeline); |
| 894 | candidates.push({ |
| 895 | compositionId: childId, |
| 896 | timeline: candidateTimeline, |
| 897 | durationSeconds: candidateDuration ?? 0, |
| 898 | }); |
| 899 | } |
| 900 | return candidates; |
| 901 | }; |
| 902 | const rootChildCandidates = collectRootChildCandidates(); |
| 903 | const ensureChildCandidatesActive = ( |
| 904 | candidates: Array<{ |
no test coverage detected