{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "receipt",
  "title": "Receipt & ReceiptList",
  "description": "Evidence chips and list container linking 7-character commit SHAs, wrapping repository file paths, or verified HTTP(S) links with WP3 non-color authorship origin indicators.",
  "registryDependencies": [
    "https://frame12.dev/r/frame12-styles.json"
  ],
  "files": [
    {
      "path": "ui/receipt.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\nexport type ReceiptKind = 'commit' | 'file' | 'link';\nexport type ReceiptOrigin = 'human' | 'agent' | 'bot';\n\nexport const RECEIPT_ORIGIN_META: Record<ReceiptOrigin, { glyph: string; srLabel: string }> = {\n  human: { glyph: '[H]', srLabel: 'Origin: human' },\n  agent: { glyph: '[A]', srLabel: 'Origin: agent' },\n  bot: { glyph: '[B]', srLabel: 'Origin: bot' },\n};\n\nfunction getSafeHttpHref(href: string | undefined): string | null {\n  if (typeof href !== 'string') return null;\n  const trimmed = href.trim();\n  if (!trimmed || /[\\u0000-\\u001F\\u007F]/.test(trimmed)) return null;\n  if (trimmed.startsWith('#')) {\n    return trimmed;\n  }\n  if (trimmed.startsWith('/')) {\n    if (trimmed.startsWith('//') || trimmed.startsWith('/\\\\')) {\n      return null;\n    }\n    return trimmed;\n  }\n  try {\n    const parsed = new URL(trimmed);\n    if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {\n      return trimmed;\n    }\n    return null;\n  } catch {\n    return null;\n  }\n}\n\nexport interface ReceiptProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'title'> {\n  kind: ReceiptKind;\n  value: string;\n  href?: string;\n  title?: string;\n  date?: string;\n  origin?: ReceiptOrigin;\n}\n\nexport interface ReceiptListProps extends React.HTMLAttributes<HTMLUListElement> {\n  ariaLabel?: string;\n  children?: React.ReactNode;\n}\n\nexport const Receipt = React.forwardRef<HTMLSpanElement, ReceiptProps>(function Receipt(\n  { kind, value, href, title, date, origin, className = '', ...rest },\n  ref,\n) {\n  const safeKind: ReceiptKind =\n    kind === 'commit' || kind === 'file' || kind === 'link' ? kind : 'file';\n  const safeOrigin: ReceiptOrigin | undefined =\n    origin === 'human' || origin === 'agent' || origin === 'bot' ? origin : undefined;\n  const rawValue = typeof value === 'string' ? value : '';\n  const trimmedRaw = rawValue.trim();\n  const isCommit = safeKind === 'commit';\n  const rawDisplayValue = isCommit ? trimmedRaw.slice(0, 7) : trimmedRaw ? rawValue : '';\n  const fullCommitTitle = isCommit && trimmedRaw ? trimmedRaw : undefined;\n  const hasTruncatedCommit = isCommit && trimmedRaw.length > rawDisplayValue.length;\n  const safeHref = getSafeHttpHref(href);\n  const trimmedTitle = typeof title === 'string' && title.trim() ? title.trim() : undefined;\n  const displayValue =\n    rawDisplayValue || (safeHref ? (trimmedTitle ?? safeHref) : (trimmedTitle ?? ''));\n  const showTitleChip = Boolean(title && (rawDisplayValue || displayValue !== trimmedTitle));\n  const originMeta = safeOrigin ? RECEIPT_ORIGIN_META[safeOrigin] : undefined;\n\n  return (\n    <span\n      ref={ref}\n      className={`f12-receipt f12-receipt-${safeKind}${className ? ` ${className}` : ''}`}\n      data-kind={safeKind}\n      data-origin={safeOrigin}\n      {...rest}\n    >\n      {originMeta ? (\n        <span className={`f12-receipt-origin f12-receipt-origin-${safeOrigin}`}>\n          <span className=\"f12-status-glyph\" aria-hidden=\"true\">\n            {originMeta.glyph}\n          </span>\n          <span className=\"f12-sr-only\">{`${originMeta.srLabel}: `}</span>\n        </span>\n      ) : null}\n      {safeHref && displayValue ? (\n        <a\n          className=\"f12-receipt-value f12-receipt-link\"\n          href={safeHref}\n          title={fullCommitTitle}\n        >\n          {isCommit ? (\n            <code className=\"f12-receipt-code\" title={fullCommitTitle}>\n              {displayValue}\n            </code>\n          ) : (\n            displayValue\n          )}\n        </a>\n      ) : isCommit ? (\n        <code className=\"f12-receipt-value f12-receipt-code\" title={fullCommitTitle}>\n          {displayValue}\n        </code>\n      ) : (\n        <span className=\"f12-receipt-value\">{displayValue}</span>\n      )}\n      {hasTruncatedCommit ? (\n        <span className=\"f12-sr-only f12-receipt-sha-sr\">{` (${trimmedRaw})`}</span>\n      ) : null}\n      {showTitleChip ? <span className=\"f12-receipt-title\">{title}</span> : null}\n      {date ? <span className=\"f12-receipt-date\">{date}</span> : null}\n    </span>\n  );\n});\n\nexport const ReceiptList = React.forwardRef<HTMLUListElement, ReceiptListProps>(\n  function ReceiptList({ ariaLabel, className = '', children, ...rest }, ref) {\n    const items = React.Children.toArray(children);\n\n    return (\n      <ul\n        role=\"list\"\n        {...rest}\n        ref={ref}\n        className={`f12-receipt-list${className ? ` ${className}` : ''}`}\n        aria-label={ariaLabel ?? rest['aria-label'] ?? 'Evidence receipts'}\n      >\n        {items.map((child, idx) => {\n          if (React.isValidElement(child) && child.type === 'li') {\n            return child;\n          }\n          const key = React.isValidElement(child) && child.key != null ? child.key : idx;\n          return (\n            <li key={key} className=\"f12-receipt-item\">\n              {child}\n            </li>\n          );\n        })}\n      </ul>\n    );\n  },\n);\n",
      "type": "registry:ui",
      "target": "components/frame12/receipt.tsx"
    }
  ],
  "type": "registry:ui"
}