{"version":3,"file":"renderFileChildren.js","names":[],"sources":["../../../src/react/utils/renderFileChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n  CUSTOM_HEADER_SLOT_ID,\n  HEADER_METADATA_SLOT_ID,\n  HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { GutterUtilitySlotStyles } from '../constants';\nimport type { FileProps } from '../types';\n\ninterface RenderFileChildrenProps<LAnnotation> {\n  file: FileContents;\n  renderCustomHeader: FileProps<LAnnotation>['renderCustomHeader'];\n  renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];\n  renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];\n  renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];\n  lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];\n  renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];\n  renderHoverUtility: FileProps<LAnnotation>['renderHoverUtility'];\n  getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function renderFileChildren<LAnnotation>({\n  file,\n  renderCustomHeader,\n  renderHeaderPrefix,\n  renderHeaderMetadata,\n  renderAnnotation,\n  lineAnnotations,\n  renderGutterUtility,\n  renderHoverUtility,\n  getHoveredLine,\n}: RenderFileChildrenProps<LAnnotation>): ReactNode {\n  const gutterUtility = renderGutterUtility ?? renderHoverUtility;\n  const customHeader = renderCustomHeader?.(file);\n  const prefix = renderHeaderPrefix?.(file);\n  const metadata = renderHeaderMetadata?.(file);\n  return (\n    <>\n      {customHeader != null ? (\n        <div slot={CUSTOM_HEADER_SLOT_ID}>{customHeader}</div>\n      ) : (\n        <>\n          {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n          {metadata != null && (\n            <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>\n          )}\n        </>\n      )}\n      {renderAnnotation != null &&\n        lineAnnotations?.map((annotation, index) => (\n          <div key={index} slot={getLineAnnotationName(annotation)}>\n            {renderAnnotation(annotation)}\n          </div>\n        ))}\n      {gutterUtility != null && (\n        <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n          {gutterUtility(getHoveredLine)}\n        </div>\n      )}\n    </>\n  );\n}\n"],"mappings":";;;;;;AAyBA,SAAgB,mBAAgC,EAC9C,MACA,oBACA,oBACA,sBACA,kBACA,iBACA,qBACA,oBACA,kBACkD;CAClD,MAAM,gBAAgB,uBAAuB;CAC7C,MAAM,eAAe,qBAAqB,KAAK;CAC/C,MAAM,SAAS,qBAAqB,KAAK;CACzC,MAAM,WAAW,uBAAuB,KAAK;AAC7C,QACE;EACG,gBAAgB,OACf,oBAAC;GAAI,MAAM;aAAwB;IAAmB,GAEtD,4CACG,UAAU,QAAQ,oBAAC;GAAI,MAAM;aAAwB;IAAa,EAClE,YAAY,QACX,oBAAC;GAAI,MAAM;aAA0B;IAAe,IAErD;EAEJ,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC;GAAgB,MAAM,sBAAsB,WAAW;aACrD,iBAAiB,WAAW;KADrB,MAEJ,CACN;EACH,iBAAiB,QAChB,oBAAC;GAAI,MAAK;GAAsB,OAAO;aACpC,cAAc,eAAe;IAC1B;KAEP"}