{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "x-twitter-widget",
  "title": "X (Twitter) Widget",
  "description": "An X (Twitter)-style DM chat bubble widget with a typing simulation, quick replies, a follows-you badge, availability status, and a notification popup.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/x-twitter-widget/x-twitter-widget.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nconst X_BLACK = \"#000000\";\nconst X_BLUE = \"#1D9BF0\";\n\nexport type XTwitterWidgetAvailability = \"online\" | \"away\" | \"offline\";\nexport type XTwitterWidgetPosition = \"bottom-right\" | \"bottom-left\";\nexport type XTwitterWidgetTheme = \"light\" | \"dark\";\n\nexport interface XTwitterWidgetQuickReply {\n  label: string;\n  message: string;\n}\n\nexport interface XTwitterWidgetProps {\n  agentName?: string;\n  agentHandle?: string;\n  agentAvatar?: string;\n  followsYou?: boolean;\n  availability?: XTwitterWidgetAvailability;\n  offlineMessage?: string;\n  greeting?: string;\n  quickReplies?: XTwitterWidgetQuickReply[];\n  popupMessage?: string;\n  theme?: XTwitterWidgetTheme;\n  accentColor?: string;\n  fontFamily?: string;\n  agentNameFontSize?: number;\n  greetingFontSize?: number;\n  quickReplyFontSize?: number;\n  inputFontSize?: number;\n  widgetBorderRadius?: number;\n  buttonBorderRadius?: number;\n  /** Fixed to the viewport corner (typical widget usage). Set false to render inline, e.g. inside a preview card. */\n  fixed?: boolean;\n  position?: XTwitterWidgetPosition;\n  notificationCount?: number;\n  popupDelay?: number;\n  typingDuration?: number;\n  autoOpenDelay?: number;\n}\n\nconst STATUS_COLORS: Record<XTwitterWidgetAvailability, string> = { online: \"#00ba7c\", away: \"#f59e0b\", offline: \"#536471\" };\nconst STATUS_LABELS: Record<XTwitterWidgetAvailability, string> = { online: \"Active\", away: \"Away\", offline: \"Offline\" };\n\nfunction XIcon({ size = 26, color = \"#fff\" }: { size?: number; color?: string }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={color}>\n      <path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.747l7.73-8.835L1.254 2.25H8.08l4.26 5.632zm-1.161 17.52h1.833L7.084 4.126H5.117z\" />\n    </svg>\n  );\n}\n\nfunction SendIcon({ color = \"#fff\" }: { color?: string }) {\n  return (\n    <svg width={18} height={18} viewBox=\"0 0 24 24\" fill=\"none\">\n      <path d=\"M22 2L11 13\" stroke={color} strokeWidth={2.2} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      <path d=\"M22 2L15 22L11 13L2 9L22 2Z\" stroke={color} strokeWidth={2.2} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction CloseIcon({ color = \"#fff\", size = 18 }: { color?: string; size?: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n      <path d=\"M18 6L6 18M6 6l12 12\" stroke={color} strokeWidth={2.5} strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction AvatarEl({ size, border, src, isDark }: { size: number; border?: string; src?: string; isDark: boolean }) {\n  return src ? (\n    <img\n      src={src}\n      alt=\"\"\n      className=\"shrink-0 rounded-full object-cover\"\n      style={{ width: size, height: size, border: border || \"none\" }}\n    />\n  ) : (\n    <div\n      className=\"flex shrink-0 items-center justify-center rounded-full\"\n      style={{ width: size, height: size, background: isDark ? \"#2f3336\" : \"#e7e9ea\", fontSize: size * 0.42, border: border || \"none\" }}\n    >\n      🧑‍💻\n    </div>\n  );\n}\n\nfunction MsgAvatar({ src, isDark }: { src?: string; isDark: boolean }) {\n  return (\n    <div\n      className=\"flex h-[30px] w-[30px] shrink-0 items-center justify-center overflow-hidden rounded-full\"\n      style={{ background: isDark ? \"#2f3336\" : \"#e7e9ea\" }}\n    >\n      {src ? <img src={src} alt=\"\" className=\"h-[30px] w-[30px] object-cover\" /> : <XIcon size={14} color={isDark ? \"#e7e9ea\" : \"#536471\"} />}\n    </div>\n  );\n}\n\nconst DEFAULT_QUICK_REPLIES: XTwitterWidgetQuickReply[] = [\n  { label: \"📩 Send us a DM\", message: \"Hi! I'd like to get in touch.\" },\n  { label: \"❓ Ask a question\", message: \"I have a question for you.\" },\n  { label: \"💡 Share feedback\", message: \"I'd like to share some feedback.\" },\n];\n\nexport function XTwitterWidget({\n  agentName = \"Support\",\n  agentHandle = \"yourusername\",\n  agentAvatar,\n  followsYou = false,\n  availability = \"online\",\n  offlineMessage = \"We're not around right now. DM us and we'll reply soon.\",\n  greeting = \"Hey there! 👋\\n\\nGot a question? We'd love to help.\",\n  quickReplies = DEFAULT_QUICK_REPLIES,\n  popupMessage = \"👋 Hey! Drop us a message, we reply fast.\",\n  theme = \"light\",\n  accentColor = X_BLUE,\n  fontFamily = \"'Inter', -apple-system, BlinkMacSystemFont, sans-serif\",\n  agentNameFontSize = 15,\n  greetingFontSize = 14,\n  quickReplyFontSize = 13.5,\n  inputFontSize = 14,\n  widgetBorderRadius = 18,\n  buttonBorderRadius = 22,\n  fixed = true,\n  position = \"bottom-right\",\n  notificationCount = 1,\n  popupDelay = 4,\n  typingDuration = 1.5,\n  autoOpenDelay = 0,\n}: XTwitterWidgetProps) {\n  const [isOpen, setIsOpen] = React.useState(false);\n  const [inputValue, setInputValue] = React.useState(\"\");\n  const [isVisible, setIsVisible] = React.useState(false);\n  const [showBadge, setShowBadge] = React.useState(notificationCount > 0);\n  const [msgTime, setMsgTime] = React.useState(\"00:00\");\n  const [showPopup, setShowPopup] = React.useState(false);\n  const [popupDismissed, setPopupDismissed] = React.useState(false);\n  const [showTyping, setShowTyping] = React.useState(false);\n  const [greetingVisible, setGreetingVisible] = React.useState(false);\n\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const timerRef = React.useRef<ReturnType<typeof setInterval> | null>(null);\n  const secondsRef = React.useRef(0);\n\n  const isDark = theme === \"dark\";\n  const bg = isDark ? \"#15202B\" : \"#f7f9f9\";\n  const textPrimary = isDark ? \"#e7e9ea\" : \"#0f1419\";\n  const textMuted = isDark ? \"#71767b\" : \"#536471\";\n  const border = isDark ? \"#2f3336\" : \"#eff3f4\";\n  const inputBg = isDark ? \"#253341\" : \"#f7f9f9\";\n  const bubbleBg = isDark ? \"#22303C\" : \"#ffffff\";\n\n  const isOffline = availability === \"offline\";\n  const isAway = availability === \"away\";\n  const dotColor = STATUS_COLORS[availability];\n  const cleanHandle = agentHandle.replace(/^@/, \"\");\n  const statusText = isOffline ? STATUS_LABELS.offline : isAway ? STATUS_LABELS.away : STATUS_LABELS.online;\n\n  React.useEffect(() => {\n    const t = setTimeout(() => setShowBadge(notificationCount > 0), 0);\n    return () => clearTimeout(t);\n  }, [notificationCount]);\n\n  React.useEffect(() => {\n    const t = setTimeout(() => setIsVisible(true), 300);\n    return () => clearTimeout(t);\n  }, []);\n\n  React.useEffect(() => {\n    if (autoOpenDelay > 0) {\n      const t = setTimeout(() => setIsOpen(true), autoOpenDelay * 1000);\n      return () => clearTimeout(t);\n    }\n  }, [autoOpenDelay]);\n\n  React.useEffect(() => {\n    if (popupDelay > 0 && !popupDismissed) {\n      const t = setTimeout(() => {\n        if (!isOpen) setShowPopup(true);\n      }, popupDelay * 1000);\n      return () => clearTimeout(t);\n    }\n  }, [popupDelay, popupDismissed, isOpen]);\n\n  React.useEffect(() => {\n    const timeouts: ReturnType<typeof setTimeout>[] = [];\n\n    const initTimer = setTimeout(() => {\n      if (isOpen) {\n        setShowBadge(false);\n        setShowPopup(false);\n        secondsRef.current = 0;\n        const startTimer = () => {\n          timerRef.current = setInterval(() => {\n            secondsRef.current += 1;\n            const m = Math.floor(secondsRef.current / 60).toString().padStart(2, \"0\");\n            const s = (secondsRef.current % 60).toString().padStart(2, \"0\");\n            setMsgTime(`${m}:${s}`);\n          }, 1000);\n        };\n        if (typingDuration > 0) {\n          setShowTyping(true);\n          setGreetingVisible(false);\n          startTimer();\n          timeouts.push(\n            setTimeout(() => {\n              setShowTyping(false);\n              setGreetingVisible(true);\n            }, typingDuration * 1000)\n          );\n          timeouts.push(setTimeout(() => inputRef.current?.focus(), 420));\n        } else {\n          setShowTyping(false);\n          setGreetingVisible(true);\n          startTimer();\n          timeouts.push(setTimeout(() => inputRef.current?.focus(), 420));\n        }\n      } else {\n        setShowTyping(false);\n        setGreetingVisible(false);\n        if (timerRef.current) clearInterval(timerRef.current);\n      }\n    }, 0);\n\n    return () => {\n      clearTimeout(initTimer);\n      timeouts.forEach(clearTimeout);\n      if (timerRef.current) clearInterval(timerRef.current);\n    };\n  }, [isOpen, typingDuration]);\n\n  const handleOpen = () => setIsOpen(true);\n  const handleClose = () => setIsOpen(false);\n  const handleDismissPopup = (e: React.MouseEvent) => {\n    e.stopPropagation();\n    setShowPopup(false);\n    setPopupDismissed(true);\n  };\n  const buildXUrl = (msg?: string) =>\n    msg ? `https://x.com/intent/tweet?text=${encodeURIComponent(`@${cleanHandle} ${msg}`)}` : `https://x.com/${cleanHandle}`;\n  const handleSend = () => {\n    const msg = inputValue.trim();\n    if (!msg) return;\n    window.open(buildXUrl(msg), \"_blank\", \"noopener,noreferrer\");\n    setInputValue(\"\");\n  };\n  const handleQuickReply = (qr: XTwitterWidgetQuickReply) => {\n    setInputValue(qr.message);\n    setTimeout(() => inputRef.current?.focus(), 50);\n  };\n  const handleKey = (e: React.KeyboardEvent) => {\n    if (e.key === \"Enter\") handleSend();\n  };\n\n  const hasInput = inputValue.trim().length > 0;\n  const isRight = position !== \"bottom-left\";\n  const chatOrigin = isRight ? \"bottom right\" : \"bottom left\";\n  // Never wider than the viewport: leave the corner offset on both sides when fixed,\n  // and a bit more slack when inline (the surrounding layout may add its own padding).\n  const panelMaxWidth = fixed ? \"calc(100vw - 3rem)\" : \"calc(100vw - 5rem)\";\n\n  return (\n    <div\n      className={cn(fixed ? \"fixed bottom-6 z-[99999]\" : \"relative\", isRight ? \"right-6\" : \"left-6\")}\n      style={{ fontFamily, ...(fixed ? undefined : { display: \"inline-block\" }) }}\n    >\n      {showPopup && !isOpen && (\n        <div\n          onClick={handleOpen}\n          className={cn(\"absolute bottom-[76px] w-[300px] cursor-pointer overflow-hidden border shadow-[0_16px_48px_rgba(0,0,0,0.14),0_4px_16px_rgba(0,0,0,0.08)]\", isRight ? \"right-0\" : \"left-0\")}\n          style={{ maxWidth: panelMaxWidth, borderColor: border, borderRadius: widgetBorderRadius, animation: \"xt-popup-in 0.42s cubic-bezier(0.34,1.56,0.64,1) forwards\" }}\n        >\n          <div className=\"flex items-center gap-2.5 px-3.5 py-3\" style={{ background: X_BLACK }}>\n            <div className=\"relative shrink-0\">\n              <AvatarEl size={36} border=\"2px solid #333\" src={agentAvatar} isDark={isDark} />\n              <div className=\"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-black\" style={{ background: dotColor }} />\n            </div>\n            <div className=\"min-w-0 flex-1\">\n              <div className=\"font-bold text-white\" style={{ fontSize: agentNameFontSize - 2 }}>{agentName}</div>\n              <div className=\"text-[11px] text-[#71767b]\">@{cleanHandle}</div>\n            </div>\n            <button\n              onClick={handleDismissPopup}\n              aria-label=\"Dismiss notification\"\n              className=\"flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full bg-white/[0.12]\"\n              style={{ transition: \"background 0.15s\" }}\n              onMouseEnter={(e) => (e.currentTarget.style.background = \"rgba(255,255,255,0.22)\")}\n              onMouseLeave={(e) => (e.currentTarget.style.background = \"rgba(255,255,255,0.12)\")}\n            >\n              <CloseIcon size={13} />\n            </button>\n          </div>\n          <div style={{ background: isDark ? \"#15202B\" : \"#f7f9f9\", padding: \"13px 14px 14px\" }}>\n            <div\n              className=\"inline-block max-w-full rounded-[4px_18px_18px_18px] leading-relaxed shadow-[0_1px_4px_rgba(0,0,0,0.07)]\"\n              style={{ background: bubbleBg, color: textPrimary, border: `1px solid ${border}`, fontSize: greetingFontSize, padding: \"10px 13px\" }}\n            >\n              {popupMessage}\n            </div>\n            <div className={cn(\"mt-2.5 text-[11.5px]\", isRight ? \"text-right\" : \"text-left\")} style={{ color: textMuted }}>\n              Tap to reply on X →\n            </div>\n          </div>\n        </div>\n      )}\n\n      <div\n        className={cn(\"absolute bottom-[76px] flex w-[360px] flex-col overflow-hidden border\", isRight ? \"right-0\" : \"left-0\")}\n        style={{\n          maxWidth: panelMaxWidth,\n          maxHeight: \"calc(100dvh - 100px)\",\n          borderColor: border,\n          borderRadius: widgetBorderRadius,\n          background: isDark ? \"#1E2732\" : \"#fff\",\n          boxShadow: isOpen ? (isDark ? \"0 24px 72px rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.4)\" : \"0 24px 72px rgba(0,0,0,0.16), 0 8px 24px rgba(0,0,0,0.1)\") : \"none\",\n          transformOrigin: chatOrigin,\n          transform: isOpen ? \"scale(1) translateY(0px)\" : \"scale(0.72) translateY(24px)\",\n          opacity: isOpen ? 1 : 0,\n          filter: isOpen ? \"blur(0px)\" : \"blur(6px)\",\n          pointerEvents: isOpen ? \"all\" : \"none\",\n          transition: isOpen\n            ? \"transform 0.45s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s ease, filter 0.28s ease, box-shadow 0.3s ease\"\n            : \"transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease, filter 0.22s ease\",\n        }}\n      >\n        <div className=\"flex items-center gap-3 px-4 py-3.5\" style={{ background: X_BLACK }}>\n          <div className=\"relative\">\n            <AvatarEl size={46} border=\"2px solid #2f3336\" src={agentAvatar} isDark={isDark} />\n            <div className=\"absolute bottom-px right-px h-3 w-3 rounded-full border-[2.5px] border-black\" style={{ background: dotColor }} />\n          </div>\n          <div className=\"min-w-0 flex-1\">\n            <div className=\"flex flex-wrap items-center gap-1.5\">\n              <span className=\"font-extrabold leading-tight tracking-tight text-[#e7e9ea]\" style={{ fontSize: agentNameFontSize }}>{agentName}</span>\n              {followsYou && (\n                <span className=\"rounded px-1.5 py-px text-[10px] font-semibold tracking-wide text-[#71767b]\" style={{ background: \"#2f3336\" }}>\n                  FOLLOWS YOU\n                </span>\n              )}\n            </div>\n            <div className=\"mt-0.5 flex items-center gap-1.5 text-[#71767b]\" style={{ fontSize: agentNameFontSize - 3 }}>\n              <span>@{cleanHandle}</span>\n              <span className=\"h-[3px] w-[3px] shrink-0 rounded-full bg-[#71767b]\" />\n              <span className=\"h-1.5 w-1.5 shrink-0 rounded-full\" style={{ background: dotColor }} />\n              <span>{statusText}</span>\n            </div>\n          </div>\n          <button\n            onClick={handleClose}\n            aria-label=\"Close chat\"\n            className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/[0.08]\"\n            style={{ transition: \"background 0.15s, transform 0.2s\" }}\n            onMouseEnter={(e) => {\n              e.currentTarget.style.background = \"rgba(255,255,255,0.18)\";\n              e.currentTarget.style.transform = \"scale(1.08)\";\n            }}\n            onMouseLeave={(e) => {\n              e.currentTarget.style.background = \"rgba(255,255,255,0.08)\";\n              e.currentTarget.style.transform = \"scale(1)\";\n            }}\n          >\n            <CloseIcon color=\"#e7e9ea\" />\n          </button>\n        </div>\n\n        {isOffline && (\n          <div className=\"flex items-start gap-1.5 border-b px-3.5 py-2\" style={{ borderColor: isDark ? \"#2f3336\" : \"#fde68a\", background: isDark ? \"#1a1f23\" : \"#fef3c7\", color: isDark ? \"#71767b\" : \"#92400e\", fontSize: greetingFontSize - 1.5 }}>\n            <span className=\"shrink-0 text-sm\">🔔</span>\n            <span>{offlineMessage}</span>\n          </div>\n        )}\n        {isAway && (\n          <div className=\"flex items-center gap-1.5 border-b px-3.5 py-2\" style={{ borderColor: isDark ? \"#2f3336\" : \"#fde68a\", background: isDark ? \"#1a1f23\" : \"#fffbeb\", color: isDark ? \"#71767b\" : \"#92400e\", fontSize: greetingFontSize - 1.5 }}>\n            <span className=\"text-sm\">🕐</span>\n            <span>Response times may be slower right now.</span>\n          </div>\n        )}\n\n        <div className=\"flex max-h-[320px] min-h-[min(220px,calc(100dvh-330px))] flex-col gap-2.5 overflow-y-auto px-3.5 py-4\" style={{ background: bg }}>\n          {showTyping && (\n            <div className=\"flex items-end gap-2\">\n              <MsgAvatar src={agentAvatar} isDark={isDark} />\n              <div\n                className=\"flex items-center gap-1.5 rounded-[4px_18px_18px_18px]\"\n                style={{ background: bubbleBg, border: `1px solid ${border}`, animation: \"xt-msg-in 0.3s ease forwards\", padding: \"11px 16px\" }}\n              >\n                <span className=\"h-[7px] w-[7px] animate-[xt-dot_1.2s_ease-in-out_0s_infinite] rounded-full\" style={{ background: textMuted }} />\n                <span className=\"h-[7px] w-[7px] animate-[xt-dot_1.2s_ease-in-out_0.2s_infinite] rounded-full\" style={{ background: textMuted }} />\n                <span className=\"h-[7px] w-[7px] animate-[xt-dot_1.2s_ease-in-out_0.4s_infinite] rounded-full\" style={{ background: textMuted }} />\n              </div>\n            </div>\n          )}\n\n          {greetingVisible && (\n            <div className=\"flex items-end gap-2\" style={{ animation: \"xt-msg-in 0.38s cubic-bezier(0.34,1.2,0.64,1) forwards\" }}>\n              <MsgAvatar src={agentAvatar} isDark={isDark} />\n              <div className=\"max-w-[256px]\">\n                <div\n                  className=\"whitespace-pre-line rounded-[4px_18px_18px_18px] px-3.5 py-2.5 leading-relaxed\"\n                  style={{ background: bubbleBg, border: `1px solid ${border}`, color: textPrimary, fontSize: greetingFontSize }}\n                >\n                  {greeting}\n                </div>\n                <div className=\"mt-1 pl-1 text-[11px]\" style={{ color: textMuted }}>\n                  {msgTime}\n                </div>\n              </div>\n            </div>\n          )}\n\n          {greetingVisible && quickReplies.length > 0 && (\n            <div className=\"mt-1 flex flex-col\" style={{ animation: \"xt-msg-in 0.42s cubic-bezier(0.34,1.2,0.64,1) 0.1s both\", gap: 7 }}>\n              {quickReplies.map((qr, i) => (\n                <button\n                  key={i}\n                  onClick={() => handleQuickReply(qr)}\n                  className=\"border-[1.5px] text-left font-medium\"\n                  style={{ borderColor: isDark ? \"#2f3336\" : \"#cfd9de\", color: textPrimary, fontSize: quickReplyFontSize, borderRadius: buttonBorderRadius, padding: \"9px 16px\", transition: \"all 0.18s ease\" }}\n                  onMouseEnter={(e) => {\n                    e.currentTarget.style.background = isDark ? \"#2f3336\" : \"#f7f9f9\";\n                    e.currentTarget.style.borderColor = isDark ? \"#536471\" : \"#0f1419\";\n                    e.currentTarget.style.transform = \"translateX(3px)\";\n                  }}\n                  onMouseLeave={(e) => {\n                    e.currentTarget.style.background = \"transparent\";\n                    e.currentTarget.style.borderColor = isDark ? \"#2f3336\" : \"#cfd9de\";\n                    e.currentTarget.style.transform = \"translateX(0)\";\n                  }}\n                >\n                  {qr.label}\n                </button>\n              ))}\n            </div>\n          )}\n        </div>\n\n        <div className=\"flex items-center gap-2 border-t px-3 py-2.5\" style={{ borderColor: border, background: isDark ? \"#1E2732\" : \"#fff\" }}>\n          <input\n            ref={inputRef}\n            value={inputValue}\n            onChange={(e) => setInputValue(e.target.value)}\n            onKeyDown={handleKey}\n            placeholder=\"Start a message\"\n            aria-label=\"Type a message\"\n            className=\"flex-1 rounded-[24px] border-[1.5px] px-4 py-2.5 outline-none\"\n            style={{ background: inputBg, color: textPrimary, borderColor: border, fontSize: inputFontSize, fontFamily, transition: \"border-color 0.15s\" }}\n            onFocus={(e) => (e.currentTarget.style.borderColor = accentColor)}\n            onBlur={(e) => (e.currentTarget.style.borderColor = border)}\n          />\n          <button\n            onClick={handleSend}\n            aria-label=\"Send message\"\n            className=\"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-full border-[1.5px]\"\n            style={{\n              background: hasInput ? X_BLACK : isDark ? \"#2f3336\" : \"#e7e9ea\",\n              borderColor: hasInput ? X_BLACK : isDark ? \"#536471\" : \"#cfd9de\",\n              cursor: hasInput ? \"pointer\" : \"default\",\n              boxShadow: hasInput ? \"0 4px 14px rgba(0,0,0,0.25)\" : \"none\",\n              transition: \"background 0.18s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s\",\n            }}\n            onMouseEnter={(e) => {\n              if (hasInput) e.currentTarget.style.transform = \"scale(1.12)\";\n            }}\n            onMouseLeave={(e) => {\n              e.currentTarget.style.transform = \"scale(1)\";\n            }}\n          >\n            <SendIcon color={hasInput ? \"#fff\" : textMuted} />\n          </button>\n        </div>\n\n        <div className=\"flex items-center justify-center border-t text-[11px]\" style={{ borderColor: border, background: isDark ? \"#1E2732\" : \"#fff\", color: textMuted, padding: \"5px 0 9px\", gap: 5 }}>\n          <XIcon size={10} color={textMuted} />\n          <span>Message us on X</span>\n        </div>\n      </div>\n\n      <div className=\"relative inline-flex\">\n        <button\n          onClick={isOpen ? handleClose : handleOpen}\n          aria-label={isOpen ? \"Close chat\" : \"Open chat\"}\n          aria-expanded={isOpen}\n          className=\"relative flex h-[60px] w-[60px] items-center justify-center overflow-hidden rounded-full\"\n          style={{\n            background: isOpen ? \"linear-gradient(135deg, #ff6b6b, #ee5a24)\" : X_BLACK,\n            boxShadow: isOpen ? \"0 6px 24px rgba(238,90,36,0.45)\" : \"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1.5px rgba(255,255,255,0.18)\",\n            transform: isVisible ? \"scale(1)\" : \"scale(0)\",\n            opacity: isVisible ? 1 : 0,\n            transition: \"transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease, background 0.3s ease, box-shadow 0.3s ease\",\n          }}\n          onMouseEnter={(e) => (e.currentTarget.style.transform = \"scale(1.1)\")}\n          onMouseLeave={(e) => (e.currentTarget.style.transform = \"scale(1)\")}\n        >\n          <span\n            className=\"pointer-events-none absolute inset-0 rounded-full bg-white/[0.15]\"\n            style={{ transform: \"scale(0)\", animation: isOpen ? \"xt-ripple 0.4s ease-out forwards\" : \"none\" }}\n          />\n          {!isOpen && (\n            <>\n              <div className=\"pointer-events-none absolute -inset-[5px] animate-[xt-pulse_2.4s_ease-in-out_1.2s_infinite] rounded-full border-2 border-white/30\" />\n              <div className=\"pointer-events-none absolute -inset-[11px] animate-[xt-pulse_2.4s_ease-in-out_1.8s_infinite] rounded-full border opacity-50\" style={{ borderColor: `${accentColor}66` }} />\n            </>\n          )}\n          <div\n            className=\"pointer-events-none absolute\"\n            style={{ transform: isOpen ? \"rotate(-90deg) scale(0.3)\" : \"rotate(0deg) scale(1)\", opacity: isOpen ? 0 : 1, transition: \"transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease\" }}\n          >\n            <XIcon size={26} color=\"#fff\" />\n          </div>\n          <div\n            className=\"pointer-events-none absolute\"\n            style={{ transform: isOpen ? \"rotate(0deg) scale(1)\" : \"rotate(90deg) scale(0.3)\", opacity: isOpen ? 1 : 0, transition: \"transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease\" }}\n          >\n            <CloseIcon color=\"#fff\" size={22} />\n          </div>\n        </button>\n\n        {!isOpen && showBadge && notificationCount > 0 && (\n          <div\n            className=\"pointer-events-none absolute -right-1 -top-1 z-[1] flex h-5 min-w-5 items-center justify-center rounded-full border-[2.5px] border-white text-[11px] font-bold text-white\"\n            style={{ background: accentColor, boxShadow: `0 2px 8px ${accentColor}66`, animation: \"xt-badge-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) 1.1s both\", padding: \"0 5px\" }}\n          >\n            {notificationCount > 9 ? \"9+\" : notificationCount}\n          </div>\n        )}\n      </div>\n\n      <style>{`\n        @keyframes xt-pulse { 0% { transform: scale(1); opacity: 0.55; } 70% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1.6); opacity: 0; } }\n        @keyframes xt-ripple { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }\n        @keyframes xt-badge-pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.25) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); } }\n        @keyframes xt-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }\n        @keyframes xt-msg-in { from { transform: translateY(12px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }\n        @keyframes xt-popup-in { from { transform: translateY(18px) scale(0.88); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }\n      `}</style>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}