Methods

(static) colorToHSV(color) → {Object}

Converts a CSS color string (hex or rgb()) to HSV components.
Parameters:
NameTypeDescription
colorstringA hex color ('#rgb', '#rrggbb') or 'rgb(r, g, b)' string
Returns:
Hue 0–360, saturation 0–1, value 0–1
Type: 
Object

(static) farthestAngle(angles) → {number}

Finds the angle (in degrees) that is farthest from all given angles on a circular 0–360 scale. Works by locating the largest arc gap between the sorted input angles and returning its midpoint. - Zero angles: returns a random angle. - One angle: returns the opposite (180° away). - Multiple angles: returns the midpoint of the largest gap.
Parameters:
NameTypeDescription
anglesArray.<number>Array of angles in degrees (0–360)
Returns:
The angle farthest from all inputs, in degrees (0–360)
Type: 
number

(static) farthestColor(colors) → {string}

Finds the color farthest from all others, considering only hue.
Parameters:
NameTypeDescription
colorsArray.<string>Array of CSS color strings (hex, rgb, hsl, named)
Returns:
- The color that is farthest from all others
Type: 
string

(static) formatTime(s) → {string}

Formats a time in seconds as "H:MM:SS" (always includes hours).
Parameters:
NameTypeDescription
snumberseconds
Returns:
e.g. "0:01:05"
Type: 
string

(static) formatTimeMs(s) → {string}

Formats a time in seconds as "H:MM:SS.S" (always includes hours, one decimal second). Used for timecode display and split popup labels.
Parameters:
NameTypeDescription
snumberseconds
Returns:
e.g. "0:01:05.3"
Type: 
string

(static) generateId() → {string}

Generates a locally-unique project id. Format: "local_" + base-36 timestamp + 4 random base-36 chars. Collision probability is negligible for typical usage.
Returns:
Type: 
string

(static) hexToHue(hex) → {number}

Extracts the hue angle (0–360) from a hex color string. Used to position the cursor in the hue picker at the color's current hue.
Parameters:
NameTypeDescription
hexstringe.g. '#47c8ff' or '47c8ff'
Returns:
hue in degrees
Type: 
number

(static) hexToRgb(hex) → {Object}

Parses a 6-digit hex color string into separate R, G, B integer components.
Parameters:
NameTypeDescription
hexstringe.g. '#47c8ff' or '47c8ff'
Returns:
Type: 
Object

(static) hslToHex(h, s, l) → {string}

Converts HSL color values to a 6-digit hex string. Uses the standard HSL → RGB algorithm.
Parameters:
NameTypeDescription
hnumberhue in degrees 0–360
snumbersaturation 0–100
lnumberlightness 0–100
Returns:
e.g. '#47c8ff'
Type: 
string

(static) mergeSegmentsToSentences(segments) → {Array.<object>}

Merges a flat array of Whisper segments (arbitrary audio chunks) into sentence-like units. Flushes the accumulator on: - speaker change - gap ≥ GAP_THRESHOLD between segments - accumulated text ending with sentence-final punctuation (.?!) Used as a transitional shim when loading legacy CSV transcripts.
Parameters:
NameTypeDescription
segmentsArray.<object>flat segments from parseCSV
Returns:
merged sentence-like segments
Type: 
Array.<object>

(static) parseCSV(text) → {Array.<{start: number, end: number, speaker: string, text: string}>}

Parses a CSV string in the format: start,end,speaker,text Implements RFC 4180 field quoting: quoted fields may contain commas, newlines, and escaped double quotes ("" → "). The header row is skipped; rows with fewer than 4 columns are ignored.
Parameters:
NameTypeDescription
textstringraw CSV string
Returns:
Type: 
Array.<{start: number, end: number, speaker: string, text: string}>

(static) parseTranscriptJSON(json) → {Array.<{start: number, end: number, speaker: string, text: string, words: Array.<object>}>}

Flattens a transcript JSON object (paragraphs > sentences > words) into a flat segments array compatible with the Transcript class. Each segment gains a `words` array for word-level playback highlighting.
Parameters:
NameTypeDescription
jsonobjecttranscript JSON with a `paragraphs` array
Returns:
Type: 
Array.<{start: number, end: number, speaker: string, text: string, words: Array.<object>}>

(static) roundRectCorners(ctx, x, y, w, h, radii)

Draws a rounded rectangle path on a 2D canvas context with independent corner radii. Each radius is clamped to half the shorter dimension to prevent over-rounding artefacts.
Parameters:
NameTypeDescription
ctxCanvasRenderingContext2Dcanvas rendering context to draw on
xnumberx coordinate of the rectangle's top-left corner
ynumbery coordinate of the rectangle's top-left corner
wnumberwidth
hnumberheight
radiiArray.<number>Corner radii [top-left, top-right, bottom-right, bottom-left]