/* ============================================================================ * video-edit.js — pure helpers for the "Edit & download" custom-video feature * * The video editor lets a user mark one or more CUT ranges (parts to delete) * on a source video before saving it offline. Everything here is pure maths on * {start,end} second ranges so it can be unit-tested with `node --test` and * reused identically by the browser (window.VideoEdit) and, conceptually, by * the server when it validates the same ?keep= parameter. * * Vocabulary: * cut — a [start,end] span the user wants REMOVED from the final video. * keep — a [start,end] span that SURVIVES into the final video. The keep * list is the complement of the (merged, clamped) cut list over * [0,duration]. * * The wire format for the server is a compact string of keep segments: * "12.5-40,95-130.2" → keep 12.5s‥40s and 95s‥130.2s, drop everything else. * ========================================================================== */ (function (root) { 'use strict'; // Round to milliseconds so float noise from the