import React, { useState } from 'react' import { X, Globe, ExternalLink } from 'lucide-react' const ENTITY_COLORS = { startup: '#3B82F6', sme: '#10B981', college_ecell: '#FBBF24', incubator: '#A855F7', accelerator: '#EC4899', } const ENTITY_LABELS = { startup: '๐ Startup', sme: '๐ข SME', college_ecell: '๐ E-Cell', incubator: '๐งช Incubator', accelerator: 'โก Accelerator', } function formatFunding(v) { if (!v || v === 0) return 'Bootstrapped' const cr = v / 10000000 if (cr >= 10000) return `โน${(cr/100000).toFixed(2)} Lakh Cr` if (cr >= 100) return `โน${cr.toLocaleString('en-IN', { maximumFractionDigits: 0 })} Cr` if (cr >= 1) return `โน${cr.toFixed(1)} Cr` return `โน${(v/100000).toFixed(0)} L` } // โโโ URL Validation โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ function isValidHttpUrl(url) { if (!url || typeof url !== 'string') return false try { const u = new URL(url.trim()) const protocol = u.protocol.toLowerCase() if (protocol !== 'http:' && protocol !== 'https:') return false const hostname = u.hostname.toLowerCase() // Block private IPs and localhost if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '0.0.0.0') return false if (hostname.startsWith('192.168.') || hostname.startsWith('10.')) return false if (hostname.startsWith('172.')) { const parts = hostname.split('.') if (parts.length >= 2) { const second = parseInt(parts[1], 10) if (second >= 16 && second <= 31) return false } } return true } catch { return false } } function sanitizeUrl(url) { if (!url || typeof url !== 'string') return '' const trimmed = url.trim() const lower = trimmed.toLowerCase() if (lower.startsWith('javascript:') || lower.startsWith('data:') || lower.startsWith('vbscript:')) { return '' } return trimmed } const SOCIAL_CONFIG = { linkedin: { icon: '๐ผ', color: '#0A66C2', label: 'LinkedIn' }, twitter: { icon: '๐', color: '#000000', label: 'X (Twitter)' }, instagram: { icon: '๐ธ', color: '#E4405F', label: 'Instagram' }, facebook: { icon: '๐', color: '#1877F2', label: 'Facebook' }, website: { icon: '๐', color: '#6366F1', label: 'Website' }, crunchbase: { icon: 'CB', color: '#0288D1', label: 'Crunchbase' }, tracxn: { icon: 'TX', color: '#FF6F00', label: 'Tracxn' }, google: { icon: '๐', color: '#4285F4', label: 'Google Search' }, } function SocialLinksGrid({ entity }) { const links = [] const name = entity.name if (entity.linkedin_url && isValidHttpUrl(entity.linkedin_url)) { links.push({ ...SOCIAL_CONFIG.linkedin, url: sanitizeUrl(entity.linkedin_url), verified: true }) } if (entity.twitter_url && isValidHttpUrl(entity.twitter_url)) { links.push({ ...SOCIAL_CONFIG.twitter, url: sanitizeUrl(entity.twitter_url), verified: true }) } if (entity.instagram_url && isValidHttpUrl(entity.instagram_url)) { links.push({ ...SOCIAL_CONFIG.instagram, url: sanitizeUrl(entity.instagram_url), verified: true }) } if (entity.facebook_url && isValidHttpUrl(entity.facebook_url)) { links.push({ ...SOCIAL_CONFIG.facebook, url: sanitizeUrl(entity.facebook_url), verified: true }) } if (entity.website && isValidHttpUrl(entity.website)) { links.push({ ...SOCIAL_CONFIG.website, url: sanitizeUrl(entity.website), verified: true }) } // Search links (always available, constructed safely) const slug = name.toLowerCase().replace(/\s+/g, '-').replace('.', '') const encName = encodeURIComponent(name) if (!entity.linkedin_url) links.push({ ...SOCIAL_CONFIG.linkedin, url: `https://www.linkedin.com/search/results/companies/?keywords=${encName}`, search: true }) if (!entity.twitter_url) links.push({ ...SOCIAL_CONFIG.twitter, url: `https://x.com/search?q=${encName}&src=typed_query`, search: true }) if (!entity.instagram_url) links.push({ ...SOCIAL_CONFIG.instagram, url: `https://www.instagram.com/${slug}`, search: true }) if (!entity.website) links.push({ ...SOCIAL_CONFIG.website, url: `https://www.google.com/search?q=${encName}+company`, search: true }) links.push({ ...SOCIAL_CONFIG.crunchbase, url: `https://www.crunchbase.com/organization/${slug}`, search: true }) links.push({ ...SOCIAL_CONFIG.tracxn, url: `https://tracxn.com/d/companies/${slug}/`, search: true }) links.push({ ...SOCIAL_CONFIG.google, url: `https://www.google.com/search?q=${encName}+startup+India+news+2024+2025`, search: true }) return (
{analysis.summary}
{analysis.latest_news?.length > 0 && (๐ {e.city}, {e.state}
{label}{e.description}
)} {/* Key Metrics */}{value}
{label}