/**
 * Resolve a response set ID into ClarificationResponseOption[] for card rendering.
 * Falls back to template defaults when no configured set is found.
 */
import { DEFAULT_CLARIFICATION_TEMPLATES } from '../config/clarification_templates.js';
export function resolve_response_options(response_set_id, clarification_type, available_response_types, available_response_sets) {
    if (response_set_id && available_response_types?.length && available_response_sets?.length) {
        const set = available_response_sets.find(s => s.set_id === response_set_id);
        if (set) {
            const type_map = new Map(available_response_types.map(t => [t.response_id, t]));
            const options = [];
            for (const rid of set.response_ids) {
                const rt = type_map.get(rid);
                if (rt) {
                    options.push({
                        value: rt.response_id,
                        label: rt.label,
                        description: rt.description,
                        shows_file_upload: rt.accept_files,
                        files_mandatory: rt.files_mandatory,
                        shows_additional_input: rt.accept_comment,
                        marks_manual_review: rt.marks_manual_review,
                    });
                }
            }
            if (options.length > 0)
                return options;
        }
    }
    if (clarification_type) {
        const template = DEFAULT_CLARIFICATION_TEMPLATES[clarification_type];
        if (template)
            return template.response_options;
    }
    return [];
}
//# sourceMappingURL=resolve_response_set.js.map