"use client"; import { useRouter } from "next/navigation"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import Link from "next/link"; import { buttonVariants } from "@/components/ui/button"; import { useSharedNotes } from "@/components/notes/NotesProvider"; import { NoteThread } from "@/components/notes/NoteThread"; import type { Anchor, CutAsk, Note } from "@/lib/annotations/types"; import { clipBenchHref, ingredientHref, openInDraftHref, postBenchHref } from "@/lib/hrefs"; import { cn } from "@/lib/utils"; import { counterSteps, cutAtSource, cutNotesRequest, playPlan, playTimeOfChrome, runningTime, seamsOf, sourceAt, startOf, } from "@/lib/report/playCut.mjs"; import { AssistReplyApply, ProposalList, routeLine, jobLine, useAssist } from "../report/AssistBox"; import type { RenderCuts } from "./playEngine/useRenderCuts"; import type { EngineInfo, MediaRef } from "./playEngine/engine"; import { PlayStage, usePlayCore } from "./playCore"; import ReelStrip, { type StripCounter, type StripEdit } from "./ReelStrip"; import { useWaveZoom, ZoomControls } from "../bench/GapsZoom"; import { followVis, itemSections } from "@/lib/report/stripDrag.mjs"; import RejectClip from "./RejectClip"; import WhatPlays, { type WorkingCut } from "./WhatPlays"; import FastRenders from "../FastRenders"; import { useCutApp } from "../cutApp/CutApp"; import { ClipExportButtons, ClipExportStatus, useClipExport } from "../ClipExport"; import AddPost from "./AddPost"; import { AddClipToggle } from "../AddClip"; import { Options, PanelSlot } from "@/components/ui/disclosure"; import type { PostPlan } from "./PostItemPlayer"; import type { VideoEntryPlay } from "@/lib/report/playVideo.mjs"; import type { ComboInfo } from "./ComboBadge"; import CopyShareLine from "../CopyShareLine"; import VersionVerdict from "./VersionVerdict"; import { StillButton } from "../inspector/StillInspector"; import type { CensorRegion } from "./CensorOverlay"; // --------------------------------------------------------------------------- // THE PLAY VIEW (umtool/docs/knobs.md, "Play the cut"): a screening room. The // whole cut -- or a take -- played continuously in this browser in its final // look, with no render, and timecoded notes left as it plays that become the // next cut. // // THE CLOCK is one cut clock across every entry (lib/report/playCut.mjs): // the estimate's segments (the live preview's schedule when the cut has a // deck: posts' holds included), re-timed by the RENDER'S EDGES -- each clip // snapped to its silences exactly as the build snaps it (the cut-points // route, lib/report/cutPoints.mjs) -- each clip played from its cached // source window (the bench's own media route, /api/report/raw, `take` for a // take's clip). // // THE ENGINE (playEngine/engine.ts): the sound decoded and scheduled on ONE // Web Audio clock, sample-exact at the render's edges, the crossfades as the // build's ramps, the loudness gain and room as gain automation; the clock of // the whole view is that context's time mapped through the plan, and the // chrome is seeked by the source second playing (chromeTime), so the rail, // the tally, the stamps and the finale land as the render lands them. The // picture follows the clock: WebCodecs where the browser has it (decoded // ahead, a real dissolve), else the two