{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-input-001",
  "dependencies": [
    "lucide-react",
    "motion",
    "react-icons"
  ],
  "registryDependencies": [
    "dropdown-menu"
  ],
  "files": [
    {
      "path": "src/components/watermelon-ui/ai-input-001.tsx",
      "content": "\"use client\";\n\nimport React, { useState, useRef, useEffect } from \"react\";\nimport { motion, AnimatePresence } from \"motion/react\";\nimport {\n  Plus,\n  Globe,\n  ChevronDown,\n  Send,\n  Image as ImageIcon,\n  FileText,\n  Layers,\n  Sparkles,\n  Cpu,\n  Zap,\n} from \"lucide-react\";\nimport { LuBrain } from \"react-icons/lu\";\nimport { PiLightbulbFilament } from \"react-icons/pi\";\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\n\nexport interface Message {\n  id: string;\n  text: string;\n  sender: \"user\" | \"ai\";\n}\n\ninterface Model {\n  id: string;\n  name: string;\n  icon: React.ReactNode;\n}\n\ninterface AIInputProps {\n  messages?: Message[];\n  onSendMessage?: (text: string, modelId: string) => void;\n  models?: Model[];\n  backgroundText?: string;\n  placeholder?: string;\n}\n\nconst DEFAULT_MODELS: Model[] = [\n  {\n    id: \"gpt-4o\",\n    name: \"GPT-4o\",\n    icon: <PiLightbulbFilament className=\"h-4 w-4\" />,\n  },\n  {\n    id: \"claude-3-5\",\n    name: \"Claude 3.5 Sonnet\",\n    icon: <Sparkles className=\"h-4 w-4\" />,\n  },\n  { id: \"gemini-pro\", name: \"Gemini Pro\", icon: <Cpu className=\"h-4 w-4\" /> },\n  { id: \"llama-3-1\", name: \"Llama 3.1\", icon: <Zap className=\"h-4 w-4\" /> },\n];\n\nexport const AiInput: React.FC<AIInputProps> = ({\n  messages = [],\n  onSendMessage = () => {},\n  models = DEFAULT_MODELS,\n  backgroundText = \"Skiper Input 001\",\n  placeholder = \"Ask anything...\",\n}) => {\n  const hasMessages = messages.length > 0;\n  const scrollRef = useRef<HTMLDivElement>(null);\n\n  useEffect(() => {\n    if (scrollRef.current) {\n      scrollRef.current.scrollTop = scrollRef.current.scrollHeight;\n    }\n  }, [messages]);\n\n  return (\n    <div className=\"relative flex h-screen w-full flex-col overflow-hidden bg-neutral-50 dark:bg-neutral-950\">\n      <AnimatePresence>\n        {!hasMessages && (\n          <motion.div\n            initial={{ opacity: 0, scale: 0.9 }}\n            animate={{ opacity: 1, scale: 1 }}\n            exit={{ opacity: 0, scale: 1.1 }}\n            transition={{ duration: 0.5 }}\n            className=\"pointer-events-none absolute inset-0 z-0 mb-10 flex items-end justify-center select-none\"\n          >\n            <h1 className=\"text-xl font-bold text-neutral-300/40 sm:text-5xl md:text-[150px] dark:text-neutral-800/40\">\n              {backgroundText}\n            </h1>\n          </motion.div>\n        )}\n      </AnimatePresence>\n\n      <MessageList messages={messages} scrollRef={scrollRef} />\n\n      <ChatInput\n        models={models}\n        placeholder={placeholder}\n        hasMessages={hasMessages}\n        onSend={onSendMessage}\n      />\n    </div>\n  );\n};\n\nconst MessageList = ({\n  messages,\n  scrollRef,\n}: {\n  messages: Message[];\n  scrollRef: React.RefObject<HTMLDivElement | null>;\n}) => {\n  if (!messages.length) return null;\n\n  return (\n    <div\n      ref={scrollRef}\n      className=\"z-10 flex w-full flex-1 flex-col items-center overflow-y-auto pt-6 sm:pt-10\"\n    >\n      <div className=\"flex w-full max-w-3xl flex-col gap-4 px-3 pb-6 sm:px-4 sm:pb-10\">\n        <AnimatePresence initial={false}>\n          {messages.map((msg) => (\n            <motion.div\n              key={msg.id}\n              initial={{ opacity: 0, y: 10, scale: 0.95 }}\n              animate={{ opacity: 1, y: 0, scale: 1 }}\n              className={`flex ${\n                msg.sender === \"user\" ? \"justify-end\" : \"justify-start\"\n              }`}\n            >\n              <div\n                className={`max-w-[85%] rounded-2xl border px-3 py-2 text-sm font-medium shadow-sm sm:max-w-[80%] sm:px-4 sm:text-[15px] ${\n                  msg.sender === \"user\"\n                    ? \"rounded-tr-none border-neutral-900 bg-neutral-900 text-white dark:border-neutral-700 dark:bg-neutral-800\"\n                    : \"rounded-tl-none border-neutral-200 bg-white text-neutral-800 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-200\"\n                }`}\n              >\n                {msg.text}\n              </div>\n            </motion.div>\n          ))}\n        </AnimatePresence>\n      </div>\n    </div>\n  );\n};\n\nconst ChatInput = ({\n  models,\n  hasMessages,\n  placeholder,\n  onSend,\n}: {\n  models: Model[];\n  hasMessages: boolean;\n  placeholder: string;\n  onSend: (text: string, modelId: string) => void;\n}) => {\n  const [inputValue, setInputValue] = useState(\"\");\n  const [selectedModel, setSelectedModel] = useState(models[0]);\n  const [isSearchActive, setIsSearchActive] = useState(false);\n  const [isDeepMindActive, setIsDeepMindActive] = useState(false);\n\n  const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n  useEffect(() => {\n    if (textAreaRef.current) {\n      textAreaRef.current.style.height = \"auto\";\n      textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;\n    }\n  }, [inputValue]);\n\n  const handleSend = () => {\n    if (!inputValue.trim()) return;\n    onSend(inputValue, selectedModel.id);\n    setInputValue(\"\");\n  };\n\n  return (\n    <motion.div\n      layout\n      transition={{ type: \"spring\", stiffness: 200, damping: 25 }}\n      className={`z-20 flex w-full justify-center px-3 py-4 sm:px-4 ${\n        !hasMessages ? \"flex-1 items-center\" : \"items-end\"\n      }`}\n    >\n      <motion.div\n        layout\n        className=\"w-full max-w-3xl rounded-2xl border border-neutral-200 bg-white p-3 shadow-lg sm:rounded-[24px] dark:border-neutral-800 dark:bg-neutral-900\"\n      >\n        <textarea\n          ref={textAreaRef}\n          value={inputValue}\n          onChange={(e) => setInputValue(e.target.value)}\n          onKeyDown={(e) => {\n            if (e.key === \"Enter\" && !e.shiftKey) {\n              e.preventDefault();\n              handleSend();\n            }\n          }}\n          placeholder={placeholder}\n          className=\"mb-2 max-h-[180px] min-h-[40px] w-full resize-none bg-transparent px-1 text-sm font-semibold text-neutral-700 outline-none placeholder:text-neutral-400 sm:max-h-[200px] sm:min-h-[44px] sm:px-2 sm:text-base dark:text-neutral-300 dark:placeholder:text-neutral-600\"\n          rows={1}\n        />\n\n        <div className=\"mt-2 flex items-center justify-between gap-2 rounded-xl border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-800 dark:bg-neutral-950\">\n          <div className=\"no-scrollbar flex items-center gap-1 overflow-x-auto sm:gap-2\">\n            <AttachmentMenu />\n\n            <motion.button\n              layout\n              onClick={() => setIsSearchActive(!isSearchActive)}\n              className={`flex items-center gap-2 rounded-lg border p-2 transition-all sm:p-2.5 ${\n                isSearchActive\n                  ? \"border-sky-300 bg-sky-50 dark:border-sky-700 dark:bg-sky-950\"\n                  : \"border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900\"\n              }`}\n            >\n              <Globe\n                className={`h-4 w-4 sm:h-5 sm:w-5 ${\n                  isSearchActive\n                    ? \"text-sky-600 dark:text-sky-400\"\n                    : \"text-neutral-500 dark:text-neutral-400\"\n                }`}\n              />\n              <AnimatePresence>\n                {isSearchActive && (\n                  <motion.span\n                    initial={{ opacity: 0, width: 0 }}\n                    animate={{ opacity: 1, width: \"auto\" }}\n                    exit={{ opacity: 0, width: 0 }}\n                    className=\"hidden overflow-hidden text-sm font-medium whitespace-nowrap text-neutral-700 sm:inline dark:text-neutral-200\"\n                  >\n                    Search\n                  </motion.span>\n                )}\n              </AnimatePresence>\n            </motion.button>\n\n            <motion.button\n              layout\n              onClick={() => setIsDeepMindActive(!isDeepMindActive)}\n              className={`flex items-center gap-2 rounded-lg border p-2 transition-all sm:p-2.5 ${\n                isDeepMindActive\n                  ? \"border-indigo-300 bg-indigo-50 dark:border-indigo-700 dark:bg-indigo-950\"\n                  : \"border-neutral-200 bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900\"\n              }`}\n            >\n              <LuBrain\n                className={`h-4 w-4 sm:h-5 sm:w-5 ${\n                  isDeepMindActive\n                    ? \"text-indigo-600 dark:text-indigo-400\"\n                    : \"text-neutral-500 dark:text-neutral-400\"\n                }`}\n              />\n              <AnimatePresence>\n                {isDeepMindActive && (\n                  <motion.span\n                    initial={{ opacity: 0, width: 0 }}\n                    animate={{ opacity: 1, width: \"auto\" }}\n                    exit={{ opacity: 0, width: 0 }}\n                    className=\"hidden overflow-hidden text-sm font-medium whitespace-nowrap text-neutral-700 sm:inline dark:text-neutral-200\"\n                  >\n                    DeepMind\n                  </motion.span>\n                )}\n              </AnimatePresence>\n            </motion.button>\n\n            <ModelSelector\n              models={models}\n              selectedModel={selectedModel}\n              onSelect={setSelectedModel}\n            />\n          </div>\n\n          <button\n            onClick={handleSend}\n            disabled={!inputValue.trim()}\n            className={`rounded-lg p-2 transition-colors sm:p-3 ${\n              inputValue.trim()\n                ? \"bg-blue-600 text-white dark:bg-blue-500\"\n                : \"cursor-not-allowed bg-neutral-200 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-600\"\n            }`}\n          >\n            <Send className=\"h-4 w-4 sm:h-5 sm:w-5\" />\n          </button>\n        </div>\n      </motion.div>\n    </motion.div>\n  );\n};\n\nconst ATTACHMENT_ITEMS = [\n  { label: \"Images\", icon: ImageIcon },\n  { label: \"Documents\", icon: FileText },\n  { label: \"Connect Apps\", icon: Layers },\n];\n\nconst AttachmentMenu = () => (\n  <DropdownMenu>\n    <DropdownMenuTrigger asChild>\n      <button className=\"group rounded-lg border border-neutral-200 bg-neutral-100 p-2 text-neutral-500 sm:p-2.5 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-400\">\n        <Plus className=\"h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-45 sm:h-5 sm:w-5\" />\n      </button>\n    </DropdownMenuTrigger>\n\n    <DropdownMenuContent\n      align=\"start\"\n      side=\"bottom\"\n      className=\"mt-5.5 w-44 rounded-xl border border-neutral-200 bg-white p-2 sm:w-48 dark:border-neutral-800 dark:bg-neutral-900\"\n    >\n      {ATTACHMENT_ITEMS.map(({ label, icon: Icon }) => (\n        <DropdownMenuItem\n          key={label}\n          className=\"flex items-center gap-2 p-2 text-sm text-neutral-700 dark:text-neutral-200\"\n        >\n          <Icon className=\"h-4 w-4 shrink-0\" />\n          {label}\n        </DropdownMenuItem>\n      ))}\n    </DropdownMenuContent>\n  </DropdownMenu>\n);\n\nconst ModelSelector = ({\n  models,\n  selectedModel,\n  onSelect,\n}: {\n  models: Model[];\n  selectedModel: Model;\n  onSelect: (model: Model) => void;\n}) => (\n  <DropdownMenu>\n    <DropdownMenuTrigger asChild>\n      <button className=\"flex items-center gap-2 rounded-lg border border-neutral-200 bg-neutral-100 p-2 text-sm text-neutral-700 sm:p-2.5 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-200\">\n        {selectedModel.icon}\n        <span className=\"hidden md:inline\">{selectedModel.name}</span>\n        <ChevronDown className=\"h-3 w-3\" />\n      </button>\n    </DropdownMenuTrigger>\n\n    <DropdownMenuContent\n      align=\"start\"\n      side=\"bottom\"\n      className=\"mt-5.5 w-48 rounded-xl border border-neutral-200 bg-white sm:w-52 dark:border-neutral-800 dark:bg-neutral-900\"\n    >\n      {models.map((model) => (\n        <DropdownMenuItem\n          key={model.id}\n          onClick={() => onSelect(model)}\n          className=\"flex items-center gap-2 p-2 text-sm text-neutral-700 dark:text-neutral-200\"\n        >\n          {model.icon}\n          {model.name}\n        </DropdownMenuItem>\n      ))}\n    </DropdownMenuContent>\n  </DropdownMenu>\n);\n",
      "type": "registry:ui",
      "target": "components/ui/ai-input-001.tsx"
    }
  ],
  "type": "registry:ui"
}
