// --- "passport stamps" icon set --------------------------------------------- // Curated set of simple outline icons (lucide-style: 24x24 viewBox, // stroke-based, no fill) representing generic "places" - the centerpiece of // each passport stamp badge (see Stamp.svelte). `paths` is the inner SVG // markup, dropped directly into Stamp.svelte's wrapper via {@html}. export const STAMP_ICONS = [ { id: 'mountain', paths: '' }, { id: 'building', paths: '' }, { id: 'tree', paths: '' }, { id: 'wave', paths: '' }, { id: 'star', paths: '' }, { id: 'leaf', paths: '' }, { id: 'sun', paths: '' }, { id: 'moon', paths: '' }, { id: 'landmark', paths: '' }, { id: 'compass', paths: '' } ]; // Deterministic string hash (DJB2 variant) - the same input string always // produces the same number, which is what lets the same place always pick // the same icon (see pickStampIcon below). function hashString(str) { let hash = 5381; for (let i = 0; i < str.length; i++) { hash = (hash * 33) ^ str.charCodeAt(i); } return Math.abs(hash); } // Picks an icon for a place deterministically: "City, Country" always maps // to the same icon, so earning a stamp for the same city twice (hypothetically) // would always show the same icon - without needing to store any extra // city->icon mapping. export function pickStampIcon(city, country) { const index = hashString(`${city}, ${country}`) % STAMP_ICONS.length; return STAMP_ICONS[index]; }