{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "support-ticket-detail",
  "title": "Support Ticket Detail",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-react/blocks/support-ticket-detail/SupportTicketDetail.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport {\n  AlertCircle,\n  AlertTriangle,\n  ArrowUpRight,\n  Bold,\n  Check,\n  CheckCheck,\n  CheckCircle2,\n  ChevronRight,\n  Clock,\n  Code,\n  Copy,\n  Download,\n  Eye,\n  FileCode2,\n  Globe,\n  ImageIcon,\n  Italic,\n  Link2,\n  Lock,\n  MessageSquare,\n  Paperclip,\n  Plus,\n  Send,\n  ShieldAlert,\n  Tag,\n  X,\n} from 'lucide-react'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Input } from '@/components/ui/input'\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'\nimport { Separator } from '@/components/ui/separator'\nimport { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'\nimport { Textarea } from '@/components/ui/textarea'\n\ninterface ThreadMessage {\n  id: string\n  authorName: string\n  authorRole: string\n  avatarText: string\n  badgeText: string\n  badgeVariant?: 'default' | 'secondary' | 'outline' | 'destructive' | 'success' | 'warning' | 'info'\n  timestamp: string\n  isInternal: boolean\n  content: string\n}\n\nconst cannedMacros = [\n  {\n    id: 'ssl-guide',\n    name: 'SSL Guide',\n    text: `Hi Sarah,\\n\\nTo resolve the ACME challenge issue, please ensure your DNS provider includes the following CAA record:\\n\\n0 issue \"letsencrypt.org\"\\n\\nOnce added, DNS propagation typically takes 2-5 minutes, after which you can re-run verification in your domain dashboard.`,\n  },\n  {\n    id: 'request-logs',\n    name: 'Request logs',\n    text: `Hi Sarah,\\n\\nCould you please provide the full HAR export and debug network logs from your browser console during the SSL verification attempt? This will help us trace the challenge request.`,\n  },\n  {\n    id: 'refund-confirmation',\n    name: 'Refund confirmation',\n    text: `Hi Sarah,\\n\\nWe have processed the billing adjustment for your dedicated SSL add-on. You will see the credit reflected on your next statement.`,\n  },\n]\n\nexport function SupportTicketDetail() {\n  const [ticketStatus, setTicketStatus] = React.useState('in_progress')\n  const [ticketPriority, setTicketPriority] = React.useState('high')\n  const [assignedAgent, setAssignedAgent] = React.useState('elena_martinez')\n  const [department, setDepartment] = React.useState('platform')\n  const [composerTab, setComposerTab] = React.useState<'public' | 'internal'>('public')\n  const [replyDraft, setReplyDraft] = React.useState('')\n  const [selectedMacro, setSelectedMacro] = React.useState('')\n  const [copiedLog, setCopiedLog] = React.useState(false)\n  const [tags, setTags] = React.useState(['ssl-certificate', 'custom-domain', 'acme-challenge', 'enterprise-tier'])\n  const [newTagInput, setNewTagInput] = React.useState('')\n  const [isAddingTag, setIsAddingTag] = React.useState(false)\n  const [dynamicMessages, setDynamicMessages] = React.useState<ThreadMessage[]>([])\n\n  function handleEscalate() {\n    setTicketStatus('escalated')\n  }\n\n  function handleResolve() {\n    setTicketStatus('resolved')\n  }\n\n  function handleSelectMacro(val: string) {\n    setSelectedMacro(val)\n    const macro = cannedMacros.find((m) => m.id === val)\n    if (macro) {\n      setReplyDraft(macro.text)\n    }\n  }\n\n  function applyFormat(type: 'bold' | 'code' | 'link') {\n    if (type === 'bold') {\n      setReplyDraft((prev) => (prev ? `${prev} **bold text**` : '**bold text**'))\n    } else if (type === 'code') {\n      setReplyDraft((prev) => (prev ? `${prev}\\n\\`\\`\\`\\ncode snippet\\n\\`\\`\\`` : '```\\ncode snippet\\n```'))\n    } else if (type === 'link') {\n      setReplyDraft((prev) =>\n        prev ? `${prev} [link title](https://example.com)` : '[link title](https://example.com)',\n      )\n    }\n  }\n\n  function copyErrorLog() {\n    setCopiedLog(true)\n    setTimeout(() => {\n      setCopiedLog(false)\n    }, 2000)\n  }\n\n  function sendReply() {\n    const body = replyDraft.trim()\n    if (!body) return\n    const isInternal = composerTab === 'internal'\n    setDynamicMessages((prev) => [\n      ...prev,\n      {\n        id: `msg-${Date.now()}`,\n        authorName: isInternal ? 'Alex Kim' : 'Elena Martinez',\n        authorRole: isInternal ? 'Senior DevOps' : 'Lead Support Engineer',\n        avatarText: isInternal ? 'AK' : 'EM',\n        badgeText: isInternal ? 'Internal Note - Only visible to team' : 'Support Engineer',\n        badgeVariant: isInternal ? 'warning' : 'default',\n        timestamp: 'Just now',\n        isInternal,\n        content: body,\n      },\n    ])\n    setReplyDraft('')\n    setSelectedMacro('')\n  }\n\n  function sendAndSolve() {\n    sendReply()\n    setTicketStatus('resolved')\n  }\n\n  function addTag() {\n    const t = newTagInput.trim().toLowerCase()\n    if (t && !tags.includes(t)) {\n      setTags((prev) => [...prev, t])\n    }\n    setNewTagInput('')\n    setIsAddingTag(false)\n  }\n\n  function removeTag(tagToRemove: string) {\n    setTags((prev) => prev.filter((t) => t !== tagToRemove))\n  }\n\n  return (\n    <div data-slot=\"support-ticket-detail\" className=\"bg-background text-foreground w-full space-y-6\">\n      {/* Ticket Header */}\n      <header className=\"bg-card rounded-xl border p-5 shadow-xs sm:p-6\">\n        <div className=\"flex flex-col gap-4\">\n          {/* Top Breadcrumb & Actions Row */}\n          <div className=\"flex flex-wrap items-center justify-between gap-3\">\n            <div className=\"text-muted-foreground flex items-center gap-1.5 text-xs\">\n              <span>Support</span>\n              <ChevronRight className=\"size-3.5\" />\n              <span>Tickets</span>\n              <ChevronRight className=\"size-3.5\" />\n              <span className=\"text-foreground font-mono font-medium\">#TICK-8492</span>\n            </div>\n\n            <div className=\"flex items-center gap-2\">\n              <Button variant=\"outline\" size=\"sm\" className=\"gap-1.5 text-xs font-medium\" onClick={handleEscalate}>\n                <AlertTriangle className=\"text-warning size-3.5\" />\n                Escalate\n              </Button>\n              <Button size=\"sm\" className=\"gap-1.5 text-xs font-medium\" onClick={handleResolve}>\n                <CheckCircle2 className=\"size-3.5\" />\n                Resolve Ticket\n              </Button>\n            </div>\n          </div>\n\n          {/* Ticket Title & Metadata */}\n          <div className=\"space-y-1.5\">\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <span className=\"text-muted-foreground font-mono text-xs font-bold tracking-tight\">#TICK-8492</span>\n              <h1 className=\"text-foreground text-lg font-bold tracking-tight sm:text-xl\">\n                Cannot configure custom domain SSL certificate\n              </h1>\n            </div>\n            <p className=\"text-muted-foreground text-xs\">\n              Opened 2 hours ago by <span className=\"text-foreground font-medium\">Sarah Davis</span> (Acme Corp) via Web\n              Portal\n            </p>\n          </div>\n\n          <Separator />\n\n          {/* Status Badges & SLA Strip */}\n          <div className=\"flex flex-wrap items-center gap-3\">\n            <Badge variant=\"destructive\" className=\"gap-1 font-medium\">\n              <AlertCircle className=\"size-3\" />\n              High Priority\n            </Badge>\n\n            <div className=\"w-44\">\n              <Select value={ticketStatus} onValueChange={setTicketStatus}>\n                <SelectTrigger size=\"sm\" className=\"h-7 text-xs font-medium\">\n                  <SelectValue placeholder=\"Status\" />\n                </SelectTrigger>\n                <SelectContent>\n                  <SelectItem value=\"in_progress\">\n                    <span className=\"flex items-center gap-1.5\">\n                      <span className=\"bg-warning size-2 rounded-full\" />\n                      In Progress\n                    </span>\n                  </SelectItem>\n                  <SelectItem value=\"waiting_on_customer\">\n                    <span className=\"flex items-center gap-1.5\">\n                      <span className=\"bg-info size-2 rounded-full\" />\n                      Waiting on Customer\n                    </span>\n                  </SelectItem>\n                  <SelectItem value=\"escalated\">\n                    <span className=\"flex items-center gap-1.5\">\n                      <span className=\"bg-destructive size-2 rounded-full\" />\n                      Escalated\n                    </span>\n                  </SelectItem>\n                  <SelectItem value=\"resolved\">\n                    <span className=\"flex items-center gap-1.5\">\n                      <span className=\"bg-success size-2 rounded-full\" />\n                      Resolved\n                    </span>\n                  </SelectItem>\n                </SelectContent>\n              </Select>\n            </div>\n\n            <div className=\"border-warning/30 bg-warning/10 text-warning inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium\">\n              <Clock className=\"size-3.5\" />\n              <span>SLA: 42m remaining</span>\n            </div>\n\n            <Badge variant=\"outline\" className=\"text-muted-foreground text-xs\">\n              SSL & Custom Domains\n            </Badge>\n          </div>\n        </div>\n      </header>\n\n      {/* 2-Column Workspace */}\n      <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-12\">\n        {/* Left Column: Conversation Thread & Composer (2/3) */}\n        <main className=\"space-y-6 lg:col-span-8\">\n          {/* Message 1: Customer Initial Request */}\n          <article className=\"bg-card rounded-xl border p-5 shadow-xs sm:p-6\">\n            <div className=\"flex items-start justify-between gap-3\">\n              <div className=\"flex items-center gap-3\">\n                <Avatar className=\"size-10\">\n                  <AvatarFallback className=\"bg-primary/10 text-primary text-xs font-semibold\">SD</AvatarFallback>\n                </Avatar>\n                <div>\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"text-foreground text-sm font-semibold\">Sarah Davis</span>\n                    <Badge variant=\"secondary\" className=\"text-xs font-normal\">\n                      Customer\n                    </Badge>\n                  </div>\n                  <p className=\"text-muted-foreground text-xs\">VP of Engineering · Acme Corp (sarah@acme-corp.io)</p>\n                </div>\n              </div>\n              <time className=\"text-muted-foreground text-xs whitespace-nowrap\">Today, 09:14 AM (2h ago)</time>\n            </div>\n\n            <div className=\"text-foreground/90 mt-4 space-y-3.5 text-sm leading-relaxed\">\n              <p>\n                We are attempting to configure our custom apex domain{' '}\n                <code className=\"bg-muted text-foreground rounded px-1.5 py-0.5 font-mono text-xs\">\n                  api.acme-corp.io\n                </code>{' '}\n                on our production cluster, but automated SSL certificate provisioning fails repeatedly during the ACME\n                DNS-01 verification challenge.\n              </p>\n              <p>\n                We verified that the CNAME and DNS TXT records exist in our Cloudflare dashboard, but the challenge\n                validation daemon continues to time out after 10 minutes with the stderr log below:\n              </p>\n\n              {/* Error Code Block Placeholder */}\n              <div className=\"overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100\">\n                <div className=\"text-muted-foreground flex items-center justify-between border-b border-zinc-800 bg-zinc-900/90 px-3.5 py-2 text-xs\">\n                  <div className=\"flex items-center gap-2\">\n                    <FileCode2 className=\"text-destructive size-3.5\" />\n                    <span className=\"font-mono text-xs\">acme-provisioner-stderr.log</span>\n                  </div>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"sm\"\n                    className=\"h-6 gap-1 px-2 text-xs text-zinc-300 hover:bg-zinc-800 hover:text-zinc-100\"\n                    onClick={copyErrorLog}\n                  >\n                    <Copy className=\"size-3\" />\n                    {copiedLog ? 'Copied' : 'Copy log'}\n                  </Button>\n                </div>\n                <pre className=\"overflow-x-auto p-3.5 font-mono text-xs leading-relaxed text-zinc-300\">\n                  <code>{`[2026-10-24T09:12:44Z] [SSL: CERTIFICATE_VERIFY_FAILED] ACME challenge failed for _acme-challenge.api.acme-corp.io\n[2026-10-24T09:13:58Z] DNS TXT record validation timed out after 600s. Response status: 400 Bad Request\n[2026-10-24T09:14:02Z] Detail: CAA record restriction on 'acme-corp.io' prevented Let's Encrypt issuance.`}</code>\n                </pre>\n              </div>\n\n              {/* Screenshot / Attachment Placeholder */}\n              <div className=\"bg-muted/40 rounded-lg border p-3\">\n                <div className=\"flex items-center justify-between gap-3\">\n                  <div className=\"flex min-w-0 items-center gap-2.5\">\n                    <div className=\"bg-background flex size-9 shrink-0 items-center justify-center rounded-md border\">\n                      <ImageIcon className=\"text-muted-foreground size-4\" />\n                    </div>\n                    <div className=\"min-w-0\">\n                      <p className=\"text-foreground truncate text-xs font-medium\">cloudflare-dns-settings.png</p>\n                      <p className=\"text-muted-foreground text-xs\">1.4 MB · PNG Image Screenshot</p>\n                    </div>\n                  </div>\n                  <div className=\"flex items-center gap-1\">\n                    <Button variant=\"ghost\" size=\"sm\" className=\"h-7 text-xs\">\n                      <Eye className=\"size-3.5\" />\n                      Preview\n                    </Button>\n                    <Button aria-label=\"Download attachment\" variant=\"ghost\" size=\"sm\" className=\"h-7 text-xs\">\n                      <Download className=\"size-3.5\" />\n                      Download\n                    </Button>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </article>\n\n          {/* Message 2: Internal Staff Note (distinct yellow/amber tint background) */}\n          <article className=\"border-warning/30 bg-warning/10 dark:bg-warning/10 rounded-xl border p-5 shadow-xs sm:p-6\">\n            <div className=\"flex items-start justify-between gap-3\">\n              <div className=\"flex items-center gap-3\">\n                <Avatar className=\"size-10\">\n                  <AvatarFallback className=\"bg-warning/20 text-warning text-xs font-semibold\">AK</AvatarFallback>\n                </Avatar>\n                <div>\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"text-foreground text-sm font-semibold\">Alex Kim</span>\n                    <Badge\n                      variant=\"outline\"\n                      className=\"border-warning/40 bg-warning/20 text-warning gap-1 text-xs font-medium\"\n                    >\n                      <Lock className=\"size-3\" />\n                      Internal Note - Only visible to team\n                    </Badge>\n                  </div>\n                  <p className=\"text-muted-foreground text-xs\">Senior DevOps Engineer · Tier 2 Infrastructure</p>\n                </div>\n              </div>\n              <time className=\"text-muted-foreground text-xs whitespace-nowrap\">Today, 09:35 AM (1h ago)</time>\n            </div>\n\n            <div className=\"text-foreground/90 mt-4 space-y-2 text-sm leading-relaxed\">\n              <p>\n                Checked Cloudflare DNS propagation on their nameservers via{' '}\n                <code className=\"text-foreground bg-warning/20 rounded px-1 py-0.5 font-mono text-xs\">\n                  dig CAA acme-corp.io\n                </code>\n                . Looks like their root zone has a CAA record restricting certificate issuance strictly to DigiCert (\n                <code className=\"text-foreground bg-warning/20 rounded px-1 py-0.5 font-mono text-xs\">\n                  0 issue &quot;digicert.com&quot;\n                </code>\n                ), while our automated ACME pipeline requests Let&apos;s Encrypt certificates.\n              </p>\n              <p>\n                If they add{' '}\n                <code className=\"text-foreground bg-warning/20 rounded px-1 py-0.5 font-mono text-xs\">\n                  0 issue &quot;letsencrypt.org&quot;\n                </code>{' '}\n                to their DNS CAA records, the validation handshake will complete within 2 minutes.\n              </p>\n            </div>\n          </article>\n\n          {/* Message 3: Agent response */}\n          <article className=\"bg-card rounded-xl border p-5 shadow-xs sm:p-6\">\n            <div className=\"flex items-start justify-between gap-3\">\n              <div className=\"flex items-center gap-3\">\n                <Avatar className=\"size-10\">\n                  <AvatarFallback className=\"bg-primary text-primary-foreground text-xs font-semibold\">\n                    EM\n                  </AvatarFallback>\n                </Avatar>\n                <div>\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"text-foreground text-sm font-semibold\">Elena Martinez</span>\n                    <Badge className=\"text-xs font-normal\">Support Engineer</Badge>\n                  </div>\n                  <p className=\"text-muted-foreground text-xs\">Lead Support Engineer · UIPKGE Staff</p>\n                </div>\n              </div>\n              <time className=\"text-muted-foreground text-xs whitespace-nowrap\">Today, 09:48 AM (45m ago)</time>\n            </div>\n\n            <div className=\"text-foreground/90 mt-4 space-y-3 text-sm leading-relaxed\">\n              <p>\n                Hi Sarah, thank you for providing the detailed error log! We analyzed the ACME challenge failure and\n                identified that your apex domain&apos;s DNS CAA records currently block Let&apos;s Encrypt certificate\n                issuance.\n              </p>\n              <p>Please follow these step-by-step instructions to enable Let&apos;s Encrypt validation:</p>\n              <ol className=\"text-foreground/90 list-inside list-decimal space-y-1.5 pl-1 text-xs sm:text-sm\">\n                <li>\n                  Log in to your Cloudflare DNS dashboard for{' '}\n                  <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-xs\">acme-corp.io</code>.\n                </li>\n                <li>\n                  Navigate to <strong>DNS Settings</strong> &rarr; <strong>Add Record</strong>.\n                </li>\n                <li>\n                  Select <strong>CAA</strong>, set Flag to{' '}\n                  <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-xs\">0</code>, Tag to{' '}\n                  <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-xs\">issue</code>, and Value to{' '}\n                  <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-xs\">&quot;letsencrypt.org&quot;</code>.\n                </li>\n                <li>Allow up to 2 minutes for DNS TTL cache propagation across edge resolvers.</li>\n                <li>\n                  Return to your cluster settings dashboard and click <strong>Retry Verification</strong>.\n                </li>\n              </ol>\n              <p>\n                Feel free to reply directly once you&apos;ve saved the record, and we&apos;ll monitor the validation\n                handshake from our side!\n              </p>\n            </div>\n          </article>\n\n          {/* Dynamic User Messages */}\n          {dynamicMessages.map((msg) => (\n            <article\n              key={msg.id}\n              className={`rounded-xl border p-5 shadow-xs sm:p-6 ${\n                msg.isInternal ? 'border-warning/30 bg-warning/10' : 'bg-card'\n              }`}\n            >\n              <div className=\"flex items-start justify-between gap-3\">\n                <div className=\"flex items-center gap-3\">\n                  <Avatar className=\"size-10\">\n                    <AvatarFallback\n                      className={`text-xs font-semibold ${\n                        msg.isInternal ? 'bg-warning/20 text-warning' : 'bg-primary text-primary-foreground'\n                      }`}\n                    >\n                      {msg.avatarText}\n                    </AvatarFallback>\n                  </Avatar>\n                  <div>\n                    <div className=\"flex items-center gap-2\">\n                      <span className=\"text-foreground text-sm font-semibold\">{msg.authorName}</span>\n                      <Badge\n                        variant={msg.isInternal ? 'outline' : 'default'}\n                        className={\n                          msg.isInternal\n                            ? 'border-warning/40 bg-warning/20 text-warning gap-1 text-xs font-medium'\n                            : 'text-xs font-normal'\n                        }\n                      >\n                        {msg.isInternal && <Lock className=\"size-3\" />}\n                        {msg.badgeText}\n                      </Badge>\n                    </div>\n                    <p className=\"text-muted-foreground text-xs\">{msg.authorRole}</p>\n                  </div>\n                </div>\n                <time className=\"text-muted-foreground text-xs whitespace-nowrap\">{msg.timestamp}</time>\n              </div>\n              <div className=\"text-foreground/90 mt-4 text-sm leading-relaxed whitespace-pre-wrap\">{msg.content}</div>\n            </article>\n          ))}\n\n          {/* Reply Box Composer */}\n          <section className=\"bg-card overflow-hidden rounded-xl border shadow-xs\">\n            <Tabs\n              value={composerTab}\n              onValueChange={(v) => setComposerTab(v as 'public' | 'internal')}\n              defaultValue=\"public\"\n            >\n              {/* Composer Header with Tabs & Macro Dropdown */}\n              <div className=\"bg-muted/30 flex flex-wrap items-center justify-between gap-3 border-b px-4 py-2.5\">\n                <TabsList className=\"h-8\">\n                  <TabsTrigger value=\"public\" className=\"gap-1.5 text-xs\">\n                    <MessageSquare className=\"size-3.5\" />\n                    Public Reply\n                  </TabsTrigger>\n                  <TabsTrigger value=\"internal\" className=\"gap-1.5 text-xs\">\n                    <Lock className=\"size-3.5\" />\n                    Internal Note\n                  </TabsTrigger>\n                </TabsList>\n\n                {/* Canned Responses / Macros Dropdown */}\n                <div className=\"w-48\">\n                  <Select value={selectedMacro} onValueChange={handleSelectMacro}>\n                    <SelectTrigger size=\"sm\" className=\"h-8 text-xs\">\n                      <SelectValue placeholder=\"Canned macro...\" />\n                    </SelectTrigger>\n                    <SelectContent>\n                      {cannedMacros.map((macro) => (\n                        <SelectItem key={macro.id} value={macro.id}>\n                          {macro.name}\n                        </SelectItem>\n                      ))}\n                    </SelectContent>\n                  </Select>\n                </div>\n              </div>\n\n              <div className=\"space-y-3 p-4\">\n                {/* Rich Formatting Toolbar */}\n                <div className=\"text-muted-foreground flex items-center gap-1 border-b pb-2\">\n                  <Button\n                    variant=\"ghost\"\n                    size=\"icon\"\n                    className=\"size-7\"\n                    aria-label=\"Format bold\"\n                    onClick={() => applyFormat('bold')}\n                  >\n                    <Bold className=\"size-3.5\" />\n                  </Button>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"icon\"\n                    className=\"size-7\"\n                    aria-label=\"Format italic\"\n                    onClick={() => applyFormat('bold')}\n                  >\n                    <Italic className=\"size-3.5\" />\n                  </Button>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"icon\"\n                    className=\"size-7\"\n                    aria-label=\"Format code\"\n                    onClick={() => applyFormat('code')}\n                  >\n                    <Code className=\"size-3.5\" />\n                  </Button>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"icon\"\n                    className=\"size-7\"\n                    aria-label=\"Insert link\"\n                    onClick={() => applyFormat('link')}\n                  >\n                    <Link2 className=\"size-3.5\" />\n                  </Button>\n                  <Separator orientation=\"vertical\" className=\"mx-1 h-4\" />\n                  <Button variant=\"ghost\" size=\"icon\" className=\"size-7\" aria-label=\"Attach file\">\n                    <Paperclip className=\"size-3.5\" />\n                  </Button>\n                  <span className=\"text-muted-foreground ml-auto text-xs\">Markdown supported</span>\n                </div>\n\n                {/* Textarea with dynamic background if internal note */}\n                <Textarea\n                  value={replyDraft}\n                  onValueChange={(v) => setReplyDraft(v)}\n                  placeholder={\n                    composerTab === 'public'\n                      ? 'Write a public reply to Sarah Davis...'\n                      : 'Add an internal note only visible to team members...'\n                  }\n                  rows={4}\n                  className={`resize-y text-sm ${\n                    composerTab === 'internal' ? 'border-warning/30 bg-warning/5 focus-visible:ring-warning/20' : ''\n                  }`}\n                />\n\n                {/* Composer Actions */}\n                <div className=\"flex flex-wrap items-center justify-between gap-3 pt-1\">\n                  <div className=\"text-muted-foreground flex items-center gap-2 text-xs\">\n                    <Paperclip className=\"size-3.5\" />\n                    <span>Attachments up to 25MB</span>\n                  </div>\n\n                  <div className=\"flex items-center gap-2\">\n                    {composerTab === 'public' && (\n                      <Button\n                        variant=\"outline\"\n                        size=\"sm\"\n                        className=\"gap-1.5 text-xs\"\n                        disabled={!replyDraft.trim()}\n                        onClick={sendAndSolve}\n                      >\n                        <CheckCheck className=\"size-3.5\" />\n                        Send & Mark Solved\n                      </Button>\n                    )}\n                    <Button size=\"sm\" className=\"gap-1.5 text-xs\" disabled={!replyDraft.trim()} onClick={sendReply}>\n                      <Send className=\"size-3.5\" />\n                      {composerTab === 'public' ? 'Send Reply' : 'Add Internal Note'}\n                    </Button>\n                  </div>\n                </div>\n              </div>\n            </Tabs>\n          </section>\n        </main>\n\n        {/* Right Column: Customer & Ticket Metadata Sidebar (1/3) */}\n        <aside className=\"space-y-6 lg:col-span-4\">\n          {/* Customer Info Card */}\n          <Card>\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex items-start justify-between gap-2\">\n                <div className=\"flex items-center gap-3\">\n                  <Avatar className=\"size-11\">\n                    <AvatarFallback className=\"bg-primary/10 text-primary text-sm font-semibold\">SD</AvatarFallback>\n                  </Avatar>\n                  <div>\n                    <CardTitle className=\"text-sm font-semibold\">Sarah Davis</CardTitle>\n                    <CardDescription className=\"text-xs\">VP of Engineering</CardDescription>\n                  </div>\n                </div>\n                <Badge variant=\"default\" className=\"text-xs font-medium\">\n                  Enterprise\n                </Badge>\n              </div>\n            </CardHeader>\n            <CardContent className=\"space-y-3 pt-0\">\n              <Separator />\n              <dl className=\"space-y-2.5 text-xs\">\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">Company</dt>\n                  <dd className=\"text-foreground font-medium\">Acme Corp</dd>\n                </div>\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">Email</dt>\n                  <dd className=\"text-foreground max-w-[180px] truncate font-medium\">sarah@acme-corp.io</dd>\n                </div>\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">Total Tickets</dt>\n                  <dd className=\"text-foreground font-medium tabular-nums\">12 (10 resolved)</dd>\n                </div>\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">Customer Since</dt>\n                  <dd className=\"text-foreground font-medium\">Jan 2024</dd>\n                </div>\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">SLA Plan</dt>\n                  <dd className=\"text-foreground font-medium\">1h Critical Response</dd>\n                </div>\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground\">Timezone</dt>\n                  <dd className=\"text-foreground font-medium\">America/Los_Angeles (UTC-7)</dd>\n                </div>\n              </dl>\n              <Separator />\n              <Button variant=\"outline\" size=\"sm\" className=\"w-full justify-center gap-1.5 text-xs\">\n                View Customer in CRM\n                <ArrowUpRight className=\"size-3.5\" />\n              </Button>\n            </CardContent>\n          </Card>\n\n          {/* Ticket Attributes Card */}\n          <Card>\n            <CardHeader className=\"pb-3\">\n              <CardTitle className=\"text-sm font-semibold\">Ticket Attributes</CardTitle>\n            </CardHeader>\n            <CardContent className=\"space-y-4 pt-0\">\n              {/* Assigned Agent */}\n              <div className=\"space-y-1.5\">\n                <label className=\"text-muted-foreground text-xs font-medium\">Assigned Agent</label>\n                <Select value={assignedAgent} onValueChange={setAssignedAgent}>\n                  <SelectTrigger size=\"sm\" className=\"w-full text-xs\">\n                    <SelectValue placeholder=\"Select Agent\" />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value=\"elena_martinez\">Elena Martinez (DevOps)</SelectItem>\n                    <SelectItem value=\"alex_kim\">Alex Kim (Tier 2)</SelectItem>\n                    <SelectItem value=\"marcus_vance\">Marcus Vance (Platform)</SelectItem>\n                    <SelectItem value=\"unassigned\">Unassigned</SelectItem>\n                  </SelectContent>\n                </Select>\n              </div>\n\n              {/* Department */}\n              <div className=\"space-y-1.5\">\n                <label className=\"text-muted-foreground text-xs font-medium\">Department</label>\n                <Select value={department} onValueChange={setDepartment}>\n                  <SelectTrigger size=\"sm\" className=\"w-full text-xs\">\n                    <SelectValue placeholder=\"Department\" />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value=\"platform\">Platform Infrastructure</SelectItem>\n                    <SelectItem value=\"billing\">Billing & Subscriptions</SelectItem>\n                    <SelectItem value=\"core_api\">Core API Support</SelectItem>\n                    <SelectItem value=\"security\">Security & Compliance</SelectItem>\n                  </SelectContent>\n                </Select>\n              </div>\n\n              {/* Priority */}\n              <div className=\"space-y-1.5\">\n                <label className=\"text-muted-foreground text-xs font-medium\">Priority</label>\n                <Select value={ticketPriority} onValueChange={setTicketPriority}>\n                  <SelectTrigger size=\"sm\" className=\"w-full text-xs\">\n                    <SelectValue placeholder=\"Priority\" />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value=\"urgent\">Urgent (P0)</SelectItem>\n                    <SelectItem value=\"high\">High (P1)</SelectItem>\n                    <SelectItem value=\"medium\">Medium (P2)</SelectItem>\n                    <SelectItem value=\"low\">Low (P3)</SelectItem>\n                  </SelectContent>\n                </Select>\n              </div>\n\n              <Separator />\n\n              {/* Tags Section */}\n              <div className=\"space-y-2\">\n                <div className=\"flex items-center justify-between\">\n                  <span className=\"text-muted-foreground text-xs font-medium\">Tags</span>\n                  {!isAddingTag && (\n                    <button\n                      className=\"text-primary min-h-6 text-xs font-medium hover:underline\"\n                      onClick={() => setIsAddingTag(true)}\n                    >\n                      + Add Tag\n                    </button>\n                  )}\n                </div>\n\n                <div className=\"flex flex-wrap gap-1.5\">\n                  {tags.map((tag) => (\n                    <span\n                      key={tag}\n                      className=\"bg-muted text-foreground inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs\"\n                    >\n                      <Tag className=\"text-muted-foreground size-3\" />\n                      {tag}\n                      <button\n                        className=\"text-muted-foreground hover:text-foreground ml-0.5\"\n                        aria-label=\"Remove tag\"\n                        onClick={() => removeTag(tag)}\n                      >\n                        <X className=\"size-3\" />\n                      </button>\n                    </span>\n                  ))}\n                </div>\n\n                {isAddingTag && (\n                  <div className=\"flex items-center gap-1.5 pt-1\">\n                    <Input\n                      value={newTagInput}\n                      onChange={(e) => setNewTagInput(e.target.value)}\n                      placeholder=\"New tag...\"\n                      className=\"h-7 text-xs\"\n                      onKeyDown={(e) => {\n                        if (e.key === 'Enter') {\n                          e.preventDefault()\n                          addTag()\n                        }\n                      }}\n                    />\n                    <Button size=\"sm\" className=\"h-7 px-2 text-xs\" onClick={addTag}>\n                      Add\n                    </Button>\n                    <Button\n                      variant=\"ghost\"\n                      size=\"sm\"\n                      className=\"h-7 px-2 text-xs\"\n                      onClick={() => setIsAddingTag(false)}\n                    >\n                      Cancel\n                    </Button>\n                  </div>\n                )}\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* SLA & Metrics Card */}\n          <Card>\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex items-center justify-between\">\n                <CardTitle className=\"text-sm font-semibold\">SLA & Metrics</CardTitle>\n                <Badge variant=\"outline\" className=\"text-xs font-medium\">\n                  Active SLA\n                </Badge>\n              </div>\n            </CardHeader>\n            <CardContent className=\"space-y-3 pt-0\">\n              <dl className=\"space-y-3 text-xs\">\n                <div className=\"flex items-center justify-between gap-2\">\n                  <div>\n                    <dt className=\"text-foreground font-medium\">First Response Time</dt>\n                    <dd className=\"text-muted-foreground text-xs\">Target: &lt; 15m</dd>\n                  </div>\n                  <div className=\"text-right\">\n                    <span className=\"text-success font-semibold\">8m</span>\n                    <span className=\"text-muted-foreground block text-xs\">7m ahead</span>\n                  </div>\n                </div>\n\n                <Separator />\n\n                <div className=\"flex items-center justify-between gap-2\">\n                  <div>\n                    <dt className=\"text-foreground font-medium\">Target Resolution</dt>\n                    <dd className=\"text-muted-foreground text-xs\">Target: 4h (Elapsed: 3h 18m)</dd>\n                  </div>\n                  <div className=\"text-right\">\n                    <span className=\"text-warning font-semibold\">42m</span>\n                    <span className=\"text-muted-foreground block text-xs\">remaining</span>\n                  </div>\n                </div>\n\n                <Separator />\n\n                <div className=\"flex items-center justify-between gap-2\">\n                  <div>\n                    <dt className=\"text-foreground font-medium\">CSAT Prediction</dt>\n                    <dd className=\"text-muted-foreground text-xs\">Based on sentiment analysis</dd>\n                  </div>\n                  <Badge variant=\"secondary\" className=\"font-medium\">\n                    98% High\n                  </Badge>\n                </div>\n\n                <Separator />\n\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Globe className=\"size-3.5\" />\n                    Source Channel\n                  </dt>\n                  <dd className=\"text-foreground font-medium\">Web Portal</dd>\n                </div>\n\n                <div className=\"flex items-center justify-between gap-2\">\n                  <dt className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <ShieldAlert className=\"size-3.5\" />\n                    Escalation Tier\n                  </dt>\n                  <dd className=\"text-foreground font-medium\">Tier 2 Support</dd>\n                </div>\n              </dl>\n            </CardContent>\n          </Card>\n        </aside>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/SupportTicketDetail.tsx"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/avatar.json",
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/input.json",
    "https://uipkge.dev/r/react/select.json",
    "https://uipkge.dev/r/react/separator.json",
    "https://uipkge.dev/r/react/tabs.json",
    "https://uipkge.dev/r/react/textarea.json"
  ],
  "description": "Customer support ticket conversation thread, SLA monitor & staff workbench with internal notes, canned response macros, and customer metadata sidebar.",
  "categories": [
    "communication",
    "app",
    "support"
  ]
}