/**
 * ClarificationDocReference - Renders a list of referenced documents
 * in the grey (issue) zone of a clarification card.
 * Uses FileBar for consistent file row rendering.
 */
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { FileBar } from '../shared/file_bar/index.js';
/** Convert a ClarificationDocReference to a FormFileAttachment for FileBar. */
function doc_ref_to_attachment(ref) {
    return {
        file_id: ref.file_id,
        ref_id: `docref_${ref.file_id}`,
        file_name: ref.file_name,
        file_size: ref.file_size ?? 0,
        mime_type: ref.mime_type || 'application/octet-stream',
        visibility: 'public',
        attached_at: new Date().toISOString(),
    };
}
export const ClarificationDocReferenceList = React.memo(function ClarificationDocReferenceList({ references, on_click, on_view, on_delete, file_validation, file_validation_details, file_pipeline_status, max_width = 'max-w-[50%]', }) {
    if (references.length === 0)
        return null;
    return (_jsxs("div", { className: "cls_clarification_doc_refs mt-3", children: [_jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1.5", children: "Referenced Documents" }), _jsx("div", { className: "space-y-1.5", children: references.map((ref) => {
                    const attachment = doc_ref_to_attachment(ref);
                    const validation = file_validation?.[ref.file_id] ?? null;
                    return (_jsxs("div", { children: [_jsx(FileBar, { attachment: attachment, validation: validation, on_download: on_click ? () => on_click(ref.file_id) : undefined, on_view: on_view ? () => on_view(ref.file_id, ref.file_name) : undefined, on_remove: on_delete ? () => on_delete(ref.file_id) : undefined, validation_details: file_validation_details?.[ref.file_id], pipeline_status_text: file_pipeline_status?.[ref.file_id], max_width: max_width }), ref.comment && (_jsxs("span", { className: "text-muted-foreground text-xs italic block mt-0.5 ml-7", children: ["\u201C", ref.comment, "\u201D"] }))] }, ref.file_id));
                }) })] }));
});
//# sourceMappingURL=clarification_doc_reference.js.map