'use client'; import React, { useState, useEffect } from 'react'; import { LineChart, Line, ResponsiveContainer } from 'recharts'; import 'katex/dist/katex.min.css'; import TechMathModal from './TechMathModal'; import { Cpu, AlertCircle, BookOpen, Activity, Zap, TrendingUp, TrendingDown, ArrowUpRight, ArrowDownRight, Minus, Server, Wallet } from 'lucide-react'; interface TickerMetricData { quarter: string; value: number; } interface SupplyChainDataPoint { quarter: string; nvdaInvTurnover: number; aggregateObligations: number; velocityIndex: number; } interface Payload { dates: string[]; liveDataAvailable: boolean; timestamp: number; metrics: { monetizationGap: { name: string; tickers: Record; }; supplyChain: { name: string; unit: string; currentVelocity: number; previousVelocity: number; currentTurnover: number; currentObligations: number; trend: 'UP' | 'DOWN' | 'FLAT'; data: SupplyChainDataPoint[]; }; infrastructure: { name: string; tickers: Record; }; }; } export default function AiSpecialSilo() { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [payload, setPayload] = useState(null); const [isMathModalOpen, setIsMathModalOpen] = useState(false); const [isShieldActive, setIsShieldActive] = useState(false); useEffect(() => { const fetchData = async () => { setLoading(true); setError(null); try { const response = await fetch('/api/tech/ai'); if (response.ok) { const data = await response.json(); setPayload(data); setIsShieldActive(!!data.isShieldActive); } else { setError('Error fetching AI Tech Hyper-Leverage metrics.'); } } catch (err) { console.error('Fetch tech metrics error:', err); setError('Network error loading AI Special Silo data.'); } finally { setLoading(false); } }; fetchData(); }, []); if (loading) { return (
Ingesting quarterly balance sheets & tech indicators...
); } if (error || !payload) { return (
{error || 'Error loading data.'}
); } const { monetizationGap, supplyChain, infrastructure } = payload.metrics; // HSL Status Colors based on metric thresholds const getMonetizationStatus = () => { const gaps = Object.values(monetizationGap.tickers).map(t => t.current); const minGap = Math.min(...gaps); if (minGap < -15) return 'RED'; if (minGap < 0) return 'AMBER'; return 'GREEN'; }; const getSupplyChainStatus = () => { const vel = supplyChain.currentVelocity; if (vel < 1.8 || supplyChain.trend === 'DOWN') return 'RED'; if (vel < 3.0) return 'AMBER'; return 'GREEN'; }; const getInfrastructureStatus = () => { const ratios = Object.values(infrastructure.tickers).map(t => t.currentCapExDep); const maxRatio = Math.max(...ratios); const des = Object.values(infrastructure.tickers).map(t => t.currentDE); const maxDE = Math.max(...des); if (maxRatio > 4.0 || maxDE > 1.2) return 'RED'; if (maxRatio > 2.5 || maxDE > 0.8) return 'AMBER'; return 'GREEN'; }; const monetizationStatus = getMonetizationStatus(); const supplyStatus = getSupplyChainStatus(); const infraStatus = getInfrastructureStatus(); // Helper for trend icons const renderTrendIcon = (trend: 'UP' | 'DOWN' | 'FLAT', isDangerUp = false) => { const baseClass = "w-3.5 h-3.5 inline-block align-middle"; if (trend === 'UP') { return ; } if (trend === 'DOWN') { return ; } return ; }; return (
{/* ⚠️ Dynamic Rate-Limit Fallback Banner */} {!payload.liveDataAvailable && (
[⚠️ API Limit - Fallback Archive Active] Real-time API balance sheet fetches are rate-limited (FMP HTTP 429). The workstation has initialized fallback calculations using the high-fidelity historical archive.
)} {/* HEADER SECTION */}
AI & Tech Silo

AI Hyper-Leverage & CapEx Matrix {isShieldActive ? ( DEV-ARCHIV AKTIV (0 CALLS) ) : ( LIVE-API ENDPUNKT (FMP CORPO) )}

Monitors Big Tech capital expenditures, segment revenues, and inventory velocities to diagnose infrastructure bubbles.

Archive State
{new Date(payload.timestamp).toLocaleTimeString()}
{/* 🚥 3 LARGE GLOWING NEON-AMPEL CARDS */}
{/* CARD 1: ROI-to-CapEx & Monetization Gap */}
1. ROI-to-CapEx & Monetization Gap
Monetization Gap
YoY Segment Rev Growth minus CapEx Growth
Max Divergence
{Math.min(...Object.values(monetizationGap.tickers).map(t => t.current)).toFixed(1)}%
Global Trend
{renderTrendIcon(monetizationStatus === 'GREEN' ? 'UP' : 'DOWN')} {monetizationStatus === 'GREEN' ? 'Stable' : monetizationStatus === 'AMBER' ? 'Diverging' : 'Bubble Risk'}
{/* CARD 2: Nvidia Supply-Chain Velocity */}
2. Supply-Chain Commitments
Nvidia SC Velocity
Buyer commitments relative to NVDA inventory
Velocity Index
{supplyChain.currentVelocity}x
NVDA Inv Turnover
{supplyChain.currentTurnover}x
{/* CARD 3: Tech Infrastructure Leverage */}
3. Cluster Construction Leverage
Infrastructure Leverage
Aggressive CapEx-to-Depreciation ratios
Max CapEx/Dep
{Math.max(...Object.values(infrastructure.tickers).map(t => t.currentCapExDep)).toFixed(1)}x
Structural Debt
Max D/E: {Math.max(...Object.values(infrastructure.tickers).map(t => t.currentDE)).toFixed(2)}
{/* DETAILED LEDGER GRID */}
{/* PANEL A: ROI-TO-CAPEX & MONETIZATION GAPS */}

Monetization Gap & Segment Returns

Compares quarterly segment revenue growth trends against CapEx growth.

{Object.entries(monetizationGap.tickers).map(([ticker, metrics]) => { const currentGap = metrics.current; const gapColorClass = currentGap >= 0 ? 'text-emerald-400' : currentGap >= -15 ? 'text-amber-400 font-semibold' : 'text-rose-400 font-bold animate-pulse'; const strokeColor = currentGap >= 0 ? '#10b981' : currentGap >= -15 ? '#fbbf24' : '#f43f5e'; return (
{ticker}
Seg Rev QoQ: {metrics.segmentRevenueGrowth > 0 ? '+' : ''}{metrics.segmentRevenueGrowth}%
{/* Sparkline for Monetization Gap */}
ROI: {metrics.roiToCapex}%
Gap: {currentGap > 0 ? '+' : ''}{currentGap}%
); })}
{/* PANEL B: TECH INFRASTRUCTURE LEVERAGE & CLUSTER HEALTH */}

Cluster Construction & Leverage Ratios

Tracks structural debt loads and CapEx spending compared to depreciation rate vectors.

{Object.entries(infrastructure.tickers).map(([ticker, metrics]) => { const currentCapExDep = metrics.currentCapExDep; const highlightClass = currentCapExDep > 4.0 ? 'text-rose-400 font-bold animate-pulse' : currentCapExDep > 2.5 ? 'text-amber-400 font-semibold' : 'text-emerald-400'; const strokeColor = currentCapExDep > 4.0 ? '#f43f5e' : currentCapExDep > 2.5 ? '#fbbf24' : '#10b981'; return (
{ticker}
D/E: {metrics.currentDE.toFixed(2)}
{/* Sparkline for D/E Ratio */}
CapEx/Depreciation
{currentCapExDep.toFixed(1)}x
); })}
{/* PANEL C: SUPPLY CHAIN FLOW DETAILS */}

Nvidia Supply-Chain Velocity Timeline

Tracks the velocity of purchase commitments from top buyers (MSFT, GOOGL, META) relative to Nvidia's inventories.

NVDA Inventory: {supplyChain.data[supplyChain.data.length - 1].aggregateObligations / 1000}B$
Commitments: {supplyChain.currentObligations / 1000}B$
{supplyChain.data.map((row, idx) => { const prevRow = idx > 0 ? supplyChain.data[idx - 1] : row; const rowTrend = row.velocityIndex > prevRow.velocityIndex ? 'UP' : row.velocityIndex < prevRow.velocityIndex ? 'DOWN' : 'FLAT'; const velocityClass = row.velocityIndex < 2.0 ? 'text-rose-400 font-semibold font-bold' : row.velocityIndex < 3.0 ? 'text-amber-400' : 'text-emerald-400'; return ( ); })}
Quarter Nvidia Inventory Turnover Top Buyer Commitments Velocity Index Trend Indicator
{row.quarter} {row.nvdaInvTurnover.toFixed(2)}x {(row.aggregateObligations / 1000).toFixed(1)}B$ {row.velocityIndex.toFixed(2)}x {renderTrendIcon(rowTrend, row.velocityIndex < 2.5)}
{/* Modulerklärung Modal */} setIsMathModalOpen(false)} />
); }