@mux/ai 0.55.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-B-rLy1do.js';
2
- export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-DxSHvTk9.js';
1
+ export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-DiuqBw6I.js';
2
+ export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-Brw74qlV.js';
3
3
  import '@mux/ts';
@@ -1903,14 +1903,13 @@ function extractTextFromVTT(vttContent) {
1903
1903
  textLines.join(" ").replace(/\s+/g, " ").trim()
1904
1904
  );
1905
1905
  }
1906
+ var VTT_TIMESTAMP_RE = /^(?:(\d+):)?(\d{2}):(\d{2})(?:\.(\d{3}))?$/;
1906
1907
  function vttTimestampToSeconds(timestamp) {
1907
- const parts = timestamp.split(":");
1908
- if (parts.length !== 3)
1909
- return 0;
1910
- const hours = Number.parseInt(parts[0], 10) || 0;
1911
- const minutes = Number.parseInt(parts[1], 10) || 0;
1912
- const seconds = Number.parseFloat(parts[2]) || 0;
1913
- return hours * 3600 + minutes * 60 + seconds;
1908
+ const match = VTT_TIMESTAMP_RE.exec(timestamp);
1909
+ if (!match)
1910
+ return void 0;
1911
+ const [, hours = "0", minutes, seconds, millis = "0"] = match;
1912
+ return Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds) + Number(millis) / 1e3;
1914
1913
  }
1915
1914
  function secondsToTimestamp(seconds) {
1916
1915
  const rounded = Math.max(0, Math.floor(seconds));
@@ -1933,6 +1932,8 @@ function extractTimestampedTranscript(vttContent) {
1933
1932
  if (line.includes("-->")) {
1934
1933
  const startTime = line.split(" --> ")[0].trim();
1935
1934
  const timeInSeconds = vttTimestampToSeconds(startTime);
1935
+ if (timeInSeconds === void 0)
1936
+ continue;
1936
1937
  let j = i + 1;
1937
1938
  while (j < lines.length && !lines[j].trim()) {
1938
1939
  j++;
@@ -1961,13 +1962,17 @@ function parseVTTCues(vttContent, options = {}) {
1961
1962
  if (isTimingLine(line)) {
1962
1963
  const [startStr, endStr] = line.split(" --> ").map((s) => s.trim());
1963
1964
  const startTime = vttTimestampToSeconds(startStr);
1964
- const endTime = vttTimestampToSeconds(endStr.split(" ")[0]);
1965
+ const endTime = vttTimestampToSeconds(endStr?.split(/\s+/)[0] ?? "");
1965
1966
  const currentCueIdentifierLine = lines[i - 1]?.trim() ?? "";
1966
1967
  const currentCueIdentifier = isLikelyCueIdentifier({
1967
1968
  line: currentCueIdentifierLine,
1968
1969
  nextLine: line,
1969
1970
  previousCueIdentifier
1970
1971
  }) ? parseNumericCueIdentifier(currentCueIdentifierLine) : null;
1972
+ if (startTime === void 0 || endTime === void 0) {
1973
+ previousCueIdentifier = currentCueIdentifier;
1974
+ continue;
1975
+ }
1971
1976
  const rawTextLines = [];
1972
1977
  let j = i + 1;
1973
1978
  while (j < lines.length && lines[j].trim() && !isTimingLine(lines[j].trim())) {