/**
 * FileChip — Thin wrapper around FileBar for backward compatibility.
 * Maps FileChipProps to FileBarProps.
 */
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { FileBar } from '../shared/file_bar/index.js';
export function FileChip({ attachment, index, disabled, classifying, queued, autofilling, validating, validated, validation_errors, response_label, classification_tags, classification_meta, on_download, on_remove, on_view, on_classify, on_issue_click, on_validated_click, responded_ids, validation_details, pipeline_status_text, max_width, }) {
    // Derive status icon (validating takes priority over classifying)
    const status_icon = validating ? 'validating'
        : classifying ? 'classifying'
            : autofilling ? 'autofilling'
                : queued ? 'queued'
                    : null;
    // Derive validation state
    let validation = null;
    if (validating) {
        validation = { state: 'validating' };
    }
    else if (validation_errors?.length) {
        if (response_label) {
            validation = { state: 'resolved', issue_count: validation_errors.length };
        }
        else {
            const pending = responded_ids
                ? validation_errors.filter(e => !responded_ids.has(e.id)).length
                : validation_errors.length;
            if (pending === 0) {
                validation = { state: 'resolved', issue_count: validation_errors.length };
            }
            else {
                validation = { state: 'issues', issue_count: pending };
            }
        }
    }
    else if (validated) {
        validation = { state: 'passed' };
    }
    // Derive validation click handler
    const handle_validation_click = validation?.state === 'passed'
        ? (on_validated_click ? (file_id) => on_validated_click(file_id) : undefined)
        : (on_issue_click ? (file_id) => on_issue_click(file_id) : undefined);
    return (_jsx(FileBar, { attachment: attachment, status_icon: status_icon, validation: validation, on_validation_click: handle_validation_click, validation_details: validation_details, pipeline_status_text: pipeline_status_text, max_width: max_width, classification_tags: classification_tags, classification_meta: classification_meta, on_download: on_download, on_view: on_view, on_remove: on_remove ? () => on_remove(index) : undefined, on_classify: on_classify, disabled: disabled }));
}
//# sourceMappingURL=file_chip.js.map