{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"channel-thread","type":"registry:component","title":"Channel Thread","description":"Slack-style chat animation: team messages arrive with typing dots. A work chat filling itself in, the way the channel actually reads: an avatar, a name in bold, a quiet timestamp and the messages as plain lines under them.","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>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/channel-thread.tsx","type":"registry:component","target":"components/kuchi/channel-thread.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Barlow\";\r\nimport type { CSSProperties } from \"react\";\r\nimport { useCallback, useState } from \"react\";\r\nimport {\r\n  AbsoluteFill,\r\n  continueRender,\r\n  delayRender,\r\n  getRemotionEnvironment,\r\n  staticFile,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport {\r\n  Item,\r\n  mixOklch,\r\n  resolveFont,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n  withAlpha,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\n/**\r\n * A work chat filling itself in, the way the channel actually reads.\r\n *\r\n * Not bubbles: a transcript. An avatar, a name in bold, a quiet timestamp, and\r\n * the messages under them as plain lines — the shape every team tool has\r\n * settled on. Messages land one at a time; a second message from the same\r\n * person joins the group without repeating the name; and when somebody new\r\n * starts typing, three dots hold their line until the words arrive. The\r\n * transcript never creeps: it sits perfectly still between arrivals and then\r\n * scrolls, once, by exactly the room the new line needs.\r\n *\r\n * ## The layout came off a recording and it closes to the pixel\r\n *\r\n * Four numbers describe every vertical position in the scene, measured on a\r\n * 638 × 354 capture by thresholding the ink of eighty frames:\r\n *\r\n *     name → its first message      37.59\r\n *     message → message             46.01\r\n *     last message → next name      69.00\r\n *     first message, before any scroll, at   158.90\r\n *\r\n * That is not a model fitted to the frames, it is *checked* against them. Take\r\n * the first message's start, add the two arrivals' scroll (46.01 + 2 × 46.01),\r\n * and the oldest line lands at 20.87; the recording's last frame has it at 21.\r\n * Carry the same arithmetic down to the newest name and it predicts 138.9 where\r\n * the recording measures 139.00. Nine tenths of a pixel over a whole scene.\r\n *\r\n * ## The scroll is an event, not a drift\r\n *\r\n * Between arrivals the transcript is *byte-identical* frame to frame — the\r\n * measured movement is 0.00px for twenty-nine frames at the head of the clip and\r\n * for another eight in the middle. Everything that looks like life comes from\r\n * the arrivals themselves. `SCROLL` is one of those moves, measured: it\r\n * accelerates for four frames, peaks at 5.1px, and then spends three quarters of\r\n * a second arriving.\r\n *\r\n * A caveat, because it is measured and it is not reproduced: the recording's\r\n * two-row scroll runs about 1.6× faster in normalised time than its one-row\r\n * scroll — a longer move that takes *less* time, which is a browser's native\r\n * smooth-scroll heuristic and not something a scene should imitate. One curve\r\n * ships, taken from the one-row move, and a two-row move simply travels twice\r\n * as far along it.\r\n */\r\n\r\nconst { fontFamily: SANS } = loadSans(\"normal\", {\r\n  weights: [\"400\", \"500\", \"600\", \"700\"],\r\n  subsets: [\"latin\"],\r\n});\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   The transcript, in the recording's own 638 × 354 pixels\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nexport const REF_W = 638;\r\nexport const REF_H = 354;\r\n\r\n/** Baseline of a group's first message, below the name. */\r\nexport const NAME_GAP = 37.59;\r\n/** Baseline to baseline, within a group. */\r\nexport const MSG_GAP = 46.01;\r\n/** Last message of a group to the next group's name. */\r\nexport const GROUP_GAP = 69;\r\n/** Where the oldest message sits before anything has arrived. */\r\nexport const START_Y = 158.9;\r\n/**\r\n * The line the newest message rests on, and the whole reason the transcript is\r\n * still between arrivals.\r\n *\r\n * It does not scroll on every message — the recording's second message lands\r\n * with the stack measurably motionless, 0.00px for twenty-nine frames. It\r\n * scrolls only by however far the newest baseline would fall *past* this line,\r\n * which is zero until the thread is tall enough to reach it. One constant\r\n * replaces a per-message \"does this one scroll\" flag, and it is what makes the\r\n * arithmetic close: 158.90 + 46.01 is above it and moves nothing; the next two\r\n * rows put the newest baseline at 311.50 and the scroll settles at exactly\r\n * 92.02, which is what the recording measures.\r\n */\r\nexport const ANCHOR = 219.48;\r\n\r\n/** The avatar is square, and its top sits this far above the name's baseline. */\r\nexport const AVATAR = 70;\r\nexport const AVATAR_X = 119.5;\r\nexport const AVATAR_RISE = 28;\r\n/** Left of the text column's box. Ink starts at 201.1 (name) and 202.4 (body). */\r\nexport const TEXT_X = 202;\r\n\r\n/** Body type. Cap height measured at 22.40px. */\r\nexport const SIZE = 31.2;\r\n/** The timestamp, measured on its digits: cap 18.09. */\r\nexport const TIME_SIZE = 24.9;\r\n/** Box top → baseline at `lineHeight: 1`. A face metric, measured, not guessed. */\r\nexport const ASC = 28.95;\r\n\r\n/** Typing dots: on the line the message will take, a little above its baseline. */\r\nexport const DOT = 5;\r\nexport const DOT_GAP = 8.4;\r\nexport const DOT_RISE = 5.7;\r\n/** A dot every this many seconds, then the ellipsis starts over. */\r\nexport const DOT_BEAT = 0.1;\r\n/**\r\n * Frames between a group's row opening and the group appearing in it.\r\n *\r\n * The room is made first and the person arrives into it: the recording starts\r\n * scrolling on frame 37 and does not paint the avatar, the name or the first\r\n * dot until frame 40. Three frames is nothing to watch and everything to match,\r\n * and it is also what the dots are timed from — anchor their cycle to the scroll\r\n * instead and the ellipsis is a step out of phase for its whole life.\r\n */\r\nexport const LEAD = 3;\r\n\r\n/**\r\n * One arrival's scroll, as (seconds since it started, share of the travel).\r\n *\r\n * Recovered by correlating each frame's vertical ink profile against the last —\r\n * which reads the move off every visible row at once rather than tracking one\r\n * word — and checked against the absolute baseline of the bold name row, which\r\n * agrees to a third of a pixel.\r\n */\r\nexport const SCROLL: readonly (readonly [number, number])[] = [\r\n  [0, 0],\r\n  [0.0167, 0.004],\r\n  [0.05, 0.016],\r\n  [0.0833, 0.044],\r\n  [0.1167, 0.093],\r\n  [0.15, 0.178],\r\n  [0.1833, 0.289],\r\n  [0.2167, 0.398],\r\n  [0.25, 0.486],\r\n  [0.2833, 0.557],\r\n  [0.3167, 0.616],\r\n  [0.35, 0.663],\r\n  [0.3833, 0.702],\r\n  [0.4167, 0.737],\r\n  [0.45, 0.767],\r\n  [0.4833, 0.791],\r\n  [0.5167, 0.814],\r\n  [0.55, 0.834],\r\n  [0.5833, 0.852],\r\n  [0.6167, 0.867],\r\n  [0.65, 0.881],\r\n  [0.6917, 0.893],\r\n  [0.7167, 0.903],\r\n  [0.75, 0.912],\r\n  [0.7833, 0.919],\r\n  [1.1, 1],\r\n];\r\n\r\n/**\r\n * How far a line is faded, by its height in the frame.\r\n *\r\n * Read as an envelope over the whole clip: the brightest any pixel of a line\r\n * ever got at each height. Taking the maximum across every frame is what makes\r\n * it a property of the *position* — one sample would have read a line with no\r\n * ascenders as a dip in the gradient.\r\n *\r\n * It stops at a tenth rather than at nothing: the oldest line is cut off by the\r\n * frame, not erased by the fade.\r\n */\r\nexport const FADE: readonly (readonly [number, number])[] = [\r\n  [10, 0.098],\r\n  [25, 0.125],\r\n  [40, 0.149],\r\n  [55, 0.216],\r\n  [70, 0.357],\r\n  [85, 0.518],\r\n  [100, 0.651],\r\n  [115, 0.843],\r\n  [140, 0.98],\r\n  [175, 1],\r\n];\r\n\r\ntype Table = readonly (readonly [number, number])[];\r\n\r\n/** Linear read of a rising table, clamped at both ends. */\r\nexport function read(table: Table, x: number): number {\r\n  const first = table[0];\r\n  const last = table[table.length - 1];\r\n  if (!first || !last) return 0;\r\n  if (x <= first[0]) return first[1];\r\n  if (x >= last[0]) return last[1];\r\n  for (let i = 1; i < table.length; i++) {\r\n    const hi = table[i];\r\n    const lo = table[i - 1];\r\n    if (hi && lo && x <= hi[0]) {\r\n      return lo[1] + ((hi[1] - lo[1]) * (x - lo[0])) / (hi[0] - lo[0]);\r\n    }\r\n  }\r\n  return last[1];\r\n}\r\n\r\ninterface Line {\r\n  /** Baseline in transcript space, before any scroll. */\r\n  y: number;\r\n  /** Baseline of this group's name row, when this line heads a group. */\r\n  nameY: number;\r\n  group: number;\r\n  /** First line of a group, i.e. the one the name and avatar belong to. */\r\n  head: boolean;\r\n  text: string;\r\n  /** Frame the words land on. The row itself opens at `opens`. */\r\n  at: number;\r\n  opens: number;\r\n}\r\n\r\n/**\r\n * Lay the transcript out once, in transcript space.\r\n *\r\n * Positions are absolute and never re-flow: the scroll is a single translate\r\n * over the top of them. That is what lets every arrival be a number rather than\r\n * a layout pass, and it is why the stack can be perfectly still between them.\r\n */\r\nexport function layout(\r\n  groups: { person: string; time: string; lines: string[] }[],\r\n): Line[] {\r\n  const out: Line[] = [];\r\n  let last = START_Y - NAME_GAP;\r\n  let first = true;\r\n  for (let g = 0; g < groups.length; g++) {\r\n    const group = groups[g];\r\n    if (!group) continue;\r\n    for (let m = 0; m < group.lines.length; m++) {\r\n      const head = m === 0;\r\n      const nameY = head ? (first ? last : last + GROUP_GAP) : 0;\r\n      const y = head ? nameY + NAME_GAP : last + MSG_GAP;\r\n      out.push({\r\n        y,\r\n        nameY,\r\n        group: g,\r\n        head,\r\n        text: group.lines[m] ?? \"\",\r\n        at: 0,\r\n        opens: 0,\r\n      });\r\n      last = y;\r\n      first = false;\r\n    }\r\n  }\r\n  return out;\r\n}\r\n\r\n/**\r\n * One message. A message with the same author, time and avatar as the one\r\n * above it joins that group, under one name, the way the channel reads.\r\n */\r\nexport interface ThreadMessage {\r\n  text: string;\r\n  author?: string;\r\n  time?: string;\r\n  avatar?: string;\r\n  /** Frame the words land on. Default: the measured 0, 12, 60, 84, then every 24. */\r\n  at?: number;\r\n  /**\r\n   * Frame the row opens on, before the words land — typing dots, if it starts\r\n   * a group. Default: the measured 0, 12, 37, 72, then every 24.\r\n   */\r\n  opens?: number;\r\n}\r\n\r\nexport const DEFAULT_MESSAGES: readonly ThreadMessage[] = [\r\n  [\"rhea\", \"9:41 AM\", \"07\", \"Launch video by Thursday?\"],\r\n  [\"rhea\", \"9:41 AM\", \"07\", \"We have nothing shot.\"],\r\n  [\"sam\", \"9:42 AM\", \"13\", \"Already done.\"],\r\n  [\"sam\", \"9:42 AM\", \"13\", \"Built it out of kuchi.\"],\r\n].map(([author, time, face, text]) => ({\r\n  author,\r\n  time,\r\n  avatar: `https://kuchi-media.kalarislabs.com/components/art/avatar-${face}.svg`,\r\n  text: text ?? \"\",\r\n}));\r\n\r\n/** The recording's four arrivals; after them, a message every 24 frames. */\r\nconst BEATS = [0, 12, 60, 84];\r\nconst OPENS = [0, 12, 37, 72];\r\n\r\n/**\r\n * The string form of `messages`, for the customizer and for quick edits:\r\n * messages split by `|`, each `avatar > name time > text`. The name runs to\r\n * the first space. A message that is only text continues the one above it.\r\n *\r\n *   \"/avatars/07.jpg > rhea 9:41 AM > Launch video? | Nothing shot.\"\r\n */\r\nexport function toMessages(\r\n  input: readonly ThreadMessage[] | string,\r\n): readonly ThreadMessage[] {\r\n  if (typeof input !== \"string\") return input;\r\n  let head = { author: \"\", time: \"\", avatar: \"\" };\r\n  return input\r\n    .split(\"|\")\r\n    .filter((m) => m.trim())\r\n    .map((m) => {\r\n      const parts = m.split(\">\").map((v) => v.trim());\r\n      const text = parts.pop() ?? \"\";\r\n      const who = parts.pop();\r\n      if (who !== undefined) {\r\n        const cut = who.indexOf(\" \");\r\n        head = {\r\n          author: cut < 0 ? who : who.slice(0, cut),\r\n          time: cut < 0 ? \"\" : who.slice(cut + 1),\r\n          avatar: parts.pop() ?? \"\",\r\n        };\r\n      }\r\n      return { ...head, text };\r\n    });\r\n}\r\n\r\nexport interface ChannelThreadProps {\r\n  /** The conversation, in order. Also takes the string form: see `toMessages`. */\r\n  messages?: readonly ThreadMessage[] | string;\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  fontFamily?: string;\r\n}\r\n\r\nexport function ChannelThread({\r\n  messages = DEFAULT_MESSAGES,\r\n  theme,\r\n  mode = \"dark\",\r\n  fontFamily = \"Default\",\r\n}: ChannelThreadProps) {\r\n  const frame = useCurrentFrame();\r\n  const { fps, width, height } = useVideoConfig();\r\n  const t = useKuchiTheme(theme, mode);\r\n  const face = resolveFont(fontFamily) ?? SANS;\r\n\r\n  const u = height / REF_H;\r\n  const ox = (width - REF_W * u) / 2;\r\n  const now = frame / fps;\r\n\r\n  const said = toMessages(messages).filter((m) => m.text.trim());\r\n  const groups: {\r\n    person: string;\r\n    time: string;\r\n    avatar: string;\r\n    lines: string[];\r\n  }[] = [];\r\n  for (const m of said) {\r\n    const [person = \"\", time = \"\", avatar = \"\"] = [m.author, m.time, m.avatar];\r\n    const g = groups[groups.length - 1];\r\n    if (g && g.person === person && g.time === time && g.avatar === avatar) {\r\n      g.lines.push(m.text.trim());\r\n    } else {\r\n      groups.push({ person, time, avatar, lines: [m.text.trim()] });\r\n    }\r\n  }\r\n\r\n  const lines = layout(groups);\r\n  lines.forEach((l, i) => {\r\n    const m = said[i];\r\n    l.at = m?.at ?? BEATS[i] ?? 84 + 24 * (i - 3);\r\n    l.opens =\r\n      i === 0\r\n        ? Number.NEGATIVE_INFINITY\r\n        : (m?.opens ?? OPENS[i] ?? 72 + 24 * (i - 3));\r\n  });\r\n\r\n  // Each opened row moves the target to however far its baseline falls past the\r\n  // anchor. A row that does not reach the anchor moves nothing, which is the\r\n  // stillness in the reference rather than an exception carved out for it.\r\n  let scroll = 0;\r\n  let target = 0;\r\n  for (const l of lines) {\r\n    const want = Math.max(0, l.y - ANCHOR);\r\n    const step = want - target;\r\n    target = want;\r\n    if (step <= 0) continue;\r\n    // A longer move takes *less* time, not more — measured, twice: the two-row\r\n    // scroll runs 1.60× faster in normalised time than the one-row scroll, which\r\n    // is what a browser's native smooth scroll does with distance and what the\r\n    // recording therefore does. One curve, read faster the further it has to go.\r\n    const rate = (step / MSG_GAP) ** 0.68;\r\n    scroll += step * read(SCROLL, (now - l.opens / fps) * rate);\r\n  }\r\n\r\n  const ink = t.foreground;\r\n  const dim = t.mutedForeground;\r\n\r\n  return (\r\n    <AbsoluteFill style={{ backgroundColor: t.background }}>\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          left: ox,\r\n          top: 0,\r\n          width: REF_W * u,\r\n          height: REF_H * u,\r\n          fontFamily: face,\r\n          // Hinting re-snaps every stem as a line slides past, and the\r\n          // letterforms boil. This renders the outline as it actually is.\r\n          textRendering: \"geometricPrecision\",\r\n          whiteSpace: \"nowrap\",\r\n          overflow: \"hidden\",\r\n        }}\r\n      >\r\n        {lines.map((l, i) => {\r\n          const y = l.y - scroll;\r\n          if (y < -MSG_GAP || y > REF_H + MSG_GAP) return null;\r\n          const shown = frame >= l.at;\r\n          if (frame < l.opens) return null;\r\n          const arrived = frame >= l.opens + LEAD;\r\n          const g = groups[l.group];\r\n          const nameA = read(FADE, y - NAME_GAP);\r\n          const bodyA = read(FADE, y);\r\n          return (\r\n            <div key={`${l.group}-${i}`}>\r\n              {l.head && g && arrived && (\r\n                <>\r\n                  <Avatar\r\n                    src={g.avatar}\r\n                    name={g.person}\r\n                    y={(y - NAME_GAP - AVATAR_RISE) * u}\r\n                    u={u}\r\n                    t={t}\r\n                    alpha={read(FADE, y - NAME_GAP - AVATAR_RISE + AVATAR / 2)}\r\n                  />\r\n                  <div\r\n                    style={{\r\n                      position: \"absolute\",\r\n                      left: TEXT_X * u,\r\n                      top: (y - NAME_GAP - ASC) * u,\r\n                      fontSize: SIZE * u,\r\n                      lineHeight: 1,\r\n                      fontWeight: 700,\r\n                      color: ink,\r\n                      // Per row, not per group. The name sits 37.59px above its\r\n                      // first message and the gradient moves measurably over\r\n                      // that distance — sharing one opacity between them reads\r\n                      // as a name that refuses to leave.\r\n                      opacity: nameA,\r\n                    }}\r\n                  >\r\n                    {g.person}\r\n                    <span\r\n                      style={{\r\n                        fontSize: TIME_SIZE * u,\r\n                        fontWeight: 500,\r\n                        color: dim,\r\n                        // The timestamp rides the name's baseline, so it is one\r\n                        // inline run and not a second absolutely-placed box to\r\n                        // keep in step when the name's width changes.\r\n                        marginLeft: 13.4 * u,\r\n                      }}\r\n                    >\r\n                      {g.time}\r\n                    </span>\r\n                  </div>\r\n                </>\r\n              )}\r\n              {shown ? (\r\n                // The message is the object Studio selects: its body line, by\r\n                // its index across the whole conversation.\r\n                <Item index={i}>\r\n                  <div\r\n                    style={{\r\n                      position: \"absolute\",\r\n                      left: TEXT_X * u,\r\n                      top: (y - ASC) * u,\r\n                      fontSize: SIZE * u,\r\n                      lineHeight: 1,\r\n                      color: ink,\r\n                      opacity: bodyA,\r\n                    }}\r\n                  >\r\n                    {l.text}\r\n                  </div>\r\n                </Item>\r\n              ) : (\r\n                l.head &&\r\n                arrived && (\r\n                  <Dots\r\n                    y={(y - DOT_RISE) * u}\r\n                    u={u}\r\n                    colour={mixOklch(dim, ink, 0.3)}\r\n                    since={now - (l.opens + LEAD) / fps}\r\n                    alpha={bodyA}\r\n                  />\r\n                )\r\n              )}\r\n            </div>\r\n          );\r\n        })}\r\n      </div>\r\n    </AbsoluteFill>\r\n  );\r\n}\r\n\r\n/** Three dots that arrive one at a time, then start over. */\r\nfunction Dots({\r\n  y,\r\n  u,\r\n  colour,\r\n  since,\r\n  alpha,\r\n}: {\r\n  y: number;\r\n  u: number;\r\n  colour: string;\r\n  since: number;\r\n  alpha: number;\r\n}) {\r\n  const step = Math.floor((since % (DOT_BEAT * 4)) / DOT_BEAT);\r\n  return (\r\n    <>\r\n      {[0, 1, 2].map((i) => (\r\n        <div\r\n          key={i}\r\n          style={{\r\n            position: \"absolute\",\r\n            left: (TEXT_X + 3.3 + i * DOT_GAP) * u,\r\n            top: y - (DOT / 2) * u,\r\n            width: DOT * u,\r\n            height: DOT * u,\r\n            borderRadius: \"50%\",\r\n            background: colour,\r\n            opacity: i < step ? alpha : 0,\r\n          }}\r\n        />\r\n      ))}\r\n    </>\r\n  );\r\n}\r\n\r\n/**\r\n * A root-relative asset is a `public/` file. Only the site's own Player serves\r\n * it at that path; Remotion Studio and a render know its URL through\r\n * `staticFile()` alone — so every environment but the Player rewrites it.\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/**\r\n * An avatar that holds the render until it has actually loaded.\r\n *\r\n * Without this a frame can be captured before the picture arrives and the\r\n * square comes out empty — invisible in the Player, where an image simply\r\n * appears, and silent in an mp4 until somebody watches it. Remotion's own `Img`\r\n * is avoided for the reason `hero-launch` documents: it awaits `decode()`, which\r\n * the headless compositor rejects for some progressive JPEGs and hangs the\r\n * export. `onError` releases too, so a bad source degrades to a missing picture\r\n * rather than a stuck render.\r\n */\r\nfunction Face({ src, style }: { src: string; style: CSSProperties }) {\r\n  const [handle] = useState(() => delayRender(`channel avatar: ${src}`));\r\n  const release = useCallback(() => continueRender(handle), [handle]);\r\n  return (\r\n    // biome-ignore lint/performance/noImgElement: Remotion frame, not a Next route.\r\n    <img // eslint-disable-line @remotion/warn-native-media-tag -- onLoad releases the frame; <Img> hangs on some JPEGs\r\n      src={resolveSrc(src)}\r\n      alt=\"\"\r\n      // Tailwind's preflight sets `img { max-width: 100% }`, which collapses an\r\n      // image inside a shrink-to-fit box to zero pixels wide on the site while\r\n      // rendering perfectly in an mp4. Size it here and say so.\r\n      style={{ ...style, maxWidth: \"none\" }}\r\n      onLoad={release}\r\n      onError={release}\r\n    />\r\n  );\r\n}\r\n\r\n/** The person's picture, or their initial on a tinted square when there is none. */\r\nfunction Avatar({\r\n  src,\r\n  name,\r\n  y,\r\n  u,\r\n  t,\r\n  alpha,\r\n}: {\r\n  src: string;\r\n  name: string;\r\n  y: number;\r\n  u: number;\r\n  t: KuchiTheme;\r\n  alpha: number;\r\n}) {\r\n  const box = {\r\n    position: \"absolute\" as const,\r\n    left: AVATAR_X * u,\r\n    top: y,\r\n    width: AVATAR * u,\r\n    height: AVATAR * u,\r\n    borderRadius: 8 * u,\r\n    overflow: \"hidden\" as const,\r\n    opacity: alpha,\r\n  };\r\n  if (src) return <Face src={src} style={{ ...box, objectFit: \"cover\" }} />;\r\n  return (\r\n    <div\r\n      style={{\r\n        ...box,\r\n        // A tinted tile with the accent's own letter on it: legible on either\r\n        // theme, and it moves with a user's palette instead of inventing a grey.\r\n        // An alpha tint rather than a mix — the page is a near-neutral, its hue\r\n        // in oklch is undefined, and interpolating toward the accent through it\r\n        // comes out somewhere else entirely. Measured: a blue accent over the\r\n        // warm off-white page mixed to a pale *green*.\r\n        background: withAlpha(t.primary, 0.16),\r\n        color: t.primary,\r\n        fontSize: AVATAR * 0.45 * u,\r\n        fontWeight: 600,\r\n        display: \"flex\",\r\n        alignItems: \"center\",\r\n        justifyContent: \"center\",\r\n      }}\r\n    >\r\n      {name.slice(0, 1).toUpperCase()}\r\n    </div>\r\n  );\r\n}\r\n"}]}