{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-input-003",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "files": [
    {
      "path": "src/components/watermelon-ui/ai-input-003.tsx",
      "content": "\"use client\";\n\nimport React, { useState, useRef, useEffect } from \"react\";\nimport { motion, AnimatePresence } from \"motion/react\";\nimport { ArrowUp, Youtube } from \"lucide-react\";\n\nexport type MentionType = \"google\" | \"youtube\" | null;\n\nexport interface MessageReply01 {\n  id: string;\n  text: string;\n  sender: \"user\" | \"ai\";\n  mention?: MentionType;\n  timestamp: number;\n}\n\ninterface AiInput003Props {\n  onSendMessage?: (message: string, mention: MentionType) => void;\n  placeholder?: string;\n}\n\nconst MentionBadge: React.FC<{ type: MentionType; compact?: boolean }> = ({\n  type,\n  compact = false,\n}) => {\n  if (!type) return null;\n  const isGoogle = type === \"google\";\n  const label = isGoogle ? \"Google Search\" : \"Youtube Analyzer\";\n\n  return (\n    <div\n      className={`flex items-center gap-2 rounded-xl px-3 py-1.5 transition-all duration-300 select-none ${\n        compact ? \"text-xs\" : \"text-sm\"\n      } border border-neutral-200 bg-neutral-100 dark:border-[#333] dark:bg-[#222]`}\n    >\n      {isGoogle ? (\n        <div className=\"flex h-5 w-5 items-center justify-center rounded-md border border-neutral-100 bg-white shadow-sm dark:border-transparent\">\n          <svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\">\n            <path\n              d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\n              fill=\"#4285F4\"\n            />\n            <path\n              d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\n              fill=\"#34A853\"\n            />\n            <path\n              d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z\"\n              fill=\"#FBBC05\"\n            />\n            <path\n              d=\"M12 5.38c1.62 0 3.06.56 4.21 1.66l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"\n              fill=\"#EA4335\"\n            />\n          </svg>\n        </div>\n      ) : (\n        <div className=\"flex h-5 w-5 items-center justify-center rounded-md bg-red-600 shadow-sm\">\n          <Youtube size={14} className=\"fill-white text-white\" />\n        </div>\n      )}\n      <span className=\"font-medium text-neutral-600 dark:text-neutral-300\">\n        {label}\n      </span>\n    </div>\n  );\n};\n\nexport const AiInput003: React.FC<AiInput003Props> = ({\n  onSendMessage,\n  placeholder = \"Type shit..\",\n}) => {\n  const [inputValue, setInputValue] = useState(\"\");\n  const [messages, setMessages] = useState<MessageReply01[]>([]);\n  const [isTyping, setIsTyping] = useState(false);\n  const [isSending, setIsSending] = useState(false);\n  const [mention, setMention] = useState<MentionType>(null);\n  const scrollRef = useRef<HTMLDivElement>(null);\n\n  useEffect(() => {\n    if (scrollRef.current) {\n      scrollRef.current.scrollTo({\n        top: scrollRef.current.scrollHeight,\n        behavior: \"smooth\",\n      });\n    }\n  }, [messages, isTyping]);\n\n  const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n    const val = e.target.value;\n    setInputValue(val);\n    if (val.includes(\"@goog\")) setMention(\"google\");\n    else if (val.includes(\"@yt\")) setMention(\"youtube\");\n    else if (!val.includes(\"@\")) setMention(null);\n  };\n\n  const handleSendMessage = async () => {\n    if (!inputValue.trim() || isSending) return;\n\n    setIsSending(true);\n    const userMessage: MessageReply01 = {\n      id: Date.now().toString(),\n      text: inputValue,\n      sender: \"user\",\n      mention: mention,\n      timestamp: Date.now(),\n    };\n\n    setMessages((prev) => [...prev, userMessage]);\n    if (onSendMessage) onSendMessage(inputValue, mention);\n\n    setInputValue(\"\");\n    setMention(null);\n\n    setTimeout(() => {\n      setIsSending(false);\n      setIsTyping(true);\n\n      setTimeout(() => {\n        const aiMessage: MessageReply01 = {\n          id: (Date.now() + 1).toString(),\n          text: \"This is a simulated response.\",\n          sender: \"ai\",\n          timestamp: Date.now(),\n        };\n        setMessages((prev) => [...prev, aiMessage]);\n        setIsTyping(false);\n      }, 1500);\n    }, 400);\n  };\n\n  return (\n    <div className=\"relative flex h-screen w-full flex-col overflow-hidden border-x border-neutral-200 bg-white text-neutral-900 selection:bg-neutral-200 dark:border-neutral-800/50 dark:bg-black dark:text-white dark:selection:bg-white/20\">\n      <div className=\"pointer-events-none absolute inset-0\">\n        <div className=\"absolute -bottom-[10%] left-1/2 h-[30%] w-[100%] -translate-x-1/2 bg-neutral-100/50 blur-[120px] dark:bg-neutral-500/10\" />\n      </div>\n\n      <div\n        ref={scrollRef}\n        className=\"custom-scrollbar relative z-10 flex flex-1 flex-col overflow-y-auto px-4\"\n      >\n        <div className=\"flex-grow\" />\n        <div className=\"mx-auto w-full max-w-2xl space-y-6 py-10\">\n          <AnimatePresence initial={false}>\n            {messages.map((msg) => (\n              <motion.div\n                key={msg.id}\n                initial={{ opacity: 0, scale: 0.95, y: 10 }}\n                animate={{ opacity: 1, scale: 1, y: 0 }}\n                className={`flex flex-col ${\n                  msg.sender === \"user\" ? \"items-end\" : \"items-start\"\n                }`}\n              >\n                <div\n                  className={`max-w-[85%] rounded-[10px] px-5 py-3 text-[15px] leading-relaxed shadow-sm transition-colors duration-300 ${\n                    msg.sender === \"user\"\n                      ? \"rounded-br-none border border-neutral-200 bg-neutral-100 text-neutral-800 dark:border-neutral-800/50 dark:bg-[#1a1a1a] dark:text-neutral-100\"\n                      : \"border border-neutral-100 bg-neutral-50 text-neutral-700 dark:border-neutral-800/30 dark:bg-neutral-900/40 dark:text-neutral-200\"\n                  }`}\n                >\n                  {msg.text}\n                </div>\n\n                {msg.mention && msg.sender === \"user\" && (\n                  <div className=\"mt-2\">\n                    <MentionBadge type={msg.mention} compact />\n                  </div>\n                )}\n              </motion.div>\n            ))}\n          </AnimatePresence>\n\n          {isTyping && (\n            <div className=\"flex h-6 items-center gap-1.5 px-4\">\n              <div className=\"h-1 w-1 animate-bounce rounded-full bg-neutral-300 [animation-delay:-0.3s] dark:bg-neutral-500\" />\n              <div className=\"h-1 w-1 animate-bounce rounded-full bg-neutral-300 [animation-delay:-0.15s] dark:bg-neutral-500\" />\n              <div className=\"h-1 w-1 animate-bounce rounded-full bg-neutral-300 dark:bg-neutral-500\" />\n            </div>\n          )}\n        </div>\n      </div>\n\n      <div className=\"relative z-20 flex w-full items-center justify-center  px-4 pt-4 pb-12 transition-colors duration-300 dark:from-black dark:via-black\">\n        <div className=\"relative w-full max-w-2xl\">\n          <AnimatePresence>\n            {mention && (\n              <motion.div\n                initial={{ opacity: 0, y: 10, scale: 0.95 }}\n                animate={{ opacity: 1, y: 0, scale: 1 }}\n                exit={{ opacity: 0, y: 10, scale: 0.95 }}\n                className=\"absolute bottom-full left-4 mb-4\"\n              >\n                <MentionBadge type={mention} />\n              </motion.div>\n            )}\n          </AnimatePresence>\n\n          <motion.div\n            animate={{\n              scale: isSending ? 0.985 : 1,\n              borderColor: isSending ? \"rgba(239,68,68,0.35)\" : \"transparent\",\n              boxShadow: isSending\n                ? \"0 0 18px rgba(239,68,68,0.12)\"\n                : \"0 4px 12px rgba(0,0,0,0.03)\",\n            }}\n            transition={{\n              type: \"spring\",\n              stiffness: 300,\n              damping: 28,\n            }}\n            className=\"group relative flex items-center overflow-hidden rounded-full border border-neutral-700 bg-black/5 px-6 py-3 pr-4 transition-colors duration-300 dark:border-neutral-800 dark:bg-neutral-800/70 dark:shadow-sm\"\n          >\n            {isSending && (\n              <motion.div\n                initial={{ y: \"220%\" }}\n                animate={{ y: \"-120%\" }}\n                transition={{\n                  duration: 0.6,\n                  ease: \"easeInOut\",\n                }}\n                className=\"pointer-events-none absolute inset-0 z-0 skew-x-12 bg-gradient-to-t from-red-500/25 via-red-500/10 to-white/10 blur-md\"\n              />\n            )}\n\n            <input\n              type=\"text\"\n              value={inputValue}\n              onChange={handleInputChange}\n              onKeyDown={(e) => e.key === \"Enter\" && handleSendMessage()}\n              placeholder={placeholder}\n              className=\"z-10 flex-1 border-none bg- py-2 text-[18px] font-semibold text-neutral-900 placeholder-neutral-400 outline-none dark:text-neutral-100 dark:placeholder-neutral-500\"\n              autoFocus\n            />\n\n            <motion.button\n              whileTap={{ scale: 0.9 }}\n              onClick={handleSendMessage}\n              disabled={!inputValue.trim()}\n              className={`z-10 ml-4 flex h-10 w-10 items-center justify-center rounded-full transition-all duration-300 ${\n                inputValue.trim()\n                  ? \"bg-neutral-900 text-white shadow-sm shadow-neutral-200 active:scale-95 dark:bg-white dark:text-black dark:shadow-none\"\n                  : \"bg-neutral-50 text-neutral-400  dark:bg-neutral-700 dark:text-neutral-200\"\n              }`}\n            >\n              <ArrowUp size={20} strokeWidth={3} />\n            </motion.button>\n          </motion.div>\n        </div>\n      </div>\n    </div>\n  );\n};\n",
      "type": "registry:ui",
      "target": "components/ui/ai-input-003.tsx"
    }
  ],
  "type": "registry:ui"
}
