{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "prompt-send",
  "title": "Prompt Send",
  "description": "AI prompt typing animation: a chat input types a prompt and a cursor clicks send. A composer that unrolls from a hairline, writes a brief into itself while the camera cuts in and rides the caret, then cuts back out to the send button as a pointer arrives and clicks it. The typing is eased, not constant — 17 chars/sec on the first word, 33 in the middle, a settle on the last three. Long copy scrolls the field under its own caret and extra suggestions wrap, so the panel fits whatever you put in it.",
  "dependencies": [
    "remotion",
    "@remotion/google-fonts"
  ],
  "registryDependencies": [
    "https://snapcn.dev/r/snap-cn-ui.json",
    "https://snapcn.dev/r/input.json"
  ],
  "files": [
    {
      "path": "registry/snap-cn/prompt-send/index.tsx",
      "content": "// Prompt Send · snapcn — https://snapcn.dev/docs/ai-input/prompt-send\n\"use client\";\n\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Inter\";\nimport type { ReactNode } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  getRemotionEnvironment,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport { inputStyleContext } from \"@/components/snap-cn/input\";\nimport {\n  Item,\n  mixOklch,\n  parseColor,\n  resolveFont,\n  type SnapCnTheme,\n  useSnapCnTheme,\n  withAlpha,\n} from \"@/lib/snap-cn-ui\";\n\n// Loaded through @remotion/google-fonts, never a CSS variable — a Remotion\n// bundle has none of the app's CSS, so a `var(--font-…)` gets you the right face\n// in the Player and a fallback in the mp4 (design-system rule 4).\nconst { fontFamily: SANS } = loadSans(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\n\n// --- The stage -------------------------------------------------------------\n//\n// The reference recording is 890×486, and every ratio below was read off its\n// frames, so there is no second conversion to get wrong. `stageScale` fits this\n// rectangle into whatever composition the component is given.\n\nconst REF_W = 890;\nconst REF_H = 486;\n/** How far past the stage the backdrop is painted, so a cut never frames off it. */\nconst BLEED = 1.4;\nconst OX = (REF_W * (BLEED - 1)) / 2;\nconst OY = (REF_H * (BLEED - 1)) / 2;\n\n// --- Measured proportions --------------------------------------------------\n//\n// Everything the layout needs is either a fixed inset (a padding, which should\n// not change when the type does) or a **ratio of a font size** (a type metric,\n// which must). Feeding the defaults through `layoutFor` reproduces the\n// recording's own geometry to a pixel; changing `fontSize`, `width`,\n// `fieldHeight` or the labels moves the whole thing coherently instead of\n// clipping against a constant that was tuned for one sentence.\n\n/** Panel → field inset, and the panel's own bottom padding under the chips. */\nconst PAD = 4.7;\n/** The panel sits a hair below the frame's centre line, as the reference's does. */\nconst PANEL_BIAS = 3.3;\n/** Field text inset, and the line box, as multiples of the prompt's font size. */\nconst LINE_PAD_X = 1.12143;\nconst LINE_PAD_Y = 1.27857;\nconst LINE_HEIGHT = 1.21429;\nconst CARET_RATIO = 0.15714;\n/** The chip row's own metrics, as multiples of the chip font size. */\nconst CHIP_HEIGHT = 2;\nconst CHIP_PAD_X = 0.93496;\nconst CHIP_GAP = 0.70732;\nconst CHIP_TOP = 0.54472;\n/** The row starts a little inside the field's text inset. */\nconst CHIP_INSET = 0.72639;\n/** The send button's corner, measured off the field's bottom-right. */\nconst SEND_RIGHT = 14.4;\nconst SEND_BOTTOM = 10.3;\n\n// --- Measured timeline, in seconds -----------------------------------------\n\n/** Reveal: a hairline at the panel's top edge that unrolls downward. */\nconst PANEL_GROW = 0.445;\n/** The writing surface finishes first — 0.83 of the panel's own duration. */\nconst FIELD_GROW = 0.831;\n/** The panel also widens as it unrolls — 0.93 of its width to all of it. */\nconst WIDEN = 0.2;\nconst WIDEN_FROM = 0.93;\n/** Placeholder and send button, together, on a straight ramp. */\nconst FIELD_FADE = 0.3;\n/** Each chip fades up over this, rising as it goes. */\nconst CHIP_DUR = 0.59;\nconst CHIP_RISE = 11.4;\n/** Caret blink half-cycle, re-anchored on every keystroke. */\nconst BLINK = 0.474;\n/** Press, then release, on the send button. */\nconst PRESS_DOWN = 0.067;\nconst PRESS_UP = 0.25;\nconst PRESS_SCALE = 0.87;\n\n/**\n * The unroll. Nearly linear out of the gate, then a long settle — fitted to the\n * panel's measured height on twenty frames (rmse 2.5px on a 167px box).\n */\nconst REVEAL_EASE = Easing.bezier(0.3, 0, 0.35, 1);\n/** The chips' rise. Fitted separately: it is a harder ease-out than the unroll. */\nconst CHIP_EASE = Easing.bezier(0.2, 0, 0.25, 1);\n/** Real mouse deceleration — half the distance in the first eighth of the move. */\nconst CURSOR_EASE = Easing.bezier(0.16, 1, 0.3, 1);\n\n// --- Pure helpers (unit-tested) --------------------------------------------\n\n/** Eased 0→1 for a beat that starts at `at` and runs for `dur` seconds. */\nexport function beat(\n  t: number,\n  at: number,\n  dur: number,\n  ease: (n: number) => number = REVEAL_EASE,\n): number {\n  if (dur <= 0) return t >= at ? 1 : 0;\n  return interpolate(t, [at, at + dur], [0, 1], {\n    extrapolateLeft: \"clamp\",\n    extrapolateRight: \"clamp\",\n    easing: ease,\n  });\n}\n\n/**\n * Characters revealed at `t`, on an **ease-in-out sine** over `dur`.\n *\n * This is the one measurement that surprised: the reference does not type at a\n * constant rate. It accelerates in and decelerates out — 17 chars/sec over the\n * first word, 33 in the middle, and a visible settle on the last three. Fitting\n * a sine ease to the character count read off twenty-four frames lands within\n * **0.30 characters rms** across all 69, which no constant rate comes close to.\n *\n * It is also what makes the shot work: the camera rides this same curve, so the\n * push never jerks and never coasts.\n */\nexport function typedCount(\n  t: number,\n  start: number,\n  dur: number,\n  total: number,\n): number {\n  if (t <= start) return 0;\n  if (dur <= 0 || t >= start + dur) return total;\n  const u = (t - start) / dur;\n  return Math.min(total, Math.round((total * (1 - Math.cos(Math.PI * u))) / 2));\n}\n\n/** Continuous 0→1 of the same curve — what the camera and the field ride. */\nexport function typedProgress(t: number, start: number, dur: number): number {\n  if (t <= start) return 0;\n  if (dur <= 0 || t >= start + dur) return 1;\n  return (1 - Math.cos((Math.PI * (t - start)) / dur)) / 2;\n}\n\n/**\n * When the `count`-th character landed — the inverse of the sine ease.\n *\n * Needed because a caret does not blink on a wall clock, it blinks a fixed\n * interval after the last thing you typed. Anchoring the blink here is what\n * keeps it solid through the sentence and gets the two measured blinks after it\n * (off at 4.27s, on at 4.74s) for free.\n */\nexport function keystrokeAt(\n  count: number,\n  start: number,\n  dur: number,\n  total: number,\n): number {\n  if (count <= 0 || total <= 0) return start;\n  const p = Math.min(1, count / total);\n  return start + (dur * Math.acos(1 - 2 * p)) / Math.PI;\n}\n\n/** Caret visibility: solid while typing, then blinking from the last keystroke. */\nexport function caretOn(t: number, anchor: number, half: number): boolean {\n  if (t < anchor) return false;\n  if (half <= 0) return true;\n  return Math.floor((t - anchor) / half) % 2 === 0;\n}\n\nexport interface CameraShot {\n  scale: number;\n  x: number;\n  y: number;\n}\n\n/**\n * The camera, as three hard states — there is no interpolation between them.\n *\n * Measured on the reference: the wide view is whole on one frame and fully\n * pushed in on the very next (1.958s → 1.975s), and the same again on the way\n * back out at 4.008s. Nothing in between, either time. Ramping it, even across\n * two frames, turns a cut into a zoom and the shot stops snapping.\n *\n * What *does* move is the middle state. It is not a fixed frame: it is pinned to\n * the caret, so as the sentence grows the camera tracks left with it. The pin is\n * on the **continuous** typing curve, not on the character count — which is why\n * the caret in the reference wobbles ±8px around its mark instead of sitting\n * dead still. Each keystroke jumps it forward; the camera slides underneath.\n *\n * Both marks are *fractions of the frame*, never pixel offsets, so a wider panel\n * or a bigger type size reframes rather than drifting off the edge.\n */\nexport function cameraFor(\n  t: number,\n  o: {\n    cutInAt: number;\n    cutOutAt: number;\n    zoomIn: number;\n    zoomOut: number;\n    caretX: number;\n    caretY: number;\n    sendX: number;\n    sendY: number;\n    focusX: number;\n    focusY: number;\n    outX: number;\n    outY: number;\n  },\n): CameraShot {\n  if (t >= o.cutOutAt) {\n    return {\n      scale: o.zoomOut,\n      x: o.outX * REF_W - o.zoomOut * o.sendX,\n      y: o.outY * REF_H - o.zoomOut * o.sendY,\n    };\n  }\n  if (t >= o.cutInAt) {\n    return {\n      scale: o.zoomIn,\n      x: o.focusX * REF_W - o.zoomIn * o.caretX,\n      y: o.focusY * REF_H - o.zoomIn * o.caretY,\n    };\n  }\n  return { scale: 1, x: 0, y: 0 };\n}\n\n/**\n * Greedy row-fill for the suggestion row.\n *\n * Four short labels are one row and that is the shot the reference shows, but a\n * component that only works for four short labels is one that breaks the first\n * time somebody writes a real one. Anything that will not fit wraps, the panel\n * grows by exactly the rows it gained, and the stagger keeps running in label\n * order across them.\n */\nexport function packChipRows(\n  widths: number[],\n  available: number,\n  gap: number,\n): number[][] {\n  const rows: number[][] = [];\n  let row: number[] = [];\n  let used = 0;\n  widths.forEach((w, i) => {\n    if (row.length > 0 && used + gap + w > available) {\n      rows.push(row);\n      row = [];\n      used = 0;\n    }\n    used += row.length === 0 ? w : gap + w;\n    row.push(i);\n  });\n  if (row.length > 0) rows.push(row);\n  return rows;\n}\n\nexport interface PromptSendLayout {\n  panelTop: number;\n  panelWidth: number;\n  panelHeight: number;\n  pad: number;\n  fieldHeight: number;\n  fieldRadius: number;\n  /** Prompt line, relative to the panel's own box. */\n  lineX: number;\n  lineY: number;\n  lineHeight: number;\n  /** How much line fits before the field has to scroll under the caret. */\n  lineMaxWidth: number;\n  caretWidth: number;\n  /** Suggestion row: `chipsX` from the panel's left, `chipsGap` below the field. */\n  chipsX: number;\n  chipsGap: number;\n  chipHeight: number;\n  chipPadX: number;\n  chipGap: number;\n  chipRows: number[][];\n  sendSize: number;\n  sendRight: number;\n  sendBottom: number;\n}\n\n/**\n * The whole geometry, from four numbers and the measured label widths.\n *\n * Every offset the recording gave up is in here either as a fixed inset or as a\n * ratio of a font size, so the defaults reproduce the reference exactly and any\n * other content still lands somewhere sensible. The panel's height is *derived*\n * — padding, field, the gap, however many chip rows there turned out to be — so\n * it hugs its content rather than being a constant that fits one sentence.\n */\nexport function layoutFor(o: {\n  width: number;\n  fieldHeight: number;\n  fontSize: number;\n  chipFontSize: number;\n  radius: number;\n  sendSize: number;\n  chipWidths: number[];\n}): PromptSendLayout {\n  const lineX = PAD + o.fontSize * LINE_PAD_X;\n  const chipHeight = o.chipFontSize * CHIP_HEIGHT;\n  const chipGap = o.chipFontSize * CHIP_GAP;\n  const chipsX = PAD + (lineX - PAD) * CHIP_INSET;\n  const chipRows = packChipRows(o.chipWidths, o.width - chipsX * 2, chipGap);\n  const chipsGap = o.chipFontSize * CHIP_TOP;\n\n  // The line only yields room to the send button when the two actually share a\n  // row. On the reference's 121px field they do not — the button sits well below\n  // the text — so the full width is the line's. Shrink the field to a single-row\n  // control and the line starts scrolling before it can run under the button.\n  const lineBottom = PAD + o.fontSize * LINE_PAD_Y + o.fontSize * LINE_HEIGHT;\n  const sendTop = PAD + o.fieldHeight - SEND_BOTTOM - o.sendSize;\n  const sendGutter =\n    lineBottom > sendTop ? o.sendSize + SEND_RIGHT + o.fontSize * 0.5 : 0;\n\n  // No chips → the panel simply hugs the field. With chips it opens up by the\n  // gap, the rows it needs, and its own bottom padding.\n  const below =\n    chipRows.length === 0\n      ? PAD\n      : chipsGap +\n        chipRows.length * chipHeight +\n        (chipRows.length - 1) * chipGap +\n        PAD * 2;\n  const panelHeight = PAD + o.fieldHeight + below;\n\n  return {\n    panelTop: (REF_H - panelHeight) / 2 + PANEL_BIAS,\n    panelWidth: o.width,\n    panelHeight,\n    pad: PAD,\n    fieldHeight: o.fieldHeight,\n    fieldRadius: Math.max(0, o.radius - 2),\n    lineX,\n    lineY: PAD + o.fontSize * LINE_PAD_Y,\n    lineHeight: o.fontSize * LINE_HEIGHT,\n    lineMaxWidth: Math.max(0, o.width - lineX * 2 - sendGutter),\n    caretWidth: o.fontSize * CARET_RATIO,\n    chipsX,\n    chipsGap,\n    chipHeight,\n    chipPadX: o.chipFontSize * CHIP_PAD_X,\n    chipGap,\n    chipRows,\n    sendSize: o.sendSize,\n    sendRight: SEND_RIGHT,\n    sendBottom: SEND_BOTTOM,\n  };\n}\n\n/** Accepts an array or the comma-separated string the customizer passes. */\nexport function chipList(chips?: string[] | string): string[] {\n  const list = typeof chips === \"string\" ? chips.split(\",\") : (chips ?? []);\n  return list.map((c) => c.trim()).filter(Boolean);\n}\n\n// One measuring context, reused. `measureText` runs once per label per frame,\n// and allocating a canvas each time is the sort of thing that only shows up\n// when somebody renders four minutes of it.\nlet measureCtx: CanvasRenderingContext2D | null | undefined;\n\n/** Advance width of `text`, measured on the face we actually draw. */\nexport function measureWidth(\n  text: string,\n  size: number,\n  family: string = SANS,\n  weight = 400,\n): number {\n  if (!text) return 0;\n  if (typeof document === \"undefined\") return text.length * size * 0.5;\n  if (measureCtx === undefined) {\n    measureCtx = document.createElement(\"canvas\").getContext(\"2d\");\n  }\n  if (!measureCtx) return text.length * size * 0.5;\n  measureCtx.font = `${weight} ${size}px ${family}, system-ui, sans-serif`;\n  return measureCtx.measureText(text).width;\n}\n\n// --- Cursor ----------------------------------------------------------------\n\n/**\n * The pointing hand, at the size the recording caught it: 18×27, hotspot on the\n * fingertip. Drawn in **stage** space, outside the camera — a pointer is a\n * property of the screen, not of the thing on it, so it must not scale when the\n * camera cuts in.\n */\nfunction HandCursor({\n  x,\n  y,\n  size,\n  fill,\n  stroke,\n}: {\n  x: number;\n  y: number;\n  size: number;\n  fill: string;\n  stroke: string;\n}) {\n  return (\n    <svg\n      viewBox=\"0 0 18 27\"\n      width={size * (18 / 27)}\n      height={size}\n      style={{\n        position: \"absolute\",\n        // The hotspot is the fingertip, which sits 6.2 of 18 across the glyph\n        // and 1 of 27 down it — not the box's corner.\n        left: x - size * (6.2 / 27),\n        top: y - size * (1 / 27),\n        display: \"block\",\n        filter: \"drop-shadow(0 1px 1.5px rgba(0,0,0,0.28))\",\n      }}\n    >\n      <title>Pointer</title>\n      <path\n        d=\"M4.1 15.6V3.1a2.1 2.1 0 0 1 4.2 0v7.6h.6l.3-1.5a1.7 1.7 0 0 1 3.4.3v1.5l.4-.5a1.7 1.7 0 0 1 3 1.1v1.1l.4-.2a1.6 1.6 0 0 1 1.9 1.6v4.6c0 3.6-2.4 6.3-6.1 6.3H9.6c-2.6 0-4-1-5.2-2.7l-3.2-4.6a1.7 1.7 0 0 1 2.5-2.2l.4.4Z\"\n        fill={fill}\n        stroke={stroke}\n        strokeWidth={1.1}\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  );\n}\n\n/** The send glyph: an up arrow, drawn to fill its disc the way the reference does. */\nfunction SendArrow({ size, color }: { size: number; color: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 24 24\"\n      width={size}\n      height={size}\n      fill=\"none\"\n      stroke={color}\n      strokeWidth={2.2}\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      style={{ display: \"block\" }}\n    >\n      <title>Send</title>\n      <path d=\"M12 19V5M5.5 11.5 12 5l6.5 6.5\" />\n    </svg>\n  );\n}\n\n// --- Props -----------------------------------------------------------------\n\nexport interface PromptSendProps {\n  /** The brief that types itself. Any length — the field scrolls under the caret. */\n  text?: string;\n  /** Shown until the first character lands. */\n  placeholder?: string;\n  /**\n   * The suggestion row under the field. Pass an array, or the comma-separated\n   * string the customizer sends. They wrap, and the panel grows to hold them;\n   * pass `[]` for a bare field.\n   */\n  chips?: string[] | string;\n  /** Replaces the up-arrow in the send button. */\n  sendIcon?: ReactNode;\n\n  // --- Size. Every default is the recording's own measurement. ---\n  /** Panel width, in stage px (the stage is 890×486, scaled to the composition). */\n  width?: number;\n  /** Height of the writing surface. The panel's height follows from it. */\n  fieldHeight?: number;\n  /** Prompt type size. The line box, caret and field padding all follow from it. */\n  fontSize?: number;\n  /** Chip label size. Chip height, padding and the row gap all follow from it. */\n  chipFontSize?: number;\n  /** Panel corner radius. The field's is this less 2, as the reference's is. */\n  radius?: number;\n  /** Diameter of the send button. */\n  sendSize?: number;\n  /** Overrides the loaded Inter — only useful if you have already loaded a face. */\n  fontFamily?: string;\n\n  // --- Timing, in seconds. ---\n  /** When the panel starts to unroll, and how long the unroll takes. */\n  revealAt?: number;\n  revealDuration?: number;\n  /** When the placeholder and the send button fade up. */\n  fieldAt?: number;\n  /** When the caret arrives (whole — it does not fade). */\n  caretAt?: number;\n  /** When the first chip starts, and the gap between them. */\n  chipsAt?: number;\n  chipStagger?: number;\n  /** When typing starts, and how long the whole sentence takes. */\n  typeStart?: number;\n  typeDuration?: number;\n  /** When the view cuts in to the caret, and back out to the button. */\n  cutInAt?: number;\n  cutOutAt?: number;\n  /** How far each cut pushes. Both are measured off the reference. */\n  zoomIn?: number;\n  zoomOut?: number;\n  /** Where the caret sits in frame while the camera rides it. */\n  focusX?: number;\n  focusY?: number;\n  /** Where the send button sits in frame after the second cut. */\n  outX?: number;\n  outY?: number;\n  /** When the pointer starts its approach, how long it takes, and when it clicks. */\n  cursorAt?: number;\n  cursorDuration?: number;\n  clickAt?: number;\n  /** Show the pointer at all. Off drops the click and the send bloom with it. */\n  cursor?: boolean;\n\n  // --- Paint. ---\n  /** The wash behind the panel and the send bloom. Defaults to `theme.primary`. */\n  accentColor?: string;\n  theme?: Partial<SnapCnTheme>;\n  mode?: \"light\" | \"dark\";\n  speed?: number;\n}\n\n// --- Main composition ------------------------------------------------------\n\n/**\n * A prompt composer that unrolls from a hairline, writes a brief into itself\n * while the camera rides the caret, then cuts back out and gets sent.\n *\n * ## Four things were measured, and they are the component\n *\n * **The unroll.** It does not fade in and it does not scale up from nothing. A\n * 2px white line appears at the panel's top edge and the box grows *downward*\n * out of it — top edge pinned, bottom edge travelling its full height in 445ms —\n * while the width goes from 0.93 to 1. The writing surface and the chip strip\n * are two separate heights on the same curve with different durations, which is\n * why the strip surfaces from under the field late rather than being there from\n * the first frame.\n *\n * **The typing is eased.** 17 chars/sec on the first word, 33 in the middle, and\n * a visible settle on the last three. An ease-in-out sine over the character\n * count fits all 69 of the reference's to within 0.30 characters rms; no\n * constant rate is close.\n *\n * **The camera cuts, and then it rides.** 2.327× in a single frame, landing with\n * the caret 57% across the frame, then tracking left with the sentence — pinned\n * to the *continuous* typing curve, so the caret wobbles ±8px about its mark as\n * each character jumps ahead of the slide. Then it cuts again, out to 1.44×,\n * centred on the send button, which is where the pointer is already heading.\n *\n * **The pointer is a real mouse.** It enters the bottom-right corner and its\n * distance to the button halves every 44ms — an exponential approach, not a\n * constant glide. It is drawn outside the camera because a pointer belongs to\n * the screen, not to the scene, and must not grow when the shot pushes in.\n *\n * ## Nothing here is a constant tuned to one sentence\n *\n * Every offset above is either a fixed inset or a ratio of a font size, and\n * `layoutFor` turns four numbers — `width`, `fieldHeight`, `fontSize`,\n * `chipFontSize` — into the whole geometry. Longer copy scrolls the field under\n * the caret instead of running past its edge; more chips wrap and the panel\n * grows by exactly the rows they needed; no chips at all and it hugs the field.\n * Both camera marks are fractions of the frame, so a wider panel reframes rather\n * than drifting off it.\n *\n * ## What is not measured\n *\n * The colours and the wording. The reference is a specific product with a\n * specific blue; none of that belongs in a component that ships to strangers and\n * lands next to somebody else's `Input` (design-system rule 5). The paint is the\n * shadcn token set, the field takes its surface from the `Input` primitive's own\n * style context so the two cannot drift, the wash is layered from `accentColor`\n * (`theme.primary` by default), and every string is a prop.\n */\nexport function PromptSend({\n  text = \"Add a text reveal, a soft blur transition, and a gradient background\",\n  placeholder = \"Describe the scene you want…\",\n  chips = [\n    \"Add a text reveal\",\n    \"Try a blur transition\",\n    \"Pick a background\",\n    \"Assemble a scene\",\n  ],\n  sendIcon,\n  width = 636.2,\n  fieldHeight = 121.2,\n  fontSize = 14,\n  chipFontSize = 12.3,\n  radius = 22,\n  sendSize = 27.4,\n  fontFamily,\n  revealAt = 0.025,\n  revealDuration = PANEL_GROW,\n  fieldAt = 0.417,\n  caretAt = 0.742,\n  chipsAt = 0.545,\n  chipStagger = 0.1,\n  typeStart = 0.915,\n  typeDuration = 3.025,\n  cutInAt = 1.975,\n  cutOutAt = 4.008,\n  zoomIn = 2.327,\n  zoomOut = 1.44,\n  focusX = 0.573,\n  focusY = 0.4881,\n  outX = 0.5305,\n  outY = 0.5261,\n  cursorAt = 4.042,\n  cursorDuration = 0.42,\n  clickAt = 4.658,\n  cursor = true,\n  accentColor,\n  theme,\n  mode,\n  speed = 1,\n}: PromptSendProps) {\n  const frame = useCurrentFrame();\n  const { width: compWidth, height: compHeight, fps } = useVideoConfig();\n  const t = useSnapCnTheme(theme, mode);\n  const face = resolveFont(fontFamily ?? t.fontFamily) ?? SANS;\n  const ui = inputStyleContext(t);\n  const accent = accentColor ?? t.primary;\n\n  const now = (frame * speed) / fps;\n  const stageScale = Math.min(compWidth / REF_W, compHeight / REF_H);\n\n  // --- layout -------------------------------------------------------------\n  const labels = chipList(chips);\n  const L = layoutFor({\n    width,\n    fieldHeight,\n    fontSize,\n    chipFontSize,\n    radius,\n    sendSize,\n    chipWidths: labels.map(\n      (c) =>\n        measureWidth(c, chipFontSize, face) + chipFontSize * CHIP_PAD_X * 2 + 2,\n    ),\n  });\n\n  // --- reveal -------------------------------------------------------------\n  const panelH = L.panelHeight * beat(now, revealAt, revealDuration);\n  const fieldH =\n    L.fieldHeight * beat(now, revealAt, revealDuration * FIELD_GROW);\n  const panelW =\n    L.panelWidth * (WIDEN_FROM + (1 - WIDEN_FROM) * beat(now, revealAt, WIDEN));\n  const panelLeft = (REF_W - panelW) / 2;\n  // The chips hang off the field's bottom edge, so they ride its growth and are\n  // already in place by the time the first one fades up.\n  const fieldBottom = L.pad + fieldH;\n\n  const fieldIn = interpolate(now, [fieldAt, fieldAt + FIELD_FADE], [0, 1], {\n    extrapolateLeft: \"clamp\",\n    extrapolateRight: \"clamp\",\n  });\n\n  // --- typing -------------------------------------------------------------\n  const count = typedCount(now, typeStart, typeDuration, text.length);\n  const typed = text.slice(0, count);\n  const progress = typedProgress(now, typeStart, typeDuration);\n  const fullWidth = measureWidth(text, fontSize, face);\n\n  // The line rides the *continuous* curve, so a sentence longer than the field\n  // scrolls under the caret the way a real single-line input does — and the\n  // caret, quantised to whole characters, hops either side of the mark rather\n  // than the whole line jerking once per keystroke.\n  const advance = fullWidth * progress;\n  const room = Math.max(0, L.lineMaxWidth - L.caretWidth);\n  const scrolled = Math.max(0, advance - room);\n  const caretSceneX = panelLeft + L.lineX + Math.min(advance, room);\n\n  const caretAnchor =\n    count === 0\n      ? caretAt\n      : // Clamped to `now`: the count is rounded, so the inverse of the ease can\n        // put the \"last keystroke\" a few milliseconds in the future — and a\n        // blink anchored in the future reads as a caret that is off while you\n        // are typing.\n        Math.min(\n          now,\n          Math.max(\n            caretAt,\n            // `count - 0.5` because the count is *rounded*: the character\n            // appears when the eased value crosses the half, and that crossing\n            // is the keystroke the caret's blink hangs off.\n            keystrokeAt(count - 0.5, typeStart, typeDuration, text.length),\n          ),\n        );\n  const caretLit = now >= caretAt && caretOn(now, caretAnchor, BLINK);\n\n  // --- camera -------------------------------------------------------------\n  const sendX = panelLeft + panelW - L.pad - L.sendRight - L.sendSize / 2;\n  const sendY =\n    L.panelTop + L.pad + L.fieldHeight - L.sendBottom - L.sendSize / 2;\n  const shot = cameraFor(now, {\n    cutInAt,\n    cutOutAt,\n    zoomIn,\n    zoomOut,\n    caretX: caretSceneX,\n    caretY: L.panelTop + L.lineY + L.lineHeight / 2,\n    sendX,\n    sendY,\n    focusX,\n    focusY,\n    outX,\n    outY,\n  });\n\n  // --- pointer ------------------------------------------------------------\n  const approach = interpolate(\n    now,\n    [cursorAt, cursorAt + cursorDuration],\n    [0, 1],\n    {\n      extrapolateLeft: \"clamp\",\n      extrapolateRight: \"clamp\",\n      easing: CURSOR_EASE,\n    },\n  );\n  // It parks just up and right of dead centre on the button, which is where a\n  // hand cursor actually lands when you aim at a target this size.\n  const sendScreenX = shot.x + shot.scale * sendX + sendSize * 0.098;\n  const sendScreenY = shot.y + shot.scale * sendY - sendSize * 0.091;\n  const cursorX = interpolate(approach, [0, 1], [REF_W * 0.86, sendScreenX]);\n  const cursorY = interpolate(approach, [0, 1], [REF_H * 1.02, sendScreenY]);\n\n  // --- press and send -----------------------------------------------------\n  const press = !cursor\n    ? 0\n    : now < clickAt\n      ? 0\n      : now < clickAt + PRESS_DOWN\n        ? (now - clickAt) / PRESS_DOWN\n        : Math.max(0, 1 - (now - clickAt - PRESS_DOWN) / PRESS_UP);\n  const pressScale = 1 - (1 - PRESS_SCALE) * press;\n  // The send bloom. It opens 220ms after the press — the reference's does — and\n  // sweeps across the field rather than sitting still. The recording ends 140ms\n  // into it, so the opening is measured and the rest is ours.\n  const glow = !cursor\n    ? 0\n    : beat(now, clickAt + 0.22, 0.3, Easing.out(Easing.quad));\n  const sweep = beat(now, clickAt + 0.22, 1.1, Easing.out(Easing.quad));\n\n  // --- paint --------------------------------------------------------------\n  // A hairline is specified at a 40px control; this panel is much taller, so the\n  // token is walked toward the background through the system's own mix rather\n  // than by picking a lighter grey (design-system rule 3b).\n  const hairline = mixOklch(ui.idleBorder, t.background, 0.1);\n  // A transparent page asks for no page: the wash is the page's, so it goes too.\n  const bare = parseColor(t.background).alpha === 0;\n  const surface = withAlpha(t.card, 0.94);\n  const glassy = withAlpha(t.card, 0.52);\n  const sendIdle = mixOklch(t.foreground, t.card, 0.55);\n  const armed = count > 0;\n\n  const isRendering = getRemotionEnvironment().isRendering;\n  const willChange = isRendering ? undefined : (\"transform\" as const);\n\n  return (\n    <AbsoluteFill style={{ background: t.background }}>\n      <div\n        style={{\n          position: \"absolute\",\n          left: \"50%\",\n          top: \"50%\",\n          width: REF_W,\n          height: REF_H,\n          transform: `translate(-50%, -50%) scale(${stageScale})`,\n          overflow: \"hidden\",\n        }}\n      >\n        {/* The camera. A plain static transform per shot — never interpolated\n            between them, so there is no frame on which a cut is halfway. */}\n        <div\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            transform: `translate(${shot.x}px, ${shot.y}px) scale(${shot.scale})`,\n            transformOrigin: \"0 0\",\n            willChange,\n          }}\n        >\n          {/* The backdrop rides *inside* the camera, because on the reference it\n              does — the wash grows with everything else when the shot pushes in.\n              It is drawn on an oversized box (and positioned in px, not %, so\n              the maths stays the stage's) because the second cut frames past the\n              stage's right edge and a wash that stopped there would show a seam.\n\n              The shape is the reference's: a cool field falling from the top\n              right, a bright patch left of centre, a warm corner under it. The\n              paint is not — it is layered as alpha over the installer's own\n              `background` and `accentColor` (design-system rule 5). Alpha, not\n              `mixOklch`: hue interpolation from a near-neutral page colour to\n              blue takes the short way round, through green. */}\n          {!bare && (\n            <div\n              style={{\n                position: \"absolute\",\n                left: -OX,\n                top: -OY,\n                width: REF_W * BLEED,\n                height: REF_H * BLEED,\n                background: t.background,\n                backgroundImage: [\n                  `radial-gradient(${0.96 * REF_W}px ${0.8 * REF_H}px at ${OX + 0.06 * REF_W}px ${OY + 0.98 * REF_H}px, ${withAlpha(t.background, 0.9)} 0%, transparent 62%)`,\n                  `radial-gradient(${0.74 * REF_W}px ${0.62 * REF_H}px at ${OX + 0.1 * REF_W}px ${OY + 0.46 * REF_H}px, ${withAlpha(t.card, 0.42)} 0%, transparent 66%)`,\n                  `linear-gradient(215deg, ${withAlpha(accent, 0.5)} 0%, ${withAlpha(accent, 0.28)} 52%, ${withAlpha(accent, 0.14)} 100%)`,\n                ].join(\",\"),\n              }}\n            />\n          )}\n\n          {/* ---- The glass panel */}\n          <div\n            style={{\n              position: \"absolute\",\n              left: panelLeft,\n              top: L.panelTop,\n              width: panelW,\n              height: panelH,\n              borderRadius: radius,\n              background: glassy,\n              // The hairline is an inset shadow, not a border: a border is\n              // layout, and every measured offset below is from the panel's own\n              // box. One pixel of border would push all of them one pixel in.\n              boxShadow: `inset 0 0 0 1px ${withAlpha(t.card, 0.6)}, 0 12px 32px ${withAlpha(t.foreground, 0.05)}`,\n              overflow: \"hidden\",\n            }}\n          >\n            {/* ---- The writing surface */}\n            <div\n              style={{\n                position: \"absolute\",\n                left: L.pad,\n                top: L.pad,\n                width: Math.max(0, panelW - L.pad * 2),\n                height: fieldH,\n                borderRadius: L.fieldRadius,\n                background: surface,\n                boxShadow: `0 6px 18px ${withAlpha(t.foreground, 0.05)}`,\n                overflow: \"hidden\",\n              }}\n            >\n              {/* The send bloom: what the click buys you. Inside the field so it\n                  is clipped by its radius, the way the reference's is. */}\n              <div\n                style={{\n                  position: \"absolute\",\n                  inset: 0,\n                  opacity: glow,\n                  background: `radial-gradient(80% 170% at ${16 + sweep * 66}% 96%, ${withAlpha(accent, 0.55)} 0%, transparent 66%)`,\n                }}\n              />\n\n              {/* The prompt line, translated left once the sentence outgrows the\n                  field. Caret between the value and the placeholder, which is\n                  where the reference puts it — the placeholder starts one caret\n                  width right of the text origin, not on it. */}\n              <div\n                style={{\n                  position: \"absolute\",\n                  left: L.lineX - L.pad - scrolled,\n                  top: L.lineY - L.pad,\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  height: L.lineHeight,\n                  fontFamily: face,\n                  fontWeight: 400,\n                  fontSize,\n                  lineHeight: `${L.lineHeight}px`,\n                  color: t.foreground,\n                  whiteSpace: \"pre\",\n                  textRendering: \"geometricPrecision\",\n                }}\n              >\n                {typed}\n                <span\n                  style={{\n                    display: \"inline-block\",\n                    width: L.caretWidth,\n                    height: L.lineHeight,\n                    background: t.foreground,\n                    opacity: caretLit ? 1 : 0,\n                    flexShrink: 0,\n                  }}\n                />\n                {count === 0 ? (\n                  <span style={{ color: ui.mutedForeground, opacity: fieldIn }}>\n                    {placeholder}\n                  </span>\n                ) : null}\n              </div>\n\n              {/* ---- Send */}\n              <div\n                style={{\n                  position: \"absolute\",\n                  right: L.sendRight,\n                  bottom: L.sendBottom,\n                  width: L.sendSize,\n                  height: L.sendSize,\n                  borderRadius: L.sendSize / 2,\n                  background: armed ? t.foreground : sendIdle,\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  justifyContent: \"center\",\n                  opacity: fieldIn,\n                  transform: `scale(${pressScale})`,\n                  willChange,\n                }}\n              >\n                {sendIcon ?? (\n                  <SendArrow size={L.sendSize * 0.56} color={t.card} />\n                )}\n              </div>\n            </div>\n\n            {/* ---- Suggestions */}\n            <div\n              style={{\n                position: \"absolute\",\n                left: L.chipsX,\n                top: fieldBottom + L.chipsGap,\n                right: L.chipsX,\n                display: \"flex\",\n                flexDirection: \"column\",\n                gap: L.chipGap,\n              }}\n            >\n              {L.chipRows.map((row) => (\n                <div\n                  key={row.join(\"-\")}\n                  style={{ display: \"flex\", gap: L.chipGap }}\n                >\n                  {row.map((i) => {\n                    const p = beat(\n                      now,\n                      chipsAt + i * chipStagger,\n                      CHIP_DUR,\n                      CHIP_EASE,\n                    );\n                    return (\n                      <Item key={labels[i]} index={i}>\n                        <div\n                          style={{\n                            boxSizing: \"border-box\",\n                            height: L.chipHeight,\n                            padding: `0 ${L.chipPadX}px`,\n                            borderRadius: L.chipHeight / 2,\n                            background: t.card,\n                            border: `1px solid ${hairline}`,\n                            color: t.foreground,\n                            fontFamily: face,\n                            fontWeight: 400,\n                            fontSize: chipFontSize,\n                            // The label rides low in the pill on the reference,\n                            // which is what stops a small label in a round pill\n                            // reading as though it were floating.\n                            paddingTop: chipFontSize * 0.17073,\n                            lineHeight: `${L.chipHeight - 4}px`,\n                            whiteSpace: \"nowrap\",\n                            textRendering: \"geometricPrecision\",\n                            opacity: p,\n                            transform: `translateY(${(1 - p) * CHIP_RISE}px)`,\n                            willChange,\n                          }}\n                        >\n                          {labels[i]}\n                        </div>\n                      </Item>\n                    );\n                  })}\n                </div>\n              ))}\n            </div>\n          </div>\n        </div>\n\n        {cursor && approach > 0 ? (\n          <HandCursor\n            x={cursorX}\n            y={cursorY}\n            size={27}\n            fill={t.card}\n            stroke={mixOklch(t.foreground, t.card, 0.2)}\n          />\n        ) : null}\n      </div>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/snap-cn/prompt-send.tsx"
    }
  ],
  "docs": "Docs and props: https://snapcn.dev/docs/ai-input/prompt-send?ref=cli — pass mode=\"dark\" if you are rendering onto a dark frame — these default to shadcn's light palette and a bare Remotion render is black. — 82 Pro components too — charts, launch scenes, device shots: https://snapcn.dev/docs/pricing?ref=cli-docs",
  "type": "registry:component"
}
