{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "schema-diagram",
  "type": "registry:ui",
  "title": "Schema Diagram",
  "description": "Tables, fields, and links with proposed changes marked.",
  "categories": [
    "data-display"
  ],
  "dependencies": [
    "@hugeicons/core-free-icons@4.4.0",
    "@hugeicons/react@1.1.10",
    "@xyflow/react@13.0.3"
  ],
  "registryDependencies": [
    "https://sprout.tulipfarm.ai/r/sprout-base.json",
    "https://sprout.tulipfarm.ai/r/badge.json",
    "https://sprout.tulipfarm.ai/r/button.json"
  ],
  "files": [
    {
      "path": "registry/sprout/components/ui/schema-diagram.tsx",
      "type": "registry:ui",
      "target": "components/ui/schema-diagram.tsx",
      "content": "'use client';\n\nimport {\n  Background,\n  BaseEdge,\n  EdgeLabelRenderer,\n  getSmoothStepPath,\n  Handle,\n  Position,\n  ReactFlow,\n  ReactFlowProvider,\n  type Edge,\n  type EdgeProps,\n  type Node,\n  type NodeProps,\n} from '@xyflow/react';\nimport { useId, useMemo, type HTMLAttributes } from 'react';\nimport { KeyIcon } from '@/lib/sprout/icons/key-icon';\nimport { cn } from '@/lib/sprout/classes';\nimport {\n  FitOnResize,\n  flowMaxZoom as maxZoom,\n  flowMinZoom as minZoom,\n  useKeyboardView,\n  useViewportMobile,\n  ZoomControls,\n} from '@/lib/sprout/flow';\nimport { Badge, type BadgeVariant } from '@/components/ui/badge';\n\nexport const schemaTableStateNames = ['new', 'changed', 'unchanged', 'linked'] as const;\nexport const schemaChangeNames = ['added', 'changed', 'removed'] as const;\nexport const schemaDiagramLayoutNames = ['auto', 'horizontal', 'vertical'] as const;\n\nexport type SchemaTableState = (typeof schemaTableStateNames)[number];\nexport type SchemaChange = (typeof schemaChangeNames)[number];\nexport type SchemaDiagramLayout = (typeof schemaDiagramLayoutNames)[number];\n\nexport interface SchemaField {\n  id: string;\n  label: string;\n  type: string;\n  required: boolean;\n  unique?: boolean | undefined;\n  detail?: string | undefined;\n  change?: SchemaChange | undefined;\n}\n\nexport interface SchemaTable {\n  id: string;\n  label: string;\n  state: SchemaTableState;\n  fields: SchemaField[];\n}\n\nexport interface SchemaLink {\n  id: string;\n  source: string;\n  field: string;\n  target: string;\n  label: string;\n}\n\ntype Direction = 'horizontal' | 'vertical';\ntype TableNode = Node<{ table: SchemaTable; direction: Direction }, 'table'>;\ntype LinkEdge = Edge<{ label: string }, 'link'>;\n\nconst tableWidth = 264;\nconst columnGap = 80;\nconst rowGap = 48;\nconst fitOptions = { padding: '6.5%', maxZoom: 1 } as const;\n\nconst tableHeight = (table: SchemaTable) =>\n  44 + (table.fields.length === 0 ? 32 : table.fields.reduce((sum, field) => sum + (field.detail ? 48 : 32), 0));\n\nconst stateBadge: Record<SchemaTableState, { label: string; variant: BadgeVariant } | null> = {\n  new: { label: 'New', variant: 'success' },\n  changed: { label: 'Changed', variant: 'warning' },\n  linked: { label: 'Existing', variant: 'secondary' },\n  unchanged: null,\n};\n\nfunction layout(tables: readonly SchemaTable[], links: readonly SchemaLink[], direction: Direction): TableNode[] {\n  const node = (table: SchemaTable, x: number, y: number): TableNode => ({\n    id: table.id,\n    type: 'table',\n    position: { x, y },\n    data: { table, direction },\n    ariaRole: 'group',\n    ariaLabel: `${table.label} table`,\n    domAttributes: { 'aria-roledescription': 'table card' },\n    sourcePosition: direction === 'vertical' ? Position.Bottom : Position.Right,\n    targetPosition: direction === 'vertical' ? Position.Top : Position.Left,\n  });\n\n  if (direction === 'vertical') {\n    const ordered: SchemaTable[] = [];\n    const seen = new Set<string>();\n    const add = (table: SchemaTable | undefined) => {\n      if (table && !seen.has(table.id)) {\n        ordered.push(table);\n        seen.add(table.id);\n      }\n    };\n    for (const link of links) for (const id of [link.source, link.target]) add(tables.find(table => table.id === id));\n    for (const table of tables) add(table);\n    let y = 0;\n    return ordered.map(table => {\n      const placed = node(table, 0, y);\n      y += tableHeight(table) + rowGap;\n      return placed;\n    });\n  }\n\n  const depth = new Map(tables.map(table => [table.id, 0]));\n  for (let pass = 0; pass < tables.length; pass++) {\n    let moved = false;\n    for (const link of links) {\n      const next = (depth.get(link.source) ?? 0) + 1;\n      if (link.source !== link.target && next > (depth.get(link.target) ?? 0) && next < tables.length) {\n        depth.set(link.target, next);\n        moved = true;\n      }\n    }\n    if (!moved) break;\n  }\n  const columns = new Map<number, number>();\n  return tables.map(table => {\n    const column = depth.get(table.id) ?? 0;\n    const y = columns.get(column) ?? 0;\n    columns.set(column, y + tableHeight(table) + rowGap);\n    return node(table, column * (tableWidth + columnGap), y);\n  });\n}\n\nfunction TableCard({ data: { table, direction } }: NodeProps<TableNode>) {\n  const badge = stateBadge[table.state];\n  const vertical = direction === 'vertical';\n  return (\n    <section data-slot=\"schema-table\" data-state={table.state} className=\"sprout-schema-table\">\n      <Handle\n        type=\"target\"\n        position={vertical ? Position.Top : Position.Left}\n        isConnectable={false}\n        className=\"sprout-schema-handle sprout-schema-handle-target\"\n      />\n      <header className=\"sprout-schema-table-header\">\n        <h3 className=\"sprout-schema-table-title\" title={table.label}>\n          {table.label}\n        </h3>\n        {badge && <Badge variant={badge.variant}>{badge.label}</Badge>}\n      </header>\n      {table.fields.length === 0 ? (\n        <p className=\"sprout-schema-table-empty\">{table.state === 'linked' ? 'Fields not shown' : 'No fields'}</p>\n      ) : (\n        <ul className=\"sprout-schema-fields\">\n          {table.fields.map(field => (\n            <li key={field.id} data-slot=\"schema-field\" data-change={field.change} className=\"sprout-schema-field\">\n              <div className=\"sprout-schema-field-line\">\n                <span className=\"sprout-schema-field-key\">\n                  {field.unique && <KeyIcon size=\"xs\" aria-label=\"Unique\" role=\"img\" />}\n                </span>\n                <span className=\"sprout-schema-field-name\" title={field.label}>\n                  {field.label}\n                  {field.required && (\n                    <span className=\"sprout-schema-field-required\">\n                      <span aria-hidden=\"true\"> *</span>\n                      <span className=\"sprout-schema-sr-only\">, required</span>\n                    </span>\n                  )}\n                </span>\n                <span className=\"sprout-schema-field-type\">{field.type}</span>\n                {field.change && <span className=\"sprout-schema-sr-only\">, {field.change}</span>}\n              </div>\n              {field.detail && (\n                <p className=\"sprout-schema-field-detail\" title={field.detail}>\n                  {field.detail}\n                </p>\n              )}\n              <Handle\n                id={field.id}\n                type=\"source\"\n                position={vertical ? Position.Bottom : Position.Right}\n                isConnectable={false}\n                className=\"sprout-schema-handle\"\n              />\n            </li>\n          ))}\n        </ul>\n      )}\n    </section>\n  );\n}\n\nfunction LinkLine({\n  id,\n  sourceX,\n  sourceY,\n  targetX,\n  targetY,\n  sourcePosition,\n  targetPosition,\n  data,\n}: EdgeProps<LinkEdge>) {\n  const [path, labelX, labelY] = getSmoothStepPath({\n    sourceX,\n    sourceY,\n    targetX,\n    targetY,\n    sourcePosition,\n    targetPosition,\n    borderRadius: 12,\n    offset: 24,\n  });\n  return (\n    <>\n      <BaseEdge id={id} path={path} />\n      {data?.label && (\n        <EdgeLabelRenderer>\n          <span\n            aria-hidden=\"true\"\n            className=\"nodrag nopan sprout-schema-link-label\"\n            style={{\n              transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)`,\n            }}\n          >\n            {data.label}\n          </span>\n        </EdgeLabelRenderer>\n      )}\n    </>\n  );\n}\n\nconst nodeTypes = { table: TableCard };\nconst edgeTypes = { link: LinkLine };\n\nconst keyboardHint = 'Arrow keys pan, plus and minus zoom, and 0 fits the diagram. Tab moves between tables.';\n\nfunction DiagramFlow({\n  nodes,\n  edges,\n  direction,\n  label,\n  hintId,\n}: {\n  nodes: TableNode[];\n  edges: LinkEdge[];\n  direction: Direction;\n  label: string;\n  hintId: string;\n}) {\n  const onKeyDown = useKeyboardView(fitOptions);\n  return (\n    <ReactFlow\n      className=\"sprout-schema-flow\"\n      data-slot=\"schema-diagram-viewport\"\n      aria-label={label}\n      aria-describedby={hintId}\n      tabIndex={0}\n      onKeyDown={onKeyDown}\n      nodes={nodes}\n      edges={edges}\n      nodeTypes={nodeTypes}\n      edgeTypes={edgeTypes}\n      fitView\n      fitViewOptions={fitOptions}\n      minZoom={minZoom}\n      maxZoom={maxZoom}\n      nodesConnectable={false}\n      elementsSelectable={false}\n      edgesFocusable={false}\n      ariaLabelConfig={{\n        'node.a11yDescription.default': keyboardHint,\n        'node.a11yDescription.keyboardDisabled': keyboardHint,\n      }}\n      proOptions={{ hideAttribution: true }}\n    >\n      <Background gap={16} size={1} />\n      <FitOnResize nodes={nodes} fit={fitOptions} />\n      <ZoomControls\n        position={direction === 'vertical' ? 'top-right' : 'bottom-right'}\n        fit={fitOptions}\n        className=\"sprout-schema-controls\"\n        slot=\"schema-diagram-controls\"\n      />\n    </ReactFlow>\n  );\n}\n\nexport interface SchemaDiagramProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'> {\n  tables: readonly SchemaTable[];\n  links: readonly SchemaLink[];\n  label: string;\n  layout?: SchemaDiagramLayout | undefined;\n}\n\nexport function SchemaDiagram({\n  tables,\n  links,\n  label,\n  layout: layoutName = 'auto',\n  className,\n  ...props\n}: SchemaDiagramProps) {\n  const mobile = useViewportMobile();\n  const direction: Direction = layoutName === 'auto' ? (mobile ? 'vertical' : 'horizontal') : layoutName;\n  const hintId = useId();\n  const nodes = useMemo(() => layout(tables, links, direction), [tables, links, direction]);\n  const edges = useMemo(() => {\n    const names = new Map(tables.map(table => [table.id, table]));\n    return links.map((link): LinkEdge => {\n      const source = names.get(link.source);\n      const field = source?.fields.find(candidate => candidate.id === link.field);\n      const from = `${source?.label ?? link.source}${field ? ` ${field.label}` : ''}`;\n      return {\n        id: link.id,\n        type: 'link',\n        source: link.source,\n        sourceHandle: link.field,\n        target: link.target,\n        ariaLabel: `${from} links to ${names.get(link.target)?.label ?? link.target}: ${link.label}`,\n        data: { label: link.label },\n      };\n    });\n  }, [tables, links]);\n  return (\n    <div\n      {...props}\n      role=\"figure\"\n      aria-label={label}\n      data-slot=\"schema-diagram\"\n      data-layout={direction}\n      className={cn('sprout-schema-diagram', className)}\n    >\n      <p id={hintId} className=\"sprout-schema-sr-only\">\n        {keyboardHint}\n      </p>\n      <ReactFlowProvider key={direction}>\n        <DiagramFlow nodes={nodes} edges={edges} direction={direction} label={label} hintId={hintId} />\n      </ReactFlowProvider>\n    </div>\n  );\n}\n\nexport interface SchemaLegendProps extends Omit<HTMLAttributes<HTMLUListElement>, 'children'> {}\n\nexport function SchemaLegend({ className, ...props }: SchemaLegendProps) {\n  return (\n    <ul aria-label=\"Legend\" data-slot=\"schema-legend\" {...props} className={cn('sprout-schema-legend', className)}>\n      {schemaChangeNames.map(change => (\n        <li key={change} className=\"sprout-schema-legend-item\">\n          <span aria-hidden=\"true\" data-change={change} className=\"sprout-schema-legend-swatch\" />\n          {change[0]!.toUpperCase() + change.slice(1)}\n        </li>\n      ))}\n      <li className=\"sprout-schema-legend-item\">\n        <KeyIcon size=\"xs\" aria-hidden=\"true\" />\n        Unique\n      </li>\n      <li className=\"sprout-schema-legend-item\">* Required</li>\n    </ul>\n  );\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/add-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/add-icon.tsx",
      "content": "import { Add01Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const AddIcon = /* @__PURE__ */ createIcon(glyph, 'AddIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/create-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/create-icon.tsx",
      "content": "import { HugeiconsIcon, type IconSvgElement } from '@hugeicons/react';\nimport type { ReactElement, Ref, SVGProps } from 'react';\n\nexport const iconSizes = {\n  xs: 12,\n  sm: 14,\n  md: 16,\n  lg: 18,\n  xl: 20,\n  '2xl': 24,\n} as const;\n\nexport type IconSize = keyof typeof iconSizes;\n\nexport const iconStrokeWidth = 1.5;\n\nexport type IconProps = Omit<SVGProps<SVGSVGElement>, 'ref'> & {\n  size?: IconSize | number;\n  ref?: Ref<SVGSVGElement>;\n};\n\nexport type IconComponent = (props: IconProps) => ReactElement;\n\nexport function createIcon(glyph: IconSvgElement, name: string): IconComponent {\n  const Icon = ({ size = '2xl', strokeWidth = iconStrokeWidth, ...props }: IconProps) => (\n    <HugeiconsIcon\n      icon={glyph}\n      size={typeof size === 'number' ? size : iconSizes[size]}\n      strokeWidth={Number(strokeWidth)}\n      {...props}\n    />\n  );\n  Icon.displayName = name;\n  return Icon;\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/key-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/key-icon.tsx",
      "content": "import { KeyIcon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const KeyIcon = /* @__PURE__ */ createIcon(glyph, 'KeyIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/minus-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/minus-icon.tsx",
      "content": "import { MinusSignIcon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const MinusIcon = /* @__PURE__ */ createIcon(glyph, 'MinusIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/scan-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/scan-icon.tsx",
      "content": "import { ScanIcon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const ScanIcon = /* @__PURE__ */ createIcon(glyph, 'ScanIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/flow.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/flow.tsx",
      "content": "'use client';\n\nimport {\n  Panel,\n  useNodesStore,\n  useReactFlow,\n  useViewportStore,\n  type FitViewOptions,\n  type Node,\n  type NodesStore,\n} from '@xyflow/react';\nimport { useEffect, useSyncExternalStore, type KeyboardEvent } from 'react';\nimport { AddIcon } from '@/lib/sprout/icons/add-icon';\nimport { MinusIcon } from '@/lib/sprout/icons/minus-icon';\nimport { ScanIcon } from '@/lib/sprout/icons/scan-icon';\nimport { Button } from '@/components/ui/button';\n\nexport const flowMinZoom = 0.2;\nexport const flowMaxZoom = 1.5;\nconst panStep = 48;\n\nconst mobileQuery = '(max-width: 767px)';\nconst motionQuery = '(prefers-reduced-motion: reduce)';\n\nfunction subscribeMobile(callback: () => void) {\n  const media = window.matchMedia(mobileQuery);\n  media.addEventListener('change', callback);\n  return () => media.removeEventListener('change', callback);\n}\n\nexport function useViewportMobile() {\n  return useSyncExternalStore(\n    subscribeMobile,\n    () => window.matchMedia(mobileQuery).matches,\n    () => false,\n  );\n}\n\nexport const motion = (ms: number) =>\n  typeof window !== 'undefined' && window.matchMedia(motionQuery).matches ? 0 : ms;\n\nfunction nodesMeasured(state: NodesStore) {\n  if (state.nodeLookup.size === 0) return false;\n  for (const node of state.nodeLookup.values()) {\n    if (node.hidden) continue;\n    if (!node.measured.width || !node.measured.height || !node.internals.handleBounds) return false;\n  }\n  return true;\n}\n\nexport function FitOnResize({ nodes, fit }: { nodes: readonly Node[]; fit: FitViewOptions }) {\n  const { fitView } = useReactFlow();\n  const width = useViewportStore(state => state.width);\n  const height = useViewportStore(state => state.height);\n  const measured = useNodesStore(nodesMeasured);\n  useEffect(() => {\n    if (!measured) return;\n    const frame = requestAnimationFrame(() => void fitView(fit));\n    return () => cancelAnimationFrame(frame);\n  }, [fitView, fit, width, height, measured, nodes]);\n  return null;\n}\n\nexport function ZoomControls({\n  position,\n  fit,\n  className,\n  slot,\n}: {\n  position: 'top-right' | 'bottom-right';\n  fit: FitViewOptions;\n  className: string;\n  slot: string;\n}) {\n  const { zoomIn, zoomOut, fitView } = useReactFlow();\n  const zoom = useViewportStore(state => state.transform[2]);\n  return (\n    <Panel\n      position={position}\n      className={className}\n      data-slot={slot}\n      role=\"toolbar\"\n      aria-label=\"Diagram view\"\n      aria-orientation=\"vertical\"\n    >\n      <Button\n        variant=\"ghost\"\n        size=\"icon-sm\"\n        aria-label=\"Zoom in\"\n        title=\"Zoom in\"\n        disabled={zoom >= flowMaxZoom}\n        onClick={() => void zoomIn({ duration: motion(160) })}\n      >\n        <AddIcon size=\"md\" aria-hidden=\"true\" />\n      </Button>\n      <Button\n        variant=\"ghost\"\n        size=\"icon-sm\"\n        aria-label=\"Zoom out\"\n        title=\"Zoom out\"\n        disabled={zoom <= flowMinZoom}\n        onClick={() => void zoomOut({ duration: motion(160) })}\n      >\n        <MinusIcon size=\"md\" aria-hidden=\"true\" />\n      </Button>\n      <Button\n        variant=\"ghost\"\n        size=\"icon-sm\"\n        aria-label=\"Fit to view\"\n        title=\"Fit to view\"\n        onClick={() => void fitView({ ...fit, duration: motion(180) })}\n      >\n        <ScanIcon size=\"md\" aria-hidden=\"true\" />\n      </Button>\n    </Panel>\n  );\n}\n\nexport function useKeyboardView(fit: FitViewOptions) {\n  const { getViewport, setViewport, zoomIn, zoomOut, fitView } = useReactFlow();\n  return (event: KeyboardEvent<HTMLDivElement>) => {\n    const target = event.target as HTMLElement;\n    if (event.altKey || event.ctrlKey || event.metaKey) return;\n    if (target !== event.currentTarget && !target.classList.contains('react-flow__node')) return;\n    const step = panStep * (event.shiftKey ? 4 : 1);\n    const pan: Record<string, [number, number]> = {\n      ArrowLeft: [step, 0],\n      ArrowRight: [-step, 0],\n      ArrowUp: [0, step],\n      ArrowDown: [0, -step],\n    };\n    const move = pan[event.key];\n    if (move) {\n      const { x, y, zoom } = getViewport();\n      void setViewport({ x: x + move[0], y: y + move[1], zoom }, { duration: motion(120) });\n    } else if (event.key === '+' || event.key === '=') {\n      void zoomIn({ duration: motion(160) });\n    } else if (event.key === '-' || event.key === '_') {\n      void zoomOut({ duration: motion(160) });\n    } else if (event.key === '0') {\n      void fitView({ ...fit, duration: motion(180) });\n    } else return;\n    event.preventDefault();\n  };\n}\n"
    }
  ],
  "css": {
    "@layer components": {
      ".sprout-schema-diagram": {
        "box-sizing": "border-box",
        "border": "1px solid var(--sprout-line)",
        "border-radius": "var(--sprout-radius-panel)",
        "background": "var(--sprout-canvas)",
        "width": "100%",
        "min-width": "0",
        "height": "100%",
        "min-height": "24rem",
        "color": "var(--sprout-text)",
        "font-family": "var(--sprout-font)",
        "flex": "1",
        "display": "flex",
        "position": "relative",
        "overflow": "hidden"
      },
      ".sprout-schema-flow.light, .sprout-schema-flow.dark": {
        "--sprout-canvas": "inherit",
        "--sprout-surface": "inherit",
        "--sprout-hover": "inherit",
        "--sprout-active": "inherit",
        "--sprout-text": "inherit",
        "--sprout-muted": "inherit",
        "--sprout-line": "inherit",
        "--sprout-border": "inherit",
        "--sprout-border-strong": "inherit",
        "--sprout-input": "inherit",
        "--sprout-primary": "inherit",
        "--sprout-primary-hover": "inherit",
        "--sprout-primary-active": "inherit",
        "--sprout-primary-subtle": "inherit",
        "--sprout-on-primary": "inherit",
        "--sprout-focus": "inherit",
        "--sprout-danger": "inherit",
        "--sprout-danger-hover": "inherit",
        "--sprout-danger-subtle": "inherit",
        "--sprout-on-danger": "inherit",
        "--sprout-info": "inherit",
        "--sprout-info-subtle": "inherit",
        "--sprout-secondary": "inherit",
        "--sprout-success": "inherit",
        "--sprout-success-subtle": "inherit",
        "--sprout-warning": "inherit",
        "--sprout-warning-subtle": "inherit",
        "--sprout-overlay": "inherit"
      },
      ".sprout-schema-flow": {
        "direction": "ltr",
        "background": "none",
        "outline": "none",
        "flex": "1",
        "width": "100%",
        "height": "100%",
        "min-height": "24rem",
        "position": "relative",
        "overflow": "hidden"
      },
      ".sprout-schema-flow:focus-visible": {
        "outline": "var(--sprout-focus-width) solid var(--sprout-focus-ring)",
        "outline-offset": "-1px",
        "border-radius": "inherit"
      },
      ".sprout-schema-flow .react-flow__container": {
        "width": "100%",
        "height": "100%",
        "position": "absolute",
        "top": "0",
        "left": "0"
      },
      ".sprout-schema-flow .react-flow__pane": {
        "z-index": "1",
        "touch-action": "none"
      },
      ".sprout-schema-flow .react-flow__pane.draggable": {
        "cursor": "grab"
      },
      ".sprout-schema-flow .react-flow__pane.dragging": {
        "cursor": "grabbing"
      },
      ".sprout-schema-flow .react-flow__viewport": {
        "z-index": "2",
        "transform-origin": "0 0",
        "pointer-events": "none"
      },
      ".sprout-schema-flow .react-flow__renderer": {
        "z-index": "4"
      },
      ".sprout-schema-flow .react-flow__background": {
        "z-index": "-1",
        "pointer-events": "none"
      },
      ".sprout-schema-flow .react-flow__background-pattern.dots": {
        "fill": "var(--sprout-line)"
      },
      ".sprout-schema-flow .react-flow__edges": {
        "position": "absolute"
      },
      ".sprout-schema-flow .react-flow__edges svg": {
        "pointer-events": "none",
        "position": "absolute",
        "overflow": "visible"
      },
      ".sprout-schema-flow .react-flow__edge-path": {
        "fill": "none",
        "stroke": "var(--sprout-muted)",
        "stroke-width": "1.25px"
      },
      ".sprout-schema-flow .react-flow__edgelabel-renderer, .sprout-schema-flow .react-flow__viewport-portal": {
        "pointer-events": "none",
        "user-select": "none",
        "width": "100%",
        "height": "100%",
        "position": "absolute",
        "top": "0",
        "left": "0"
      },
      ".sprout-schema-flow .react-flow__nodes": {
        "transform-origin": "0 0",
        "pointer-events": "none"
      },
      ".sprout-schema-flow .react-flow__node": {
        "box-sizing": "border-box",
        "transform-origin": "0 0",
        "user-select": "none",
        "pointer-events": "all",
        "cursor": "default",
        "border-radius": "8px",
        "outline": "none",
        "position": "absolute"
      },
      ".sprout-schema-flow .react-flow__node.draggable": {
        "cursor": "grab"
      },
      ".sprout-schema-flow .react-flow__node.dragging": {
        "cursor": "grabbing"
      },
      ".sprout-schema-flow .react-flow__node:focus-visible": {
        "outline": "var(--sprout-focus-width) solid var(--sprout-focus-ring)",
        "outline-offset": "0"
      },
      ".sprout-schema-flow .react-flow__panel": {
        "z-index": "5",
        "margin": "12px",
        "position": "absolute"
      },
      ".sprout-schema-flow .react-flow__panel.top": {
        "top": "0"
      },
      ".sprout-schema-flow .react-flow__panel.bottom": {
        "bottom": "0"
      },
      ".sprout-schema-flow .react-flow__panel.right": {
        "right": "0"
      },
      ".sprout-schema-flow .react-flow__panel.left": {
        "left": "0"
      },
      ".sprout-schema-handle.react-flow__handle": {
        "opacity": "0",
        "pointer-events": "none",
        "border": "0",
        "width": "6px",
        "min-width": "0",
        "height": "6px",
        "min-height": "0",
        "position": "absolute"
      },
      ".sprout-schema-handle.react-flow__handle-left": {
        "top": "50%",
        "left": "0",
        "transform": "translate(-50%, -50%)"
      },
      ".sprout-schema-handle.react-flow__handle-right": {
        "top": "50%",
        "right": "0",
        "transform": "translate(50%, -50%)"
      },
      ".sprout-schema-handle.react-flow__handle-top": {
        "top": "0",
        "left": "50%",
        "transform": "translate(-50%, -50%)"
      },
      ".sprout-schema-handle.react-flow__handle-bottom": {
        "bottom": "0",
        "left": "50%",
        "transform": "translate(-50%, 50%)"
      },
      ".sprout-schema-handle-target.react-flow__handle-left": {
        "top": "22px"
      },
      ".sprout-schema-table": {
        "box-sizing": "border-box",
        "border": "1px solid var(--sprout-line)",
        "background": "var(--sprout-surface)",
        "width": "264px",
        "color": "var(--sprout-text)",
        "box-shadow": "var(--sprout-shadow-control)",
        "border-top-width": "2px",
        "border-radius": "8px",
        "overflow": "hidden"
      },
      ".sprout-schema-table[data-state=\"new\"]": {
        "border-top-color": "var(--sprout-success)"
      },
      ".sprout-schema-table[data-state=\"changed\"]": {
        "border-top-color": "var(--sprout-warning)"
      },
      ".sprout-schema-table[data-state=\"linked\"]": {
        "border-style": "dashed",
        "border-top-color": "var(--sprout-line)"
      },
      ".react-flow__node.dragging .sprout-schema-table": {
        "box-shadow": "var(--sprout-shadow-panel)"
      },
      ".sprout-schema-table-header": {
        "box-sizing": "border-box",
        "border-bottom": "1px solid var(--sprout-line)",
        "background": "color-mix(in oklab, var(--sprout-hover) 45%, var(--sprout-surface))",
        "align-items": "center",
        "gap": "8px",
        "height": "44px",
        "padding": "0 12px",
        "display": "flex"
      },
      ".sprout-schema-table-title": {
        "min-width": "0",
        "color": "var(--sprout-text)",
        "font-size": "var(--sprout-text-sm)",
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "flex": "1",
        "margin": "0",
        "font-weight": "500",
        "line-height": "1.25rem",
        "overflow": "hidden"
      },
      ".sprout-schema-table-empty": {
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-xs)",
        "margin": "0",
        "padding": "8px 12px",
        "line-height": "1rem"
      },
      ".sprout-schema-fields": {
        "margin": "0",
        "padding": "0",
        "list-style": "none"
      },
      ".sprout-schema-field": {
        "border-bottom": "1px solid var(--sprout-line)",
        "padding": "6px 12px",
        "position": "relative"
      },
      ".sprout-schema-field:last-child": {
        "border-bottom": "0"
      },
      ".sprout-schema-field[data-change=\"added\"]": {
        "background": "var(--sprout-success-subtle)"
      },
      ".sprout-schema-field[data-change=\"changed\"]": {
        "background": "var(--sprout-warning-subtle)"
      },
      ".sprout-schema-field[data-change=\"removed\"]": {
        "background": "var(--sprout-danger-subtle)"
      },
      ".sprout-schema-field-line": {
        "align-items": "center",
        "gap": "8px",
        "height": "20px",
        "font-size": ".8125rem",
        "line-height": "1.25rem",
        "display": "flex"
      },
      ".sprout-schema-field[data-change=\"removed\"] .sprout-schema-field-line": {
        "text-decoration": "line-through"
      },
      ".sprout-schema-field-key": {
        "width": "12px",
        "color": "var(--sprout-muted)",
        "flex-shrink": "0",
        "justify-content": "center",
        "display": "flex"
      },
      ".sprout-schema-field-name": {
        "min-width": "0",
        "color": "var(--sprout-text)",
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "flex": "1",
        "overflow": "hidden"
      },
      ".sprout-schema-field-required": {
        "color": "var(--sprout-muted)"
      },
      ".sprout-schema-field-type": {
        "max-width": "45%",
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-xs)",
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "flex-shrink": "0",
        "overflow": "hidden"
      },
      ".sprout-schema-field-detail": {
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-xs)",
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "margin": "0",
        "padding-left": "20px",
        "line-height": "1rem",
        "overflow": "hidden"
      },
      ".sprout-schema-link-label": {
        "box-sizing": "border-box",
        "border": "1px solid var(--sprout-line)",
        "background": "var(--sprout-surface)",
        "max-width": "180px",
        "color": "var(--sprout-muted)",
        "font-family": "var(--sprout-font)",
        "font-size": "var(--sprout-text-xs)",
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "pointer-events": "none",
        "border-radius": "6px",
        "padding": "0 6px",
        "line-height": "1rem",
        "position": "absolute",
        "overflow": "hidden"
      },
      ".sprout-schema-controls": {
        "border": "1px solid var(--sprout-line)",
        "background": "var(--sprout-surface)",
        "box-shadow": "var(--sprout-shadow-control)",
        "border-radius": "8px",
        "flex-direction": "column",
        "gap": "2px",
        "padding": "2px",
        "display": "flex"
      },
      ".sprout-schema-legend": {
        "color": "var(--sprout-muted)",
        "font-family": "var(--sprout-font)",
        "font-size": "var(--sprout-text-xs)",
        "flex-wrap": "wrap",
        "align-items": "center",
        "gap": "4px 16px",
        "margin": "0",
        "padding": "0",
        "line-height": "1rem",
        "list-style": "none",
        "display": "flex"
      },
      ".sprout-schema-legend-item": {
        "align-items": "center",
        "gap": "6px",
        "display": "flex"
      },
      ".sprout-schema-legend-swatch": {
        "border-radius": "2px",
        "flex-shrink": "0",
        "width": "10px",
        "height": "10px"
      },
      ".sprout-schema-legend-swatch[data-change=\"added\"]": {
        "background": "var(--sprout-success-subtle)",
        "box-shadow": "0 0 0 1px var(--sprout-success)"
      },
      ".sprout-schema-legend-swatch[data-change=\"changed\"]": {
        "background": "var(--sprout-warning-subtle)",
        "box-shadow": "0 0 0 1px var(--sprout-warning)"
      },
      ".sprout-schema-legend-swatch[data-change=\"removed\"]": {
        "background": "var(--sprout-danger-subtle)",
        "box-shadow": "0 0 0 1px var(--sprout-danger)"
      },
      ".sprout-schema-sr-only": {
        "clip-path": "inset(50%)",
        "white-space": "nowrap",
        "border": "0",
        "width": "1px",
        "height": "1px",
        "margin": "-1px",
        "padding": "0",
        "position": "absolute",
        "overflow": "hidden"
      },
      "@media (prefers-reduced-motion: no-preference)": {
        ".sprout-schema-table": {
          "transition": "box-shadow var(--sprout-motion-normal) var(--sprout-motion-ease)"
        },
        ".sprout-schema-flow .react-flow__node": {
          "transition": "outline-color var(--sprout-motion-fast) ease-out"
        }
      }
    }
  },
  "docs": "Docs and examples: https://sprout.tulipfarm.ai/components/schema-diagram/",
  "meta": {
    "source": "packages/sprout/src/components/schema-diagram.tsx"
  }
}
