{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"launch-days","type":"registry:component","title":"Launch Days","description":"Vertical day tabs expand one into a big card, '03 Templates', under a Launch Week header.","dependencies":["remotion","@remotion/google-fonts"],"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>.","registryDependencies":["https://kuchi.kalarislabs.com/r/gradient-ground.json"],"files":[{"path":"components/kuchi/launch-days.tsx","type":"registry:component","target":"components/kuchi/launch-days.tsx","content":"/*! Portions Copyright (c) 2026 Remocn. MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\n\nimport { loadFont as loadHanken } from \"@remotion/google-fonts/HankenGrotesk\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/JetBrainsMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { Fragment } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/kuchi/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/kuchi/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/kuchi/gsh/presets\";\n\nconst hanken = loadHanken(\"normal\", {\n  weights: [\"300\", \"400\"],\n  subsets: [\"latin\"],\n});\nconst mono = loadMono(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\n});\n\nexport interface LaunchDay {\n  day: string;\n  title: string;\n  description?: string;\n}\n\nexport interface LaunchDaysProps {\n  week?: string;\n  label?: string;\n  days?: LaunchDay[];\n  active?: number;\n  from?: number;\n  revealUpcoming?: boolean;\n  logo?: React.ReactNode;\n  accent?: string;\n  background?: string;\n  /** Text color; overrides the theme ink. */\n  ink?: string;\n  /** Typeface for the titles and copy. Load it yourself; Hanken Grotesk by default. */\n  fontFamily?: string;\n  /** Frames between title words as the active day writes in. */\n  stagger?: number;\n  /** Corner radius of the day cards, in px at 720p. */\n  radius?: number;\n  /** Size of the header and strip, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  speed?: number;\n  theme?: \"dark\" | \"light\";\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_DAYS: LaunchDay[] = [\n  {\n    day: \"Mon\",\n    title: \"Captions\",\n    description: \"31 transcript-driven caption styles.\",\n  },\n  {\n    day: \"Tue\",\n    title: \"Transitions\",\n    description: \"Cuts that land on the beat.\",\n  },\n  {\n    day: \"Wed\",\n    title: \"Templates\",\n    description:\n      \"Whole launch films, installed into your project and yours to edit.\",\n  },\n  {\n    day: \"Thu\",\n    title: \"Agent skill\",\n    description: \"Your agent reads the docs and picks the beat.\",\n  },\n  {\n    day: \"Fri\",\n    title: \"Studio\",\n    description: \"Preview every scene before it renders.\",\n  },\n];\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0A0A0B\",\n    scrim: \"rgba(10,10,11,0.84)\",\n    fg: \"#F4F3F0\",\n    muted: \"#8E8D94\",\n    faint: \"#55555C\",\n    panel: \"rgba(255,255,255,0.03)\",\n    line: \"rgba(255,255,255,0.08)\",\n    litLine: \"rgba(255,255,255,0.14)\",\n    activeFg: \"#F7F8FF\",\n    activeMuted: \"rgba(236,240,255,0.74)\",\n    shade:\n      \"linear-gradient(180deg, rgba(4,6,20,0) 35%, rgba(4,6,20,0.55) 100%)\",\n    ground: \"film-blue\" as GshPresetId,\n    groundParams: undefined as Partial<GradientParams> | undefined,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    scrim: \"rgba(245,244,240,0.84)\",\n    fg: \"#111113\",\n    muted: \"#6E6C67\",\n    faint: \"#A9A69E\",\n    panel: \"rgba(255,255,255,0.5)\",\n    line: \"rgba(17,17,19,0.08)\",\n    litLine: \"rgba(17,17,19,0.1)\",\n    activeFg: \"#0B0D1E\",\n    activeMuted: \"rgba(11,13,30,0.68)\",\n    shade:\n      \"linear-gradient(180deg, rgba(245,246,252,0) 35%, rgba(245,246,252,0.6) 100%)\",\n    ground: \"glasswork\" as GshPresetId,\n    groundParams: {\n      colors: [\"#a9bcff\", \"#3552ff\", \"#1a2a9e\", \"#7f9bff\"],\n    } as Partial<GradientParams> | undefined,\n  },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_IN = Easing.bezier(0.55, 0, 1, 0.45);\nconst SPRING_CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst SPRING_MORPH = { damping: 200 };\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n\nfunction KuchiLogo({ 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      }}\n    >\n      <span>Acme</span>\n    </div>\n  );\n}\n\nfunction estimateEm(text: string) {\n  let w = 0;\n  for (const ch of text) {\n    if (ch === \" \") w += 0.24;\n    else if (/[ilIj.,'’!|]/.test(ch)) w += 0.25;\n    else if (/[mwMW]/.test(ch)) w += 0.82;\n    else if (/[A-Z]/.test(ch)) w += 0.64;\n    else if (/[0-9]/.test(ch)) w += 0.55;\n    else w += 0.52;\n  }\n  return w;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\");\n\n/** The foreground at `scale`, around the frame's center; nothing extra at 1. */\nfunction ScaleLayer({\n  scale,\n  children,\n}: {\n  scale: number;\n  children: React.ReactNode;\n}) {\n  if (scale === 1) return children;\n  return (\n    <AbsoluteFill style={{ transform: `scale(${scale})` }}>\n      {children}\n    </AbsoluteFill>\n  );\n}\n\nexport function LaunchDays({\n  week = \"Launch Week 01\",\n  label = \"New today\",\n  days = DEFAULT_DAYS,\n  active = 2,\n  from,\n  revealUpcoming = false,\n  logo,\n  accent = \"#3B5BFD\",\n  background,\n  ink,\n  fontFamily = hanken.fontFamily,\n  stagger = 3,\n  radius: corner = 16,\n  scale = 1,\n  delay = 0,\n  speed = 1,\n  theme = \"dark\",\n  ground,\n  groundParams,\n}: LaunchDaysProps) {\n  const raw = Math.max(0, useCurrentFrame() - delay);\n  const frame = raw * speed;\n  const { width, height, fps } = useVideoConfig();\n  const p = PALETTES[theme];\n  const fg = ink ?? p.fg;\n  const activeFg = ink ?? p.activeFg;\n\n  const list = days.length >= 2 ? days.slice(0, 7) : DEFAULT_DAYS;\n  const n = list.length;\n  const act = Math.min(Math.max(0, Math.round(active)), n - 1);\n  const swap =\n    from !== undefined && Math.round(from) !== act\n      ? Math.min(Math.max(0, Math.round(from)), n - 1)\n      : null;\n\n  const portrait = height > width * 1.1;\n  const u = Math.min(width, height) / 720;\n  const margin = 40 * u;\n  const marginX = portrait ? width * 0.07 : width * 0.1;\n  const headerH = week || logo !== null ? 64 * u : 0;\n  const gap = 8 * u;\n  const radius = corner * u;\n\n  const stripW = width - marginX * 2;\n  const stripH = height - margin - headerH - margin * (headerH ? 0 : 1);\n  const main = portrait ? stripH : stripW;\n  const cross = portrait ? stripW : stripH;\n  const sliver = Math.max(\n    44 * u,\n    Math.min((portrait ? 92 : 76) * u, main * 0.075),\n  );\n  const free = main - gap * (n - 1);\n  const equal = free / n;\n  const wide = free - sliver * (n - 1);\n\n  const rise = (i: number) =>\n    swap === null\n      ? spring({ frame: frame - i * 2, fps, config: SPRING_CARD })\n      : 1;\n  const open = spring({\n    frame: frame - 14,\n    fps,\n    config: SPRING_MORPH,\n    durationInFrames: 28,\n  });\n  const sizeOf = (i: number) => {\n    if (swap === null) {\n      return interpolate(open, [0, 1], [equal, i === act ? wide : sliver]);\n    }\n    const a = i === swap ? wide : sliver;\n    const b = i === act ? wide : sliver;\n    return interpolate(open, [0, 1], [a, b]);\n  };\n\n  const eyebrowT = interpolate(frame, [26, 42], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const wordT = (i: number) =>\n    interpolate(frame, [30 + i * stagger, 48 + i * stagger], [0, 1], {\n      ...CLAMP,\n      easing: EASE_OUT,\n    });\n  const outT = (i: number) =>\n    interpolate(frame, [6 + i * 2, 16 + i * 2], [0, 1], {\n      ...CLAMP,\n      easing: EASE_IN,\n    });\n\n  const panelPad = (portrait ? 44 : 36) * u;\n  const avail = (portrait ? cross : wide) - panelPad * 2;\n  const base = (portrait ? 150 : 136) * u;\n  const numFs = (portrait ? 150 : 112) * u;\n  const titleFs = (title: string) => {\n    const em = estimateEm(title);\n    const one = avail / Math.max(em, 0.5);\n    if (one >= base * 0.78) return Math.min(base, one);\n    return Math.max(base * 0.5, Math.min(base * 0.86, (avail * 1.9) / em));\n  };\n\n  const transparent = background === \"transparent\";\n  const showHeader = headerH > 0;\n  const labelFs = 16 * u;\n  const preset = ground ?? (groundParams ? undefined : p.ground);\n  const litO = (i: number) =>\n    i === act\n      ? interpolate(frame, [16, 40], [0, 1], { ...CLAMP, easing: EASE_OUT })\n      : i === swap\n        ? 1 -\n          interpolate(frame, [14, 36], [0, 1], { ...CLAMP, easing: EASE_IN })\n        : 0;\n  const stripX = marginX;\n  const stripY = showHeader ? headerH + margin * 0.15 : margin;\n  const sizes = list.map((_, i) => sizeOf(i));\n  const rectOf = (i: number) => {\n    let at = 0;\n    for (let k = 0; k < i; k++) at += (sizes[k] as number) + gap;\n    const lift = (1 - rise(i)) * 30 * u;\n    const sz = sizes[i] as number;\n    return portrait\n      ? { x: stripX, y: stripY + at + lift, w: stripW, h: sz }\n      : { x: stripX + at, y: stripY + lift, w: sz, h: stripH - margin * 0.15 };\n  };\n  const rr = (x: number, y: number, w: number, h: number, r: number) =>\n    `M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`;\n  const holes = list\n    .map((_, i) => i)\n    .filter((i) => litO(i) > 0.001)\n    .map((i) => {\n      const q = rectOf(i);\n      if (scale === 1) return rr(q.x, q.y, q.w, q.h, radius);\n      // The cards sit in the ScaleLayer; the scrim doesn't, so map its holes.\n      const sx = width / 2 + (q.x - width / 2) * scale;\n      const sy = height / 2 + (q.y - height / 2) * scale;\n      return rr(sx, sy, q.w * scale, q.h * scale, radius * scale);\n    });\n  const scrimD = `M0 0H${width}V${height}H0Z${holes.join(\"\")}`;\n\n  const headerT = interpolate(frame, [0, 18], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  const renderOpen = (\n    d: LaunchDay,\n    i: number,\n    mode: \"in\" | \"out\",\n    size: number,\n  ) => {\n    const fs = titleFs(d.title);\n    const words = d.title.split(/\\s+/).filter(Boolean);\n    const shown = mode === \"in\";\n    const eb = shown ? eyebrowT : 1 - outT(0);\n    const numT = shown\n      ? interpolate(frame, [24, 44], [0, 1], { ...CLAMP, easing: EASE_OUT })\n      : 1 - outT(0);\n    const descT = shown\n      ? interpolate(\n          frame,\n          [40 + words.length * 3, 60 + words.length * 3],\n          [0, 1],\n          {\n            ...CLAMP,\n            easing: EASE_OUT,\n          },\n        )\n      : 1 - outT(1);\n    const box = portrait ? cross : wide;\n    const contentOpacity = interpolate(\n      size,\n      [sliver * 1.2, sliver * 2.4],\n      [0, 1],\n      CLAMP,\n    );\n    return (\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0,\n          top: 0,\n          width: portrait ? box : wide,\n          height: portrait ? wide : cross,\n          padding: panelPad,\n          display: \"flex\",\n          flexDirection: \"column\",\n          justifyContent: \"space-between\",\n          opacity: contentOpacity,\n        }}\n      >\n        <div\n          style={{\n            display: \"flex\",\n            alignItems: \"flex-start\",\n            justifyContent: \"space-between\",\n          }}\n        >\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 12 * u,\n              marginTop: 6 * u,\n              fontFamily: mono.fontFamily,\n              fontWeight: 400,\n              fontSize: labelFs * 1.1,\n              letterSpacing: \"0.08em\",\n              textTransform: \"uppercase\",\n              color: activeFg,\n              opacity: eb,\n              transform: `translateX(${(1 - eb) * -16 * u}px)`,\n            }}\n          >\n            <span>{d.day}</span>\n            {label ? (\n              <>\n                <span\n                  style={{\n                    width: 22 * u,\n                    height: 1,\n                    background: p.activeMuted,\n                    opacity: 0.6,\n                  }}\n                />\n                <span style={{ color: p.activeMuted }}>{label}</span>\n              </>\n            ) : null}\n          </div>\n          <span\n            style={{\n              display: \"inline-block\",\n              overflow: \"hidden\",\n              paddingRight: \"0.04em\",\n              marginTop: -numFs * 0.12,\n              marginRight: -numFs * 0.02,\n            }}\n          >\n            <span\n              style={{\n                display: \"inline-block\",\n                fontFamily,\n                fontWeight: 400,\n                fontSize: numFs,\n                lineHeight: 1,\n                letterSpacing: \"-0.05em\",\n                fontVariantNumeric: \"tabular-nums\",\n                color: activeFg,\n                transform: `translateY(${(1 - numT) * 100}%)`,\n              }}\n            >\n              {pad2(i + 1)}\n            </span>\n          </span>\n        </div>\n        <div>\n          <div\n            style={{\n              fontFamily,\n              fontWeight: 400,\n              fontSize: fs,\n              lineHeight: 0.98,\n              letterSpacing: \"-0.045em\",\n              color: activeFg,\n              textWrap: \"balance\",\n              marginLeft: -fs * 0.04,\n            }}\n          >\n            {words.map((w, k) => {\n              const t = shown ? wordT(k) : 1;\n              const o = shown ? 0 : outT(k);\n              return (\n                <Fragment key={`${w}-${k}`}>\n                  {k > 0 ? \" \" : null}\n                  <span\n                    style={{\n                      display: \"inline-block\",\n                      overflow: \"hidden\",\n                      verticalAlign: \"top\",\n                      paddingBottom: \"0.12em\",\n                      marginBottom: \"-0.12em\",\n                      paddingRight: \"0.05em\",\n                      marginRight: \"-0.05em\",\n                    }}\n                  >\n                    <span\n                      style={{\n                        display: \"inline-block\",\n                        transform: `translateY(${(1 - t) * 105 - o * 105}%)`,\n                      }}\n                    >\n                      {w}\n                    </span>\n                  </span>\n                </Fragment>\n              );\n            })}\n          </div>\n          {d.description ? (\n            <div\n              style={{\n                marginTop: fs * 0.26,\n                maxWidth: Math.min(avail, 620 * u),\n                fontFamily,\n                fontWeight: 400,\n                fontSize: (portrait ? 30 : 24) * u,\n                lineHeight: 1.35,\n                letterSpacing: \"-0.01em\",\n                color: p.activeMuted,\n                textWrap: \"balance\",\n                opacity: descT,\n                transform: `translateY(${(1 - descT) * 12 * u}px)`,\n                filter: `blur(${(1 - descT) * 5 * u}px)`,\n              }}\n            >\n              {d.description}\n            </div>\n          ) : null}\n        </div>\n      </div>\n    );\n  };\n\n  return (\n    <AbsoluteFill\n      style={{\n        background: transparent ? \"transparent\" : (background ?? p.bg),\n        overflow: \"hidden\",\n      }}\n    >\n      {transparent || background ? null : (\n        <>\n          <GshGround\n            preset={preset}\n            params={groundParams ?? (ground ? undefined : p.groundParams)}\n            timeOffset={theme === \"light\" ? 4 : 2}\n            timeScale={0.5}\n          />\n          <svg\n            width={width}\n            height={height}\n            viewBox={`0 0 ${width} ${height}`}\n            style={{ position: \"absolute\", inset: 0 }}\n            aria-hidden\n          >\n            <path d={scrimD} fill={p.scrim} fillRule=\"evenodd\" />\n          </svg>\n        </>\n      )}\n      <ScaleLayer scale={scale}>\n        {showHeader ? (\n          <div\n            style={{\n              position: \"absolute\",\n              left: marginX,\n              right: marginX,\n              top: 0,\n              height: headerH + margin * 0.15,\n              display: \"flex\",\n              alignItems: \"center\",\n              justifyContent: \"space-between\",\n              opacity: headerT,\n              transform: `translateY(${(1 - headerT) * -8 * u}px)`,\n            }}\n          >\n            <span\n              style={{\n                fontFamily: mono.fontFamily,\n                fontWeight: 400,\n                fontSize: labelFs * 1.1,\n                letterSpacing: \"0.08em\",\n                textTransform: \"uppercase\",\n                color: fg,\n              }}\n            >\n              {week}\n            </span>\n            {logo === null ? null : (\n              <div style={{ display: \"flex\", alignItems: \"center\" }}>\n                {logo ?? <KuchiLogo fontSize={24 * u} color={fg} />}\n              </div>\n            )}\n          </div>\n        ) : null}\n\n        <div\n          style={{\n            position: \"absolute\",\n            left: stripX,\n            top: stripY,\n            width: stripW,\n            height: stripH - margin * 0.15,\n            display: \"flex\",\n            flexDirection: portrait ? \"column\" : \"row\",\n            gap,\n          }}\n        >\n          {list.map((d, i) => {\n            const size = sizeOf(i);\n            const r = rise(i);\n            const isAct = i === act;\n            const isFrom = i === swap;\n            const groundO = litO(i);\n            const past = i < act;\n            const upcoming = i > act;\n            const sliverTitle = upcoming && !revealUpcoming ? \"\" : d.title;\n            const labelO = interpolate(\n              size,\n              [equal * 1.05, equal * 1.6],\n              [1, 0],\n              CLAMP,\n            );\n            const numColor = isAct ? activeFg : past ? fg : p.muted;\n            return (\n              <div\n                key={`${d.day}-${i}`}\n                style={{\n                  position: \"relative\",\n                  flex: \"none\",\n                  [portrait ? \"height\" : \"width\"]: size,\n                  [portrait ? \"width\" : \"height\"]: \"100%\",\n                  borderRadius: radius,\n                  overflow: \"hidden\",\n                  background: groundO > 0.001 ? undefined : p.panel,\n                  boxShadow: `inset 0 0 0 1px ${groundO > 0.5 ? p.litLine : p.line}`,\n                  clipPath: `inset(${Math.max(0, 1 - r) * 100}% 0 0 0 round ${radius}px)`,\n                  transform: `translateY(${(1 - r) * 30 * u}px)`,\n                }}\n              >\n                {groundO > 0 ? (\n                  <>\n                    <div\n                      style={{\n                        position: \"absolute\",\n                        inset: 0,\n                        background: p.scrim,\n                        opacity: 1 - groundO,\n                      }}\n                    />\n                    <div\n                      style={{\n                        position: \"absolute\",\n                        inset: 0,\n                        background: p.shade,\n                        opacity: groundO,\n                      }}\n                    />\n                  </>\n                ) : null}\n\n                <div\n                  style={{\n                    position: \"absolute\",\n                    inset: 0,\n                    padding: `${18 * u}px ${portrait ? 24 * u : 0}px`,\n                    display: \"flex\",\n                    flexDirection: portrait ? \"row\" : \"column\",\n                    alignItems: portrait ? \"center\" : \"center\",\n                    justifyContent: \"space-between\",\n                    opacity: labelO * interpolate(r, [0.4, 1], [0, 1], CLAMP),\n                  }}\n                >\n                  <div\n                    style={{\n                      display: \"flex\",\n                      flexDirection: portrait ? \"row\" : \"column\",\n                      alignItems: \"center\",\n                      gap: 10 * u,\n                    }}\n                  >\n                    <span\n                      style={{\n                        fontFamily: mono.fontFamily,\n                        fontWeight: 400,\n                        fontSize: labelFs * 1.15,\n                        letterSpacing: \"0.04em\",\n                        color: numColor,\n                      }}\n                    >\n                      {pad2(i + 1)}\n                    </span>\n                    {past ? (\n                      <span\n                        style={{\n                          width: 6 * u,\n                          height: 6 * u,\n                          borderRadius: 99,\n                          background: accent,\n                        }}\n                      />\n                    ) : null}\n                  </div>\n                  <div\n                    style={{\n                      display: \"flex\",\n                      alignItems: \"center\",\n                      gap: 12 * u,\n                      writingMode: portrait ? undefined : \"vertical-rl\",\n                      transform: portrait ? undefined : \"rotate(180deg)\",\n                      whiteSpace: \"nowrap\",\n                    }}\n                  >\n                    <span\n                      style={{\n                        fontFamily: mono.fontFamily,\n                        fontWeight: 400,\n                        fontSize: labelFs,\n                        letterSpacing: \"0.1em\",\n                        textTransform: \"uppercase\",\n                        color: past ? p.muted : p.faint,\n                      }}\n                    >\n                      {d.day}\n                    </span>\n                    {sliverTitle ? (\n                      <span\n                        style={{\n                          fontFamily,\n                          fontWeight: 400,\n                          fontSize: labelFs * 1.6,\n                          letterSpacing: \"-0.02em\",\n                          color: past ? fg : p.muted,\n                        }}\n                      >\n                        {sliverTitle}\n                      </span>\n                    ) : null}\n                  </div>\n                </div>\n\n                {isAct ? renderOpen(d, i, \"in\", size) : null}\n                {isFrom ? renderOpen(d, i, \"out\", size) : null}\n              </div>\n            );\n          })}\n        </div>\n      </ScaleLayer>\n    </AbsoluteFill>\n  );\n}\n"}]}