{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "macro-tab-name",
  "title": "Macro Tab Name",
  "description": "A macro-zoomed tab chip reads \"Launch Assets\" as a cursor moves in and clicks.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "registryDependencies": ["@remocn/gsh"],
  "files": [
    {
      "path": "registry/remocn/macro-tab-name/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadInterTight } from \"@remotion/google-fonts/InterTight\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n  AbsoluteFill,\n  continueRender,\n  delayRender,\n  Easing,\n  interpolate,\n  random,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst inter = loadInterTight(\"normal\", {\n  weights: [\"300\", \"400\"],\n  subsets: [\"latin\"],\n});\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst EXIT = Easing.bezier(0.55, 0, 1, 0.45);\nconst FOCUS = Easing.bezier(0.22, 1, 0.36, 1);\nconst SWAY = Easing.bezier(0.45, 0, 0.55, 1);\nconst GROW = { mass: 0.5, damping: 13, stiffness: 240 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst GLIDE = { mass: 0.8, damping: 22, stiffness: 150 };\n\nconst B = {\n  focus: 0,\n  type: 10,\n  step: 3,\n  space: 6,\n  clicks: [1, 6],\n  park: 12,\n  morph: 60,\n  resolve: 86,\n  end: 108,\n};\n\nexport const MACRO_TAB_NAME_DURATION = B.end;\n\nconst MEASURE_PX = 100;\n\nconst ramp = (f: number, start: number, dur: number, easing = ENTER) =>\n  interpolate(f, [start, start + dur], [0, 1], {\n    extrapolateLeft: \"clamp\",\n    extrapolateRight: \"clamp\",\n    easing,\n  });\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\ninterface Metrics {\n  width: (s: string) => number;\n}\n\nfunction buildMetrics(_version: number): Metrics {\n  const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n  const font = `400 ${MEASURE_PX}px \"${inter.fontFamily}\"`;\n  const cache: Record<string, number> = {};\n  return {\n    width: (s: string) => {\n      if (cache[s] === undefined) {\n        if (!ctx) return s.length * 0.52;\n        ctx.font = font;\n        cache[s] = ctx.measureText(s).width / MEASURE_PX;\n      }\n      return cache[s];\n    },\n  };\n}\n\nfunction useMetrics() {\n  const [version, setVersion] = useState(0);\n  const [handle] = useState(() => delayRender(\"macro-tab-name: measuring\"));\n  const released = useRef(false);\n  useEffect(() => {\n    let live = true;\n    const bump = () => {\n      if (live) setVersion((v) => v + 1);\n    };\n    document.fonts.addEventListener(\"loadingdone\", bump);\n    Promise.all([\n      inter.waitUntilDone(),\n      document.fonts.load(`400 ${MEASURE_PX}px \"${inter.fontFamily}\"`),\n    ])\n      .catch(() => undefined)\n      .then(() => {\n        bump();\n        if (!released.current) {\n          released.current = true;\n          continueRender(handle);\n        }\n      });\n    return () => {\n      live = false;\n      document.fonts.removeEventListener(\"loadingdone\", bump);\n    };\n  }, [handle]);\n  return useMemo(() => buildMetrics(version), [version]);\n}\n\nfunction FileIcon({ size, color }: { size: number; color: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 24 24\"\n      width={size}\n      height={size}\n      style={{ display: \"block\" }}\n      aria-hidden\n    >\n      <g\n        fill=\"none\"\n        stroke={color}\n        strokeWidth={1.5}\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n      >\n        <path d=\"M6 2.8h7.6L18.5 7.7v13.5H6z\" />\n        <path d=\"M13.3 2.8v5.2h5.2\" />\n      </g>\n    </svg>\n  );\n}\n\nfunction Cursor({ size }: { size: number }) {\n  return (\n    <svg\n      viewBox=\"0 0 24 24\"\n      width={size}\n      height={size}\n      style={{\n        display: \"block\",\n        filter: \"drop-shadow(0 4px 6px rgba(0,0,0,0.3))\",\n      }}\n      aria-hidden\n    >\n      <path\n        d=\"M5 3.2v15.6l4.3-4.1 2.7 6.1 2.6-1.1-2.7-6h6z\"\n        fill=\"#0d0f10\"\n        stroke=\"#fff\"\n        strokeWidth={1.4}\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  );\n}\n\nexport interface MacroTabNameProps {\n  theme?: \"dark\" | \"light\";\n  accent?: string;\n  name?: string;\n  neighbors?: string[];\n  path?: string[];\n  docMeta?: string;\n  docBody?: string[];\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}\n\nexport function MacroTabName({\n  theme = \"dark\",\n  accent = \"#3B5BFD\",\n  name = \"Launch Assets\",\n  neighbors = [\"Changelog\", \"Pricing\"],\n  path = [\"Marketing\", \"Launch week\"],\n  docMeta = \"Edited 2 min ago · 14 files\",\n  docBody = [\n    \"Hero cut, 0:42 — 1080p and 4K masters\",\n    \"Pricing table screenshots, light and dark\",\n    \"Waitlist email header, 600 × 200\",\n    \"Social cutdowns: 1:1, 4:5, 9:16\",\n  ],\n  ground,\n  groundParams,\n}: MacroTabNameProps) {\n  const frame = useCurrentFrame();\n  const { width, height, fps } = useVideoConfig();\n  const m = useMetrics();\n  const dark = theme === \"dark\";\n  const portrait = height > width * 1.2;\n  const stageW = portrait ? 1080 : 1280;\n  const stageH = portrait ? 1920 : 720;\n  const sc = width / stageW;\n\n  const ink = dark ? \"#f1f2f8\" : \"#15171d\";\n  const soft = dark ? \"rgba(230,233,245,0.55)\" : \"rgba(21,23,29,0.5)\";\n  const xColor = dark ? \"rgba(230,233,245,0.62)\" : \"rgba(21,23,29,0.5)\";\n  const chipBg = dark\n    ? \"linear-gradient(180deg, #2a2d3b 0%, #1f2230 100%)\"\n    : \"linear-gradient(180deg, #ffffff 0%, #fbfbfc 100%)\";\n  const chipShadow = dark\n    ? \"0 0 0 1px rgba(255,255,255,0.1), inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 10px rgba(0,0,0,0.35), 0 24px 48px rgba(0,0,12,0.45)\"\n    : \"0 0 0 1px rgba(20,24,40,0.06), 0 2px 4px rgba(30,30,80,0.05), 0 14px 30px rgba(30,30,90,0.08), 0 40px 80px rgba(30,30,90,0.1)\";\n  const band = dark ? \"rgba(255,255,255,0.035)\" : \"rgba(255,255,255,0.45)\";\n  const bandLine = dark ? \"rgba(255,255,255,0.07)\" : \"rgba(20,24,40,0.07)\";\n\n  const F = portrait ? 96 : 84;\n  const chipH = F * 1.86;\n  const padX = F * 0.46;\n  const iconS = F * 0.86;\n  const gap = F * 0.3;\n  const xGap = F * 0.62;\n  const xS = F * 0.44;\n  const cx = stageW / 2;\n  const cy = portrait ? stageH * 0.37 : stageH * 0.44;\n  const bandTop = cy - chipH / 2 - F * 0.34;\n  const bandBottom = cy + chipH / 2 + F * 0.34;\n  const docW = portrait ? 880 : 1040;\n  const docL = stageW / 2 - docW / 2;\n\n  const chars = Array.from(name);\n  const times: number[] = [];\n  let t = B.type;\n  for (let i = 0; i < chars.length; i++) {\n    times.push(t);\n    const jitter = Math.round((random(`mtn-${i}`) - 0.5) * 2);\n    t += chars[i] === \" \" ? B.space : B.step + (i > 0 ? jitter : 0);\n  }\n  const typedEnd = t;\n  const track = -0.018 * F;\n  const prefix = chars.map(\n    (_, i) => m.width(chars.slice(0, i).join(\"\")) * F + i * track,\n  );\n  const full = m.width(name) * F + chars.length * track;\n  const adv = chars.map((_, i) =>\n    i === chars.length - 1 ? full - prefix[i] : prefix[i + 1] - prefix[i],\n  );\n  let textW = 0;\n  for (let i = 0; i < chars.length; i++) {\n    textW +=\n      adv[i] * spring({ frame: frame - times[i] + 1, fps, config: GROW });\n  }\n  const typedCount = times.filter((ti) => frame >= ti).length;\n\n  const caretW = Math.max(2, F * 0.04);\n  const chipW = padX + iconS + gap + textW + caretW + xGap + xS + padX;\n  const chipL = cx - chipW / 2;\n  const textL = chipL + padX + iconS + gap;\n\n  const focus = ramp(frame, B.focus, 16, FOCUS);\n  const push =\n    mix(1.14, 1, focus) * (1 + 0.04 * ramp(frame, 16, B.end - 16, SWAY));\n  const blurAll = (1 - focus) * 7;\n\n  const caretVis =\n    frame < typedEnd + 4\n      ? frame < B.type\n        ? Math.floor(frame / 6) % 2 === 0\n        : true\n      : Math.floor((frame - typedEnd) / 6) % 2 === 0 && frame < B.morph - 2;\n\n  const morphOut =\n    ramp(frame, B.morph, 7, EXIT) * (1 - ramp(frame, B.resolve + 2, 8, FOCUS));\n  const iconBack = spring({ frame: frame - B.resolve - 2, fps, config: CHIP });\n  const ringIn = spring({ frame: frame - B.morph - 3, fps, config: CHIP });\n  const ringOut = ramp(frame, B.resolve, 6, EXIT);\n  const ringSweep = interpolate(\n    frame,\n    [B.morph + 3, B.resolve - 4],\n    [0.18, 1],\n    {\n      extrapolateLeft: \"clamp\",\n      extrapolateRight: \"clamp\",\n      easing: Easing.bezier(0.65, 0, 0.35, 1),\n    },\n  );\n  const ringSpin = (frame - B.morph) * 9;\n  const iconScale =\n    frame < B.resolve + 2 ? 1 - 0.45 * morphOut : mix(0.55, 1, iconBack);\n\n  const lead = neighbors.slice(-2);\n  const neighborW = lead.map(\n    (s) => F * (0.86 + 0.3) + m.width(s) * F + padX * 2,\n  );\n  const nbGap = F * 0.22;\n  let nx = chipL - nbGap;\n  const neighborX = neighborW\n    .slice()\n    .reverse()\n    .map((w) => {\n      nx -= w;\n      const x = nx;\n      nx -= nbGap;\n      return x;\n    })\n    .reverse();\n  const plusX = chipL + chipW + F * 0.5;\n  const titleK = ramp(frame, B.resolve + 4, 12, FOCUS);\n  const docLines = portrait ? docBody : docBody.slice(0, 1);\n\n  const curFrom = { x: cx + chipW * 0.62, y: cy + chipH * 1.9 };\n  const curHit = { x: cx - F * 0.12, y: cy + F * 0.08 };\n  const curRest = { x: cx + chipW * 0.36, y: cy + chipH * 0.78 };\n  const arrive = spring({\n    frame: frame + 12,\n    fps,\n    config: GLIDE,\n    durationInFrames: 13,\n  });\n  const park = spring({ frame: frame - B.park, fps, config: GLIDE });\n  const bow = (t: number, a: number, b: number) =>\n    Math.sin(Math.PI * Math.min(1, Math.max(0, t))) * (b - a) * 0.18;\n  const curX =\n    frame < B.park\n      ? mix(curFrom.x, curHit.x, arrive) + bow(arrive, curFrom.y, curHit.y)\n      : mix(curHit.x, curRest.x, park);\n  const curY =\n    frame < B.park\n      ? mix(curFrom.y, curHit.y, arrive) - bow(arrive, curFrom.x, curHit.x)\n      : mix(curHit.y, curRest.y, park);\n  const curPress = B.clicks.reduce(\n    (acc, c) =>\n      Math.max(\n        acc,\n        spring({ frame: frame - c + 2, fps, config: CHIP }) -\n          spring({ frame: frame - c - 1, fps, config: CHIP }),\n      ),\n    0,\n  );\n  const curIn = ramp(frame, -12, 8);\n\n  const resolvedGround: GshPresetId | undefined =\n    ground ?? (dark ? undefined : \"paper-crease\");\n  const resolvedParams: Partial<GradientParams> | undefined =\n    groundParams ??\n    (dark && !ground\n      ? {\n          kind: \"mist\",\n          colors: [\"#dbe3ff\", \"#6d84ff\", \"#2738b0\", \"#090d2e\"],\n          background: \"#03040c\",\n          speed: 0.8,\n          loopSeconds: 16,\n          scale: 0.9,\n          warp: 0.4,\n          blur: 0.75,\n          grain: 0.1,\n          seed: 11,\n        }\n      : undefined);\n\n  return (\n    <AbsoluteFill style={{ fontFamily: inter.fontFamily, overflow: \"hidden\" }}>\n      <GshGround\n        preset={resolvedGround}\n        params={resolvedParams}\n        timeOffset={4}\n        timeScale={0.4}\n      />\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0,\n          top: 0,\n          width: stageW,\n          height: stageH,\n          transform: `scale(${sc})`,\n          transformOrigin: \"0 0\",\n          overflow: \"hidden\",\n        }}\n      >\n        <div\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            transform: `scale(${push})`,\n            transformOrigin: `${cx}px ${cy}px`,\n            filter: blurAll > 0.05 ? `blur(${blurAll}px)` : undefined,\n          }}\n        >\n          <div\n            style={{\n              position: \"absolute\",\n              left: -40,\n              right: -40,\n              top: bandTop,\n              height: bandBottom - bandTop,\n              background: band,\n              borderTop: `1px solid ${bandLine}`,\n              borderBottom: `1px solid ${bandLine}`,\n              filter: \"blur(1.5px)\",\n            }}\n          />\n          <div\n            style={{\n              position: \"absolute\",\n              left: docL,\n              top: bandTop - F * 1.45,\n              height: F * 0.9,\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: F * 0.28,\n              fontSize: F * 0.5,\n              color: soft,\n              whiteSpace: \"nowrap\",\n              filter: \"blur(5px)\",\n              opacity: 0.6,\n            }}\n          >\n            <svg\n              viewBox=\"0 0 24 24\"\n              width={F * 0.5}\n              height={F * 0.5}\n              style={{ display: \"block\" }}\n              aria-hidden\n            >\n              <path\n                d=\"M14.5 6l-6 6 6 6\"\n                fill=\"none\"\n                stroke={soft}\n                strokeWidth={1.6}\n                strokeLinecap=\"round\"\n                strokeLinejoin=\"round\"\n              />\n            </svg>\n            <svg\n              viewBox=\"0 0 24 24\"\n              width={F * 0.5}\n              height={F * 0.5}\n              style={{ display: \"block\", opacity: 0.5 }}\n              aria-hidden\n            >\n              <path\n                d=\"M9.5 6l6 6-6 6\"\n                fill=\"none\"\n                stroke={soft}\n                strokeWidth={1.6}\n                strokeLinecap=\"round\"\n                strokeLinejoin=\"round\"\n              />\n            </svg>\n            <span style={{ marginLeft: F * 0.2 }}>\n              {[...path, titleK > 0.5 ? name : \"Untitled\"].join(\"  /  \")}\n            </span>\n          </div>\n          <div\n            style={{\n              position: \"absolute\",\n              left: docL,\n              top: bandBottom + F * 0.8,\n              width: docW,\n              color: ink,\n              whiteSpace: \"nowrap\",\n            }}\n          >\n            <div\n              style={{\n                position: \"relative\",\n                height: F * 1.3,\n                fontSize: F * 1.05,\n                letterSpacing: \"-0.02em\",\n                filter: \"blur(2.5px)\",\n                opacity: 0.62,\n              }}\n            >\n              <div\n                style={{\n                  position: \"absolute\",\n                  inset: 0,\n                  opacity: 1 - titleK,\n                  color: soft,\n                }}\n              >\n                Untitled\n              </div>\n              <div\n                style={{\n                  position: \"absolute\",\n                  inset: 0,\n                  opacity: titleK,\n                  transform: `translateY(${(1 - titleK) * F * 0.18}px)`,\n                }}\n              >\n                {name}\n              </div>\n            </div>\n            <div\n              style={{\n                marginTop: F * 0.22,\n                fontSize: F * 0.46,\n                color: soft,\n                filter: \"blur(3.5px)\",\n                opacity: 0.7,\n                fontVariantNumeric: \"tabular-nums\",\n              }}\n            >\n              {docMeta}\n            </div>\n            {docLines.map((line, i) => (\n              <div\n                key={line}\n                style={{\n                  marginTop: i === 0 ? F * 0.7 : F * 0.36,\n                  fontSize: F * 0.56,\n                  color: soft,\n                  filter: `blur(${4.5 + i * 1.2}px)`,\n                  opacity: 0.6 - i * 0.08,\n                  fontVariantNumeric: \"tabular-nums\",\n                }}\n              >\n                {line}\n              </div>\n            ))}\n          </div>\n          {lead.map((label, i) => (\n            <div\n              key={label}\n              style={{\n                position: \"absolute\",\n                left: neighborX[i],\n                top: cy - chipH / 2,\n                width: neighborW[i],\n                height: chipH,\n                padding: `0 ${padX}px`,\n                display: \"flex\",\n                alignItems: \"center\",\n                gap: F * 0.3,\n                fontSize: F,\n                color: soft,\n                whiteSpace: \"nowrap\",\n                filter: `blur(${i === lead.length - 1 ? 3.5 : 6}px)`,\n                opacity: i === lead.length - 1 ? 0.75 : 0.5,\n              }}\n            >\n              <FileIcon size={F * 0.86} color={soft} />\n              <span>{label}</span>\n            </div>\n          ))}\n          <div\n            style={{\n              position: \"absolute\",\n              left: plusX,\n              top: cy - F * 0.4,\n              width: F * 0.8,\n              height: F * 0.8,\n              filter: \"blur(3.5px)\",\n              opacity: 0.7,\n            }}\n          >\n            <svg\n              viewBox=\"0 0 24 24\"\n              width={F * 0.8}\n              height={F * 0.8}\n              aria-hidden\n            >\n              <path\n                d=\"M12 5v14M5 12h14\"\n                stroke={soft}\n                strokeWidth={1.5}\n                strokeLinecap=\"round\"\n              />\n            </svg>\n          </div>\n\n          <div\n            style={{\n              position: \"absolute\",\n              left: chipL,\n              top: cy - chipH / 2,\n              width: chipW,\n              height: chipH,\n              borderRadius: F * 0.4,\n              background: chipBg,\n              boxShadow: chipShadow,\n            }}\n          />\n          <div\n            style={{\n              position: \"absolute\",\n              left: chipL + padX,\n              top: cy - iconS / 2,\n              width: iconS,\n              height: iconS,\n            }}\n          >\n            <div\n              style={{\n                position: \"absolute\",\n                inset: 0,\n                opacity: 1 - morphOut,\n                transform: `scale(${iconScale})`,\n              }}\n            >\n              <FileIcon size={iconS} color={ink} />\n            </div>\n            {frame >= B.morph ? (\n              <svg\n                viewBox=\"0 0 24 24\"\n                width={iconS}\n                height={iconS}\n                style={{\n                  position: \"absolute\",\n                  inset: 0,\n                  opacity: Math.min(1, ringIn) * (1 - ringOut),\n                  transform: `scale(${Math.max(0, ringIn) * (1 - 0.3 * ringOut)}) rotate(${ringSpin}deg)`,\n                }}\n                aria-hidden\n              >\n                <circle\n                  cx={12}\n                  cy={12}\n                  r={8}\n                  fill=\"none\"\n                  stroke={soft}\n                  strokeOpacity={0.35}\n                  strokeWidth={1.5}\n                />\n                <circle\n                  cx={12}\n                  cy={12}\n                  r={8}\n                  fill=\"none\"\n                  stroke={accent}\n                  strokeWidth={1.75}\n                  strokeLinecap=\"round\"\n                  strokeDasharray={`${ringSweep * 50.3} 60`}\n                  transform=\"rotate(-90 12 12)\"\n                />\n              </svg>\n            ) : null}\n          </div>\n          <div\n            style={{\n              position: \"absolute\",\n              left: textL,\n              top: cy - chipH / 2,\n              width: textW + caretW + F * 0.04,\n              height: chipH,\n            }}\n          >\n            {chars.map((ch, i) => {\n              if (frame < times[i] || ch === \" \") return null;\n              const k = ramp(frame, times[i], 4, FOCUS);\n              return (\n                <span\n                  key={`c${i.toString()}`}\n                  style={{\n                    position: \"absolute\",\n                    left: prefix[i],\n                    top: 0,\n                    height: chipH,\n                    lineHeight: `${chipH}px`,\n                    fontSize: F,\n                    letterSpacing: 0,\n                    color: ink,\n                    whiteSpace: \"pre\",\n                    opacity: k,\n                    filter: k < 0.99 ? `blur(${(1 - k) * 5}px)` : undefined,\n                    transform: `translateY(${(1 - k) * F * 0.14}px)`,\n                  }}\n                >\n                  {ch}\n                </span>\n              );\n            })}\n            <div\n              style={{\n                position: \"absolute\",\n                left:\n                  (typedCount > 0\n                    ? prefix[typedCount - 1] + adv[typedCount - 1]\n                    : 0) +\n                  F * 0.02,\n                top: chipH / 2 - F * 0.42,\n                width: caretW,\n                height: F * 0.84,\n                borderRadius: caretW,\n                background: accent,\n                opacity: caretVis ? 1 : 0,\n              }}\n            />\n          </div>\n          <svg\n            viewBox=\"0 0 24 24\"\n            width={xS}\n            height={xS}\n            style={{\n              position: \"absolute\",\n              left: chipL + chipW - padX - xS,\n              top: cy - xS / 2,\n            }}\n            aria-hidden\n          >\n            <path\n              d=\"M5 5l14 14M19 5L5 19\"\n              stroke={xColor}\n              strokeWidth={1.6}\n              strokeLinecap=\"round\"\n            />\n          </svg>\n\n          <div\n            style={{\n              position: \"absolute\",\n              left: curX,\n              top: curY,\n              opacity: curIn,\n              transform: `scale(${1 - 0.04 * curPress})`,\n              transformOrigin: \"20% 15%\",\n            }}\n          >\n            <Cursor size={F * 0.72} />\n          </div>\n        </div>\n      </div>\n    </AbsoluteFill>\n  );\n}\n\nexport default MacroTabName;\n",
      "type": "registry:component",
      "target": "components/remocn/macro-tab-name.tsx"
    }
  ],
  "type": "registry:component"
}
