{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "terminal",
  "title": "terminal",
  "description": "A terminal component.",
  "dependencies": [
    "react",
    "lucide-react",
    "react-icons/go"
  ],
  "files": [
    {
      "path": "registry/eldoraui/terminal.tsx",
      "content": "\"use client\"\n\nimport { useEffect, useMemo, useState, type ReactElement } from \"react\"\nimport { TerminalIcon } from \"lucide-react\"\nimport { GoTerminal } from \"react-icons/go\"\n\ntype TerminalStep = {\n  text: string\n  bold?: boolean\n}\n\ntype TerminalProps = {\n  command: string\n  steps: TerminalStep[]\n  pulseInterval?: number\n  showLocalhost?: boolean\n  hostBarTitle?: string\n  hostMessage?: string\n}\n\nfunction MacControls() {\n  return (\n    <>\n      <GoTerminal className=\"text-muted-foreground mr-1 size-4\" />\n      <div className=\"h-2 w-2 rounded-full bg-red-500\" />\n      <div className=\"h-2 w-2 rounded-full bg-yellow-500\" />\n      <div className=\"h-2 w-2 rounded-full bg-green-500\" />\n    </>\n  )\n}\n\nfunction LocalHost({ title, message }: { title: string; message: string }) {\n  return (\n    <div className=\"bg-card animate-in fade-in slide-in-from-top-10 absolute right-4 bottom-5 z-10 overflow-hidden rounded-md border shadow-xl\">\n      <div className=\"bg-muted text-muted-foreground relative flex h-6 flex-row items-center border-b px-4 text-xs\">\n        <TerminalIcon className=\"absolute inset-2 size-3\" />\n        <p className=\"absolute inset-x-0 text-center\">{title}</p>\n      </div>\n      <div className=\"text-card-foreground p-4 text-sm\">{message}</div>\n    </div>\n  )\n}\n\nconst Terminal = ({\n  command,\n  steps,\n  pulseInterval = 100,\n  showLocalhost = true,\n  hostBarTitle = \"localhost:3000\",\n  hostMessage = \"New App Created!\",\n}: TerminalProps) => {\n  const typingLen = useMemo(() => command.length, [command])\n  const revealLen = useMemo(() => steps.length, [steps])\n  const finalCount = typingLen + revealLen + 1\n\n  const [counter, setCounter] = useState(finalCount)\n\n  useEffect(() => {\n    const interval = setInterval(() => {\n      setCounter((prev) => (prev >= finalCount ? prev : prev + 1))\n    }, pulseInterval)\n    return () => clearInterval(interval)\n  }, [pulseInterval, finalCount])\n\n  const elements: ReactElement[] = []\n\n  const typedChars = Math.min(counter, typingLen)\n  const isTyping = counter < typingLen\n\n  elements.push(\n    <span key=\"command\" className=\"text-foreground\">\n      {command.substring(0, typedChars)}\n      {isTyping && (\n        <div className=\"bg-foreground inline-block h-3 w-1 animate-pulse\" />\n      )}\n    </span>\n  )\n\n  if (!isTyping) {\n    const shownSteps = Math.min(revealLen, counter - typingLen)\n    if (shownSteps > 0) {\n      elements.push(<span key=\"space\"> </span>)\n    }\n    for (let i = 0; i < shownSteps; i++) {\n      const step = steps[i]\n      elements.push(\n        <span\n          key={`step-${i}`}\n          className={\n            step.bold ? \"text-foreground font-bold\" : \"text-foreground\"\n          }\n        >\n          {step.text}\n        </span>\n      )\n    }\n  }\n\n  const revealComplete = counter > typingLen + revealLen\n\n  return (\n    <div\n      className=\"relative\"\n      onMouseEnter={() => {\n        if (counter >= finalCount) {\n          setCounter(0)\n        }\n      }}\n    >\n      {showLocalhost && revealComplete && (\n        <LocalHost title={hostBarTitle} message={hostMessage} />\n      )}\n\n      <pre className=\"bg-card w-full min-w-[320px] overflow-hidden rounded-xl border text-[11px] shadow-lg sm:min-w-[480px] sm:text-[12px] md:min-w-[600px] md:text-[13px]\">\n        <div className=\"bg-muted flex flex-row items-center gap-2 border-b px-3 py-2 sm:px-4\">\n          <MacControls />\n        </div>\n        <div className=\"from-background to-muted min-h-[150px] bg-gradient-to-b sm:min-h-[180px] md:min-h-[200px]\">\n          <div className=\"grid p-3 whitespace-pre-wrap sm:p-4\">{elements}</div>\n        </div>\n      </pre>\n    </div>\n  )\n}\n\nexport default Terminal\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}