// --- SVG icon data URIs for all map markers ---
// Extracted from MaplibreViewer.tsx — pure data, no JSX

export const svgPlaneCyan = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="cyan" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlaneYellow = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlaneOrange = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#FF8C00" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlanePurple = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#9B59B6" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgFighter = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="M12 2L14 8L18 10L14 16L15 22L12 20L9 22L10 16L6 10L10 8L12 2Z"/></svg>`)}`;
export const svgHeli = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="black" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliCyan = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="cyan" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="cyan" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliDimCyan = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#0891b2" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#0891b2" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliOrange = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#FF8C00" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#FF8C00" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliPurple = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#9B59B6" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#9B59B6" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliSlate = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#94a3b8" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#94a3b8" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliAmber = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#f59e0b" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#f59e0b" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgTanker = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /><line x1="12" y1="20" x2="12" y2="24" stroke="yellow" stroke-width="2" /></svg>`)}`;
export const svgRecon = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /><ellipse cx="12" cy="11" rx="5" ry="3" fill="none" stroke="red" stroke-width="1.5"/></svg>`)}`;
export const svgPlanePink = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#FF1493" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlaneAlertRed = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#FF2020" stroke="black"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlaneDarkBlue = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#1A3A8A" stroke="#4A80D0"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgPlaneWhiteAlert = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="white" stroke="#ff0000" stroke-width="2"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgHeliPink = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#FF1493" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#FF1493" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliAlertRed = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#ff0000" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#ff0000" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliDarkBlue = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#000080" stroke="#4A80D0"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#4A80D0" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliBlue = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#3b82f6" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#3b82f6" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliLime = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="#32CD32" stroke="black"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#32CD32" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgHeliWhiteAlert = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="white" stroke="#666"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#999" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgPlaneBlack = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#222" stroke="#444"><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z" /></svg>`)}`;
export const svgHeliBlack = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#222" stroke="#444"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#444" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;
export const svgDrone = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="orange" stroke="black"><path d="M12 2L15 8H9L12 2Z" /><rect x="8" y="8" width="8" height="2" /><path d="M4 10L10 14H14L20 10V12L14 16H10L4 12V10Z" /><circle cx="12" cy="14" r="2" fill="red"/></svg>`)}`;
export const svgPowerPlant = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#f59e0b" stroke-width="1.5"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" fill="#78350f" stroke="#f59e0b" stroke-linejoin="round" stroke-linecap="round"/></svg>`)}`;
export const svgDataCenter = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#a78bfa" stroke-width="1.5"><rect x="3" y="3" width="18" height="6" rx="1" fill="#2e1065"/><rect x="3" y="11" width="18" height="6" rx="1" fill="#2e1065"/><circle cx="7" cy="6" r="1" fill="#a78bfa"/><circle cx="7" cy="14" r="1" fill="#a78bfa"/><line x1="11" y1="6" x2="17" y2="6" stroke="#a78bfa" stroke-width="1"/><line x1="11" y1="14" x2="17" y2="14" stroke="#a78bfa" stroke-width="1"/><line x1="12" y1="19" x2="12" y2="22" stroke="#a78bfa" stroke-width="1.5"/></svg>`)}`;
export const svgShipGray = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="24" viewBox="0 0 24 24" fill="none"><path d="M6 20 L6 8 L12 2 L18 8 L18 20 C18 22 6 22 6 20 Z" fill="gray" stroke="#000" stroke-width="1"/><polygon points="12,6 16,16 8,16" fill="#fff" stroke="#000" stroke-width="1"/></svg>`)}`;
export const svgShipRed = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="32" viewBox="0 0 24 24" fill="none"><path d="M6 22 L6 6 L12 2 L18 6 L18 22 Z" fill="#ff2222" stroke="#000" stroke-width="1"/><rect x="8" y="15" width="8" height="4" fill="#880000" stroke="#000" stroke-width="1"/><rect x="8" y="7" width="8" height="6" fill="#444" stroke="#000" stroke-width="1"/></svg>`)}`;
export const svgShipYellow = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="34" viewBox="0 0 24 24" fill="none"><path d="M7 22 L7 6 L12 1 L17 6 L17 22 Z" fill="yellow" stroke="#000" stroke-width="1"/><rect x="9" y="8" width="6" height="8" fill="#555" stroke="#000" stroke-width="1"/><circle cx="12" cy="18" r="1.5" fill="#000"/><line x1="12" y1="18" x2="12" y2="24" stroke="#000" stroke-width="1.5"/></svg>`)}`;
export const svgShipBlue = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="32" viewBox="0 0 24 24" fill="none"><path d="M6 22 L6 6 L12 2 L18 6 L18 22 Z" fill="#3b82f6" stroke="#000" stroke-width="1"/></svg>`)}`;
export const svgShipWhite = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="36" viewBox="0 0 24 24" fill="none"><path d="M5 21 L5 8 L12 2 L19 8 L19 21 C19 23 5 23 5 21 Z" fill="white" stroke="#000" stroke-width="1"/><rect x="7" y="10" width="10" height="8" fill="#90cdf4" stroke="#000" stroke-width="1"/><circle cx="12" cy="14" r="2" fill="yellow" stroke="#000"/></svg>`)}`;
export const svgShipPink = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="36" viewBox="0 0 24 24" fill="none"><path d="M5 21 L5 8 L12 2 L19 8 L19 21 C19 23 5 23 5 21 Z" fill="#FF69B4" stroke="#000" stroke-width="1"/><rect x="7" y="10" width="10" height="8" fill="#ff8dc7" stroke="#000" stroke-width="1"/><circle cx="12" cy="14" r="2" fill="white" stroke="#000"/></svg>`)}`;
export const svgShipGreyBlue = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="32" viewBox="0 0 24 24" fill="none"><path d="M6 22 L6 6 L12 2 L18 6 L18 22 Z" fill="#64748b" stroke="#000" stroke-width="1"/><rect x="8" y="15" width="8" height="4" fill="#475569" stroke="#000" stroke-width="1"/><rect x="8" y="7" width="8" height="6" fill="#444" stroke="#000" stroke-width="1"/></svg>`)}`;
export const svgShipAmber = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="34" viewBox="0 0 24 24" fill="none"><path d="M7 22 L7 6 L12 1 L17 6 L17 22 Z" fill="#f59e0b" stroke="#000" stroke-width="1"/><rect x="9" y="8" width="6" height="8" fill="#555" stroke="#000" stroke-width="1"/><circle cx="12" cy="18" r="1.5" fill="#000"/><line x1="12" y1="18" x2="12" y2="24" stroke="#000" stroke-width="1.5"/></svg>`)}`;
export const svgCarrier = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="orange" stroke="black"><polygon points="3,21 21,21 20,4 16,4 16,3 12,3 12,4 4,4" /><rect x="15" y="6" width="3" height="10" /></svg>`)}`;
export const svgCctv = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="cyan" stroke-width="2"><path d="M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-.894.553H5.652a1 1 0 0 1-.894-.553L2.724 13.447A1 1 0 0 1 3.618 12h3.632M14 12V8a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v4a4 4 0 1 0 8 0Z" /></svg>`)}`;
export const svgRadioTower = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#f59e0b" stroke-width="1.5"><line x1="12" y1="10" x2="12" y2="23" stroke="#f59e0b" stroke-width="2"/><line x1="8" y1="23" x2="16" y2="23" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/><line x1="9" y1="16" x2="15" y2="16" stroke="#f59e0b" stroke-width="1.5" stroke-linecap="round"/><circle cx="12" cy="9" r="2" fill="#f59e0b" stroke="none"/><path d="M8 6a5.5 5.5 0 0 1 8 0" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-linecap="round"/><path d="M5.5 3.5a9 9 0 0 1 13 0" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-linecap="round" opacity="0.6"/></svg>`)}`;
export const svgScannerTower = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="1.5"><line x1="12" y1="10" x2="12" y2="23" stroke="#dc2626" stroke-width="2"/><line x1="8" y1="23" x2="16" y2="23" stroke="#dc2626" stroke-width="2" stroke-linecap="round"/><line x1="9" y1="16" x2="15" y2="16" stroke="#dc2626" stroke-width="1.5" stroke-linecap="round"/><circle cx="12" cy="9" r="2" fill="#dc2626" stroke="none"/><path d="M8 6a5.5 5.5 0 0 1 8 0" fill="none" stroke="#dc2626" stroke-width="1.5" stroke-linecap="round"/><path d="M5.5 3.5a9 9 0 0 1 13 0" fill="none" stroke="#dc2626" stroke-width="1.5" stroke-linecap="round" opacity="0.6"/></svg>`)}`;
export const svgSatDish = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="#14b8a6" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 10a7.31 7.31 0 0 0 10 10Z"/><path d="m9 15 3-3"/><path d="M17 13a6 6 0 0 0-6-6"/><path d="M21 13A10 10 0 0 0 11 3"/><circle cx="12" cy="12" r="1.5" fill="#14b8a6" stroke="none"/></svg>`)}`;
export const svgLoRaSat = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#a855f7" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="8" width="8" height="8" rx="1" fill="#a855f7" fill-opacity="0.3"/><line x1="4" y1="12" x2="8" y2="12"/><line x1="16" y1="12" x2="20" y2="12"/><line x1="12" y1="4" x2="12" y2="8"/><line x1="12" y1="16" x2="12" y2="20"/><circle cx="12" cy="12" r="2" fill="#a855f7" stroke="none"/></svg>`)}`;
export const svgWarning = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="yellow" stroke="black"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`)}`;
export const svgThreat = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="#ffff00" stroke="#ff0000" stroke-width="2"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`)}`;
export const svgTriangleYellow = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#ffaa00" stroke="#000" stroke-width="1"><path d="M1 21h22L12 2 1 21z"/></svg>`)}`;
export const svgTriangleRed = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#ff0000" stroke="#fff" stroke-width="1"><path d="M1 21h22L12 2 1 21z"/></svg>`)}`;
export const svgTrianglePink = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="#f472b6" stroke="#1a1a2e" stroke-width="1.5"><path d="M1 21h22L12 2 1 21z"/></svg>`)}`;
export const svgTriangleGreen = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="#22c55e" stroke="#1a1a2e" stroke-width="1.5"><path d="M1 21h22L12 2 1 21z"/></svg>`)}`;

// --- Aircraft type-specific SVG paths (top-down silhouettes) ---
// Airliner: wide swept wings with engine pods, narrow fuselage
export const AIRLINER_PATH =
  'M12 2C11.2 2 10.5 2.8 10.5 3.5V8.5L3 13V15L10.5 12.5V18L8 19.5V21L12 19.5L16 21V19.5L13.5 18V12.5L21 15V13L13.5 8.5V3.5C13.5 2.8 12.8 2 12 2Z M5.5 13.5L3.5 14.5 M18.5 13.5L20.5 14.5';
// Turboprop: straight high wings, shorter body
export const TURBOPROP_PATH =
  'M12 3C11.3 3 10.8 3.5 10.8 4V9L3 12V13.5L10.8 11.5V18.5L9 19.5V21L12 20L15 21V19.5L13.2 18.5V11.5L21 13.5V12L13.2 9V4C13.2 3.5 12.7 3 12 3Z';
// Bizjet: sleek, small swept wings, T-tail
export const BIZJET_PATH =
  'M12 1.5C11.4 1.5 11 2 11 2.8V9L5 12.5V14L11 12V18.5L8.5 20V21.5L12 20.5L15.5 21.5V20L13 18.5V12L19 14V12.5L13 9V2.8C13 2 12.6 1.5 12 1.5Z';

// --- Fire icon SVGs for FIRMS hotspots (multi-tongue flame, unmistakably fire) ---
export function makeFireSvg(fill: string, innerFill: string, size = 18) {
  // Multi-forked flame: main body + left tongue + right tongue + inner glow
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 28">` +
      // Main flame body (wide base, pointed top)
      `<path d="M12 1C12 1 9 5 8 8C7 11 5.5 13 5.5 16.5C5.5 20.5 8 23.5 12 23.5C16 23.5 18.5 20.5 18.5 16.5C18.5 13 17 11 16 8C15 5 12 1 12 1Z" fill="${fill}" stroke="rgba(0,0,0,0.7)" stroke-width="0.7"/>` +
      // Left tongue (forks out left from top)
      `<path d="M10 8C10 8 7.5 4.5 7 2.5C7 2.5 6 5.5 7 9C7.5 10.5 8.5 11.5 9.5 12" fill="${fill}" stroke="rgba(0,0,0,0.5)" stroke-width="0.4"/>` +
      // Right tongue (forks out right from top)
      `<path d="M14 8C14 8 16.5 4.5 17 2.5C17 2.5 18 5.5 17 9C16.5 10.5 15.5 11.5 14.5 12" fill="${fill}" stroke="rgba(0,0,0,0.5)" stroke-width="0.4"/>` +
      // Inner bright core
      `<path d="M12 8C12 8 10.5 11 10.5 14.5C10.5 17.5 11 19.5 12 20C13 19.5 13.5 17.5 13.5 14.5C13.5 11 12 8 12 8Z" fill="${innerFill}" opacity="0.85"/>` +
      `</svg>`,
  )}`;
}
export const svgFireYellow = makeFireSvg('#ffcc00', '#fff5aa', 16);
export const svgFireOrange = makeFireSvg('#ff8800', '#ffcc00', 18);
export const svgFireRed = makeFireSvg('#ff2200', '#ff8800', 20);
export const svgFireDarkRed = makeFireSvg('#cc0000', '#ff2200', 22);
// Larger fire icons for cluster markers (visually distinct from Global Incidents circles)
export const svgFireClusterSmall = makeFireSvg('#ff6600', '#ffcc00', 32);
export const svgFireClusterMed = makeFireSvg('#ff3300', '#ff8800', 40);
export const svgFireClusterLarge = makeFireSvg('#cc0000', '#ff3300', 48);
export const svgFireClusterXL = makeFireSvg('#880000', '#cc0000', 56);

export function makeAircraftSvg(
  type: 'airliner' | 'turboprop' | 'bizjet' | 'generic',
  fill: string,
  stroke = 'black',
  size = 20,
) {
  const paths: Record<string, string> = {
    airliner: AIRLINER_PATH,
    turboprop: TURBOPROP_PATH,
    bizjet: BIZJET_PATH,
    generic:
      'M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z',
  };
  const p = paths[type] || paths.generic;
  // Airliner gets engine pod circles
  const extras =
    type === 'airliner'
      ? `<circle cx="7" cy="12.5" r="1.2" fill="${fill}" stroke="${stroke}" stroke-width="0.5"/><circle cx="17" cy="12.5" r="1.2" fill="${fill}" stroke="${stroke}" stroke-width="0.5"/>`
      : '';
  return `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="${fill}" stroke="${stroke}"><path d="${p}"/>${extras}</svg>`)}`;
}

// POTUS fleet — oversized hot pink with yellow halo ring
export const svgPotusPlane = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="15" fill="none" stroke="gold" stroke-width="2" stroke-dasharray="4 2"/><g transform="translate(4,4)"><path d="${AIRLINER_PATH}" fill="#FF1493" stroke="black"/><circle cx="7" cy="12.5" r="1.2" fill="#FF1493" stroke="black" stroke-width="0.5"/><circle cx="17" cy="12.5" r="1.2" fill="#FF1493" stroke="black" stroke-width="0.5"/></g></svg>`)}`;
export const svgPotusHeli = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="15" fill="none" stroke="gold" stroke-width="2" stroke-dasharray="4 2"/><g transform="translate(6,4)"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z" fill="#FF1493" stroke="black"/><circle cx="12" cy="12" r="8" fill="none" stroke="#FF1493" stroke-dasharray="2 2" stroke-width="1"/></g></svg>`)}`;

// POTUS fleet ICAO hex codes (verified FAA registry)
export const POTUS_ICAOS = new Set([
  'ADFDF8',
  'ADFDF9', // Air Force One (VC-25A)
  'ADFEB7',
  'ADFEB8',
  'ADFEB9',
  'ADFEBA', // Air Force Two (C-32A)
  'AE4AE6',
  'AE4AE8',
  'AE4AEA',
  'AE4AEC', // Air Force Two (C-32B)
  'AE0865',
  'AE5E76',
  'AE5E77',
  'AE5E79', // Marine One (VH-3D / VH-92A)
]);

// Pre-built aircraft SVGs by type & color
export const svgAirlinerCyan = makeAircraftSvg('airliner', 'cyan');
export const svgAirlinerDimCyan = makeAircraftSvg('airliner', '#0891b2');
export const svgAirlinerOrange = makeAircraftSvg('airliner', '#FF8C00');
export const svgAirlinerPurple = makeAircraftSvg('airliner', '#9B59B6');
export const svgAirlinerSlate = makeAircraftSvg('airliner', '#94a3b8');
export const svgAirlinerYellow = makeAircraftSvg('airliner', 'yellow');
export const svgAirlinerAmber = makeAircraftSvg('airliner', '#f59e0b');
export const svgAirlinerPink = makeAircraftSvg('airliner', '#FF1493', 'black', 22);
export const svgAirlinerRed = makeAircraftSvg('airliner', '#FF2020', 'black', 22);
export const svgAirlinerDarkBlue = makeAircraftSvg('airliner', '#1A3A8A', '#4A80D0', 22);
export const svgAirlinerBlue = makeAircraftSvg('airliner', '#3b82f6', 'black', 22);
export const svgAirlinerLime = makeAircraftSvg('airliner', '#32CD32', 'black', 22);
export const svgAirlinerBlack = makeAircraftSvg('airliner', '#222', '#555', 22);
export const svgAirlinerWhite = makeAircraftSvg('airliner', 'white', '#666', 22);

export const svgTurbopropCyan = makeAircraftSvg('turboprop', 'cyan');
export const svgTurbopropDimCyan = makeAircraftSvg('turboprop', '#0891b2');
export const svgTurbopropOrange = makeAircraftSvg('turboprop', '#FF8C00');
export const svgTurbopropPurple = makeAircraftSvg('turboprop', '#9B59B6');
export const svgTurbopropSlate = makeAircraftSvg('turboprop', '#94a3b8');
export const svgTurbopropYellow = makeAircraftSvg('turboprop', 'yellow');
export const svgTurbopropAmber = makeAircraftSvg('turboprop', '#f59e0b');
export const svgTurbopropPink = makeAircraftSvg('turboprop', '#FF1493', 'black', 22);
export const svgTurbopropRed = makeAircraftSvg('turboprop', '#FF2020', 'black', 22);
export const svgTurbopropDarkBlue = makeAircraftSvg('turboprop', '#1A3A8A', '#4A80D0', 22);
export const svgTurbopropBlue = makeAircraftSvg('turboprop', '#3b82f6', 'black', 22);
export const svgTurbopropLime = makeAircraftSvg('turboprop', '#32CD32', 'black', 22);
export const svgTurbopropBlack = makeAircraftSvg('turboprop', '#222', '#555', 22);
export const svgTurbopropWhite = makeAircraftSvg('turboprop', 'white', '#666', 22);

export const svgBizjetCyan = makeAircraftSvg('bizjet', 'cyan');
export const svgBizjetDimCyan = makeAircraftSvg('bizjet', '#0891b2');
export const svgBizjetOrange = makeAircraftSvg('bizjet', '#FF8C00');
export const svgBizjetPurple = makeAircraftSvg('bizjet', '#9B59B6');
export const svgBizjetSlate = makeAircraftSvg('bizjet', '#94a3b8');
export const svgBizjetYellow = makeAircraftSvg('bizjet', 'yellow');
export const svgBizjetAmber = makeAircraftSvg('bizjet', '#f59e0b');
export const svgBizjetPink = makeAircraftSvg('bizjet', '#FF1493', 'black', 22);
export const svgBizjetRed = makeAircraftSvg('bizjet', '#FF2020', 'black', 22);
export const svgBizjetDarkBlue = makeAircraftSvg('bizjet', '#1A3A8A', '#4A80D0', 22);
export const svgBizjetBlue = makeAircraftSvg('bizjet', '#3b82f6', 'black', 22);
export const svgBizjetLime = makeAircraftSvg('bizjet', '#32CD32', 'black', 22);
export const svgBizjetBlack = makeAircraftSvg('bizjet', '#222', '#555', 22);
export const svgBizjetWhite = makeAircraftSvg('bizjet', 'white', '#666', 22);

// Grey variants for grounded/parked aircraft (altitude 0)
export const svgAirlinerGrey = makeAircraftSvg('airliner', '#555', '#333');
export const svgTurbopropGrey = makeAircraftSvg('turboprop', '#555', '#333');
export const svgBizjetGrey = makeAircraftSvg('bizjet', '#555', '#333');
export const svgHeliGrey = `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="#555" stroke="#333"><path d="M10 6L10 14L8 16L8 18L10 17L12 22L14 17L16 18L16 16L14 14L14 6C14 4 13 2 12 2C11 2 10 4 10 6Z"/><circle cx="12" cy="12" r="8" fill="none" stroke="#555" stroke-dasharray="2 2" stroke-width="1"/></svg>`)}`;

// Grey icon map for grounded aircraft
export const GROUNDED_ICON_MAP: Record<string, string> = {
  heli: 'svgHeliGrey',
  turboprop: 'svgTurbopropGrey',
  bizjet: 'svgBizjetGrey',
  airliner: 'svgAirlinerGrey',
};

// Per-layer color maps (module-level to avoid re-allocation every render tick)
// 3-tier hierarchy: Baseline (dim cyan/slate) → Watch (amber) → Critical (red/gold/pink)
export const COLOR_MAP_COMMERCIAL: Record<string, string> = {
  heli: 'svgHeliDimCyan',
  turboprop: 'svgTurbopropDimCyan',
  bizjet: 'svgBizjetDimCyan',
  airliner: 'svgAirlinerDimCyan',
};
export const COLOR_MAP_PRIVATE: Record<string, string> = {
  heli: 'svgHeliPurple',
  turboprop: 'svgTurbopropPurple',
  bizjet: 'svgBizjetPurple',
  airliner: 'svgAirlinerPurple',
};
export const COLOR_MAP_JETS: Record<string, string> = {
  heli: 'svgHeliPurple',
  turboprop: 'svgTurbopropPurple',
  bizjet: 'svgBizjetPurple',
  airliner: 'svgAirlinerPurple',
};
export const COLOR_MAP_MILITARY: Record<string, string> = {
  heli: 'svgHeliAmber',
  turboprop: 'svgTurbopropAmber',
  bizjet: 'svgBizjetAmber',
  airliner: 'svgAirlinerAmber',
};
export const MIL_SPECIAL_MAP: Record<string, string> = {
  fighter: 'svgFighter',
  tanker: 'svgTanker',
  recon: 'svgRecon',
};

// ─── Military Base Icons (square with X or circle) ───────────────────────

/** Generate a square-with-X SVG data URL for military base markers. */
export function makeMilBaseSvg(fill: string, xColor: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">` +
    `<rect x="1" y="1" width="18" height="18" fill="${fill}" stroke="#000" stroke-width="1.5"/>` +
    `<line x1="1" y1="1" x2="19" y2="19" stroke="${xColor}" stroke-width="2.5"/>` +
    `<line x1="19" y1="1" x2="1" y2="19" stroke="${xColor}" stroke-width="2.5"/>` +
    `</svg>`
  )}`;
}

/** Generate a square-with-filled-circle SVG data URL for military base markers. */
export function makeMilBaseCircleSvg(fill: string, circleColor: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">` +
    `<rect x="1" y="1" width="18" height="18" fill="${fill}" stroke="#000" stroke-width="1.5"/>` +
    `<circle cx="10" cy="10" r="5.5" fill="${circleColor}"/>` +
    `</svg>`
  )}`;
}

function makeMilBaseCustomSvg(content: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">` +
    `<rect x="1" y="1" width="18" height="18" rx="1.5" fill="#111827" stroke="#000" stroke-width="1.5"/>` +
    content +
    `</svg>`
  )}`;
}

function makeMilBaseUSSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#ffffff"/>` +
    `<rect x="1" y="1" width="18" height="2.6" fill="#b91c1c"/>` +
    `<rect x="1" y="6.2" width="18" height="2.6" fill="#b91c1c"/>` +
    `<rect x="1" y="11.4" width="18" height="2.6" fill="#b91c1c"/>` +
    `<rect x="1" y="16.6" width="18" height="2.4" fill="#b91c1c"/>` +
    `<rect x="1" y="1" width="8.5" height="8.5" fill="#1d4ed8"/>` +
    `<circle cx="5.2" cy="5.2" r="1.6" fill="#ffffff"/>`
  );
}

function makeMilBaseChinaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#dc2626"/>` +
    `<polygon points="6,3.2 6.8,5.2 9,5.3 7.2,6.7 7.9,8.8 6,7.5 4.1,8.8 4.8,6.7 3,5.3 5.2,5.2" fill="#facc15"/>`
  );
}

function makeMilBaseUnionJackSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#1d4ed8"/>` +
    `<rect x="8" y="1" width="4" height="18" fill="#ffffff"/>` +
    `<rect x="1" y="8" width="18" height="4" fill="#ffffff"/>` +
    `<rect x="8.8" y="1" width="2.4" height="18" fill="#dc2626"/>` +
    `<rect x="1" y="8.8" width="18" height="2.4" fill="#dc2626"/>`
  );
}

function makeMilBaseRussiaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="6" fill="#ffffff"/>` +
    `<rect x="1" y="7" width="18" height="6" fill="#2563eb"/>` +
    `<rect x="1" y="13" width="18" height="6" fill="#dc2626"/>`
  );
}

function makeMilBaseIndiaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="6" fill="#f97316"/>` +
    `<rect x="1" y="7" width="18" height="6" fill="#ffffff"/>` +
    `<rect x="1" y="13" width="18" height="6" fill="#16a34a"/>` +
    `<circle cx="10" cy="10" r="2.4" fill="none" stroke="#1d4ed8" stroke-width="1.2"/>`
  );
}

function makeMilBaseNorthKoreaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="3" fill="#1d4ed8"/>` +
    `<rect x="1" y="4" width="18" height="1.2" fill="#ffffff"/>` +
    `<rect x="1" y="5.2" width="18" height="9.6" fill="#dc2626"/>` +
    `<rect x="1" y="14.8" width="18" height="1.2" fill="#ffffff"/>` +
    `<rect x="1" y="16" width="18" height="3" fill="#1d4ed8"/>` +
    `<circle cx="6.2" cy="10" r="2.5" fill="#ffffff"/>` +
    `<polygon points="6.2,7.8 6.8,9.3 8.4,9.4 7.1,10.4 7.6,11.9 6.2,11 4.8,11.9 5.3,10.4 4,9.4 5.6,9.3" fill="#dc2626"/>`
  );
}

function makeMilBaseIsraelSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#ffffff"/>` +
    `<rect x="1" y="2.2" width="18" height="2.2" fill="#2563eb"/>` +
    `<rect x="1" y="15.6" width="18" height="2.2" fill="#2563eb"/>` +
    `<line x1="5" y1="5" x2="15" y2="15" stroke="#2563eb" stroke-width="1.8"/>` +
    `<line x1="15" y1="5" x2="5" y2="15" stroke="#2563eb" stroke-width="1.8"/>`
  );
}

function makeMilBasePakistanSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="4" height="18" fill="#ffffff"/>` +
    `<rect x="5" y="1" width="14" height="18" fill="#166534"/>` +
    `<circle cx="12" cy="10" r="3.2" fill="#ffffff"/>` +
    `<circle cx="13.2" cy="10" r="2.7" fill="#166534"/>`
  );
}

function makeMilBaseTaiwanSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#dc2626"/>` +
    `<rect x="1" y="1" width="8.5" height="8.5" fill="#1d4ed8"/>` +
    `<circle cx="5.2" cy="5.2" r="1.8" fill="#ffffff"/>`
  );
}

function makeMilBasePhilippinesSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="9" fill="#2563eb"/>` +
    `<rect x="1" y="10" width="18" height="9" fill="#dc2626"/>` +
    `<polygon points="1,1 1,19 9.5,10" fill="#ffffff"/>` +
    `<circle cx="4.6" cy="10" r="1.5" fill="#facc15"/>`
  );
}

function makeMilBaseAustraliaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#1e3a8a"/>` +
    `<circle cx="12.8" cy="12" r="2" fill="#ffffff"/>` +
    `<circle cx="6" cy="6" r="1.2" fill="#ffffff"/>`
  );
}

function makeMilBaseSouthKoreaSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="18" fill="#ffffff"/>` +
    `<path d="M10 6 A4 4 0 0 1 14 10 H6 A4 4 0 0 1 10 6Z" fill="#ef4444"/>` +
    `<path d="M6 10 H14 A4 4 0 0 1 10 14 A4 4 0 0 1 6 10Z" fill="#2563eb"/>` +
    `<rect x="4" y="4.4" width="2.2" height="0.8" fill="#111827"/>` +
    `<rect x="13.8" y="14.8" width="2.2" height="0.8" fill="#111827"/>`
  );
}

function makeMilBaseIranSvg(): string {
  return makeMilBaseCustomSvg(
    `<rect x="1" y="1" width="18" height="6" fill="#16a34a"/>` +
    `<rect x="1" y="7" width="18" height="6" fill="#ffffff"/>` +
    `<rect x="1" y="13" width="18" height="6" fill="#dc2626"/>` +
    `<circle cx="10" cy="10" r="1.6" fill="none" stroke="#dc2626" stroke-width="1.1"/>`
  );
}

/** All unique military base icon specs for preloading. */
export const MILBASE_ICON_SPECS: {
  id: string;
  fill: string;
  inner: string;
  shape: 'x' | 'circle';
  svg?: string;
}[] = [
  { id: 'milbase-us',       fill: '#1d4ed8', inner: '#ffffff', shape: 'x', svg: makeMilBaseUSSvg() },          // US — stripes + canton
  { id: 'milbase-cn',       fill: '#dc2626', inner: '#facc15', shape: 'x', svg: makeMilBaseChinaSvg() },       // China — red + yellow star
  { id: 'milbase-uk',       fill: '#1d4ed8', inner: '#ffffff', shape: 'x', svg: makeMilBaseUnionJackSvg() },   // UK — Union Jack-ish cross
  { id: 'milbase-jp',       fill: '#ffffff', inner: '#ef4444', shape: 'circle' },  // Japan — white / red circle
  { id: 'milbase-ru',       fill: '#2563eb', inner: '#dc2626', shape: 'x', svg: makeMilBaseRussiaSvg() },      // Russia — tricolor
  { id: 'milbase-in',       fill: '#f97316', inner: '#1d4ed8', shape: 'circle', svg: makeMilBaseIndiaSvg() },  // India — tricolor + chakra
  { id: 'milbase-eu-x',     fill: '#3b82f6', inner: '#fbbf24', shape: 'circle' },  // EU big 3 — blue / yellow circle
  { id: 'milbase-nk',       fill: '#dc2626', inner: '#1d4ed8', shape: 'circle', svg: makeMilBaseNorthKoreaSvg() }, // North Korea — red/blue flag
  { id: 'milbase-il',       fill: '#ffffff', inner: '#2563eb', shape: 'x', svg: makeMilBaseIsraelSvg() },      // Israel — white + blue bands
  { id: 'milbase-pk',       fill: '#166534', inner: '#ffffff', shape: 'circle', svg: makeMilBasePakistanSvg() }, // Pakistan — green + crescent
  { id: 'milbase-tw',       fill: '#dc2626', inner: '#ffffff', shape: 'circle', svg: makeMilBaseTaiwanSvg() }, // Taiwan — red + blue canton
  { id: 'milbase-ph',       fill: '#2563eb', inner: '#facc15', shape: 'circle', svg: makeMilBasePhilippinesSvg() }, // Philippines — blue/red + sun
  { id: 'milbase-au',       fill: '#1e3a8a', inner: '#ffffff', shape: 'circle', svg: makeMilBaseAustraliaSvg() }, // Australia — navy + stars
  { id: 'milbase-sk',       fill: '#ffffff', inner: '#2563eb', shape: 'circle', svg: makeMilBaseSouthKoreaSvg() }, // South Korea — white + taegeuk
  { id: 'milbase-ir',       fill: '#16a34a', inner: '#dc2626', shape: 'circle', svg: makeMilBaseIranSvg() },   // Iran — tricolor
  { id: 'milbase-eu',       fill: '#3b82f6', inner: '#fbbf24', shape: 'circle' },  // EU others — blue / yellow circle
  { id: 'milbase-default',  fill: '#ec4899', inner: '#000000', shape: 'x' },       // Unknown — pink / black X
];


/** Generate a volcano-cone SVG data URL for volcano markers. */
export function makeVolcanoSvg(fill: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">` +
    `<polygon points="10,2 18,18 2,18" fill="${fill}" stroke="#000" stroke-width="1.2"/>` +
    `<line x1="8" y1="3" x2="6" y2="0" stroke="${fill}" stroke-width="1.5" stroke-linecap="round"/>` +
    `<line x1="10" y1="2" x2="10" y2="0" stroke="${fill}" stroke-width="1.5" stroke-linecap="round"/>` +
    `<line x1="12" y1="3" x2="14" y2="0" stroke="${fill}" stroke-width="1.5" stroke-linecap="round"/>` +
    `</svg>`
  )}`;
}

/** Volcano icon specs for preloading. */
export const VOLCANO_ICON_SPECS: { id: string; fill: string }[] = [
  { id: 'volcano-active',     fill: '#ef4444' },  // Red — erupted within 50 years
  { id: 'volcano-historical', fill: '#f97316' },  // Orange — erupted 50–500 years ago
  { id: 'volcano-dormant',    fill: '#6b7280' },  // Grey — dormant (500+ years)
];

// ─── Weather Icons ─────────────────────────────────────────────────────────────

function weatherSvg(inner: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">${inner}</svg>`
  )}`;
}

/** Thunderstorm — cloud with lightning bolt */
export const svgWeatherThunderstorm = weatherSvg(
  `<ellipse cx="16" cy="12" rx="10" ry="6" fill="#64748b" stroke="#334155" stroke-width="1"/>` +
  `<ellipse cx="12" cy="11" rx="6" ry="5" fill="#94a3b8"/>` +
  `<polygon points="15,17 12,24 16,22 13,30 19,21 15,23" fill="#facc15" stroke="#a16207" stroke-width="0.5"/>`,
);

/** Rain — cloud with rain drops */
export const svgWeatherRain = weatherSvg(
  `<ellipse cx="16" cy="11" rx="10" ry="6" fill="#64748b" stroke="#334155" stroke-width="1"/>` +
  `<ellipse cx="12" cy="10" rx="6" ry="5" fill="#94a3b8"/>` +
  `<line x1="10" y1="19" x2="8" y2="25" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round"/>` +
  `<line x1="16" y1="19" x2="14" y2="25" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round"/>` +
  `<line x1="22" y1="19" x2="20" y2="25" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round"/>` +
  `<line x1="13" y1="22" x2="11" y2="28" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round"/>` +
  `<line x1="19" y1="22" x2="17" y2="28" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round"/>`,
);

/** Snow / Winter — cloud with snowflakes */
export const svgWeatherSnow = weatherSvg(
  `<ellipse cx="16" cy="11" rx="10" ry="6" fill="#94a3b8" stroke="#64748b" stroke-width="1"/>` +
  `<ellipse cx="12" cy="10" rx="6" ry="5" fill="#cbd5e1"/>` +
  `<circle cx="10" cy="21" r="1.5" fill="#e2e8f0"/>` +
  `<circle cx="16" cy="23" r="1.5" fill="#e2e8f0"/>` +
  `<circle cx="22" cy="21" r="1.5" fill="#e2e8f0"/>` +
  `<circle cx="13" cy="27" r="1.5" fill="#e2e8f0"/>` +
  `<circle cx="19" cy="27" r="1.5" fill="#e2e8f0"/>`,
);

/** Tornado / Funnel — spinning funnel shape */
export const svgWeatherTornado = weatherSvg(
  `<ellipse cx="16" cy="6" rx="10" ry="4" fill="#64748b" stroke="#334155" stroke-width="1"/>` +
  `<path d="M8,8 Q10,14 13,18 Q14,22 15,28" fill="none" stroke="#94a3b8" stroke-width="3" stroke-linecap="round"/>` +
  `<path d="M24,8 Q22,14 19,18 Q18,22 17,28" fill="none" stroke="#94a3b8" stroke-width="3" stroke-linecap="round"/>` +
  `<ellipse cx="16" cy="28" rx="2" ry="1" fill="#78716c"/>`,
);

/** Wind — wavy lines */
export const svgWeatherWind = weatherSvg(
  `<path d="M4,10 Q8,6 12,10 Q16,14 20,10 Q24,6 28,10" fill="none" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>` +
  `<path d="M4,17 Q8,13 12,17 Q16,21 20,17 Q24,13 28,17" fill="none" stroke="#cbd5e1" stroke-width="2" stroke-linecap="round"/>` +
  `<path d="M6,24 Q10,20 14,24 Q18,28 22,24 Q26,20 30,24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round"/>`,
);

/** Flood — water waves */
export const svgWeatherFlood = weatherSvg(
  `<ellipse cx="16" cy="10" rx="10" ry="5" fill="#64748b" stroke="#334155" stroke-width="1"/>` +
  `<path d="M2,20 Q6,16 10,20 Q14,24 18,20 Q22,16 26,20 Q30,24 34,20" fill="none" stroke="#3b82f6" stroke-width="2"/>` +
  `<path d="M0,26 Q4,22 8,26 Q12,30 16,26 Q20,22 24,26 Q28,30 32,26" fill="none" stroke="#2563eb" stroke-width="2"/>`,
);

/** Heat — sun with radiating lines */
export const svgWeatherHeat = weatherSvg(
  `<circle cx="16" cy="16" r="6" fill="#f59e0b" stroke="#d97706" stroke-width="1"/>` +
  `<line x1="16" y1="4" x2="16" y2="8" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="16" y1="24" x2="16" y2="28" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="4" y1="16" x2="8" y2="16" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="24" y1="16" x2="28" y2="16" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="7.5" y1="7.5" x2="10.3" y2="10.3" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="21.7" y1="21.7" x2="24.5" y2="24.5" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="24.5" y1="7.5" x2="21.7" y2="10.3" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>` +
  `<line x1="10.3" y1="21.7" x2="7.5" y2="24.5" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/>`,
);

/** Fog — stacked horizontal lines */
export const svgWeatherFog = weatherSvg(
  `<line x1="4" y1="10" x2="28" y2="10" stroke="#94a3b8" stroke-width="2.5" stroke-linecap="round"/>` +
  `<line x1="6" y1="15" x2="26" y2="15" stroke="#cbd5e1" stroke-width="2.5" stroke-linecap="round"/>` +
  `<line x1="4" y1="20" x2="28" y2="20" stroke="#94a3b8" stroke-width="2.5" stroke-linecap="round"/>` +
  `<line x1="8" y1="25" x2="24" y2="25" stroke="#cbd5e1" stroke-width="2.5" stroke-linecap="round"/>`,
);

/** Generic weather alert — cloud with exclamation */
export const svgWeatherGeneric = weatherSvg(
  `<ellipse cx="16" cy="12" rx="10" ry="6" fill="#64748b" stroke="#334155" stroke-width="1"/>` +
  `<ellipse cx="12" cy="11" rx="6" ry="5" fill="#94a3b8"/>` +
  `<rect x="14.5" y="19" width="3" height="6" rx="1" fill="#f59e0b"/>` +
  `<circle cx="16" cy="28" r="1.8" fill="#f59e0b"/>`,
);

// ─── CrowdThreat Icons ───────────────────────────────────────────────────────
// Filled circle markers with inner symbol, matching CrowdThreat category colours.

function ctSvg(fill: string, inner: string): string {
  return `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">` +
    `<circle cx="12" cy="12" r="10" fill="${fill}" stroke="#0a0a0a" stroke-width="1.5"/>` +
    `<circle cx="12" cy="12" r="10" fill="none" stroke="${fill}" stroke-width="0.5" stroke-opacity="0.4"/>` +
    inner +
    `</svg>`
  )}`;
}

// Security & Conflict — red, crosshair
export const svgCtSecurity = ctSvg('#ef4444',
  `<circle cx="12" cy="12" r="3.5" fill="none" stroke="#fff" stroke-width="1.4"/>` +
  `<line x1="12" y1="5" x2="12" y2="8" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>` +
  `<line x1="12" y1="16" x2="12" y2="19" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>` +
  `<line x1="5" y1="12" x2="8" y2="12" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>` +
  `<line x1="16" y1="12" x2="19" y2="12" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>`
);

// Crime & Safety — blue, shield
export const svgCtCrime = ctSvg('#3b82f6',
  `<path d="M12 5.5L7.5 7.5V11.5C7.5 14.5 9.5 17 12 18C14.5 17 16.5 14.5 16.5 11.5V7.5L12 5.5Z" fill="none" stroke="#fff" stroke-width="1.3" stroke-linejoin="round"/>`
);

// Aviation — green, plane
export const svgCtAviation = ctSvg('#22c55e',
  `<path d="M16.5 13v-1l-4-2.5V6.25c0-.42-.34-.75-.75-.75s-.75.34-.75.75V9.5L7 12v1l4.25-1.25V15L10 16v.75L11.75 16 13.5 16.75V16L12.25 15V11.75L16.5 13z" fill="#fff"/>`
);

// Maritime — teal, anchor
export const svgCtMaritime = ctSvg('#14b8a6',
  `<circle cx="12" cy="8" r="1.5" fill="none" stroke="#fff" stroke-width="1.2"/>` +
  `<line x1="12" y1="9.5" x2="12" y2="17" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>` +
  `<path d="M8 15C8 17.2 9.8 19 12 19C14.2 19 16 17.2 16 15" fill="none" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>` +
  `<line x1="10" y1="12" x2="14" y2="12" stroke="#fff" stroke-width="1.2" stroke-linecap="round"/>`
);

// Industrial & Infrastructure — orange, bolt
export const svgCtInfrastructure = ctSvg('#f97316',
  `<path d="M13 5.5L8 13h4l-.5 5.5L17 11h-4l.5-5.5z" fill="#fff" stroke="none"/>`
);

// Special Threats — purple, warning triangle
export const svgCtSpecial = ctSvg('#a855f7',
  `<path d="M12 6L6.5 17h11L12 6z" fill="none" stroke="#fff" stroke-width="1.3" stroke-linejoin="round"/>` +
  `<line x1="12" y1="10" x2="12" y2="13.5" stroke="#fff" stroke-width="1.3" stroke-linecap="round"/>` +
  `<circle cx="12" cy="15.5" r="0.8" fill="#fff"/>`
);

// Social & Political — pink, people
export const svgCtSocial = ctSvg('#ec4899',
  `<circle cx="10" cy="9" r="2" fill="#fff"/>` +
  `<circle cx="14.5" cy="9" r="2" fill="#fff"/>` +
  `<path d="M6 16.5C6 14 7.8 13 10 13C11 13 11.8 13.3 12.2 13.7" fill="none" stroke="#fff" stroke-width="1.2"/>` +
  `<path d="M10.8 13.7C11.2 13.3 12 13 13 13C15.2 13 17 14 17 16.5" fill="none" stroke="#fff" stroke-width="1.2"/>`
);

// Other — gray, question mark
export const svgCtOther = ctSvg('#6b7280',
  `<text x="12" y="16" text-anchor="middle" fill="#fff" font-size="11" font-weight="bold" font-family="sans-serif">?</text>`
);

/** All CrowdThreat icon specs for preloading. */
export const CT_ICON_SPECS: { id: string; svg: string }[] = [
  { id: 'ct-security',       svg: svgCtSecurity },
  { id: 'ct-crime',          svg: svgCtCrime },
  { id: 'ct-aviation',       svg: svgCtAviation },
  { id: 'ct-maritime',       svg: svgCtMaritime },
  { id: 'ct-infrastructure', svg: svgCtInfrastructure },
  { id: 'ct-special',        svg: svgCtSpecial },
  { id: 'ct-social',         svg: svgCtSocial },
  { id: 'ct-other',          svg: svgCtOther },
];

/** Map event name keywords → weather icon ID */
export function weatherIconId(event: string): string {
  const e = event.toLowerCase();
  if (e.includes('tornado') || e.includes('funnel')) return 'wx-tornado';
  if (e.includes('thunder') || e.includes('lightning') || e.includes('tstm')) return 'wx-thunderstorm';
  if (e.includes('snow') || e.includes('blizzard') || e.includes('winter') || e.includes('ice') || e.includes('freezing') || e.includes('frost') || e.includes('sleet')) return 'wx-snow';
  if (e.includes('flood') || e.includes('surge') || e.includes('tsunami') || e.includes('coastal')) return 'wx-flood';
  if (e.includes('wind') || e.includes('gale') || e.includes('hurricane') || e.includes('tropical') || e.includes('typhoon')) return 'wx-wind';
  if (e.includes('heat') || e.includes('excessive') || e.includes('fire') || e.includes('red flag')) return 'wx-heat';
  if (e.includes('fog') || e.includes('dense') || e.includes('smoke') || e.includes('haze')) return 'wx-fog';
  if (e.includes('rain') || e.includes('shower') || e.includes('drizzle')) return 'wx-rain';
  return 'wx-generic';
}

/** All weather icon specs for preloading */
export const WEATHER_ICON_SPECS: { id: string; svg: string }[] = [
  { id: 'wx-thunderstorm', svg: svgWeatherThunderstorm },
  { id: 'wx-rain',         svg: svgWeatherRain },
  { id: 'wx-snow',         svg: svgWeatherSnow },
  { id: 'wx-tornado',      svg: svgWeatherTornado },
  { id: 'wx-wind',         svg: svgWeatherWind },
  { id: 'wx-flood',        svg: svgWeatherFlood },
  { id: 'wx-heat',         svg: svgWeatherHeat },
  { id: 'wx-fog',          svg: svgWeatherFog },
  { id: 'wx-generic',      svg: svgWeatherGeneric },
];
