{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "color-bars",
  "title": "Color Bars",
  "description": "Slanted fluted color bars whip across the frame and swap the outgoing shot for the incoming one.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/color-bars/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  Img,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: sans } = loadFont(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst display = sans;\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\n});\n\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n/* ------------------------------------------------------------------ */\n/* Built-in placeholder shots: abstract compositions in one palette.   */\n/* ------------------------------------------------------------------ */\n\ntype Tone = \"dark\" | \"graphite\" | \"light\" | \"accent\";\ntype Kind = \"title\" | \"pane\" | \"chart\" | \"word\";\ninterface SceneSpec {\n  kind: Kind;\n  tone: Tone;\n}\ninterface Rect {\n  x: number;\n  y: number;\n  w: number;\n  h: number;\n}\n\nfunction toRgb(color: string): [number, number, number] {\n  if (color.startsWith(\"rgb\")) {\n    const [r, g, b] = color.match(/[\\d.]+/g)?.map(Number) ?? [0, 0, 0];\n    return [r, g, b];\n  }\n  const h = color.replace(\"#\", \"\");\n  const v =\n    h.length === 3\n      ? h\n          .split(\"\")\n          .map((ch) => ch + ch)\n          .join(\"\")\n      : h.slice(0, 6);\n  const n = Number.parseInt(v, 16);\n  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\n\nfunction mix(a: string, b: string, t: number) {\n  const x = toRgb(a);\n  const y = toRgb(b);\n  const c = x.map((v, i) => Math.round(v + (y[i] - v) * t));\n  return `rgb(${c[0]},${c[1]},${c[2]})`;\n}\n\nfunction palette(tone: Tone, accent: string) {\n  if (tone === \"light\") {\n    return {\n      bg: \"#F5F4F0\",\n      fg: \"#121214\",\n      muted: \"#6E6C67\",\n      hair: \"rgba(18,18,20,0.10)\",\n      surface: \"#FFFFFF\",\n      block: \"#E6E3DC\",\n      light: \"rgba(255,255,255,0.95)\",\n      shadow: \"rgba(40,36,30,0.16)\",\n      dot: accent,\n    };\n  }\n  if (tone === \"accent\") {\n    return {\n      bg: accent,\n      fg: \"#F7F7F5\",\n      muted: \"rgba(247,247,245,0.7)\",\n      hair: \"rgba(255,255,255,0.22)\",\n      surface: mix(accent, \"#0A0A0B\", 0.32),\n      block: \"rgba(255,255,255,0.16)\",\n      light: \"rgba(255,255,255,0.2)\",\n      shadow: \"rgba(0,0,0,0.35)\",\n      dot: \"#0A0A0B\",\n    };\n  }\n  const graphite = tone === \"graphite\";\n  return {\n    bg: graphite ? \"#17171A\" : \"#0A0A0B\",\n    fg: \"#F3F2EF\",\n    muted: graphite ? \"#97969C\" : \"#8B8A90\",\n    hair: \"rgba(255,255,255,0.10)\",\n    surface: graphite ? \"#1F1F23\" : \"#151517\",\n    block: graphite ? \"#2B2B30\" : \"#232326\",\n    light: graphite ? \"rgba(255,255,255,0.07)\" : \"rgba(255,255,255,0.06)\",\n    shadow: \"rgba(0,0,0,0.6)\",\n    dot: accent,\n  };\n}\n\ntype Colors = ReturnType<typeof palette>;\ninterface Ctx {\n  W: number;\n  H: number;\n  u: number;\n  c: Colors;\n  accent: string;\n  slot?: Rect;\n}\n\nconst LIGHT_AT: Record<Kind, string> = {\n  title: \"18% 8%\",\n  pane: \"50% -10%\",\n  chart: \"8% 0%\",\n  word: \"22% 0%\",\n};\n\nconst REMOCN_R_PATH =\n  \"M 0.01 0.81 C 0.01 1.73, 0.36 2.79, 1.09 4.13 C 4.91 11.04, 13.45 17.16, 21.7 18.9 C 22.94 19.16, 23.18 19.16, 51.39 19.27 C 76.07 19.36, 80.02 19.4, 81.32 19.57 C 89.89 20.69, 96.2 24.68, 99.38 31.01 C 103.19 38.56, 102.53 50.1, 97.91 57.07 C 94.66 61.96, 89.68 64.99, 83.26 66 C 82.81 66.07, 70.18 66.83, 55.2 67.69 C 24.82 69.43, 27.03 69.23, 24.18 70.4 C 19.9 72.15, 14.84 75.7, 10.65 79.89 C 4.86 85.68, 1.3 91.91, 0.25 98.13 C 0.12 98.85, 0.08 103.13, 0.04 116.66 L 0 134.26 9.5 134.26 L 19 134.26 19.05 119.41 C 19.1 103.27, 19.08 103.82, 19.82 101.04 C 21.79 93.65, 27.86 88.75, 36.45 87.63 C 37.23 87.53, 39.41 87.5, 43.57 87.53 C 50.12 87.59, 50.75 87.65, 53.22 88.45 C 56.61 89.56, 59.67 91.86, 62.02 95.07 C 62.52 95.76, 69.35 103.85, 77.2 113.07 C 85.04 122.28, 91.63 130.04, 91.85 130.32 C 92.07 130.59, 92.5 131.34, 92.82 131.97 C 93.52 133.35, 94.11 133.93, 95.06 134.13 C 95.5 134.23, 98.97 134.26, 106.36 134.23 L 117.01 134.19 100.82 113.07 C 91.91 101.45, 84.52 91.78, 84.39 91.57 C 83.36 89.89, 83.66 87.53, 85.09 86 C 85.79 85.25, 86.36 84.94, 88.07 84.38 C 96.18 81.72, 104.15 76.62, 109.97 70.36 C 120.59 58.93, 124.06 44.32, 119.44 30.43 C 114.59 15.81, 101.93 4.02, 87.64 0.83 C 83.93 0.01, 88.09 0.08, 41.85 0.04 L 0.01 0 0.01 0.81 Z\";\n\n/** The \"R\" mark alone (viewBox 124.06 × 134.26). Fill follows `color`. */\nfunction RemocnR({ height, color }: { height: number; color: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 124.06 134.26\"\n      height={height}\n      width={(height * 124.06) / 134.26}\n      style={{ display: \"block\", flexShrink: 0 }}\n      aria-hidden\n    >\n      <path fill={color} d={REMOCN_R_PATH} />\n    </svg>\n  );\n}\n\n/** Full logo as on remocn.dev: R mark (0.76em tall, baseline-aligned) + \"emocn\" in Manrope 600, tracking-tight. */\nfunction RemocnLogo({ fontSize, color }: { fontSize: number; color: string }) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"baseline\",\n        color,\n        fontFamily: manrope.fontFamily,\n        fontWeight: 600,\n        fontSize,\n        letterSpacing: \"-0.025em\",\n        lineHeight: 1,\n        flexShrink: 0,\n      }}\n    >\n      <svg\n        viewBox=\"0 0 124.06 134.26\"\n        style={{ height: \"0.76em\", width: \"auto\" }}\n        aria-hidden\n      >\n        <path fill=\"currentColor\" d={REMOCN_R_PATH} />\n      </svg>\n      <span style={{ marginLeft: \"0.04em\" }}>emocn</span>\n    </div>\n  );\n}\n\nconst abs = (r: Rect): React.CSSProperties => ({\n  position: \"absolute\",\n  left: r.x,\n  top: r.y,\n  width: r.w,\n  height: r.h,\n});\n\nconst displayType = (size: number): React.CSSProperties => ({\n  fontFamily: display,\n  fontWeight: 500,\n  fontSize: size,\n  letterSpacing: \"-0.035em\",\n  lineHeight: 1,\n  fontVariantNumeric: \"tabular-nums\",\n});\n\nfunction TitleBody({ x }: { x: Ctx }) {\n  const { W, H, u, c, slot } = x;\n  const left = slot ? 0.08 * W : 0;\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        left,\n        top: 0,\n        height: H,\n        width: slot ? slot.x - left - 0.03 * W : W,\n        display: \"flex\",\n        flexDirection: \"column\",\n        justifyContent: \"center\",\n        alignItems: slot ? \"flex-start\" : \"center\",\n        gap: 18 * u,\n      }}\n    >\n      <div style={{ fontSize: 22 * u, fontWeight: 400, color: c.muted }}>\n        Introducing\n      </div>\n      <RemocnLogo fontSize={132 * u} color={c.fg} />\n      <div\n        style={{\n          fontSize: 24 * u,\n          color: c.muted,\n          letterSpacing: \"-0.01em\",\n          textAlign: slot ? \"left\" : \"center\",\n        }}\n      >\n        Motion for the films you launch with.\n      </div>\n    </div>\n  );\n}\n\nfunction PaneBody({ x }: { x: Ctx }) {\n  const { W, H, u, c, accent, slot } = x;\n  const pane = { x: 0.08 * W, y: 0.1 * H, w: 0.84 * W, h: 0.8 * H };\n  const canvas = slot ?? { x: 0.335 * W, y: 0.2 * H, w: 0.36 * W, h: 0.36 * H };\n  const side = 0.27 * W;\n  const insp = 0.765 * W;\n  const bar = 0.075 * H;\n  const lightPane = c.surface === \"#FFFFFF\";\n  const tint = mix(accent, c.surface, lightPane ? 0.9 : 0.82);\n  const rows = [0.62, 0.48, 0.7, 0.42, 0.56, 0.5];\n  const tracks = [\n    [\n      [0.3, 0.42],\n      [0.43, 0.62],\n    ],\n    [[0.34, 0.56]],\n    [\n      [0.29, 0.38],\n      [0.39, 0.52],\n      [0.53, 0.74],\n    ],\n  ];\n  return (\n    <>\n      <div\n        style={{\n          ...abs(pane),\n          background: c.surface,\n          borderRadius: 16 * u,\n          boxShadow: `0 0 0 1px ${c.hair}, 0 ${30 * u}px ${70 * u}px ${c.shadow}`,\n          overflow: \"hidden\",\n        }}\n      />\n      <div\n        style={{\n          ...abs({ x: pane.x, y: pane.y + bar, w: pane.w, h: 1 }),\n          background: c.hair,\n        }}\n      />\n      <div\n        style={{\n          position: \"absolute\",\n          left: pane.x + 22 * u,\n          top: pane.y,\n          height: bar,\n          display: \"flex\",\n          alignItems: \"center\",\n          gap: 9 * u,\n        }}\n      >\n        <RemocnLogo fontSize={18 * u} color={c.fg} />\n        <div style={{ fontSize: 15 * u, color: c.muted, marginLeft: 6 * u }}>\n          / Launch film\n        </div>\n      </div>\n      <div\n        style={{\n          position: \"absolute\",\n          right: W - pane.x - pane.w + 18 * u,\n          top: pane.y + bar / 2 - 15 * u,\n          height: 30 * u,\n          padding: `0 ${14 * u}px`,\n          borderRadius: 8 * u,\n          background: accent,\n          color: \"#FFFFFF\",\n          fontSize: 14 * u,\n          fontWeight: 500,\n          display: \"flex\",\n          alignItems: \"center\",\n        }}\n      >\n        Render\n      </div>\n      <div\n        style={{\n          ...abs({ x: side, y: pane.y + bar, w: 1, h: pane.h - bar }),\n          background: c.hair,\n        }}\n      />\n      <div\n        style={{\n          ...abs({ x: insp, y: pane.y + bar, w: 1, h: pane.h - bar }),\n          background: c.hair,\n        }}\n      />\n      {rows.map((w, i) => {\n        const y = pane.y + bar + 26 * u + i * 0.062 * H;\n        const on = i === 1;\n        return (\n          <div key={w}>\n            {on ? (\n              <div\n                style={{\n                  ...abs({\n                    x: pane.x + 12 * u,\n                    y: y - 10 * u,\n                    w: side - pane.x - 24 * u,\n                    h: 34 * u,\n                  }),\n                  background: tint,\n                  borderRadius: 8 * u,\n                }}\n              />\n            ) : null}\n            <div\n              style={{\n                ...abs({ x: pane.x + 24 * u, y, w: 14 * u, h: 14 * u }),\n                borderRadius: 4 * u,\n                background: on ? accent : c.block,\n              }}\n            />\n            <div\n              style={{\n                ...abs({\n                  x: pane.x + 48 * u,\n                  y: y + 3 * u,\n                  w: (side - pane.x - 80 * u) * w,\n                  h: 8 * u,\n                }),\n                borderRadius: 4 * u,\n                background: on ? mix(accent, c.surface, 0.55) : c.block,\n              }}\n            />\n          </div>\n        );\n      })}\n      {[0, 1, 2, 3, 4].map((i) => {\n        const y = pane.y + bar + 28 * u + i * 0.075 * H;\n        return (\n          <div key={i}>\n            <div\n              style={{\n                ...abs({ x: insp + 20 * u, y, w: 0.04 * W, h: 7 * u }),\n                borderRadius: 4 * u,\n                background: c.block,\n              }}\n            />\n            <div\n              style={{\n                ...abs({\n                  x: insp + 20 * u,\n                  y: y + 16 * u,\n                  w: 0.155 * W - 40 * u,\n                  h: 22 * u,\n                }),\n                borderRadius: 6 * u,\n                boxShadow: `inset 0 0 0 1px ${c.hair}`,\n              }}\n            />\n          </div>\n        );\n      })}\n      <div\n        style={{\n          ...abs({\n            x: side,\n            y: canvas.y + canvas.h + 0.07 * H,\n            w: insp - side,\n            h: 1,\n          }),\n          background: c.hair,\n        }}\n      />\n      {tracks.map((clips, ti) =>\n        clips.map(([a, b]) => (\n          <div\n            key={`${ti}-${a}`}\n            style={{\n              ...abs({\n                x: a * W,\n                y: canvas.y + canvas.h + 0.1 * H + ti * 0.058 * H,\n                w: (b - a) * W - 4 * u,\n                h: 0.042 * H,\n              }),\n              borderRadius: 6 * u,\n              background: ti === 1 ? accent : c.block,\n              opacity: ti === 1 ? 0.9 : 1,\n            }}\n          />\n        )),\n      )}\n      <div\n        style={{\n          ...abs({\n            x: 0.47 * W,\n            y: canvas.y + canvas.h + 0.085 * H,\n            w: 2 * u,\n            h: 0.2 * H,\n          }),\n          background: c.fg,\n          borderRadius: u,\n        }}\n      />\n      {slot ? null : (\n        <div\n          style={{\n            ...abs(canvas),\n            borderRadius: 10 * u,\n            background: lightPane ? \"#0A0A0B\" : \"#F5F4F0\",\n            boxShadow: `inset 0 0 0 1px ${c.hair}`,\n            display: \"flex\",\n            alignItems: \"center\",\n            justifyContent: \"center\",\n            overflow: \"hidden\",\n          }}\n        >\n          <div\n            style={{\n              position: \"absolute\",\n              inset: 0,\n              background: `radial-gradient(ellipse 80% 90% at 30% 0%, ${lightPane ? \"rgba(255,255,255,0.09)\" : \"rgba(255,255,255,0.9)\"}, transparent 70%)`,\n            }}\n          />\n          <RemocnR height={58 * u} color={lightPane ? \"#F3F2EF\" : \"#121214\"} />\n        </div>\n      )}\n    </>\n  );\n}\n\nfunction ChartBody({ x }: { x: Ctx }) {\n  const { W, H, u, c, accent } = x;\n  const heights = [0.14, 0.19, 0.17, 0.26, 0.31, 0.38, 0.52];\n  const base = 0.84 * H;\n  const bw = 0.046 * W;\n  const gap = 0.018 * W;\n  const x0 = 0.92 * W - heights.length * (bw + gap) + gap;\n  return (\n    <>\n      <div style={{ position: \"absolute\", left: 0.08 * W, top: 0.14 * H }}>\n        <div style={{ fontSize: 20 * u, color: c.muted, fontWeight: 500 }}>\n          Videos shipped per week\n        </div>\n        <div style={{ ...displayType(110 * u), marginTop: 22 * u }}>+212%</div>\n      </div>\n      <div\n        style={{\n          ...abs({ x: 0.08 * W, y: base, w: 0.84 * W, h: 1 }),\n          background: c.hair,\n        }}\n      />\n      {heights.map((h, i) => (\n        <div\n          key={h}\n          style={{\n            ...abs({\n              x: x0 + i * (bw + gap),\n              y: base - h * H,\n              w: bw,\n              h: h * H,\n            }),\n            borderRadius: `${8 * u}px ${8 * u}px ${2 * u}px ${2 * u}px`,\n            background: i === heights.length - 1 ? accent : c.block,\n          }}\n        />\n      ))}\n    </>\n  );\n}\n\nfunction WordBody({ x }: { x: Ctx }) {\n  const { W, H, u, c } = x;\n  return (\n    <>\n      <div\n        style={{\n          ...abs({ x: 0.08 * W, y: 0.2 * H, w: 0.84 * W, h: 1 }),\n          background: c.hair,\n        }}\n      />\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0.08 * W,\n          right: 0.08 * W,\n          top: 0.2 * H - 40 * u,\n          display: \"flex\",\n          justifyContent: \"space-between\",\n          fontSize: 19 * u,\n          color: c.muted,\n          fontVariantNumeric: \"tabular-nums\",\n        }}\n      >\n        <span>02</span>\n        <span>Chapter</span>\n      </div>\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0.08 * W - 12 * u,\n          bottom: 0.1 * H,\n          ...displayType(250 * u),\n          letterSpacing: \"-0.055em\",\n        }}\n      >\n        Render<span style={{ color: c.dot }}>.</span>\n      </div>\n    </>\n  );\n}\n\nconst BODIES: Record<Kind, (p: { x: Ctx }) => React.ReactElement> = {\n  title: TitleBody,\n  pane: PaneBody,\n  chart: ChartBody,\n  word: WordBody,\n};\n\n/** One full-frame placeholder shot. `slot` reserves room for a window. */\nfunction PlaceholderScene({\n  kind,\n  tone,\n  accent,\n  slot,\n}: SceneSpec & { accent: string; slot?: Rect }) {\n  const { width: W, height: H } = useVideoConfig();\n  const u = H / 720;\n  const c = palette(tone, accent);\n  const Body = BODIES[kind];\n  return (\n    <AbsoluteFill\n      style={{\n        background: c.bg,\n        color: c.fg,\n        fontFamily: sans,\n        overflow: \"hidden\",\n      }}\n    >\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 75% 85% at ${LIGHT_AT[kind]}, ${c.light}, transparent 72%)`,\n        }}\n      />\n      <Body x={{ W, H, u, c, accent, slot }} />\n    </AbsoluteFill>\n  );\n}\n\nfunction ImageScene({ src }: { src: string }) {\n  return (\n    <AbsoluteFill style={{ background: \"#0A0A0B\" }}>\n      <Img\n        src={src}\n        style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }}\n      />\n    </AbsoluteFill>\n  );\n}\n\nfunction Grain({ opacity }: { opacity: number }) {\n  const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n  return (\n    <svg\n      width=\"100%\"\n      height=\"100%\"\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        opacity,\n        pointerEvents: \"none\",\n      }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={7}\n          stitchTiles=\"stitch\"\n        />\n        <feColorMatrix values=\"0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 0\" />\n      </filter>\n      <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n    </svg>\n  );\n}\n\n/* ------------------------------------------------------------------ */\n/* Color bars                                                          */\n/* ------------------------------------------------------------------ */\n\nexport interface ColorBarsProps {\n  /** `[outgoing, incoming]` shots. */\n  scenes?: React.ReactNode[];\n  /** `[outgoing, incoming]` screenshots, used when `scenes` is not passed. */\n  images?: string[];\n  /** Which way the bars travel. */\n  direction?: \"right\" | \"left\" | \"up\" | \"down\";\n  /** Slant of the bar edges in degrees; 0 is a straight wipe. */\n  angle?: number;\n  /** Number of bars, 4–6. */\n  bars?: number;\n  /** Override the derived bar colors, leading bar first. */\n  colors?: string[];\n  accent?: string;\n  /** Playback multiplier. */\n  speed?: number;\n  theme?: \"dark\" | \"light\";\n}\n\nconst HOLD = 14;\nconst SWEEP = 24;\nconst STAGGER = 3;\n/** A whip: almost no motion, a violent middle, a hard brake. */\nconst EASE_WHIP = Easing.bezier(0.82, 0, 0.12, 1);\nconst EASE_SETTLE = Easing.bezier(0.22, 1, 0.36, 1);\n/** Extra lean of an edge at full speed, in degrees. */\nconst LEAN = 6;\n\nconst DARK_PAIR: SceneSpec[] = [\n  { kind: \"title\", tone: \"dark\" },\n  { kind: \"pane\", tone: \"light\" },\n];\nconst LIGHT_PAIR: SceneSpec[] = [\n  { kind: \"chart\", tone: \"light\" },\n  { kind: \"word\", tone: \"graphite\" },\n];\n\n/**\n * Bar colours from the gradients.sh \"fluted\" palette (bg #050507, [#1d2a8f,\n * #2f7bff, #ff7a3d, #ffe2c4]); the accent stands in for its blue.\n */\nfunction barColors(n: number, accent: string, theme: \"dark\" | \"light\") {\n  const ramp =\n    n >= 6\n      ? [\"#FFF1E4\", \"#ffe2c4\", \"#ff7a3d\", accent, \"#1d2a8f\", \"#050507\"]\n      : n === 5\n        ? [\"#ffe2c4\", \"#ff7a3d\", accent, \"#1d2a8f\", \"#050507\"]\n        : [\"#ffe2c4\", \"#ff7a3d\", accent, \"#050507\"];\n  // Lead with the color that contrasts the outgoing shot, end on the one\n  // that contrasts the incoming shot.\n  return theme === \"light\" ? ramp.reverse() : ramp;\n}\n\n/** Each bar is a flute: lit at one end, deepening along its length. */\nfunction fluteFill(c: string, alongEdge: number) {\n  return `linear-gradient(${alongEdge.toFixed(1)}deg, ${mix(c, \"#FFFFFF\", 0.14)} 0%, ${c} 45%, ${mix(c, \"#050507\", 0.16)} 100%)`;\n}\n\nexport function ColorBars({\n  scenes,\n  images,\n  direction = \"right\",\n  angle = 16,\n  bars = 5,\n  colors,\n  accent = \"#3B5BFD\",\n  speed = 1,\n  theme = \"dark\",\n}: ColorBarsProps) {\n  const frame = useCurrentFrame() * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const u = H / 720;\n  const n = Math.round(Math.min(6, Math.max(4, colors?.length ?? bars)));\n  const fills = colors?.length ? colors : barColors(n, accent, theme);\n  const pair = theme === \"light\" ? LIGHT_PAIR : DARK_PAIR;\n\n  // Work in a canonical frame where bars always travel +x.\n  const horizontal = direction === \"right\" || direction === \"left\";\n  const Wc = horizontal ? W : H;\n  const Hc = horizontal ? H : W;\n  const toScreen = (x: number, y: number): [number, number] => {\n    if (direction === \"left\") return [W - x, y];\n    if (direction === \"down\") return [y, x];\n    if (direction === \"up\") return [y, H - x];\n    return [x, y];\n  };\n  const dir = toScreen(1, 0);\n  const origin = toScreen(0, 0);\n  const ux = dir[0] - origin[0];\n  const uy = dir[1] - origin[1];\n\n  const rad = (angle * Math.PI) / 180;\n  const maxLean = (LEAN * Math.PI) / 180;\n  const slant = Math.abs(Math.tan(rad) + Math.sign(angle || 1) * maxLean) * Hc;\n  const from = -slant / 2 - 6 * u;\n  const to = Wc + slant / 2 + 6 * u;\n  const avgSpeed = (to - from) / SWEEP;\n\n  const progress = (i: number, f: number) =>\n    EASE_WHIP(\n      interpolate(\n        f,\n        [HOLD + i * STAGGER, HOLD + i * STAGGER + SWEEP],\n        [0, 1],\n        CLAMP,\n      ),\n    );\n  const edge = (i: number) => {\n    const e = from + (to - from) * progress(i, frame);\n    // Speed-stretch: the edge leans into the move while it is fast.\n    const v =\n      ((progress(i, frame + 0.5) - progress(i, frame - 0.5)) * (to - from)) /\n      (avgSpeed * 3.2);\n    const lean = Math.min(1, v) * maxLean * Math.sign(angle || 1);\n    return { e, tan: Math.tan(rad + lean) };\n  };\n  const region = ({ e, tan }: { e: number; tan: number }) => {\n    const m = 40 * u;\n    const ex = (y: number) => e + (y - Hc / 2) * tan;\n    const left = -(slant + 3 * m);\n    const pts: [number, number][] = [\n      [left, -m],\n      [ex(-m), -m],\n      [ex(Hc + m), Hc + m],\n      [left, Hc + m],\n    ];\n    return `polygon(${pts\n      .map(([x, y]) => toScreen(x, y))\n      .map(([x, y]) => `${x.toFixed(2)}px ${y.toFixed(2)}px`)\n      .join(\", \")})`;\n  };\n\n  const edges = Array.from({ length: n + 1 }, (_, i) => edge(i));\n  // CSS gradient angle running down the bar edges (0deg points up, clockwise).\n  const [ex0, ey0] = toScreen(0, 0);\n  const [ex1, ey1] = toScreen(Math.tan(rad), 1);\n  const alongEdge = (Math.atan2(ex1 - ex0, -(ey1 - ey0)) * 180) / Math.PI;\n  const started = (i: number) => edges[i].e > from + 0.5;\n  const buried = (i: number) => i < n && edges[i + 1].e >= to - 0.5;\n\n  // The outgoing shot gets shoved along; the incoming one arrives late and settles.\n  const shove = 0.05 * Wc * progress(0, frame);\n  const settle = EASE_SETTLE(\n    interpolate(\n      frame,\n      [HOLD + n * STAGGER + SWEEP * 0.35, HOLD + n * STAGGER + SWEEP + 16],\n      [0, 1],\n      CLAMP,\n    ),\n  );\n  const drift = -0.07 * Wc * (1 - settle);\n  const shadow = (on: boolean) =>\n    on\n      ? `drop-shadow(${ux * 10 * u}px ${uy * 10 * u}px ${22 * u}px rgba(0,0,0,0.28))`\n      : undefined;\n\n  const shot = (j: number) => {\n    if (scenes) return <AbsoluteFill>{scenes[j]}</AbsoluteFill>;\n    if (images) return <ImageScene src={images[j]} />;\n    return <PlaceholderScene {...pair[j]} accent={accent} />;\n  };\n\n  return (\n    <AbsoluteFill style={{ background: \"#0A0A0B\", overflow: \"hidden\" }}>\n      {edges[n].e >= to - 0.5 ? null : (\n        <AbsoluteFill\n          style={{ transform: `translate(${ux * shove}px, ${uy * shove}px)` }}\n        >\n          {shot(0)}\n        </AbsoluteFill>\n      )}\n      {fills.slice(0, n).map((fill, i) =>\n        !started(i) || buried(i) ? null : (\n          <AbsoluteFill key={`${fill}-${i}`} style={{ filter: shadow(true) }}>\n            <AbsoluteFill\n              style={{\n                clipPath: region(edges[i]),\n                background: fluteFill(fill, alongEdge),\n              }}\n            />\n          </AbsoluteFill>\n        ),\n      )}\n      {started(n) ? (\n        <AbsoluteFill style={{ filter: shadow(edges[n].e < to - 0.5) }}>\n          <AbsoluteFill style={{ clipPath: region(edges[n]) }}>\n            <AbsoluteFill\n              style={{\n                transform: `translate(${ux * drift}px, ${uy * drift}px) scale(${1 + 0.03 * (1 - settle)})`,\n              }}\n            >\n              {shot(1)}\n            </AbsoluteFill>\n          </AbsoluteFill>\n        </AbsoluteFill>\n      ) : null}\n      <Grain opacity={theme === \"light\" ? 0.04 : 0.055} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/color-bars.tsx"
    }
  ],
  "type": "registry:component"
}
