{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "beta-thanks",
  "title": "Beta Thanks",
  "description": "\"Remocn is out\" with a green \"out\", thanking the beta testers below.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/beta-thanks/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/BigShoulders\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n  AbsoluteFill,\n  continueRender,\n  delayRender,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst shoulders = loadFont(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\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\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      }}\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\nexport interface BetaThanksProps {\n  logo?: React.ReactNode;\n  tag?: string;\n  status?: string;\n  before?: string;\n  after?: string;\n  accent?: string;\n  background?: string;\n  speed?: number;\n  theme?: \"dark\" | \"light\";\n}\n\nconst THEMES = {\n  dark: { bg: \"#26231F\", ink: \"#F6F0E6\", accent: \"#2BD96B\" },\n  light: { bg: \"#F5F5F2\", ink: \"#000000\", accent: \"#0E9F4B\" },\n} as const;\n\nconst REF = 200;\nconst TAG_EM = 0.3;\nconst LINE2_EM = 0.36;\nconst STATUS_GAP = 0.2;\nconst LINE_GAP = 0.16;\n\nconst T_TAG = 10;\nconst T_LIFT = 40;\nconst T_TURN = 58;\nconst T_LAND = 78;\nconst T_STATUS = 58;\nconst T_BEFORE = 64;\nconst T_AFTER = 78;\nconst NATURAL_END = 94;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_TRAVEL = Easing.bezier(0.65, 0, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\ninterface Measured {\n  w: number;\n  h: number;\n  fromX: number;\n  fromY: number;\n  toX: number;\n  toY: number;\n}\n\nfunction offsetIn(el: HTMLElement, root: HTMLElement) {\n  let x = 0;\n  let y = 0;\n  let node: HTMLElement | null = el;\n  while (node && node !== root) {\n    x += node.offsetLeft;\n    y += node.offsetTop;\n    node = node.offsetParent as HTMLElement | null;\n  }\n  return { x, y };\n}\n\nfunction words(s: string) {\n  return s.split(/\\s+/).filter(Boolean);\n}\n\nexport function BetaThanks({\n  logo,\n  tag = \"beta\",\n  status = \"is out.\",\n  before = \"Thank you,\",\n  after = \"testers.\",\n  accent,\n  background,\n  speed = 1,\n  theme = \"dark\",\n}: BetaThanksProps) {\n  const frame = useCurrentFrame();\n  const { width: W, height: H, durationInFrames } = useVideoConfig();\n  const c = THEMES[theme];\n  const hi = accent ?? c.accent;\n  const stage =\n    background === \"transparent\" ? \"transparent\" : (background ?? c.bg);\n  const pace = Math.max(1, (NATURAL_END + 30) / Math.max(1, durationInFrames));\n  const t = frame * speed * pace;\n\n  const rootRef = useRef<HTMLDivElement>(null);\n  const logoRef = useRef<HTMLDivElement>(null);\n  const slotRef = useRef<HTMLSpanElement>(null);\n  const [handle] = useState(() => delayRender(\"beta-thanks: measuring\"));\n  const released = useRef(false);\n  const [fontsOk, setFontsOk] = useState(false);\n  const [m, setM] = useState<Measured | null>(null);\n\n  useEffect(() => {\n    let live = true;\n    Promise.all([\n      shoulders.waitUntilDone(),\n      manrope.waitUntilDone(),\n      document.fonts.load(`500 100px \"${shoulders.fontFamily}\"`),\n    ])\n      .catch(() => undefined)\n      .then(() => {\n        if (live) setFontsOk(true);\n      });\n    return () => {\n      live = false;\n    };\n  }, []);\n\n  useLayoutEffect(() => {\n    if (!fontsOk) return;\n    const root = rootRef.current;\n    const lg = logoRef.current;\n    const slot = slotRef.current;\n    if (!root || !lg || !slot) return;\n    const lp = offsetIn(lg, root);\n    const sp = offsetIn(slot, root);\n    const next: Measured = {\n      w: root.offsetWidth,\n      h: root.offsetHeight,\n      fromX: lp.x + lg.offsetWidth + REF * 0.07,\n      fromY: lp.y + REF * 0.085,\n      toX: sp.x,\n      toY: sp.y,\n    };\n    setM((prev) =>\n      prev &&\n      prev.w === next.w &&\n      prev.h === next.h &&\n      prev.fromX === next.fromX &&\n      prev.fromY === next.fromY &&\n      prev.toX === next.toX &&\n      prev.toY === next.toY\n        ? prev\n        : next,\n    );\n  });\n\n  useEffect(() => {\n    if (m && !released.current) {\n      released.current = true;\n      continueRender(handle);\n    }\n  }, [m, handle]);\n\n  const portrait = H > W * 1.1;\n  const marginX = W * (portrait ? 0.08 : 0.065);\n  const marginY = H * (portrait ? 0.1 : 0.11);\n  const k = m\n    ? Math.min(\n        (W - marginX * 2) / m.w,\n        (H * (portrait ? 0.42 : 0.62)) / m.h,\n        (H * (portrait ? 0.09 : 0.26)) / REF,\n      )\n    : 1;\n\n  const rise = (start: number, dur = 16) =>\n    interpolate(t, [start, start + dur], [0, 1], {\n      ...CLAMP,\n      easing: EASE_OUT,\n    });\n\n  const logoIn = rise(0, 22);\n  const tagIn = rise(T_TAG, 14);\n  const drop = interpolate(t, [T_LIFT, T_TURN + 2], [0, 1], {\n    ...CLAMP,\n    easing: EASE_TRAVEL,\n  });\n  const slide = interpolate(t, [T_TURN - 2, T_LAND], [0, 1], {\n    ...CLAMP,\n    easing: EASE_TRAVEL,\n  });\n  const travel = (drop + slide) / 2;\n  const lift = interpolate(t, [T_LIFT - 4, T_LIFT + 8], [0, 1], {\n    ...CLAMP,\n    easing: Easing.bezier(0.65, 0, 0.35, 1),\n  });\n  const landed = t >= T_LAND;\n\n  const tagScale0 = TAG_EM / LINE2_EM;\n  const tagX = m ? m.fromX + (m.toX - m.fromX) * slide : 0;\n  const tagY = m\n    ? m.fromY + (m.toY - m.fromY) * drop - lift * (1 - drop) * REF * 0.06\n    : 0;\n  const tagS = tagScale0 + (1 - tagScale0) * travel;\n  const tagColorMix = interpolate(travel, [0, 1], [0.62, 1], CLAMP);\n\n  const statusWords = words(status);\n  const beforeWords = words(before);\n  const afterWords = words(after);\n\n  const display: React.CSSProperties = {\n    fontFamily: shoulders.fontFamily,\n    fontWeight: 500,\n    lineHeight: 1,\n    letterSpacing: \"-0.01em\",\n  };\n\n  const riser = (key: string, text: string, p: number, color: string) => (\n    <span\n      key={key}\n      style={{\n        display: \"inline-block\",\n        color,\n        opacity: p,\n        transform: `translateY(${((1 - p) * 0.32).toFixed(3)}em)`,\n      }}\n    >\n      {text}\n    </span>\n  );\n\n  const joinSpaced = (nodes: React.ReactNode[]) =>\n    nodes.flatMap((n, i) => (i === 0 ? [n] : [\" \", n]));\n\n  const line2Nodes: React.ReactNode[] = [\n    ...beforeWords.map((w, i) =>\n      riser(`b${i}`, w, rise(T_BEFORE + i * 4), c.ink),\n    ),\n    <span\n      key=\"slot\"\n      ref={slotRef}\n      style={{\n        display: \"inline-block\",\n        color: c.ink,\n        opacity: landed ? 1 : 0,\n      }}\n    >\n      {tag}\n    </span>,\n    ...afterWords.map((w, i) =>\n      riser(`a${i}`, w, rise(T_AFTER + i * 4), c.ink),\n    ),\n  ];\n\n  return (\n    <AbsoluteFill style={{ background: stage, overflow: \"hidden\" }}>\n      <div\n        style={{\n          position: \"absolute\",\n          left: marginX,\n          bottom: marginY,\n          transformOrigin: \"0 100%\",\n          transform: `scale(${k})`,\n          opacity: m ? 1 : 0,\n        }}\n      >\n        <div\n          ref={rootRef}\n          style={{\n            position: \"relative\",\n            display: \"inline-flex\",\n            flexDirection: \"column\",\n            alignItems: \"flex-start\",\n          }}\n        >\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"baseline\",\n              whiteSpace: \"nowrap\",\n            }}\n          >\n            <div\n              ref={logoRef}\n              style={{\n                display: \"inline-flex\",\n                alignItems: \"baseline\",\n                opacity: logoIn,\n                transform: `translateY(${((1 - logoIn) * REF * 0.18).toFixed(2)}px)`,\n              }}\n            >\n              {logo ?? <RemocnLogo fontSize={REF} color={c.ink} />}\n            </div>\n            <div\n              style={{\n                ...display,\n                fontSize: REF * 0.97,\n                marginLeft: REF * STATUS_GAP,\n                whiteSpace: \"pre\",\n              }}\n            >\n              {joinSpaced(\n                statusWords.map((w, i) =>\n                  riser(`s${i}`, w, rise(T_STATUS + i * 5, 18), hi),\n                ),\n              )}\n            </div>\n          </div>\n          <div\n            style={{\n              ...display,\n              fontSize: REF * LINE2_EM,\n              marginTop: REF * LINE_GAP,\n              maxWidth: REF * 4.6,\n              whiteSpace: \"normal\",\n              textWrap: \"balance\",\n            }}\n          >\n            {joinSpaced(line2Nodes)}\n          </div>\n          {m && !landed ? (\n            <span\n              style={{\n                ...display,\n                position: \"absolute\",\n                left: 0,\n                top: 0,\n                fontSize: REF * LINE2_EM,\n                color: c.ink,\n                opacity: tagIn * tagColorMix,\n                transformOrigin: \"0 0\",\n                transform: `translate(${tagX.toFixed(2)}px, ${tagY.toFixed(2)}px) scale(${tagS.toFixed(4)})`,\n                whiteSpace: \"pre\",\n              }}\n            >\n              {tag}\n            </span>\n          ) : null}\n        </div>\n      </div>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/beta-thanks.tsx"
    }
  ],
  "type": "registry:component"
}
