@mieweb/ui 0.7.1-dev.2 → 0.7.1-dev.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useTranscriptEdits.ts"],"names":["useRef","useState","useCallback","useEffect","isSilenceType","useMemo"],"mappings":";;;;;AAyBO,IAAM,oBAAA,GAAuB;AAAA,EAClC,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAGO,IAAM,sBAAA,GAAyB;AAG/B,IAAM,qBAAA,GAAwB;AAGrC,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,IAAA,EAAM,CAAA,EAAK,KAAK,CAAG,CAAA;AAoBhE,SAAS,sBACd,WAAA,EACmB;AACnB,EAAA,MAAM,cAAc,WAAA,CAAY,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,EAAE,OAAO,CAAA;AACxD,EAAA,IAAI,WAAA,CAAY,MAAA,KAAW,CAAA,EAAG,OAAO,EAAC;AAEtC,EAAA,MAAM,WAA8B,EAAC;AACrC,EAAA,IAAI,cAAA,GAAyC,IAAA;AAC7C,EAAA,IAAI,iBAAA,GAAoB,EAAA;AACxB,EAAA,IAAI,eAAA,GAAkB,KAAA;AAEtB,EAAA,KAAA,IAAS,CAAA,GAA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AChB;AAAA,MACF;AACA,MAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,UAAA,EAAW;AAAA,IACxC,CAAC,CAAA;AAED,IAAA,OAAO;AAAA,MACL,WAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA;AAAA,MACA,kBAAA,EAAoB;AAAA,KACtB;AAAA,EACF,CAAA,EAAG,CAAC,WAAW,CAAC,CAAA;AAEhB,EAAA,OAAO;AAAA,IACL,WAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,iBAAA;AAAA,IACA,WAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,kBAAA;AAAA,IACA,aAAA;AAAA,IACA,oBAAA;AAAA,IACA,iBAAA,EAAmB,EAAE,YAAA,EAAc,WAAA,EAAY;AAAA,IAC/C,YAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA,EAAiB,uBAAA;AAAA,IACjB,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,eAAA,EAAiB,oBAAA;AAAA,IACjB,qBAAA;AAAA,IACA,gBAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-O5UJRGRV.cjs","sourcesContent":["/**\n * useTranscriptEdits — headless transcript-editing state hook.\n *\n * Extracted from pulseclip's TranscriptViewer for @mieweb/ui. Holds the\n * edited word timeline (deletions, insertions, text edits, silence\n * splitting), a single-level undo stack, an internal clipboard, speed\n * markers, and derived playback/statistics data.\n *\n * Controlled + persistence-agnostic: no DOM, no fetches. Selection lives in\n * the UI layer — mutations take explicit indices. State flows out via\n * `onChange` and back in via `initialEditedWords` / `initialUndoStack`.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type {\n Transcript,\n TranscriptWord,\n EditableWord,\n PlaybackSegment,\n PlaybackSpeed,\n SpeedMarker,\n} from '../components/TranscriptView/transcript';\nimport { isSilenceType } from '../components/TranscriptView/transcript';\n\n/** Default filler words offered for removal */\nexport const DEFAULT_FILLER_WORDS = [\n 'um',\n 'uh',\n 'umm',\n 'uhh',\n 'uh-huh',\n 'mm-hmm',\n 'hmm',\n 'hm',\n 'er',\n 'err',\n 'ah',\n 'ahh',\n 'eh',\n 'oh',\n 'ooh',\n 'like',\n 'you know',\n 'i mean',\n 'so',\n 'well',\n 'actually',\n 'basically',\n 'literally',\n 'right',\n 'okay',\n 'ok',\n];\n\n/** Default minimum silence duration in milliseconds to detect and insert */\nexport const DEFAULT_MIN_SILENCE_MS = 400;\n\n/** Default threshold for \"newline\" silences - longer pauses that indicate paragraph breaks */\nexport const DEFAULT_NL_SILENCE_MS = 1500;\n\n/** Silence thresholds (seconds) reported by the filler analysis */\nconst SILENCE_ANALYSIS_THRESHOLDS = [0.3, 0.4, 0.5, 0.75, 1.0, 1.5, 2.0];\n\n/** Clipboard data for cut/copy/paste operations */\nexport interface TranscriptClipboard {\n words: EditableWord[];\n operation: 'cut' | 'copy';\n}\n\n/** Count and total duration of silences above a given threshold (seconds) */\nexport interface SilenceThresholdCount {\n threshold: number;\n count: number;\n durationMs: number;\n}\n\n/**\n * Builds playback segments from the edited word list.\n * Consecutive words in original order are merged into single segments.\n * Inserted (pasted) words each get their own segment since they may be duplicates.\n */\nexport function buildPlaybackSegments(\n editedWords: EditableWord[]\n): PlaybackSegment[] {\n const activeWords = editedWords.filter((w) => !w.deleted);\n if (activeWords.length === 0) return [];\n\n const segments: PlaybackSegment[] = [];\n let currentSegment: PlaybackSegment | null = null;\n let lastOriginalIndex = -2; // Use -2 so first word always starts new segment\n let lastWasInserted = false;\n\n for (let i = 0; i < editedWords.length; i++) {\n const ew = editedWords[i];\n if (ew.deleted) continue;\n\n // Check if this word is consecutive to the previous in the original\n // Inserted words always start a new segment (they might be duplicates)\n const isConsecutive =\n !ew.inserted &&\n !lastWasInserted &&\n ew.originalIndex === lastOriginalIndex + 1;\n\n if (currentSegment && isConsecutive) {\n // Extend current segment\n currentSegment.endMs = ew.word.endMs;\n currentSegment.editedIndices.push(i);\n } else {\n // Start new segment\n if (currentSegment) {\n segments.push(currentSegment);\n }\n currentSegment = {\n startMs: ew.word.startMs,\n endMs: ew.word.endMs,\n editedIndices: [i],\n };\n }\n\n lastOriginalIndex = ew.originalIndex;\n lastWasInserted = ew.inserted ?? false;\n }\n\n if (currentSegment) {\n segments.push(currentSegment);\n }\n\n return segments;\n}\n\n/**\n * Get the effective playback speed at a given word index.\n * Finds the most recent speed marker at or before the word index,\n * or returns the default speed if no marker applies.\n */\nexport function getSpeedAtIndex(\n wordIndex: number,\n speedMarkers: SpeedMarker[],\n defaultSpeed: PlaybackSpeed\n): PlaybackSpeed {\n // Single O(n) pass that takes the marker with the greatest wordIndex at or\n // before the target. This avoids the per-call copy+sort (stats calls this\n // once per word) without assuming callers pass sorted markers — it is a\n // public helper, so arbitrary order must still yield the right answer.\n let effectiveSpeed = defaultSpeed;\n let nearest = -1;\n for (const marker of speedMarkers) {\n if (marker.wordIndex <= wordIndex && marker.wordIndex > nearest) {\n nearest = marker.wordIndex;\n effectiveSpeed = marker.speed;\n }\n }\n return effectiveSpeed;\n}\n\n/**\n * Detect silences between words and return a new array with silence pseudo-words inserted.\n * Silences are detected as gaps between the endMs of one word and startMs of the next.\n * Silences >= nlSilenceMs are marked as 'silence-newline' for visual line breaks.\n */\nexport function insertSilences(\n words: TranscriptWord[],\n minSilenceMs: number = DEFAULT_MIN_SILENCE_MS,\n nlSilenceMs: number = DEFAULT_NL_SILENCE_MS\n): TranscriptWord[] {\n if (words.length === 0) return [];\n\n const result: TranscriptWord[] = [];\n\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n\n // Check for silence before the first word (from 0ms)\n if (i === 0 && word.startMs > minSilenceMs) {\n const isNewline = word.startMs >= nlSilenceMs;\n result.push({\n text: `[${(word.startMs / 1000).toFixed(1)}s]`,\n startMs: 0,\n endMs: word.startMs,\n wordType: isNewline ? 'silence-newline' : 'silence',\n });\n }\n\n // Add the word (with default wordType)\n result.push({ ...word, wordType: word.wordType ?? 'word' });\n\n // Check for silence after this word (gap before next word)\n if (i < words.length - 1) {\n const nextWord = words[i + 1];\n const gapMs = nextWord.startMs - word.endMs;\n\n if (gapMs >= minSilenceMs) {\n const isNewline = gapMs >= nlSilenceMs;\n result.push({\n text: `[${(gapMs / 1000).toFixed(1)}s]`,\n startMs: word.endMs,\n endMs: nextWord.startMs,\n wordType: isNewline ? 'silence-newline' : 'silence',\n });\n }\n }\n }\n\n return result;\n}\n\n/** Initialize editable words from transcript, inserting detected silences */\nexport function initEditableWords(\n transcript: Transcript,\n minSilenceMs: number = DEFAULT_MIN_SILENCE_MS,\n nlSilenceMs: number = DEFAULT_NL_SILENCE_MS\n): EditableWord[] {\n // First insert silences between the original words\n const wordsWithSilences = insertSilences(\n transcript.words,\n minSilenceMs,\n nlSilenceMs\n );\n\n return wordsWithSilences.map((word, index) => ({\n originalIndex: index,\n word,\n deleted: false,\n }));\n}\n\n/** Strip trailing punctuation and lowercase for filler-word matching */\nfunction normalizeWordText(text: string): string {\n return text.toLowerCase().replace(/[.,!?;:]/g, '');\n}\n\nexport interface UseTranscriptEditsOptions {\n /** The source transcript (canonical, immutable) */\n transcript: Transcript;\n /** Initial edited words (from saved edits) */\n initialEditedWords?: EditableWord[];\n /** Initial undo stack (from saved edits) */\n initialUndoStack?: EditableWord[][];\n /** Fired after every mutation (for persistence) */\n onChange?: (editedWords: EditableWord[], undoStack: EditableWord[][]) => void;\n /** Minimum silence duration (ms) to detect and insert. Default 400 */\n minSilenceMs?: number;\n /** Threshold (ms) for \"newline\" silences (paragraph breaks). Default 1500 */\n nlSilenceMs?: number;\n /** Initial speed markers (from saved edits) */\n initialSpeedMarkers?: SpeedMarker[];\n /** Initial default playback speed (from saved edits). Default 1 */\n initialDefaultSpeed?: PlaybackSpeed;\n}\n\nexport interface TranscriptEditStats {\n /** Non-deleted spoken words (silences excluded) */\n activeWordCount: number;\n /** Non-deleted silence entries */\n activeSilenceCount: number;\n /** Deleted spoken words */\n deletedWordCount: number;\n /** Deleted silence entries */\n deletedSilenceCount: number;\n /** Total duration of non-deleted entries, adjusted for speed markers */\n editedDurationMs: number;\n}\n\nexport interface FillerAnalysis {\n /** Occurrence count per normalized word (fillers and every active word) */\n matchCounts: Map<string, number>;\n /** Total duration (ms) per normalized word */\n durations: Map<string, number>;\n /** Count + total duration of active silences above each analysis threshold */\n silenceCounts: SilenceThresholdCount[];\n /** The built-in filler word list */\n defaultFillerWords: string[];\n}\n\nexport interface UseTranscriptEditsResult {\n // -- State --\n /** The edited timeline (words + silence pseudo-words) */\n editedWords: EditableWord[];\n /** Undo snapshots, oldest first */\n undoStack: EditableWord[][];\n /** Internal clipboard from the last cut/copy, or null */\n clipboard: TranscriptClipboard | null;\n /** Whether any edit has been made (deletions, insertions, text edits, speed markers) */\n hasEdits: boolean;\n\n // -- Undo --\n /** Push the current editedWords onto the undo stack (call before external batch mutations) */\n pushUndo: () => void;\n /** Restore the most recent undo snapshot */\n undo: () => void;\n\n // -- Word mutations (selection-agnostic: pass explicit indices) --\n /** Toggle the deleted flag on a single word */\n toggleWordDeleted: (index: number) => void;\n /**\n * Toggle the deleted state of a contiguous range. The first index acts as\n * the anchor: all words are set to the opposite of the anchor's state\n * (delete all if anchor active, restore all if anchor deleted).\n */\n deleteRange: (indices: number[]) => void;\n /** Cut words at the given indices into the clipboard (marks them deleted) */\n cut: (indices: number[]) => void;\n /** Copy non-deleted words at the given indices into the clipboard */\n copy: (indices: number[]) => void;\n /**\n * Paste the clipboard at a word index. `before` (default true) inserts\n * before the word at `atIndex`; false inserts after it. Returns the index\n * where the first pasted word landed, or null if the clipboard was empty.\n */\n paste: (atIndex: number, before?: boolean) => number | null;\n /** Replace a word's text (no-op if unchanged) */\n setWordText: (index: number, text: string) => void;\n /** Split a silence at the given index into segments with the given durations (seconds) */\n splitSilence: (index: number, durationsSec: number[]) => void;\n /** Toggle the word at the index deleted (editor \"delete\" action) */\n deleteWord: (index: number) => void;\n /** Replace the entire edit state from an external source (e.g. an editable script view); undo-safe */\n replaceEditedWords: (next: EditableWord[]) => void;\n /** Mark matching filler words (and silences above the given seconds threshold) deleted */\n removeFillers: (\n fillerWords: string[],\n removeSilenceAboveSec: number | null\n ) => void;\n\n // -- Silence thresholds --\n /** Rebuild silence detection with new thresholds, preserving word deletions.\n * Not undoable — clears the undo stack (prior snapshots reference the old silence layout). */\n setSilenceThresholds: (minMs: number, nlMs: number) => void;\n /** Current silence detection thresholds (ms) */\n silenceThresholds: { minSilenceMs: number; nlSilenceMs: number };\n\n // -- Playback speed --\n /** Speed markers, sorted by word index */\n speedMarkers: SpeedMarker[];\n /** Default playback speed when no marker applies */\n defaultSpeed: PlaybackSpeed;\n /** Set the default playback speed (undoable) */\n setDefaultSpeed: (speed: PlaybackSpeed) => void;\n /** Add/update/remove a speed marker (re-selecting the same speed removes it; undoable) */\n toggleSpeedMarker: (index: number, speed: PlaybackSpeed) => void;\n /** Remove the speed marker at a word index, if any (undoable) */\n removeSpeedMarker: (index: number) => void;\n /**\n * Apply one speed across an index range (typically the selection): marks the\n * start, restores the prior effective speed after the end. One undo step.\n */\n setSpeedForRange: (\n startIndex: number,\n endIndex: number,\n speed: PlaybackSpeed\n ) => void;\n /** Effective playback speed at a word index */\n getSpeedAtIndex: (index: number) => PlaybackSpeed;\n /** The speed marker at a word index, if any */\n getSpeedMarkerAtIndex: (index: number) => SpeedMarker | undefined;\n\n // -- Derived --\n /** Contiguous playback segments built from the edited timeline */\n playbackSegments: PlaybackSegment[];\n /** Word/silence counts and speed-adjusted edited duration */\n stats: TranscriptEditStats;\n /** Filler word and silence analysis for removal UIs */\n fillerAnalysis: FillerAnalysis;\n}\n\n/**\n * Headless transcript-editing hook. See module docs for scope.\n *\n * Undo semantics: each mutation snapshots the full `editedWords` array onto\n * a single-level stack before applying; `undo` pops one snapshot. Speed\n * markers and silence-threshold changes are NOT part of the undo stack\n * (matching the source component).\n */\nexport function useTranscriptEdits(\n options: UseTranscriptEditsOptions\n): UseTranscriptEditsResult {\n const {\n transcript,\n initialEditedWords,\n initialUndoStack,\n onChange,\n minSilenceMs: initialMinSilenceMs = DEFAULT_MIN_SILENCE_MS,\n nlSilenceMs: initialNlSilenceMs = DEFAULT_NL_SILENCE_MS,\n initialSpeedMarkers,\n initialDefaultSpeed,\n } = options;\n\n // Track if we've initialized from saved state (skip first onChange notification)\n const initializedFromSaved = useRef(false);\n\n const [editedWords, setEditedWords] = useState<EditableWord[]>(\n () =>\n initialEditedWords ||\n initEditableWords(transcript, initialMinSilenceMs, initialNlSilenceMs)\n );\n const [undoStack, setUndoStack] = useState<EditableWord[][]>(\n initialUndoStack || []\n );\n const [clipboard, setClipboard] = useState<TranscriptClipboard | null>(null);\n const [hasEdits, setHasEdits] = useState(() => {\n // Rehydrated speed state counts as an edit, matching the live setters\n // (toggleSpeedMarker sets hasEdits) and this flag's documented contract\n if (\n (initialSpeedMarkers && initialSpeedMarkers.length > 0) ||\n (initialDefaultSpeed !== undefined && initialDefaultSpeed !== 1)\n ) {\n return true;\n }\n // Compare saved state against the derived baseline: deletions, insertions,\n // length changes, AND text edits (text-only edits previously initialized\n // hasEdits=false, which also suppressed onChange persistence).\n if (initialEditedWords) {\n const baseline = initEditableWords(\n transcript,\n initialMinSilenceMs,\n initialNlSilenceMs\n );\n return (\n initialEditedWords.length !== baseline.length ||\n initialEditedWords.some(\n (ew, i) =>\n ew.deleted ||\n ew.inserted ||\n ew.originalIndex !== i ||\n ew.word.text !== baseline[i].word.text\n )\n );\n }\n return false;\n });\n const [minSilenceMs, setMinSilenceMs] = useState(initialMinSilenceMs);\n const [nlSilenceMs, setNlSilenceMs] = useState(initialNlSilenceMs);\n const [defaultSpeed, setDefaultSpeed] = useState<PlaybackSpeed>(\n initialDefaultSpeed ?? 1\n );\n const [speedMarkers, setSpeedMarkers] = useState<SpeedMarker[]>(\n initialSpeedMarkers ?? []\n );\n\n // Speed snapshots aligned with undoStack so undo restores speed too. Not\n // persisted: entries synthesized for a rehydrated undoStack carry the\n // initial speed, so undoing past them simply leaves speed at its saved\n // state instead of guessing history we never had.\n const [speedUndoStack, setSpeedUndoStack] = useState<\n { speedMarkers: SpeedMarker[]; defaultSpeed: PlaybackSpeed }[]\n >(() =>\n (initialUndoStack ?? []).map(() => ({\n speedMarkers: initialSpeedMarkers ?? [],\n defaultSpeed: initialDefaultSpeed ?? 1,\n }))\n );\n\n // Helper to save current state to undo stack before making changes\n const pushUndo = useCallback(() => {\n setUndoStack((prev) => [...prev, editedWords]);\n setSpeedUndoStack((prev) => [...prev, { speedMarkers, defaultSpeed }]);\n }, [editedWords, speedMarkers, defaultSpeed]);\n\n // Track previous transcript to detect changes\n const prevTranscriptRef = useRef(transcript);\n\n // Reset edited words when transcript changes (but not on initial load with saved edits)\n useEffect(() => {\n if (prevTranscriptRef.current === transcript) {\n return;\n }\n prevTranscriptRef.current = transcript;\n\n // Transcript changed - reset to fresh state (use current silence thresholds)\n setEditedWords(initEditableWords(transcript, minSilenceMs, nlSilenceMs));\n setUndoStack([]);\n setHasEdits(false);\n setClipboard(null);\n // Speed markers index into the old transcript's word list; keeping them\n // would apply stale rates to arbitrary words of the new transcript\n setSpeedMarkers([]);\n setDefaultSpeed(1);\n setSpeedUndoStack([]);\n initializedFromSaved.current = false;\n }, [transcript, minSilenceMs, nlSilenceMs]);\n\n // Notify consumer when editor state changes (for persistence)\n useEffect(() => {\n // Skip the initial render if we initialized from saved state\n if (!initializedFromSaved.current && initialEditedWords) {\n initializedFromSaved.current = true;\n return;\n }\n initializedFromSaved.current = true;\n\n // Only notify if there are edits to persist\n if (hasEdits || undoStack.length > 0) {\n onChange?.(editedWords, undoStack);\n }\n }, [editedWords, undoStack, hasEdits, onChange, initialEditedWords]);\n\n // Undo last edit\n const undo = useCallback(() => {\n if (undoStack.length === 0) return;\n const previousState = undoStack[undoStack.length - 1];\n setUndoStack((prev) => prev.slice(0, -1));\n setEditedWords(previousState);\n // Speed snapshots ride along with word snapshots\n const speedSnapshot = speedUndoStack[speedUndoStack.length - 1];\n if (speedSnapshot) {\n setSpeedUndoStack((prev) => prev.slice(0, -1));\n setSpeedMarkers(speedSnapshot.speedMarkers);\n setDefaultSpeed(speedSnapshot.defaultSpeed);\n }\n // Compare against the silence-inserted baseline (what the editor actually\n // starts from), not raw transcript.words — with any detected silence the\n // lengths never matched and hasEdits stayed true after undoing everything.\n const baseline = initEditableWords(transcript, minSilenceMs, nlSilenceMs);\n const isOriginal =\n previousState.length === baseline.length &&\n previousState.every(\n (ew, i) =>\n ew.originalIndex === i &&\n !ew.deleted &&\n !ew.inserted &&\n ew.word.text === baseline[i].word.text\n );\n const speedIsOriginal =\n !speedSnapshot ||\n (speedSnapshot.speedMarkers.length === 0 &&\n speedSnapshot.defaultSpeed === 1);\n setHasEdits(!isOriginal || !speedIsOriginal);\n }, [undoStack, speedUndoStack, transcript, minSilenceMs, nlSilenceMs]);\n\n // Toggle deleted state on a single word\n const toggleWordDeleted = useCallback(\n (index: number) => {\n const ew = editedWords[index];\n if (!ew) return;\n\n pushUndo();\n const newEditedWords = [...editedWords];\n newEditedWords[index] = { ...ew, deleted: !ew.deleted };\n setEditedWords(newEditedWords);\n setHasEdits(true);\n },\n [editedWords, pushUndo]\n );\n\n // Toggle deleted state for a range; the first index acts as the anchor\n const deleteRange = useCallback(\n (indices: number[]) => {\n if (indices.length === 0) return;\n const anchor = editedWords[indices[0]];\n if (!anchor) return;\n\n pushUndo();\n // The anchor word's state determines the action for all words:\n // if anchor is not deleted, delete all; if anchor is deleted, restore all\n const targetDeletedState = !anchor.deleted;\n setEditedWords((prev) => {\n const updated = [...prev];\n for (const i of indices) {\n if (updated[i]) {\n updated[i] = { ...updated[i], deleted: targetDeletedState };\n }\n }\n return updated;\n });\n setHasEdits(true);\n },\n [editedWords, pushUndo]\n );\n\n // Cut words at the given indices into the clipboard\n const cut = useCallback(\n (indices: number[]) => {\n if (indices.length === 0) return;\n const cutWords = indices\n .map((i) => editedWords[i])\n .filter((ew): ew is EditableWord => ew !== undefined);\n if (cutWords.length === 0) return;\n\n pushUndo();\n setClipboard({ words: cutWords, operation: 'cut' });\n setEditedWords((prev) => {\n const updated = [...prev];\n for (const i of indices) {\n if (updated[i]) {\n updated[i] = { ...updated[i], deleted: true };\n }\n }\n return updated;\n });\n setHasEdits(true);\n },\n [editedWords, pushUndo]\n );\n\n // Copy non-deleted words at the given indices into the clipboard (no mutation)\n const copy = useCallback(\n (indices: number[]) => {\n const selectedWords = indices\n .map((i) => editedWords[i])\n .filter((ew): ew is EditableWord => ew !== undefined && !ew.deleted);\n if (selectedWords.length === 0) return;\n setClipboard({ words: selectedWords, operation: 'copy' });\n },\n [editedWords]\n );\n\n // Paste from clipboard at a word index\n const paste = useCallback(\n (atIndex: number, before: boolean = true): number | null => {\n if (!clipboard) return null;\n pushUndo();\n const insertIndex = before ? atIndex : atIndex + 1;\n setEditedWords((prev) => {\n const updated = [...prev];\n const wordsToInsert = clipboard.words.map((w) => ({\n ...w,\n deleted: false,\n inserted: true,\n }));\n updated.splice(insertIndex, 0, ...wordsToInsert);\n return updated;\n });\n setHasEdits(true);\n return insertIndex;\n },\n [clipboard, pushUndo]\n );\n\n // Replace a word's text\n const setWordText = useCallback(\n (index: number, text: string) => {\n const ew = editedWords[index];\n if (!ew || text === ew.word.text) return;\n\n pushUndo();\n const newEditedWords = [...editedWords];\n newEditedWords[index] = {\n ...ew,\n word: { ...ew.word, text },\n };\n setEditedWords(newEditedWords);\n setHasEdits(true);\n },\n [editedWords, pushUndo]\n );\n\n // Split a silence into multiple segments\n const splitSilence = useCallback(\n (index: number, durationsSec: number[]) => {\n const ew = editedWords[index];\n if (!ew || !isSilenceType(ew.word.wordType)) return;\n\n pushUndo();\n\n // Create new silence segments from the durations\n const silenceStart = ew.word.startMs;\n const newSilences: EditableWord[] = [];\n let currentMs = silenceStart;\n\n for (let i = 0; i < durationsSec.length; i++) {\n const durationMs = Math.round(durationsSec[i] * 1000);\n const endMs = currentMs + durationMs;\n\n newSilences.push({\n originalIndex: -1, // Negative indicates a split/inserted silence\n word: {\n text: `[${durationsSec[i].toFixed(1)}s]`,\n startMs: currentMs,\n endMs: endMs,\n wordType: 'silence',\n },\n deleted: false,\n inserted: true,\n });\n\n currentMs = endMs;\n }\n\n // Replace the original silence with the new segments\n const newEditedWords = [...editedWords];\n newEditedWords.splice(index, 1, ...newSilences);\n setEditedWords(newEditedWords);\n setHasEdits(true);\n },\n [editedWords, pushUndo]\n );\n\n // Editor \"delete\" action: toggles the word's deleted state\n const deleteWord = useCallback(\n (index: number) => {\n toggleWordDeleted(index);\n },\n [toggleWordDeleted]\n );\n\n // Replace the entire edit state from an external source (e.g. the editable\n // script/YAML panel). Undo-safe: the previous state is pushed first.\n const replaceEditedWords = useCallback(\n (next: EditableWord[]) => {\n pushUndo();\n setEditedWords(next);\n setHasEdits(true);\n },\n [pushUndo]\n );\n\n // Mark filler words (and optionally silences above threshold) deleted\n const removeFillers = useCallback(\n (fillerWords: string[], removeSilenceAboveSec: number | null) => {\n const fillerSet = new Set(fillerWords.map((f) => f.toLowerCase()));\n const silenceThresholdMs =\n removeSilenceAboveSec !== null ? removeSilenceAboveSec * 1000 : null;\n\n const newEditedWords = editedWords.map((ew) => {\n if (ew.deleted) return ew;\n\n // Check if it's a silence that should be removed\n if (isSilenceType(ew.word.wordType) && silenceThresholdMs !== null) {\n const durationMs = ew.word.endMs - ew.word.startMs;\n if (durationMs > silenceThresholdMs) {\n return { ...ew, deleted: true };\n }\n return ew;\n }\n\n // Check if it's a filler word that should be removed\n if (!isSilenceType(ew.word.wordType)) {\n const wordText = normalizeWordText(ew.word.text);\n if (fillerSet.has(wordText)) {\n return { ...ew, deleted: true };\n }\n }\n\n return ew;\n });\n\n const deletedCount = newEditedWords.filter(\n (ew, i) => ew.deleted && !editedWords[i].deleted\n ).length;\n\n if (deletedCount > 0) {\n pushUndo();\n setEditedWords(newEditedWords);\n setHasEdits(true);\n }\n },\n [editedWords, pushUndo]\n );\n\n // Apply new silence thresholds, rebuilding silences while preserving word deletions\n const setSilenceThresholds = useCallback(\n (newMinSilenceMs: number, newNlSilenceMs: number) => {\n setMinSilenceMs(newMinSilenceMs);\n setNlSilenceMs(newNlSilenceMs);\n // Rebuild the editable words with new silence detection.\n // Preserve deleted status for actual words (not silences), keyed by the\n // word's ORDINAL among non-silence words — the same key the restore loop\n // below uses. (Keying by originalIndex — a position in the old\n // silence-inserted array — mismatched the restore counter and applied\n // deletions to the wrong words after a threshold change.)\n // Pasted words keep their source originalIndex but are dropped by the\n // rebuild, so they must not occupy a slot in this keyspace either.\n const wordDeletedStatus = new Map<number, boolean>();\n let saveIdx = 0;\n editedWords.forEach((ew) => {\n if (\n !isSilenceType(ew.word.wordType) &&\n ew.originalIndex >= 0 &&\n !ew.inserted\n ) {\n wordDeletedStatus.set(saveIdx, ew.deleted);\n saveIdx++;\n }\n });\n\n // Re-initialize with new thresholds\n const newEditedWords = initEditableWords(\n transcript,\n newMinSilenceMs,\n newNlSilenceMs\n );\n\n // Restore deleted status for words (same ordinal keyspace as the save)\n let wordIdx = 0;\n const restoredWords = newEditedWords.map((ew) => {\n if (!isSilenceType(ew.word.wordType)) {\n const wasDeleted = wordDeletedStatus.get(wordIdx) ?? false;\n wordIdx++;\n return { ...ew, deleted: wasDeleted };\n }\n return ew;\n });\n\n setEditedWords(restoredWords);\n\n // Speed markers index into the silence-inserted array, so the rebuild\n // shifts them too. Re-anchor each marker to the first rebuild-surviving\n // word at or after it — the same ordinal keyspace as the deletion\n // restore above. Markers with no surviving word left are dropped;\n // markers that collapse onto the same word keep the later speed (it\n // governed the words from that point on).\n if (speedMarkers.length > 0) {\n const survivorPrefix: number[] = [];\n let survivors = 0;\n editedWords.forEach((ew) => {\n survivorPrefix.push(survivors);\n if (\n !isSilenceType(ew.word.wordType) &&\n ew.originalIndex >= 0 &&\n !ew.inserted\n ) {\n survivors++;\n }\n });\n survivorPrefix.push(survivors);\n const newIndexByOrdinal: number[] = [];\n restoredWords.forEach((ew, i) => {\n if (!isSilenceType(ew.word.wordType)) newIndexByOrdinal.push(i);\n });\n const remapped: SpeedMarker[] = [];\n speedMarkers.forEach((m) => {\n const ordinal =\n survivorPrefix[Math.min(m.wordIndex, editedWords.length)];\n const newIndex = newIndexByOrdinal[ordinal];\n if (newIndex === undefined) return;\n const last = remapped[remapped.length - 1];\n if (last && last.wordIndex === newIndex) {\n remapped[remapped.length - 1] = {\n wordIndex: newIndex,\n speed: m.speed,\n };\n } else {\n remapped.push({ wordIndex: newIndex, speed: m.speed });\n }\n });\n setSpeedMarkers(remapped);\n }\n\n // Undo snapshots were captured against the previous silence layout;\n // restoring one after a rebuild would resurrect silence chips that no\n // longer match the current thresholds. Threshold changes are not\n // undoable, so drop the stale history rather than restore it — the\n // speed stack rides along or the two stacks drift out of alignment.\n setUndoStack([]);\n setSpeedUndoStack([]);\n },\n [editedWords, transcript, speedMarkers]\n );\n\n // Get the speed marker at a specific word index (if any)\n const getSpeedMarkerAtIndex = useCallback(\n (wordIndex: number): SpeedMarker | undefined => {\n return speedMarkers.find((m) => m.wordIndex === wordIndex);\n },\n [speedMarkers]\n );\n\n // Toggle a speed marker at a word index\n const toggleSpeedMarker = useCallback(\n (wordIndex: number, speed: PlaybackSpeed) => {\n pushUndo();\n setSpeedMarkers((prev) => {\n const existingIdx = prev.findIndex((m) => m.wordIndex === wordIndex);\n if (existingIdx >= 0) {\n // If marker exists with same speed, remove it\n if (prev[existingIdx].speed === speed) {\n return prev.filter((_, i) => i !== existingIdx);\n }\n // If marker exists with different speed, update it\n const updated = [...prev];\n updated[existingIdx] = { wordIndex, speed };\n return updated;\n }\n // Add new marker\n return [...prev, { wordIndex, speed }].sort(\n (a, b) => a.wordIndex - b.wordIndex\n );\n });\n setHasEdits(true);\n },\n [pushUndo]\n );\n\n // Remove a speed marker at a word index\n const removeSpeedMarker = useCallback(\n (wordIndex: number) => {\n if (!speedMarkers.some((m) => m.wordIndex === wordIndex)) return;\n pushUndo();\n setSpeedMarkers(speedMarkers.filter((m) => m.wordIndex !== wordIndex));\n setHasEdits(true);\n },\n [speedMarkers, pushUndo]\n );\n\n // Undoable default-speed setter (the raw setter stays internal for undo/reset)\n const setDefaultSpeedUndoable = useCallback(\n (speed: PlaybackSpeed) => {\n if (speed === defaultSpeed) return;\n pushUndo();\n setDefaultSpeed(speed);\n setHasEdits(true);\n },\n [defaultSpeed, pushUndo]\n );\n\n /**\n * Apply one speed across an index range (typically the current selection):\n * clears markers inside the range, marks the start with the new speed, and\n * restores the previous effective speed just after the end so only the\n * range is affected. One undo step.\n */\n const setSpeedForRange = useCallback(\n (startIndex: number, endIndex: number, speed: PlaybackSpeed) => {\n if (startIndex > endIndex) return;\n pushUndo();\n const afterIndex = endIndex + 1;\n const speedAfter = getSpeedAtIndex(\n afterIndex,\n speedMarkers,\n defaultSpeed\n );\n const kept = speedMarkers.filter(\n (m) => m.wordIndex < startIndex || m.wordIndex > endIndex\n );\n // Only pin the range start when it changes the effective speed there.\n // Applying the speed already in effect (e.g. 1x under a 1x default, or a\n // preceding marker's speed) would persist a no-op marker into saves/exports.\n const speedAtStart = getSpeedAtIndex(startIndex, kept, defaultSpeed);\n const next =\n speedAtStart === speed\n ? [...kept]\n : [...kept, { wordIndex: startIndex, speed }];\n if (\n afterIndex < editedWords.length &&\n speedAfter !== speed &&\n !kept.some((m) => m.wordIndex === afterIndex)\n ) {\n next.push({ wordIndex: afterIndex, speed: speedAfter });\n }\n next.sort((a, b) => a.wordIndex - b.wordIndex);\n setSpeedMarkers(next);\n setHasEdits(true);\n },\n [pushUndo, speedMarkers, defaultSpeed, editedWords.length]\n );\n\n // Effective playback speed at a word index (bound to current markers + default)\n const getSpeedAtIndexBound = useCallback(\n (index: number): PlaybackSpeed => {\n return getSpeedAtIndex(index, speedMarkers, defaultSpeed);\n },\n [speedMarkers, defaultSpeed]\n );\n\n // -- Derived data --\n\n const playbackSegments = useMemo(\n () => buildPlaybackSegments(editedWords),\n [editedWords]\n );\n\n const stats = useMemo<TranscriptEditStats>(() => {\n // Count active (non-deleted) words (excluding silences for word count)\n const activeWordCount = editedWords.filter(\n (ew) => !ew.deleted && !isSilenceType(ew.word.wordType)\n ).length;\n const activeSilenceCount = editedWords.filter(\n (ew) => !ew.deleted && isSilenceType(ew.word.wordType)\n ).length;\n const deletedWordCount = editedWords.filter(\n (ew) => ew.deleted && !isSilenceType(ew.word.wordType)\n ).length;\n const deletedSilenceCount = editedWords.filter(\n (ew) => ew.deleted && isSilenceType(ew.word.wordType)\n ).length;\n\n // Calculate edited duration (sum of non-deleted words/silences, adjusted for speed markers)\n const editedDurationMs = editedWords.reduce((sum, ew, index) => {\n if (ew.deleted) return sum;\n const wordDuration = ew.word.endMs - ew.word.startMs;\n const speed = getSpeedAtIndex(index, speedMarkers, defaultSpeed);\n // Duration is divided by speed (2x speed = half the time)\n return sum + wordDuration / speed;\n }, 0);\n\n return {\n activeWordCount,\n activeSilenceCount,\n deletedWordCount,\n deletedSilenceCount,\n editedDurationMs,\n };\n }, [editedWords, speedMarkers, defaultSpeed]);\n\n const fillerAnalysis = useMemo<FillerAnalysis>(() => {\n // Occurrence counts per filler (and every active word, for custom fillers)\n const matchCounts = new Map<string, number>();\n for (const ew of editedWords) {\n if (ew.deleted || isSilenceType(ew.word.wordType)) continue;\n const wordText = normalizeWordText(ew.word.text);\n // One increment per occurrence — DEFAULT_FILLER_WORDS entries were\n // previously counted twice (once in a defaults loop, once here).\n matchCounts.set(wordText, (matchCounts.get(wordText) || 0) + 1);\n }\n\n // Total duration per filler word type\n const durations = new Map<string, number>();\n for (const ew of editedWords) {\n if (ew.deleted || isSilenceType(ew.word.wordType)) continue;\n const wordText = normalizeWordText(ew.word.text);\n const wordDuration = ew.word.endMs - ew.word.startMs;\n // One accumulation per occurrence — DEFAULT_FILLER_WORDS entries were\n // previously accumulated twice, inflating time-saved estimates 2x.\n durations.set(wordText, (durations.get(wordText) || 0) + wordDuration);\n }\n\n // Silence counts and durations at various thresholds\n const silenceCounts = SILENCE_ANALYSIS_THRESHOLDS.map((threshold) => {\n const thresholdMs = threshold * 1000;\n let count = 0;\n let durationMs = 0;\n for (const ew of editedWords) {\n if (ew.deleted) continue;\n if (!isSilenceType(ew.word.wordType)) continue;\n const silenceDuration = ew.word.endMs - ew.word.startMs;\n if (silenceDuration > thresholdMs) {\n count++;\n durationMs += silenceDuration;\n }\n }\n return { threshold, count, durationMs };\n });\n\n return {\n matchCounts,\n durations,\n silenceCounts,\n defaultFillerWords: DEFAULT_FILLER_WORDS,\n };\n }, [editedWords]);\n\n return {\n editedWords,\n undoStack,\n clipboard,\n hasEdits,\n pushUndo,\n undo,\n toggleWordDeleted,\n deleteRange,\n cut,\n copy,\n paste,\n setWordText,\n splitSilence,\n deleteWord,\n replaceEditedWords,\n removeFillers,\n setSilenceThresholds,\n silenceThresholds: { minSilenceMs, nlSilenceMs },\n speedMarkers,\n defaultSpeed,\n setDefaultSpeed: setDefaultSpeedUndoable,\n setSpeedForRange,\n toggleSpeedMarker,\n removeSpeedMarker,\n getSpeedAtIndex: getSpeedAtIndexBound,\n getSpeedMarkerAtIndex,\n playbackSegments,\n stats,\n fillerAnalysis,\n };\n}\n"]}
@@ -5,7 +5,7 @@ import { Select } from './chunk-J7Z7467B.js';
5
5
  import { Modal, ModalHeader, ModalTitle, ModalClose, ModalBody, ModalFooter } from './chunk-IUFDGB5O.js';
6
6
  import { Input } from './chunk-PVUDXJAI.js';
7
7
  import { Button } from './chunk-ZVSW2KS6.js';
8
- import { useTranscriptEdits, DEFAULT_FILLER_WORDS } from './chunk-OOYEHBYJ.js';
8
+ import { useTranscriptEdits, DEFAULT_FILLER_WORDS } from './chunk-FKHMTRF2.js';
9
9
  import { isSilenceType, PLAYBACK_SPEEDS } from './chunk-6CGM5H4J.js';
10
10
  import * as React6 from 'react';
11
11
  import { cva } from 'class-variance-authority';
@@ -860,6 +860,11 @@ function wordClassName(s) {
860
860
  if (s.hasSpeedMarker) {
861
861
  parts.push("ml-0.5 border-l-[3px] border-l-warning pl-1.5");
862
862
  }
863
+ if (s.isSped) {
864
+ parts.push(
865
+ "underline decoration-warning decoration-dotted decoration-2 underline-offset-4"
866
+ );
867
+ }
863
868
  return parts.join(" ");
864
869
  }
865
870
  var Caret = ({ side }) => /* @__PURE__ */ jsx(
@@ -876,10 +881,13 @@ var MediaEditor = React6.forwardRef(
876
881
  transcript,
877
882
  initialEditedWords,
878
883
  initialUndoStack,
884
+ initialSpeedMarkers,
885
+ initialDefaultSpeed,
879
886
  onEditorStateChange,
880
887
  onHasEditsChange,
881
888
  onCursorTimestampChange,
882
889
  onEditedWordsRender,
890
+ onSpeedStateChange,
883
891
  playerRef: externalPlayerRef,
884
892
  className,
885
893
  splitLayout
@@ -888,6 +896,8 @@ var MediaEditor = React6.forwardRef(
888
896
  transcript,
889
897
  initialEditedWords,
890
898
  initialUndoStack,
899
+ initialSpeedMarkers,
900
+ initialDefaultSpeed,
891
901
  onChange: onEditorStateChange
892
902
  });
893
903
  const {
@@ -912,6 +922,7 @@ var MediaEditor = React6.forwardRef(
912
922
  defaultSpeed,
913
923
  setDefaultSpeed,
914
924
  toggleSpeedMarker,
925
+ setSpeedForRange,
915
926
  removeSpeedMarker,
916
927
  getSpeedAtIndex,
917
928
  getSpeedMarkerAtIndex,
@@ -965,6 +976,10 @@ var MediaEditor = React6.forwardRef(
965
976
  null
966
977
  );
967
978
  const longPressTriggered = React6.useRef(false);
979
+ const selectionAnchorRef = React6.useRef(null);
980
+ const dragPointer = React6.useRef(null);
981
+ const dragScrollFrame = React6.useRef(null);
982
+ const dragListeners = React6.useRef(null);
968
983
  const wordPlaybackStartMs = React6.useRef(null);
969
984
  const wordPlaybackEndMs = React6.useRef(null);
970
985
  const sequenceSegments = React6.useRef([]);
@@ -975,6 +990,13 @@ var MediaEditor = React6.forwardRef(
975
990
  React6.useEffect(() => {
976
991
  onEditedWordsRender?.(editedWords);
977
992
  }, [editedWords, onEditedWordsRender]);
993
+ const onSpeedStateChangeRef = React6.useRef(onSpeedStateChange);
994
+ React6.useEffect(() => {
995
+ onSpeedStateChangeRef.current = onSpeedStateChange;
996
+ });
997
+ React6.useEffect(() => {
998
+ onSpeedStateChangeRef.current?.(speedMarkers, defaultSpeed);
999
+ }, [speedMarkers, defaultSpeed]);
978
1000
  React6.useEffect(() => {
979
1001
  if (onCursorTimestampChange) {
980
1002
  const word = editedWords[cursorIndex];
@@ -1214,6 +1236,157 @@ var MediaEditor = React6.forwardRef(
1214
1236
  setSelection(null);
1215
1237
  }
1216
1238
  };
1239
+ const AUTOSCROLL_EDGE_PX = 24;
1240
+ const AUTOSCROLL_MAX_STEP_PX = 24;
1241
+ const extendDragSelection = (index) => {
1242
+ const anchor = selectionAnchorRef.current;
1243
+ if (!isDragging.current || anchor === null) return;
1244
+ setSelection({
1245
+ start: Math.min(anchor, index),
1246
+ end: Math.max(anchor, index)
1247
+ });
1248
+ setCursorIndex(index);
1249
+ };
1250
+ const wordIndexAtPoint = (x, y) => {
1251
+ const span = document.elementFromPoint?.(x, y)?.closest?.("[data-word-index]");
1252
+ if (!span) return null;
1253
+ const parsed = Number(span.dataset.wordIndex);
1254
+ return Number.isInteger(parsed) ? parsed : null;
1255
+ };
1256
+ const extendSelectionToPointer = () => {
1257
+ const container = contentRef.current;
1258
+ const pointer = dragPointer.current;
1259
+ if (!container || !pointer) return;
1260
+ const rect = container.getBoundingClientRect();
1261
+ const top = Math.max(rect.top, 0);
1262
+ const bottom = Math.min(rect.bottom, window.innerHeight);
1263
+ const left = Math.max(rect.left, 0);
1264
+ const right = Math.min(rect.right, window.innerWidth);
1265
+ if (bottom <= top || right <= left) return;
1266
+ const y = Math.min(Math.max(pointer.y, top + 2), bottom - 2);
1267
+ const x = Math.min(Math.max(pointer.x, left + 2), right - 2);
1268
+ for (const rawX of [x, left + (right - left) / 2, left + 16]) {
1269
+ const probeX = Math.min(Math.max(rawX, left + 2), right - 2);
1270
+ const index = wordIndexAtPoint(probeX, y);
1271
+ if (index !== null) {
1272
+ extendDragSelection(index);
1273
+ return;
1274
+ }
1275
+ }
1276
+ const spans = container.querySelectorAll("[data-word-index]");
1277
+ if (spans.length === 0) return;
1278
+ if (spans[0].getBoundingClientRect().top > y) {
1279
+ const parsed = Number(spans[0].dataset.wordIndex);
1280
+ if (Number.isInteger(parsed)) extendDragSelection(parsed);
1281
+ return;
1282
+ }
1283
+ for (let i = spans.length - 1; i >= 0; i--) {
1284
+ const spanRect = spans[i].getBoundingClientRect();
1285
+ if (spanRect.top <= y) {
1286
+ const parsed = Number(spans[i].dataset.wordIndex);
1287
+ if (Number.isInteger(parsed)) extendDragSelection(parsed);
1288
+ return;
1289
+ }
1290
+ }
1291
+ };
1292
+ const stepDragAutoScroll = () => {
1293
+ dragScrollFrame.current = null;
1294
+ const container = contentRef.current;
1295
+ const pointer = dragPointer.current;
1296
+ if (!isDragging.current || !container || !pointer) return;
1297
+ const rect = container.getBoundingClientRect();
1298
+ const top = Math.max(rect.top, 0);
1299
+ const bottom = Math.min(rect.bottom, window.innerHeight);
1300
+ if (bottom <= top) {
1301
+ dragScrollFrame.current = requestAnimationFrame(stepDragAutoScroll);
1302
+ return;
1303
+ }
1304
+ let step = 0;
1305
+ if (pointer.y < top + AUTOSCROLL_EDGE_PX) {
1306
+ step = Math.max(
1307
+ (pointer.y - (top + AUTOSCROLL_EDGE_PX)) / 3,
1308
+ -AUTOSCROLL_MAX_STEP_PX
1309
+ );
1310
+ } else if (pointer.y > bottom - AUTOSCROLL_EDGE_PX) {
1311
+ step = Math.min(
1312
+ (pointer.y - (bottom - AUTOSCROLL_EDGE_PX)) / 3,
1313
+ AUTOSCROLL_MAX_STEP_PX
1314
+ );
1315
+ }
1316
+ if (step !== 0) {
1317
+ const before = container.scrollTop;
1318
+ container.scrollTop += step;
1319
+ if (container.scrollTop !== before) {
1320
+ extendSelectionToPointer();
1321
+ }
1322
+ }
1323
+ dragScrollFrame.current = requestAnimationFrame(stepDragAutoScroll);
1324
+ };
1325
+ const detachDragListeners = () => {
1326
+ if (dragListeners.current) {
1327
+ document.removeEventListener("mousemove", dragListeners.current.move);
1328
+ document.removeEventListener("mouseup", dragListeners.current.up);
1329
+ dragListeners.current = null;
1330
+ }
1331
+ if (dragScrollFrame.current !== null) {
1332
+ cancelAnimationFrame(dragScrollFrame.current);
1333
+ dragScrollFrame.current = null;
1334
+ }
1335
+ };
1336
+ const handleMouseUp = () => {
1337
+ if (longPressTimer.current) {
1338
+ clearTimeout(longPressTimer.current);
1339
+ longPressTimer.current = null;
1340
+ }
1341
+ if (isDragging.current) {
1342
+ isDragging.current = false;
1343
+ }
1344
+ detachDragListeners();
1345
+ };
1346
+ const beginDragTracking = () => {
1347
+ detachDragListeners();
1348
+ const up = () => handleMouseUp();
1349
+ const move = (e) => {
1350
+ if (!isDragging.current) return;
1351
+ if (e.buttons === 0) {
1352
+ up();
1353
+ return;
1354
+ }
1355
+ dragPointer.current = { x: e.clientX, y: e.clientY };
1356
+ const container = contentRef.current;
1357
+ if (container && longPressTimer.current) {
1358
+ const rect = container.getBoundingClientRect();
1359
+ const outside = e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom;
1360
+ if (outside) {
1361
+ clearTimeout(longPressTimer.current);
1362
+ longPressTimer.current = null;
1363
+ }
1364
+ }
1365
+ extendSelectionToPointer();
1366
+ };
1367
+ dragListeners.current = { move, up };
1368
+ document.addEventListener("mousemove", move);
1369
+ document.addEventListener("mouseup", up);
1370
+ dragScrollFrame.current = requestAnimationFrame(stepDragAutoScroll);
1371
+ };
1372
+ React6.useEffect(
1373
+ () => () => {
1374
+ if (dragListeners.current) {
1375
+ document.removeEventListener("mousemove", dragListeners.current.move);
1376
+ document.removeEventListener("mouseup", dragListeners.current.up);
1377
+ dragListeners.current = null;
1378
+ }
1379
+ if (dragScrollFrame.current !== null) {
1380
+ cancelAnimationFrame(dragScrollFrame.current);
1381
+ dragScrollFrame.current = null;
1382
+ }
1383
+ if (longPressTimer.current) {
1384
+ clearTimeout(longPressTimer.current);
1385
+ longPressTimer.current = null;
1386
+ }
1387
+ },
1388
+ []
1389
+ );
1217
1390
  const handleWordMouseDown = (index, e) => {
1218
1391
  if (e.button !== 0) return;
1219
1392
  longPressTriggered.current = false;
@@ -1222,31 +1395,20 @@ var MediaEditor = React6.forwardRef(
1222
1395
  openWordEditor(index);
1223
1396
  }, 500);
1224
1397
  isDragging.current = true;
1398
+ selectionAnchorRef.current = index;
1399
+ dragPointer.current = { x: e.clientX, y: e.clientY };
1225
1400
  setSelectionAnchor(index);
1226
1401
  setCursorIndex(index);
1227
1402
  setCursorPosition("before");
1228
1403
  setSelection(null);
1404
+ beginDragTracking();
1229
1405
  };
1230
1406
  const handleWordMouseEnter = (index) => {
1231
1407
  if (longPressTimer.current) {
1232
1408
  clearTimeout(longPressTimer.current);
1233
1409
  longPressTimer.current = null;
1234
1410
  }
1235
- if (!isDragging.current || selectionAnchor === null) return;
1236
- setSelection({
1237
- start: Math.min(selectionAnchor, index),
1238
- end: Math.max(selectionAnchor, index)
1239
- });
1240
- setCursorIndex(index);
1241
- };
1242
- const handleMouseUp = () => {
1243
- if (longPressTimer.current) {
1244
- clearTimeout(longPressTimer.current);
1245
- longPressTimer.current = null;
1246
- }
1247
- if (isDragging.current) {
1248
- isDragging.current = false;
1249
- }
1411
+ extendDragSelection(index);
1250
1412
  };
1251
1413
  const handleWordContextMenu = (index, e) => {
1252
1414
  e.preventDefault();
@@ -1463,7 +1625,8 @@ var MediaEditor = React6.forwardRef(
1463
1625
  isSilenceNewline,
1464
1626
  isAnchor,
1465
1627
  isFocused,
1466
- hasSpeedMarker
1628
+ hasSpeedMarker,
1629
+ isSped: effectiveSpeed !== defaultSpeed
1467
1630
  }),
1468
1631
  onClick: (e) => handleWordClick(ew.word, index, e),
1469
1632
  onDoubleClick: (e) => handleWordDoubleClick(index, e),
@@ -1701,7 +1864,6 @@ var MediaEditor = React6.forwardRef(
1701
1864
  onFocus: () => setIsFocused(true),
1702
1865
  onBlur: () => setIsFocused(false),
1703
1866
  onMouseUp: handleMouseUp,
1704
- onMouseLeave: handleMouseUp,
1705
1867
  role: "listbox",
1706
1868
  "aria-label": "Transcript words",
1707
1869
  "aria-activedescendant": `word-${cursorIndex}`,
@@ -1765,7 +1927,10 @@ var MediaEditor = React6.forwardRef(
1765
1927
  currentMarker: speedMenuWordIndex !== null ? getSpeedMarkerAtIndex(speedMenuWordIndex) : void 0,
1766
1928
  defaultSpeed,
1767
1929
  onSetSpeed: (speed) => {
1768
- if (speedMenuWordIndex !== null) {
1930
+ if (speedMenuWordIndex === null) return;
1931
+ if (selection) {
1932
+ setSpeedForRange(selection.start, selection.end, speed);
1933
+ } else {
1769
1934
  toggleSpeedMarker(speedMenuWordIndex, speed);
1770
1935
  }
1771
1936
  },
@@ -1788,5 +1953,5 @@ var MediaEditor = React6.forwardRef(
1788
1953
  MediaEditor.displayName = "MediaEditor";
1789
1954
 
1790
1955
  export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal };
1791
- //# sourceMappingURL=chunk-MCCO4A23.js.map
1792
- //# sourceMappingURL=chunk-MCCO4A23.js.map
1956
+ //# sourceMappingURL=chunk-YVBSAIJ4.js.map
1957
+ //# sourceMappingURL=chunk-YVBSAIJ4.js.map