{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chat-response",
  "title": "Chat response",
  "author": "superzero11 <https://github.com/superzero11/uiset>",
  "description": "Streaming markdown that repairs itself mid-stream and never renders raw HTML, with code blocks highlighted by skin colors.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.5",
    "@ui-sdk/react@0.1.0-beta.5",
    "react-markdown@10.1.0",
    "remark-gfm@4.0.1",
    "remend@1.4.0",
    "shiki@4.6.0"
  ],
  "registryDependencies": [
    "https://uiset.dev/r/uiset.json",
    "https://uiset.dev/r/chat.json",
    "https://uiset.dev/r/button.json"
  ],
  "files": [
    {
      "path": "registry/uiset/ui/chat-response.tsx",
      "content": "\"use client\"\n\nimport { announce } from \"@ui-sdk/core\"\nimport { Toggle } from \"@ui-sdk/react/toggle\"\nimport {\n  Children,\n  isValidElement,\n  useEffect,\n  useMemo,\n  useState,\n  type ReactElement,\n  type ReactNode,\n} from \"react\"\nimport ReactMarkdown, { type Components } from \"react-markdown\"\nimport remarkGfm from \"remark-gfm\"\nimport remend from \"remend\"\nimport { Button } from \"./button\"\nimport { ChatIcon, chatIcons } from \"./chat\"\nimport { tokenize, type Token } from \"./code/highlight\"\nimport \"./chat/chat.css\"\nimport \"./code/code.css\"\n\nfunction ChatCodeBlock({\n  code,\n  language,\n  filename,\n}: {\n  code: string\n  language?: string\n  filename?: string\n}) {\n  const [tokens, setTokens] = useState<Token[][] | null>(null)\n  const [wrap, setWrap] = useState(false)\n  const [copied, setCopied] = useState(false)\n\n  useEffect(() => {\n    let current = true\n    if (!language) return\n    tokenize(code, language)\n      .then((result) => current && setTokens(result))\n      .catch(() => current && setTokens(null))\n    return () => {\n      current = false\n    }\n  }, [code, language])\n\n  const copy = async () => {\n    await navigator.clipboard.writeText(code)\n    setCopied(true)\n    announce(\"Copied\")\n    setTimeout(() => setCopied(false), 1600)\n  }\n\n  const title = filename ?? language ?? \"Code\"\n\n  return (\n    <figure className=\"chat-code\" data-wrap={wrap ? \"\" : undefined}>\n      <figcaption className=\"chat-code-header\">\n        <span translate=\"no\">{title}</span>\n        <span className=\"chat-code-actions\">\n          <Toggle\n            aria-label=\"Wrap lines\"\n            pressed={wrap}\n            onPressedChange={setWrap}\n            className=\"chat-code-toggle\"\n          >\n            Wrap\n          </Toggle>\n          <Button variant=\"ghost\" aria-label={`Copy ${title}`} onClick={copy}>\n            <ChatIcon path={copied ? chatIcons.check : chatIcons.copy} />\n          </Button>\n        </span>\n      </figcaption>\n      <pre tabIndex={0} role=\"region\" aria-label={title}>\n        <code translate=\"no\">\n          {tokens\n            ? tokens.map((line, index) => (\n                <span key={index} className=\"chat-code-line\">\n                  {line.map((token, j) => (\n                    <span\n                      key={j}\n                      style={token.color ? { color: token.color } : undefined}\n                    >\n                      {token.content}\n                    </span>\n                  ))}\n                  {\"\\n\"}\n                </span>\n              ))\n            : code}\n        </code>\n      </pre>\n    </figure>\n  )\n}\n\nconst components: Components = {\n  pre: ({ children }) => {\n    const child = Children.toArray(children)[0]\n    if (!isValidElement(child)) return <pre>{children}</pre>\n    const { className, children: text } = (\n      child as ReactElement<{ className?: string; children?: ReactNode }>\n    ).props\n    const language = /language-([\\w+#-]+)/.exec(className ?? \"\")?.[1]\n    return (\n      <ChatCodeBlock code={String(text ?? \"\").replace(/\\n$/, \"\")} language={language} />\n    )\n  },\n  a: ({ href, children }) => {\n    const external = href ? /^https?:\\/\\//.test(href) : false\n    return (\n      <a\n        href={href}\n        {...(external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})}\n      >\n        {children}\n        {external && <span className=\"chat-visually-hidden\"> (opens in a new tab)</span>}\n      </a>\n    )\n  },\n  table: ({ children }) => (\n    <div className=\"chat-table\" role=\"region\" aria-label=\"Table\" tabIndex={0}>\n      <table>{children}</table>\n    </div>\n  ),\n}\n\n/** Same-origin, data: and blob: images load; remote ones wait for the page to allow them. */\nconst sameOriginImages = (url: URL) =>\n  url.origin === globalThis.location?.origin || url.protocol === \"data:\" || url.protocol === \"blob:\"\n\n/**\n * An image from the model. A remote one could carry what the model read to someone else's\n * server in its address, so unless `allowImage` lets it load, it's a link the person can follow.\n */\nfunction ResponseImage({ src, alt, allowImage }: { src?: string; alt?: string; allowImage: (url: URL) => boolean }) {\n  let url: URL | null = null\n  try {\n    url = src ? new URL(src, globalThis.location?.href ?? \"http://localhost/\") : null\n  } catch {\n    url = null\n  }\n  if (url && allowImage(url)) return <img src={url.href} alt={alt ?? \"\"} loading=\"lazy\" />\n  if (url && /^https?:$/.test(url.protocol))\n    return (\n      <a href={url.href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"chat-image-link\">\n        Image: {alt || url.hostname}\n        <span className=\"chat-visually-hidden\"> (opens in a new tab)</span>\n      </a>\n    )\n  return alt ? <>{alt}</> : null\n}\n\n// Raw HTML in the markdown is shown as text, never rendered: model output is untrusted.\n// Links go through react-markdown's own URL check, which drops `javascript:` and the like.\nfunction ChatResponse({\n  children,\n  streaming = false,\n  allowImage = sameOriginImages,\n}: {\n  children: string\n  streaming?: boolean\n  /** Which images in answers load. Same-origin, data: and blob: by default; others are links. */\n  allowImage?: (url: URL) => boolean\n}) {\n  const withImages = useMemo<Components>(\n    () => ({ ...components, img: ({ src, alt }) => <ResponseImage src={typeof src === \"string\" ? src : undefined} alt={alt} allowImage={allowImage} /> }),\n    [allowImage],\n  )\n  return (\n    <div className=\"chat-response\">\n      <ReactMarkdown remarkPlugins={[remarkGfm]} components={withImages} skipHtml>\n        {streaming ? remend(children) : children}\n      </ReactMarkdown>\n    </div>\n  )\n}\n\nexport { ChatCodeBlock, ChatResponse }\n",
      "type": "registry:ui",
      "target": "@ui/chat-response.tsx"
    },
    {
      "path": "registry/uiset/ui/chat/chat.css",
      "content": "@layer ui-sdk, uiset.tokens, uiset.base, uiset.skin;\n\n@layer uiset.base {\n  :where([data-uiset]) {\n    --chat-bubble: var(--ui-primary);\n    --chat-bubble-text: var(--ui-primary-foreground);\n    --chat-surface: var(--ui-muted);\n    --chat-code-bg: var(--ui-muted);\n\n    /* Code token colors live in code/code.css, shared with the IDE kit. */\n  }\n\n  /* A user's plain message and the files they attached (the chat-app template). */\n  .chat-plain {\n    margin: 0;\n  }\n\n  .chat-file-note {\n    color: var(--ui-muted-foreground);\n    font-size: 0.8125rem;\n  }\n\n  .chat-visually-hidden {\n    position: absolute;\n    width: 1px;\n    height: 1px;\n    overflow: hidden;\n    clip-path: inset(50%);\n    white-space: nowrap;\n  }\n\n  .chat-icon {\n    width: 1rem;\n    height: 1rem;\n    fill: none;\n    stroke: currentColor;\n    stroke-width: 1.75;\n    stroke-linecap: round;\n    stroke-linejoin: round;\n  }\n\n  /* Thread */\n\n  .chat-thread {\n    position: relative;\n    min-height: 0;\n  }\n\n  .chat-thread-scroller {\n    max-height: var(--chat-thread-height, 26rem);\n    overflow-y: auto;\n    overscroll-behavior: contain;\n    border-radius: var(--ui-radius, 0px);\n\n    &:focus-visible {\n      outline: 2px solid var(--ui-ring-border);\n      outline-offset: 2px;\n    }\n  }\n\n  .chat-thread-log {\n    display: flex;\n    flex-direction: column;\n    gap: 1rem;\n    padding: 0.25rem 0.25rem 0.75rem;\n  }\n\n  .chat-thread-jump {\n    position: absolute;\n    bottom: 0.5rem;\n    left: 50%;\n    translate: -50% 0;\n    box-shadow: var(--ui-shadow);\n  }\n\n  .chat-empty {\n    display: grid;\n    justify-items: center;\n    gap: 0.75rem;\n    padding: 2.5rem 1rem;\n    text-align: center;\n    color: var(--ui-muted-foreground);\n  }\n\n  .chat-empty-title {\n    margin: 0;\n    font-size: 1.125rem;\n    font-weight: 600;\n    color: var(--ui-foreground);\n  }\n\n  /* Messages */\n\n  .chat-message {\n    display: grid;\n    grid-template-columns: auto minmax(0, 1fr);\n    gap: 0.625rem;\n    align-items: start;\n\n    &:not(:has(.chat-message-avatar)) {\n      grid-template-columns: minmax(0, 1fr);\n    }\n  }\n\n  .chat-message-avatar {\n    width: 1.75rem;\n    height: 1.75rem;\n    font-size: 0.75rem;\n  }\n\n  .chat-message-body {\n    display: grid;\n    gap: 0.25rem;\n    min-width: 0;\n  }\n\n  .chat-message-meta {\n    display: flex;\n    align-items: baseline;\n    gap: 0.5rem;\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .chat-message-name {\n    font-weight: 600;\n    color: var(--ui-foreground);\n  }\n\n  .chat-message-content {\n    display: grid;\n    gap: 0.5rem;\n    line-height: 1.55;\n    /* A long URL or token wraps rather than widening the message. (Short messages stay on\n       one line because a person's bubble may use 90% of the row, see below.) */\n    overflow-wrap: anywhere;\n  }\n\n  /* The body takes the row and puts the bubble at its end; a bubble's 90% is of the row,\n     not of a body shrunk to the name and time above it. */\n  .chat-message[data-from=\"user\"] {\n    grid-template-columns: minmax(0, 1fr) auto;\n\n    .chat-message-avatar {\n      order: 2;\n    }\n\n    .chat-message-body {\n      justify-items: end;\n    }\n\n    .chat-message-content {\n      max-width: min(36rem, 90%);\n      padding: 0.5rem 0.875rem;\n      border-radius: calc(var(--ui-radius, 0px) + 10px);\n      background: var(--chat-bubble);\n      color: var(--chat-bubble-text);\n    }\n  }\n\n  /* Without an avatar, a person's bubble sits flush at the end of the row. */\n  .chat-message[data-from=\"user\"]:not(:has(.chat-message-avatar)) {\n    grid-template-columns: minmax(0, 1fr);\n  }\n\n  /* Files in a person's own bubble read in the bubble's text color. */\n  .chat-message[data-from=\"user\"] .chat-message-content :is(a, figcaption) {\n    color: inherit;\n  }\n\n  .chat-message[data-from=\"system\"] .chat-message-content {\n    color: var(--ui-muted-foreground);\n    font-style: italic;\n  }\n\n  .chat-message[data-streaming] .chat-message-content > :last-child::after {\n    content: \"▍\";\n    margin-inline-start: 1px;\n    animation: chat-blink 1s steps(2) infinite;\n  }\n\n  @keyframes chat-blink {\n    50% {\n      opacity: 0;\n    }\n  }\n\n  :is(.chat-actions, .chat-suggestions)[data-slot=\"toolbar\"] {\n    padding: 0;\n    border: 0;\n    background: none;\n    box-shadow: none;\n  }\n\n  .chat-actions,\n  .chat-suggestions {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 0.25rem;\n  }\n\n  .chat-actions {\n    :is([data-slot=\"toolbar-button\"], [data-slot=\"toggle\"]) {\n      height: 1.875rem;\n      width: 1.875rem;\n      padding: 0;\n      border-color: transparent;\n      background: transparent;\n      color: var(--ui-muted-foreground);\n\n      &:hover {\n        background: var(--ui-muted);\n        color: var(--ui-foreground);\n      }\n\n      &[data-pressed] {\n        color: var(--ui-foreground);\n        background: var(--ui-muted);\n      }\n    }\n\n    [data-slot=\"toggle-group\"] {\n      display: flex;\n      gap: 0.25rem;\n    }\n  }\n\n  /* Suggestions are chips you can press: an outline, and a fill on hover. */\n  .chat-suggestions [data-slot=\"toolbar-button\"] {\n    height: auto;\n    min-height: 2rem;\n    padding: 0.375rem 0.875rem;\n    border: 1px solid var(--ui-border);\n    border-radius: 999px;\n    background: var(--ui-background);\n    color: var(--ui-foreground);\n    text-align: start;\n    white-space: normal;\n\n    &:hover:not([data-disabled]) {\n      border-color: var(--ui-input);\n      background: var(--ui-muted);\n    }\n  }\n\n  .chat-branch {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n    font-variant-numeric: tabular-nums;\n\n    [data-slot=\"button\"] {\n      width: 1.75rem;\n      height: 1.75rem;\n      padding: 0;\n    }\n  }\n\n  .chat-shimmer {\n    background: linear-gradient(\n        90deg,\n        var(--ui-muted-foreground) 0 40%,\n        var(--ui-foreground) 50%,\n        var(--ui-muted-foreground) 60% 100%\n      )\n      0 0 / 300% 100%;\n    background-clip: text;\n    color: transparent;\n    animation: chat-shimmer 1.8s linear infinite;\n  }\n\n  @keyframes chat-shimmer {\n    from {\n      background-position: 100% 0;\n    }\n    to {\n      background-position: 0 0;\n    }\n  }\n\n  /* Disclosures: reasoning, tools, sources, tasks */\n\n  .chat-disclosure {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 0.75rem;\n    width: 100%;\n    height: auto;\n    min-height: 2.25rem;\n    padding: 0.375rem 0.625rem;\n    border: 1px solid var(--ui-border);\n    border-radius: calc(var(--ui-radius, 0px) + 4px);\n    background: var(--ui-background);\n    color: var(--ui-foreground);\n    font: inherit;\n    font-size: 0.8125rem;\n    text-align: start;\n    cursor: pointer;\n\n    &[data-open] {\n      border-end-start-radius: 0;\n      border-end-end-radius: 0;\n    }\n\n    /* The label takes the room, so a status (\"Done\") sits by the chevron at the end\n       rather than floating in the middle. */\n    & > :first-child {\n      flex: 1 1 auto;\n      min-inline-size: 0;\n    }\n  }\n\n  .chat-disclosure-meta,\n  .chat-tool-status {\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  :is(.chat-reasoning, .chat-tool, .chat-sources, .chat-tasks)\n    [data-slot=\"collapsible-panel\"] {\n    padding: 0.625rem;\n    border: 1px solid var(--ui-border);\n    border-top: 0;\n    border-end-start-radius: calc(var(--ui-radius, 0px) + 4px);\n    border-end-end-radius: calc(var(--ui-radius, 0px) + 4px);\n    font-size: 0.8125rem;\n  }\n\n  .chat-reasoning-panel {\n    color: var(--ui-muted-foreground);\n    white-space: pre-wrap;\n  }\n\n  .chat-tool-name {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.5rem;\n    font-weight: 500;\n  }\n\n  .chat-tool-mark {\n    width: 0.5rem;\n    height: 0.5rem;\n    border: 1.5px solid currentColor;\n    border-radius: 50%;\n  }\n\n  .chat-tool[data-status=\"done\"] .chat-tool-mark {\n    background: currentColor;\n  }\n\n  .chat-tool[data-status=\"running\"] .chat-tool-mark {\n    border-style: dashed;\n    animation: chat-blink 1s ease-in-out infinite;\n  }\n\n  .chat-tool[data-status=\"approval\"] {\n    --chat-tool-accent: oklch(0.72 0.16 75);\n\n    .chat-disclosure {\n      border-color: var(--chat-tool-accent);\n    }\n\n    .chat-tool-mark {\n      border-color: var(--chat-tool-accent);\n      background: var(--chat-tool-accent);\n    }\n  }\n\n  :is(.chat-tool[data-status=\"error\"], .chat-tool[data-status=\"denied\"]) .chat-tool-mark {\n    border-radius: 1px;\n    rotate: 45deg;\n  }\n\n  .chat-tool-panel {\n    display: grid;\n    gap: 0.625rem;\n\n    h4 {\n      margin: 0 0 0.25rem;\n      font-size: 0.75rem;\n      font-weight: 600;\n      color: var(--ui-muted-foreground);\n    }\n\n    pre {\n      margin: 0;\n      padding: 0.5rem;\n      max-height: 14rem;\n      overflow: auto;\n      border-radius: var(--ui-radius, 0px);\n      background: var(--chat-code-bg);\n      font-family: var(--ui-font-mono);\n      font-size: 0.75rem;\n    }\n  }\n\n  .chat-tool-error {\n    margin: 0;\n    color: var(--ui-destructive);\n  }\n\n  .chat-source-list,\n  .chat-task-list {\n    display: grid;\n    gap: 0.375rem;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n  }\n\n  .chat-source-list li {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0 0.5rem;\n  }\n\n  .chat-source-host {\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .chat-citation {\n    display: inline-grid;\n    place-items: center;\n    min-width: 1.25rem;\n    height: 1.25rem;\n    margin-inline: 0.125rem;\n    padding-inline: 0.25rem;\n    border-radius: 999px;\n    background: var(--ui-muted);\n    color: var(--ui-foreground);\n    font-size: 0.6875rem;\n    font-weight: 600;\n    vertical-align: 0.125em;\n    text-decoration: none;\n  }\n\n  .chat-citation-card {\n    max-width: 18rem;\n    font-size: 0.8125rem;\n\n    p {\n      margin: 0 0 0.25rem;\n    }\n  }\n\n  .chat-citation-title {\n    font-weight: 600;\n  }\n\n  .chat-task-list li {\n    display: grid;\n    grid-template-columns: auto minmax(0, 1fr) auto;\n    align-items: center;\n    gap: 0 0.5rem;\n  }\n\n  .chat-task-mark {\n    width: 0.75rem;\n    height: 0.75rem;\n    border: 1.5px solid var(--ui-muted-foreground);\n    border-radius: 50%;\n  }\n\n  .chat-task-list li[data-status=\"done\"] {\n    .chat-task-mark {\n      border-color: var(--ui-primary);\n      background: var(--ui-primary);\n    }\n\n    .chat-task-title {\n      color: var(--ui-muted-foreground);\n    }\n  }\n\n  .chat-task-list li[data-status=\"running\"] .chat-task-mark {\n    border-style: dashed;\n    border-color: var(--ui-primary);\n  }\n\n  .chat-task-list li[data-status=\"failed\"] .chat-task-mark {\n    border-color: var(--ui-destructive);\n    border-radius: 2px;\n  }\n\n  .chat-task-status {\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .chat-task-detail {\n    grid-column: 2 / -1;\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .chat-image {\n    margin: 0;\n\n    img {\n      max-width: 100%;\n      height: auto;\n      border-radius: calc(var(--ui-radius, 0px) + 4px);\n    }\n\n    figcaption {\n      margin-top: 0.25rem;\n      font-size: 0.75rem;\n      color: var(--ui-muted-foreground);\n    }\n  }\n\n  /* Response: markdown */\n\n  .chat-response {\n    display: grid;\n    gap: 0.625rem;\n\n    > * {\n      margin: 0;\n    }\n\n    :is(ul, ol) {\n      margin: 0;\n      padding-inline-start: 1.25rem;\n    }\n\n    li + li {\n      margin-top: 0.25rem;\n    }\n\n    :is(h1, h2, h3, h4) {\n      margin: 0.5rem 0 0;\n      font-size: 1rem;\n      line-height: 1.3;\n    }\n\n    a {\n      color: inherit;\n      text-underline-offset: 0.2em;\n    }\n\n    :not(pre) > code {\n      padding: 0.0625rem 0.3125rem;\n      border-radius: calc(var(--ui-radius, 0px) / 2 + 2px);\n      background: var(--chat-code-bg);\n      font-family: var(--ui-font-mono);\n      font-size: 0.875em;\n    }\n\n    blockquote {\n      padding-inline-start: 0.75rem;\n      border-inline-start: 3px solid var(--ui-border);\n      color: var(--ui-muted-foreground);\n    }\n\n    hr {\n      margin: 0.25rem 0;\n    }\n\n    img {\n      max-width: 100%;\n      height: auto;\n    }\n  }\n\n  .chat-table {\n    max-width: 100%;\n    overflow-x: auto;\n\n    table {\n      border-collapse: collapse;\n      font-size: 0.8125rem;\n    }\n\n    :is(th, td) {\n      padding: 0.375rem 0.625rem;\n      border: 1px solid var(--ui-border);\n      text-align: start;\n    }\n  }\n\n  .chat-code {\n    margin: 0;\n    overflow: hidden;\n    border: 1px solid var(--ui-border);\n    border-radius: calc(var(--ui-radius, 0px) + 4px);\n    background: var(--chat-code-bg);\n\n    pre {\n      margin: 0;\n      padding: 0.75rem;\n      overflow-x: auto;\n      font-family: var(--ui-font-mono);\n      font-size: 0.8125rem;\n      line-height: 1.6;\n      color: var(--shiki-foreground);\n      tab-size: 2;\n\n      &:focus-visible {\n        outline: 2px solid var(--ui-ring-border);\n        outline-offset: -2px;\n      }\n    }\n\n    &[data-wrap] pre {\n      white-space: pre-wrap;\n      overflow-wrap: anywhere;\n    }\n  }\n\n  .chat-code-header {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 0.5rem;\n    padding: 0.25rem 0.25rem 0.25rem 0.75rem;\n    border-bottom: 1px solid var(--ui-border);\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .chat-code-actions {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n\n    :is([data-slot=\"toggle\"], [data-slot=\"button\"]) {\n      height: 1.75rem;\n      min-width: 1.75rem;\n      padding: 0 0.5rem;\n      font-size: 0.75rem;\n    }\n  }\n\n  /* Composer */\n\n  .chat-composer,\n  .chat-composer > [data-slot=\"file-input\"] {\n    display: block;\n    width: 100%;\n    max-width: none;\n  }\n\n  .chat-composer-box {\n    display: grid;\n    gap: 0.375rem;\n    padding: 0.5rem;\n    border: 1px solid var(--ui-input);\n    border-radius: calc(var(--ui-radius, 0px) + 8px);\n    background: var(--ui-background);\n\n    &:focus-within {\n      outline: 2px solid var(--ui-ring-border);\n      outline-offset: 1px;\n    }\n\n    &[data-drag-over] {\n      outline: 2px dashed var(--ui-ring-border);\n    }\n  }\n\n  .chat-composer-input {\n    width: 100%;\n    min-height: 2.5rem;\n    max-height: 12rem;\n    padding: 0.375rem 0.5rem;\n    border: 0;\n    background: transparent;\n    color: inherit;\n    font: inherit;\n    resize: none;\n    field-sizing: content;\n  }\n\n  /* The composer box draws the focus ring for the field inside it. */\n  [data-uiset] .chat-composer-input[data-slot]:focus-visible {\n    outline: none;\n\n    &::placeholder {\n      color: var(--ui-muted-foreground);\n    }\n  }\n\n  /* Wraps on a phone, so the model picker and usage never widen the page. */\n  .chat-composer-toolbar {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 0.375rem;\n  }\n\n  .chat-composer-spacer {\n    flex: 1;\n  }\n\n  .chat-composer-attach {\n    width: 2rem;\n    height: 2rem;\n    padding: 0;\n  }\n\n  .chat-attachments {\n    display: flex;\n    flex-direction: row;\n    flex-wrap: wrap;\n    gap: 0.375rem;\n    margin: 0;\n    padding: 0;\n    border: 0;\n    border-radius: 0;\n    list-style: none;\n\n    &:empty {\n      display: none;\n    }\n  }\n\n  .chat-attachment {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.375rem;\n    min-height: 0;\n    max-width: 16rem;\n    padding: 0.25rem 0.25rem 0.25rem 0.625rem;\n    border: 1px solid var(--ui-border);\n    border-radius: 999px;\n    background: var(--ui-muted);\n    font-size: 0.75rem;\n\n    [data-slot=\"file-input-item-remove\"] {\n      width: 1.5rem;\n      height: 1.5rem;\n      padding: 0;\n    }\n  }\n\n  .chat-attachment-name {\n    flex: 0 1 auto;\n    text-align: start;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n\n  .chat-attachment-size {\n    color: var(--ui-muted-foreground);\n  }\n\n  .chat-menu {\n    min-width: 14rem;\n  }\n\n  .chat-menu-label {\n    font-weight: 500;\n  }\n\n  .chat-menu-hint,\n  .chat-model-description {\n    display: block;\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .chat-model-trigger {\n    height: 2rem;\n    min-width: 8rem;\n    font-size: 0.8125rem;\n  }\n\n  .chat-model-name {\n    display: block;\n  }\n\n  /* Each model's description sits under its name, as a command's does in the menu. */\n  .chat-model-list [data-slot=\"select-item\"] {\n    flex-direction: column;\n    align-items: flex-start;\n    gap: 0.0625rem;\n    padding-block: 0.4375rem;\n  }\n\n  .chat-usage {\n    white-space: nowrap;\n    display: inline-flex;\n    flex-direction: row;\n    align-items: center;\n    gap: 0.5rem;\n    min-width: 0;\n    width: auto;\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n\n    [data-slot=\"meter-track\"] {\n      width: 4rem;\n      height: 0.375rem;\n    }\n\n    &[data-level=\"medium\"] [data-slot=\"meter-indicator\"] {\n      background: oklch(0.72 0.16 75);\n    }\n\n    &[data-level=\"high\"] [data-slot=\"meter-indicator\"] {\n      background: var(--ui-destructive);\n    }\n  }\n\n  .chat-dialog-actions {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0.5rem;\n  }\n\n  /* Chat list */\n\n  /* No clipping here: focus rings on full-width rows (a chat, the rename field) stay whole.\n     The padding gives them room; the margin keeps the list aligned with what's around it. */\n  .chat-threads {\n    display: grid;\n    align-content: start;\n    gap: 0.5rem;\n    min-width: 0;\n    padding: 0.25rem;\n    margin: -0.25rem;\n\n    ul {\n      display: grid;\n      gap: 0.125rem;\n      margin: 0;\n      padding: 0;\n      list-style: none;\n    }\n\n    li {\n      display: flex;\n      align-items: center;\n      gap: 0.25rem;\n      min-width: 0;\n      border-radius: var(--ui-radius, 0px);\n\n      &[data-active] {\n        background: var(--ui-muted);\n      }\n    }\n  }\n\n  .chat-thread-link {\n    flex: 1 1 0;\n    justify-content: space-between;\n    min-width: 0;\n    overflow: hidden;\n    height: auto;\n    min-height: 2.25rem;\n    gap: 0.5rem;\n    text-align: start;\n\n    time {\n      flex-shrink: 0;\n      font-size: 0.75rem;\n      color: var(--ui-muted-foreground);\n    }\n  }\n\n  .chat-thread-title {\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n\n  .chat-thread-more {\n    flex-shrink: 0;\n    width: 2rem;\n    height: 2rem;\n    padding: 0;\n    color: var(--ui-muted-foreground);\n\n    &:hover:not([data-disabled]),\n    &[data-open] {\n      background: var(--ui-muted);\n      color: var(--ui-foreground);\n    }\n  }\n\n  .chat-thread-rename {\n    flex: 1;\n  }\n\n  .chat-threads-empty {\n    margin: 0.5rem 0;\n    color: var(--ui-muted-foreground);\n  }\n\n  /* Launcher */\n\n  .chat-launcher {\n    position: fixed;\n    inset: auto 1.25rem 1.25rem auto;\n    z-index: 5;\n    width: 3.25rem;\n    height: 3.25rem;\n    padding: 0;\n    border-radius: 50%;\n    background: var(--ui-primary);\n    color: var(--ui-primary-foreground);\n    box-shadow: var(--ui-shadow);\n\n    .chat-icon {\n      width: 1.375rem;\n      height: 1.375rem;\n    }\n  }\n\n  .chat-launcher-panel {\n    display: grid;\n    grid-template-rows: auto minmax(0, 1fr);\n    gap: 0.75rem;\n    width: min(24rem, calc(100vw - 2rem));\n    height: min(36rem, calc(100dvh - 7rem));\n    padding: 1rem;\n  }\n\n  .chat-launcher-header {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n\n    [data-slot=\"popover-title\"] {\n      margin: 0;\n      font-size: 1rem;\n    }\n\n    [data-slot=\"popover-close\"] {\n      width: 2rem;\n      height: 2rem;\n      padding: 0;\n    }\n  }\n\n  @media (prefers-reduced-motion: reduce) {\n    .chat-shimmer {\n      animation: none;\n      background: none;\n      color: var(--ui-muted-foreground);\n    }\n\n    .chat-message[data-streaming] .chat-message-content > :last-child::after,\n    .chat-tool[data-status=\"running\"] .chat-tool-mark {\n      animation: none;\n    }\n  }\n\n  @media (forced-colors: active) {\n    .chat-shimmer {\n      background: none;\n      color: CanvasText;\n    }\n\n    .chat-message[data-from=\"user\"] .chat-message-content,\n    .chat-attachment,\n    .chat-citation {\n      border: 1px solid CanvasText;\n    }\n\n    .chat-code pre span {\n      forced-color-adjust: auto;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/chat/chat.css"
    },
    {
      "path": "registry/uiset/ui/code/highlight.ts",
      "content": "// Syntax colors from shiki, loaded on first use: the core and the JavaScript regex engine\n// once, then each language the first time it's asked for. Its css-variables theme colors\n// tokens from --shiki-* variables (code/code.css), so every skin themes code.\n\ntype Token = { content: string; color?: string }\ntype Highlighter = {\n  codeToTokensBase: (code: string, options: { lang: string; theme: string }) => Token[][]\n  loadLanguage: (...langs: unknown[]) => Promise<void>\n  getLoadedLanguages: () => string[]\n}\n\nlet highlighter: Promise<Highlighter> | null = null\n\nfunction loadHighlighter() {\n  highlighter ??= (async () => {\n    const [{ createHighlighterCore, createCssVariablesTheme }, { createJavaScriptRegexEngine }] = await Promise.all([\n      import(\"shiki/core\"),\n      import(\"shiki/engine/javascript\"),\n    ])\n    return (await createHighlighterCore({\n      themes: [createCssVariablesTheme({ name: \"uiset\", variablePrefix: \"--shiki-\" })],\n      langs: [],\n      engine: createJavaScriptRegexEngine(),\n    })) as unknown as Highlighter\n  })()\n  return highlighter\n}\n\n/** Lines of colored tokens, or null for a language shiki doesn't know. */\nasync function tokenize(code: string, language: string): Promise<Token[][] | null> {\n  const shiki = await loadHighlighter()\n  const { bundledLanguages, bundledLanguagesAlias } = (await import(\"shiki/langs\")) as unknown as {\n    bundledLanguages: Record<string, () => Promise<unknown>>\n    bundledLanguagesAlias: Record<string, () => Promise<unknown>>\n  }\n  const load = bundledLanguages[language] ?? bundledLanguagesAlias[language]\n  if (!load) return null\n  if (!shiki.getLoadedLanguages().includes(language)) await shiki.loadLanguage(load())\n  return shiki.codeToTokensBase(code, { lang: language, theme: \"uiset\" })\n}\n\nconst byExtension: Record<string, string> = {\n  ts: \"typescript\",\n  tsx: \"tsx\",\n  js: \"javascript\",\n  jsx: \"jsx\",\n  mjs: \"javascript\",\n  cjs: \"javascript\",\n  json: \"json\",\n  css: \"css\",\n  html: \"html\",\n  md: \"markdown\",\n  mdx: \"mdx\",\n  py: \"python\",\n  rs: \"rust\",\n  go: \"go\",\n  sh: \"shellscript\",\n  yml: \"yaml\",\n  yaml: \"yaml\",\n  toml: \"toml\",\n  sql: \"sql\",\n}\n\n/** The language for a file name, like \"tsx\" for \"app.tsx\", or undefined for plain text. */\nfunction languageOf(path: string) {\n  const name = path.split(\"/\").pop() ?? path\n  const ext = name.includes(\".\") ? name.split(\".\").pop()!.toLowerCase() : \"\"\n  return byExtension[ext]\n}\n\nexport { languageOf, loadHighlighter, tokenize }\nexport type { Token }\n",
      "type": "registry:file",
      "target": "@ui/code/highlight.ts"
    },
    {
      "path": "registry/uiset/ui/code/code.css",
      "content": "@layer ui-sdk, uiset.tokens, uiset.base, uiset.skin;\n\n/*\n * Code token colors for shiki's css-variables theme, shared by chat code blocks and the\n * IDE's editor. Each is 4.5:1 on --ui-muted and on --ui-background in its scheme.\n */\n@layer uiset.base {\n  :where([data-uiset]) {\n    --shiki-foreground: var(--ui-foreground);\n    --shiki-background: transparent;\n    /* Dark keyword at 0.84: Blueprint's code blocks sit on its muted blue, not its page. */\n    --shiki-token-keyword: light-dark(oklch(0.47 0.19 300), oklch(0.84 0.1 300));\n    --shiki-token-string: light-dark(oklch(0.45 0.13 150), oklch(0.82 0.13 150));\n    --shiki-token-string-expression: light-dark(\n      oklch(0.45 0.13 150),\n      oklch(0.82 0.13 150)\n    );\n    --shiki-token-comment: var(--ui-muted-foreground);\n    --shiki-token-function: light-dark(oklch(0.46 0.15 255), oklch(0.8 0.11 240));\n    --shiki-token-constant: light-dark(oklch(0.48 0.16 35), oklch(0.82 0.12 60));\n    --shiki-token-parameter: light-dark(oklch(0.44 0.12 20), oklch(0.82 0.09 30));\n    --shiki-token-punctuation: var(--ui-foreground);\n    --shiki-token-link: light-dark(oklch(0.46 0.15 255), oklch(0.8 0.11 240));\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/code/code.css"
    }
  ],
  "type": "registry:ui"
}