import React, { useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import {
Code2,
Copy,
Check,
Braces,
FileCode2,
FileText,
Sparkles,
ChevronDown,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { cn } from "@/lib/utils";
// Mock extracted data
const mockData = {
document: {
type: "Invoice",
confidence: 0.98,
},
vendor: {
name: "Acme Corporation",
address: "123 Business Ave, Suite 400",
city: "San Francisco",
state: "CA",
zip: "94102",
phone: "+1 (555) 123-4567",
},
invoice: {
number: "INV-2024-0847",
date: "2024-01-15",
due_date: "2024-02-14",
po_number: "PO-9823",
},
items: [
{ description: "Professional Services", quantity: 40, unit_price: 150.0, total: 6000.0 },
{ description: "Software License", quantity: 5, unit_price: 299.99, total: 1499.95 },
{ description: "Support Package", quantity: 1, unit_price: 500.0, total: 500.0 },
],
totals: {
subtotal: 7999.95,
tax_rate: 0.0875,
tax_amount: 699.99,
total: 8699.94,
},
};
const mockXML = `
{isComplete ? "25 fields extracted" : "Waiting for extraction"}
Extracted data will appear here
AI is extracting data...
Analyzing document structure
{mockText}
) : activeTab === "json" ? (
{mockXML.split("\n").map((line, i) => (
{line.includes("<") ? (
<>
{line.split(/(<\/?[\w\s=".-]+>)/g).map((part, j) => {
if (part.startsWith("")) {
return (
{part}
);
}
if (part.startsWith("<")) {
return (
{part}
);
}
return (
{part}
);
})}
>
) : (
line
)}
))}
)}