/**
 * Text-based doc check — shows quoted snippet + issue + response mechanism.
 * Used when AI finds issues in client's text input.
 */
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { cn, WarningIcon } from './shared.js';
export function TextDocCheck({ doc_check_msg, role, on_respond }) {
    const [responding_to, set_responding_to] = useState(null);
    const check = doc_check_msg.doc_check;
    if (!check || !check.issues || check.issues.length === 0)
        return null;
    return (_jsxs("div", { className: "rounded-md border border-amber-200 overflow-hidden mt-2", children: [_jsxs("div", { className: "px-3 py-2 bg-amber-50/60 flex items-center gap-2 border-b border-amber-200", children: [_jsx(WarningIcon, {}), _jsx("span", { className: "text-[12px] font-medium text-amber-800", children: check.summary })] }), check.issues.map((issue, i) => (_jsxs("div", { className: cn('px-3 py-3', i > 0 && 'border-t border-amber-100'), children: [issue.text_snippet && (_jsxs("div", { className: "flex items-start gap-2 mb-2", children: [_jsx("div", { className: "w-1 self-stretch bg-amber-300 rounded-full flex-shrink-0" }), _jsxs("p", { className: "text-[12px] text-[#64748B] italic leading-relaxed", children: ["\u201C", issue.text_snippet, "\u201D"] })] })), _jsx("p", { className: "text-[12px] text-amber-800 leading-relaxed", children: issue.description }), role === 'client' && responding_to !== i && (_jsxs("div", { className: "flex gap-2 mt-2", children: [_jsx("button", { onClick: () => set_responding_to(i), className: "text-[11px] font-medium text-[#2563EB] border border-[#2563EB] rounded px-2.5 py-1 hover:bg-[#2563EB] hover:text-white transition-colors cursor-pointer", children: "Provide details" }), _jsx("button", { onClick: () => set_responding_to(i), className: "text-[11px] text-[#64748B] border border-[#CBD5E1] rounded px-2.5 py-1 hover:bg-white transition-colors cursor-pointer", children: "Upload receipt" })] })), role === 'client' && responding_to === i && (_jsxs("div", { className: "mt-2 bg-white border border-[#E2E8F0] rounded-md p-2.5", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx("button", { className: "text-[11px] font-medium text-[#2563EB] border border-[#2563EB]/30 bg-[#EFF6FF] rounded px-2 py-0.5 cursor-pointer", children: "\uD83D\uDCCE Attach receipt" }), _jsx("span", { className: "text-[11px] text-[#94A3B8]", children: "or drag & drop" })] }), _jsx("textarea", { className: "w-full border border-[#E2E8F0] rounded px-2.5 py-1.5 text-[12px] resize-none focus:outline-none focus:ring-1 focus:ring-[#2563EB] placeholder:text-[#CBD5E1]", rows: 2, placeholder: "Explain or provide corrected details..." }), _jsxs("div", { className: "flex justify-end gap-2 mt-1.5", children: [_jsx("button", { onClick: () => set_responding_to(null), className: "text-[11px] text-[#94A3B8] cursor-pointer", children: "Cancel" }), _jsx("button", { className: "text-[11px] font-medium text-white bg-[#2563EB] px-3 py-1 rounded hover:bg-[#1D4ED8] cursor-pointer", children: "Submit" })] })] }))] }, i)))] }));
}
//# sourceMappingURL=text_doc_check.js.map