{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"screen-recording","type":"registry:component","title":"Screen Recording","description":"Screen recording zoom: crop and auto-zoom a product demo capture. The treatment that turns a raw screen capture into a shot: crop the browser and OS chrome off each edge as a fraction, fit what is left to the frame, and run a keyframed camera that pushes in on whatever matters at a given frame and holds until the next move.","dependencies":["remotion"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/screen-recording.tsx","type":"registry:component","target":"components/kuchi/screen-recording.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport type { CSSProperties } from \"react\";\r\nimport {\r\n  AbsoluteFill,\r\n  Easing,\r\n  getRemotionEnvironment,\r\n  Img,\r\n  interpolate,\r\n  OffthreadVideo,\r\n  staticFile,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport { type KuchiTheme, useKuchiTheme } from \"@/lib/kuchi-ui\";\r\n\r\nexport type ScreenRecordingFit = \"cover\" | \"contain\";\r\nexport type ScreenRecordingEntrance = \"fade\" | \"none\";\r\n\r\n/**\r\n * Chrome to cut off the source, one fraction per edge — `{ top: 0.11 }` drops\r\n * the top 11% of the recording, which is about what a browser's tab strip and\r\n * address bar come to. Fractions of the source, never pixels: the component\r\n * then never has to know the file's intrinsic size, and the same numbers\r\n * survive a re-record at a different resolution. Measure once on a still and\r\n * divide — `chromePixels / recordingHeight`. All four default to 0.\r\n */\r\nexport interface ScreenCrop {\r\n  top?: number;\r\n  right?: number;\r\n  bottom?: number;\r\n  left?: number;\r\n}\r\n\r\n/**\r\n * One camera keyframe.\r\n *\r\n * A move eases from wherever the camera actually is at `at` to the pose named\r\n * here, over `duration` frames, and then HOLDS that pose until the next move's\r\n * `at`. There is no `hold` field — the hold is the gap between two moves.\r\n *\r\n * \"At frame 40, over 25 frames, push to 2.2x centred on (0.62, 0.31), hold\r\n * until frame 90, then pull back\" is two lines:\r\n *\r\n * ```tsx\r\n * camera={[\r\n *   { at: 40, duration: 25, zoom: 2.2, x: 0.62, y: 0.31 },\r\n *   { at: 90, duration: 25, zoom: 1 },\r\n * ]}\r\n * ```\r\n */\r\nexport interface CameraMove {\r\n  /**\r\n   * Frame this move starts, absolute on the component's own clock — i.e.\r\n   * compared against `useCurrentFrame() * speed`, not against the previous\r\n   * move. Moves are sorted by `at`; ties break on array order and the last one\r\n   * wins, the same rule `useStateTransition` uses for `Step`.\r\n   */\r\n  at: number;\r\n  /**\r\n   * Frames the move takes. Default 25 — a push worth about 0.8s at 30fps.\r\n   * A move whose `at + duration` runs past the next move's `at` is TRUNCATED,\r\n   * never blended: the next move takes over from the pose actually on screen at\r\n   * that frame, so the camera stays continuous but never averages two targets.\r\n   */\r\n  duration?: number;\r\n  /**\r\n   * Zoom this move lands on, ABSOLUTE — `1` is the fitted shot and `2.2` is\r\n   * 2.2x that. Never a multiplier on the previous move. Omit it and the move\r\n   * carries the previous zoom, which is what makes a pure pan one line.\r\n   */\r\n  zoom?: number;\r\n  /**\r\n   * Focal point the zoom centres on, normalized: 0 -> 1 left to right across\r\n   * the composition, origin top-left, measured on the shot as it sits at zoom\r\n   * 1. Omit it to carry the previous move's `x`. Defaults to 0.5 before the\r\n   * first move.\r\n   */\r\n  x?: number;\r\n  /**\r\n   * Focal point, normalized: 0 -> 1 top to bottom across the composition. Same\r\n   * space as `x`. Omit it to carry the previous move's `y`.\r\n   */\r\n  y?: number;\r\n}\r\n\r\nexport interface ScreenRecordingProps {\r\n  /**\r\n   * The recording. A video (.mp4/.webm/.mov/.m4v) plays through\r\n   * `<OffthreadVideo>` and anything else renders as an `<Img>`, so a single\r\n   * screenshot takes exactly the same camera track. A root-relative path\r\n   * (`/recordings/checkout.mp4`) is served by Next in the Player and rewritten\r\n   * through `staticFile()` in Remotion Studio and a render; http(s)/data/blob URLs pass through.\r\n   */\r\n  src: string;\r\n  /** Browser and OS chrome to cut away, as a fraction of each edge of the source. */\r\n  crop?: ScreenCrop;\r\n  /**\r\n   * The four edges of `crop`, flat. `crop` is the API you write by hand; these\r\n   * exist because the customizer's controls become props verbatim and\r\n   * `ControlType` has no object control, so a crop slider has to land on a\r\n   * number prop. Set here, an edge overrides the same edge of `crop`.\r\n   */\r\n  cropTop?: number;\r\n  cropRight?: number;\r\n  cropBottom?: number;\r\n  cropLeft?: number;\r\n  /**\r\n   * Width divided by height of the source file, if you know it (1920x1080 ->\r\n   * 1.778). Give it and `crop` is exact on the raw file. Omit it and the source\r\n   * is aspect-filled to the composition first, so `crop` is measured on the\r\n   * shot as it appears rather than on the file — the same thing whenever the\r\n   * two aspect ratios already match, which is the usual case.\r\n   *\r\n   * ponytail: it is compared against the COMPOSITION's aspect, not the box this\r\n   * component is mounted in. Everything else here is box-relative, so a\r\n   * recording inset in a device frame is correct — but its `crop` fractions\r\n   * carry the frame's aspect error (a laptop screen is 1.68, a 16:9 comp is\r\n   * 1.78, so ~6%). Omit `sourceAspect` there, or pass the container's aspect\r\n   * ratio's worth of it. Measuring the real box would need a ref and a state\r\n   * update, which is exactly the non-determinism this component cannot have.\r\n   */\r\n  sourceAspect?: number;\r\n  /**\r\n   * `cover` (default) fills the frame with the cropped region and centre-crops\r\n   * whichever axis is long — nothing is letterboxed and nothing is stretched,\r\n   * and the cropped region therefore *is* the frame, which is what lets camera\r\n   * coordinates and overlay coordinates be one space. `contain` fits the whole\r\n   * cropped region inside the frame and pads the rest with `backdropColor`;\r\n   * reach for it only when losing an edge is worse than bars.\r\n   */\r\n  fit?: ScreenRecordingFit;\r\n  /** Padding behind a `contain` fit. Defaults to the theme's `background`. */\r\n  backdropColor?: string;\r\n  /**\r\n   * The camera track, in `at` order. `DEMO_CAMERA` by default — a push and a\r\n   * pull-back, so the component shows what it is for with nothing passed. Pass\r\n   * `[]` for a locked-off shot at zoom 1; a treated recording with no camera is\r\n   * still the point of this component.\r\n   *\r\n   * A focal point is clamped to whatever the current zoom can actually hold\r\n   * (`clampFocus`), so a pull-back to zoom 1 recentres itself rather than\r\n   * dragging a band of `backdropColor` into frame. See `CameraMove` for how\r\n   * moves hold and how overlaps resolve.\r\n   */\r\n  camera?: CameraMove[];\r\n  /**\r\n   * Corner radius on the treated shot, in px. 0 (default) is edge-to-edge.\r\n   * A value here reads as a floating window, which only makes sense when the\r\n   * recording is inset inside something else.\r\n   */\r\n  radius?: number;\r\n  /**\r\n   * Frames to skip into the source video before frame 0 of the scene — the\r\n   * `trimBefore` of `<OffthreadVideo>`. Cut the dead air at the head of a take\r\n   * here instead of re-exporting the file. Ignored for images.\r\n   */\r\n  trimBefore?: number;\r\n  /** Play the recording's audio. Default false — a demo carries its own bed. */\r\n  audio?: boolean;\r\n  /**\r\n   * How the shot arrives. `fade` (default) is the same 18-frame\r\n   * fade-and-unblur `laptop-frame` and `phone-frame` run on screen media, so a\r\n   * recording dropped into either does not double up on two arrivals. `none`\r\n   * is up on frame 0.\r\n   */\r\n  entrance?: ScreenRecordingEntrance;\r\n  /** Design-system token overrides. */\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  /**\r\n   * Time multiplier. Every `at` in `camera` is measured against\r\n   * `useCurrentFrame() * speed`. Layers do not inherit it — pass the same\r\n   * `speed` to the overlays wrapping this one.\r\n   */\r\n  speed?: number;\r\n  className?: string;\r\n}\r\n\r\n// --- Constants -------------------------------------------------------------\r\n\r\n/**\r\n * The camera-move easing. A *moderate* decelerate — not quint/expo-out, which\r\n * cover their travel in the first third and then spend frames moving < 0.5px,\r\n * i.e. freeze on a frame clock. Same constant, same value, as `laptop-frame`'s\r\n * dolly, so a recording and a device frame move alike. See the motion-quality\r\n * skill.\r\n */\r\nexport const CAMERA_EASE = Easing.bezier(0.2, 0.6, 0.35, 1);\r\n\r\n/** Frames a camera move takes when `duration` is omitted. */\r\nexport const CAMERA_MOVE_FRAMES = 25;\r\n\r\n/** Hold past the last settle, so the shot reads as finished rather than cut. */\r\nexport const TAIL_FRAMES = 18;\r\n\r\n/** Fade-and-unblur window for `entrance: \"fade\"`. */\r\nexport const ENTRANCE_FRAMES = 18;\r\n\r\n/** The entrance starts a few frames in, exactly as `laptop-frame`'s does. */\r\nconst ENTRANCE_START = 4;\r\n\r\n/** Peak blur of the entrance, in px — `laptop-frame`'s `ScreenMedia` value. */\r\nconst ENTRANCE_BLUR = 8;\r\n\r\n/**\r\n * A push and a pull-back over the default recording. This is the component's\r\n * `camera` default rather than a config control: `ControlType` in\r\n * lib/customizer-config.ts has no array control, so the demo has to live on the\r\n * prop — the same way `terminal-simulator` carries `DEFAULT_LINES`.\r\n */\r\nexport const DEMO_CAMERA: CameraMove[] = [\r\n  { at: 34, duration: 25, zoom: 1.6, x: 0.36, y: 0.42 },\r\n  { at: 96, duration: 25, zoom: 1 },\r\n];\r\n\r\n// --- Pure helpers (unit-tested) -------------------------------------------\r\n\r\nexport interface CameraPose {\r\n  /** 1 is the fitted shot. */\r\n  zoom: number;\r\n  /** Focal point, normalized to the frame, origin top-left. */\r\n  x: number;\r\n  y: number;\r\n}\r\n\r\n/** The pose before any move has run. */\r\nexport const RESTING_POSE: CameraPose = { zoom: 1, x: 0.5, y: 0.5 };\r\n\r\nconst lerp = (a: number, b: number, p: number) => a + (b - a) * p;\r\n\r\n/**\r\n * Eased progress through one move. A zero or negative `duration` is a cut — it\r\n * cannot go through `interpolate`, whose input range must be increasing.\r\n */\r\nfunction moveProgress(frame: number, at: number, duration: number): number {\r\n  if (duration <= 0) return 1;\r\n  return interpolate(frame, [at, at + duration], [0, 1], {\r\n    easing: CAMERA_EASE,\r\n    extrapolateLeft: \"clamp\",\r\n    extrapolateRight: \"clamp\",\r\n  });\r\n}\r\n\r\n/**\r\n * The camera pose at `frame`, folding the track forward so a move that starts\r\n * mid-flight takes over from the pose actually on screen. Pure: same frame,\r\n * same answer, whatever order Remotion renders in.\r\n */\r\nexport function cameraPoseAt(frame: number, moves?: CameraMove[]): CameraPose {\r\n  if (!moves || moves.length === 0) return RESTING_POSE;\r\n  const sorted = moves\r\n    .map((move, index) => ({ move, index }))\r\n    .sort((a, b) => a.move.at - b.move.at || a.index - b.index)\r\n    // Same-`at` ties: the later array entry wins and the earlier tied entries\r\n    // never display, so they cannot act as a `from` pose either — the rule\r\n    // `useStateTransition` already applies to `Step`.\r\n    .filter(\r\n      (e, i, arr) => i === arr.length - 1 || arr[i + 1].move.at !== e.move.at,\r\n    )\r\n    .map((e) => e.move);\r\n\r\n  // `on` is the pose actually on screen; `target` is the last resolved target,\r\n  // which is what an omitted field carries forward.\r\n  let on = RESTING_POSE;\r\n  let target = RESTING_POSE;\r\n  let current: {\r\n    from: CameraPose;\r\n    to: CameraPose;\r\n    at: number;\r\n    dur: number;\r\n  } | null = null;\r\n\r\n  for (const move of sorted) {\r\n    if (move.at > frame) break;\r\n    if (current) {\r\n      // Truncation, not blending: sample the move in flight at the moment the\r\n      // next one takes over, and hand that pose on as the next move's `from`.\r\n      const p = moveProgress(move.at, current.at, current.dur);\r\n      on = {\r\n        zoom: lerp(current.from.zoom, current.to.zoom, p),\r\n        x: lerp(current.from.x, current.to.x, p),\r\n        y: lerp(current.from.y, current.to.y, p),\r\n      };\r\n    }\r\n    target = {\r\n      zoom: move.zoom ?? target.zoom,\r\n      x: move.x ?? target.x,\r\n      y: move.y ?? target.y,\r\n    };\r\n    current = {\r\n      from: on,\r\n      to: target,\r\n      at: move.at,\r\n      dur: move.duration ?? CAMERA_MOVE_FRAMES,\r\n    };\r\n  }\r\n\r\n  if (!current) return on;\r\n  const p = moveProgress(frame, current.at, current.dur);\r\n  return {\r\n    zoom: lerp(current.from.zoom, current.to.zoom, p),\r\n    x: lerp(current.from.x, current.to.x, p),\r\n    y: lerp(current.from.y, current.to.y, p),\r\n  };\r\n}\r\n\r\n/**\r\n * A focal point the current zoom can actually hold. At zoom `z` the camera sees\r\n * `1/z` of the shot, so its centre cannot get closer than `0.5/z` to an edge\r\n * without dragging `backdropColor` into frame — which is what `{ zoom: 1 }`\r\n * after an off-centre push would otherwise do to its own pull-back. At zoom 1\r\n * (or below) the only legal focal point is dead centre.\r\n */\r\nexport function clampFocus(value: number, zoom: number): number {\r\n  const lo = 0.5 / zoom;\r\n  const hi = 1 - lo;\r\n  if (lo >= hi) return 0.5;\r\n  return Math.min(Math.max(value, lo), hi);\r\n}\r\n\r\n/**\r\n * Natural length: the last move's `at + duration`, plus `TAIL_FRAMES`. A\r\n * locked-off shot (no moves) reports 0 and the composer uses the source's own\r\n * length instead.\r\n */\r\nexport function screenRecordingFrames(camera?: CameraMove[]): number {\r\n  if (!camera || camera.length === 0) return 0;\r\n  const end = Math.max(\r\n    ...camera.map((m) => m.at + (m.duration ?? CAMERA_MOVE_FRAMES)),\r\n  );\r\n  return Math.round(end + TAIL_FRAMES);\r\n}\r\n\r\nexport interface ShotLayout {\r\n  /** Cropped region in frame px: where it sits and how big it is. */\r\n  left: number;\r\n  top: number;\r\n  width: number;\r\n  height: number;\r\n  /** The media element inside that region — its size, and its offset from it. */\r\n  mediaWidth: number;\r\n  mediaHeight: number;\r\n  mediaLeft: number;\r\n  mediaTop: number;\r\n}\r\n\r\n/**\r\n * Where the cropped region and the media element land, in composition px.\r\n *\r\n * The source is measured in \"height = 1\" units, so `sourceAspect` is the only\r\n * thing the component ever needs to know about the file — omitted, it is the\r\n * composition's own aspect, which is exactly the \"crop measured on the fitted\r\n * shot\" reading documented on the prop.\r\n */\r\nexport function shotLayout(\r\n  width: number,\r\n  height: number,\r\n  crop: ScreenCrop | undefined,\r\n  fit: ScreenRecordingFit,\r\n  sourceAspect: number | undefined,\r\n): ShotLayout {\r\n  const left = crop?.left ?? 0;\r\n  const top = crop?.top ?? 0;\r\n  // A crop that eats the whole source would divide by zero and blank the frame;\r\n  // leave a sliver rather than an Infinity.\r\n  const keepX = Math.max(1 - left - (crop?.right ?? 0), 0.01);\r\n  const keepY = Math.max(1 - top - (crop?.bottom ?? 0), 0.01);\r\n  // A zero or negative `sourceAspect` divides by zero downstream and every\r\n  // returned size comes back NaN, which CSS drops silently — the shot just\r\n  // never appears. Fall back to the composition's aspect, i.e. to the\r\n  // documented \"omit it\" behaviour.\r\n  const aspect =\r\n    sourceAspect && sourceAspect > 0 ? sourceAspect : width / height;\r\n\r\n  // Cropped region in source units, then the scale that fits it to the frame.\r\n  const regionW = aspect * keepX;\r\n  const regionH = keepY;\r\n  const k =\r\n    fit === \"contain\"\r\n      ? Math.min(width / regionW, height / regionH)\r\n      : Math.max(width / regionW, height / regionH);\r\n\r\n  const w = regionW * k;\r\n  const h = regionH * k;\r\n  return {\r\n    left: (width - w) / 2,\r\n    top: (height - h) / 2,\r\n    width: w,\r\n    height: h,\r\n    mediaWidth: aspect * k,\r\n    mediaHeight: k,\r\n    // The region's top-left sits `crop.left`/`crop.top` into the scaled source.\r\n    mediaLeft: -left * aspect * k,\r\n    mediaTop: -top * k,\r\n  };\r\n}\r\n\r\n// --- Media ----------------------------------------------------------------\r\n\r\nconst isVideo = (src: string) => /\\.(mp4|webm|mov|m4v)(\\?|$)/i.test(src);\r\n\r\n/**\r\n * `shotLayout` works in composition px, but this component is an `AbsoluteFill`\r\n * and can be mounted in a box that is NOT the composition — a device frame's\r\n * screen (`laptop-frame`'s is 792x472), a split-screen `<Sequence>`. Laid out\r\n * in px there, the shot is sized for 1280x720 and clipped to the top-left\r\n * corner of the screen, and the camera centres the focal point on the\r\n * composition's centre rather than the box's.\r\n *\r\n * Dividing every offset by the composition size makes it a fraction of whatever\r\n * box the component actually lands in — identical when that box IS the frame,\r\n * correct when it is not, and with nothing to measure, so the layout stays a\r\n * pure function of the props.\r\n */\r\nconst pct = (value: number, of: number) => `${(value / of) * 100}%`;\r\n\r\n/**\r\n * A root-relative asset (`/recordings/checkout.mp4`) is served at the origin\r\n * root by Next in the Player, but Remotion Studio and a render serve `public/` through\r\n * `staticFile()` alone — so rewrite local paths everywhere but the Player, and pass\r\n * http(s)/data/blob URLs straight through.\r\n */\r\nfunction resolveSrc(src: string): string {\r\n  const isLocal = src.startsWith(\"/\") && !src.startsWith(\"//\");\r\n  if (!isLocal || getRemotionEnvironment().isPlayer) return src;\r\n  // A value that already came out of staticFile() carries the static base\r\n  // (`/static-<hash>/…`); running it through again would prefix it twice.\r\n  const base = staticFile(\"_\").slice(0, -2);\r\n  if (base && src.startsWith(`${base}/`)) return src;\r\n  try {\r\n    return staticFile(src.replace(/^\\/+/, \"\"));\r\n  } catch {\r\n    return src;\r\n  }\r\n}\r\n\r\n// --- Component ------------------------------------------------------------\r\n\r\nexport function ScreenRecording({\r\n  src,\r\n  crop,\r\n  cropTop,\r\n  cropRight,\r\n  cropBottom,\r\n  cropLeft,\r\n  sourceAspect,\r\n  fit = \"cover\",\r\n  backdropColor,\r\n  camera = DEMO_CAMERA,\r\n  radius = 0,\r\n  trimBefore,\r\n  audio = false,\r\n  entrance = \"fade\",\r\n  theme,\r\n  mode,\r\n  speed = 1,\r\n  className,\r\n}: ScreenRecordingProps) {\r\n  const frame = useCurrentFrame() * speed;\r\n  const t = useKuchiTheme(theme, mode);\r\n  const { width, height } = useVideoConfig();\r\n  const isRendering = getRemotionEnvironment().isRendering;\r\n\r\n  const shot = shotLayout(\r\n    width,\r\n    height,\r\n    {\r\n      top: cropTop ?? crop?.top,\r\n      right: cropRight ?? crop?.right,\r\n      bottom: cropBottom ?? crop?.bottom,\r\n      left: cropLeft ?? crop?.left,\r\n    },\r\n    fit,\r\n    sourceAspect,\r\n  );\r\n  const pose = cameraPoseAt(frame, camera);\r\n  const focusX = clampFocus(pose.x, pose.zoom);\r\n  const focusY = clampFocus(pose.y, pose.zoom);\r\n  // Screen = (content - focal) * zoom + centre, so the focal point lands dead\r\n  // centre at any zoom. With a `0 0` origin that is a plain translate + scale,\r\n  // and as a PERCENTAGE of the camera box it is `0.5 - focal * zoom` — which is\r\n  // the same number in a full-frame mount and correct in a smaller one.\r\n  const tx = (0.5 - focusX * pose.zoom) * 100;\r\n  const ty = (0.5 - focusY * pose.zoom) * 100;\r\n\r\n  const arrival =\r\n    entrance === \"none\"\r\n      ? 1\r\n      : interpolate(\r\n          frame,\r\n          [ENTRANCE_START, ENTRANCE_START + ENTRANCE_FRAMES],\r\n          [0, 1],\r\n          { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" },\r\n        );\r\n\r\n  const mediaStyle: CSSProperties = {\r\n    position: \"absolute\",\r\n    // Percentages of the region box, not px — see `pct` above.\r\n    left: pct(shot.mediaLeft, shot.width),\r\n    top: pct(shot.mediaTop, shot.height),\r\n    width: pct(shot.mediaWidth, shot.width),\r\n    height: pct(shot.mediaHeight, shot.height),\r\n    // Tailwind's preflight sets `img { max-width: 100% }`, which can collapse a\r\n    // media element we size ourselves to 0px wide. Opt out. (motion-quality skill.)\r\n    maxWidth: \"none\",\r\n    // A no-op when `sourceAspect` is given (the box already is the file's\r\n    // aspect); when it is omitted this is what \"aspect-filled first\" means.\r\n    objectFit: \"cover\",\r\n    opacity: arrival,\r\n    // Dropped once the entrance is over rather than left at `blur(0px)`: a\r\n    // filter that is not `none` promotes the media to its own compositing\r\n    // layer, and a promoted layer under the camera's `scale()` is resampled\r\n    // from a stale raster instead of redrawn — across parallel tabs, in a\r\n    // render. `blur(0px)` is on the motion-quality skill's cargo-cult list for\r\n    // exactly that reason, and this shot is scaled on nearly every frame.\r\n    ...(arrival < 1\r\n      ? { filter: `blur(${(1 - arrival) * ENTRANCE_BLUR}px)` }\r\n      : null),\r\n  };\r\n  const resolved = resolveSrc(src);\r\n\r\n  return (\r\n    <AbsoluteFill\r\n      className={className}\r\n      style={{\r\n        backgroundColor: backdropColor ?? t.background,\r\n        borderRadius: radius,\r\n        overflow: \"hidden\",\r\n      }}\r\n    >\r\n      {/* Camera. will-change helps the live Player but is wrong in a render —\r\n          it rasterises the shot across parallel tabs. (motion-quality skill.) */}\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          inset: 0,\r\n          transformOrigin: \"0 0\",\r\n          transform: `translate(${tx}%, ${ty}%) scale(${pose.zoom})`,\r\n          ...(isRendering ? {} : { willChange: \"transform\" as const }),\r\n        }}\r\n      >\r\n        {/* The cropped region. Clips the chrome off the source, and under\r\n            `contain` keeps it off the backdrop as well. */}\r\n        <div\r\n          style={{\r\n            position: \"absolute\",\r\n            left: pct(shot.left, width),\r\n            top: pct(shot.top, height),\r\n            width: pct(shot.width, width),\r\n            height: pct(shot.height, height),\r\n            overflow: \"hidden\",\r\n          }}\r\n        >\r\n          {isVideo(src) ? (\r\n            <OffthreadVideo\r\n              src={resolved}\r\n              muted={!audio}\r\n              trimBefore={trimBefore}\r\n              // The camera runs on `frame * speed`; the footage has to as well,\r\n              // or a faster take zooms to a moment the video has not reached.\r\n              playbackRate={speed}\r\n              style={mediaStyle}\r\n            />\r\n          ) : (\r\n            <Img src={resolved} style={mediaStyle} />\r\n          )}\r\n        </div>\r\n      </div>\r\n    </AbsoluteFill>\r\n  );\r\n}\r\n\r\n// ponytail: no `chrome=\"browser\"` preset. A fraction that guesses an unknown\r\n// recording's tab strip is wrong more often than right; `crop` is one division.\r\n// ponytail: no `children`. A slot here would be a second, zoom-locked overlay\r\n// space, which contradicts overlays living in frame coordinates — wrap this\r\n// component in cursor-track instead. Emphasis inside the shot is `camera`'s\r\n// job: a push to a focal point rides the footage by construction, which is\r\n// exactly what an overlay in frame coordinates cannot do.\r\n// ponytail: no per-move easing override. Add one when a track needs two feels.\r\n"}]}