/**
* SiboPay Food & Beverage Vector Icons (SVG)
* Iconografía vectorial fina, minimalista y elegante para productos escolares y soda
*/
(function (window) {
'use strict';
const FOOD_ICONS = {
'sandwich': {
label: 'Sandwich / Panini',
svg: ''
},
'croissant': {
label: 'Empanada / Repostería',
svg: ''
},
'utensils': {
label: 'Plato Fuerte / Almuerzo',
svg: ''
},
'cup-soda': {
label: 'Bebida / Fresco Natural',
svg: ''
},
'milk': {
label: 'Leche / Lácteos',
svg: ''
},
'coffee': {
label: 'Café / Infusión Caliente',
svg: ''
},
'apple': {
label: 'Fruta / Saludable',
svg: ''
},
'bowl': {
label: 'Bowl / Ensalada / Sopa',
svg: ''
},
'cookie': {
label: 'Galleta / Snack',
svg: ''
},
'pizza': {
label: 'Pizza / Taco / Rápida',
svg: ''
},
'meat': {
label: 'Carne / Pollo / Proteína',
svg: ''
},
'wheat': {
label: 'Cereal / Granola / Avena',
svg: ''
},
'ice-cream': {
label: 'Postre / Gelatina / Helado',
svg: ''
},
'store': {
label: 'Todos / Menú Completo',
svg: ''
}
};
// Mapeo automático de emojis antiguos a iconos SVG elegantes
const EMOJI_TO_KEY = {
'🥪': 'sandwich',
'🥟': 'croissant',
'🌮': 'pizza',
'🍳': 'utensils',
'🍗': 'meat',
'🍛': 'utensils',
'🍹': 'cup-soda',
'🥤': 'cup-soda',
'🧃': 'cup-soda',
'🥛': 'milk',
'🍉': 'apple',
'🥣': 'bowl',
'🌾': 'wheat',
'🍮': 'ice-cream',
'🍎': 'apple',
'🍕': 'pizza',
'🥗': 'bowl',
'🍪': 'cookie',
'🍽️': 'utensils',
'☕': 'coffee',
'🥩': 'meat',
'🍦': 'ice-cream',
'🥑': 'apple',
'🥐': 'croissant',
'🍞': 'sandwich',
'🍔': 'sandwich'
};
/**
* Resuelve el identificador de icono SVG a partir de una clave, emoji o nombre de producto
*/
function resolveIconKey(rawInput, fallbackName) {
if (!rawInput && !fallbackName) return 'sandwich';
const input = String(rawInput || '').trim();
// 1. Si coincide directamente con una clave conocida
if (FOOD_ICONS[input]) return input;
// 2. Si coincide con un emoji mapeado
if (EMOJI_TO_KEY[input]) return EMOJI_TO_KEY[input];
// 3. Analizar palabras clave en el nombre del producto
const text = (String(fallbackName || '') + ' ' + input).toLowerCase();
if (text.includes('empanada') || text.includes('pastel') || text.includes('reposter') || text.includes('croissant')) return 'croissant';
if (text.includes('sandwich') || text.includes('emparedado') || text.includes('pan') || text.includes('tostada')) return 'sandwich';
if (text.includes('fresco') || text.includes('jugo') || text.includes('te frio') || text.includes('té') || text.includes('gaseosa') || text.includes('bebida') || text.includes('refresco')) return 'cup-soda';
if (text.includes('leche') || text.includes('batido')) return 'milk';
if (text.includes('cafe') || text.includes('café') || text.includes('chocolate caliente')) return 'coffee';
if (text.includes('fruta') || text.includes('manzana') || text.includes('sandia') || text.includes('sandía') || text.includes('pina') || text.includes('piña')) return 'apple';
if (text.includes('ensalada') || text.includes('sopa') || text.includes('bowl') || text.includes('yogurt')) return 'bowl';
if (text.includes('pinto') || text.includes('casado') || text.includes('almuerzo') || text.includes('arroz') || text.includes('plato')) return 'utensils';
if (text.includes('pollo') || text.includes('carne') || text.includes('bistec') || text.includes('chuleta')) return 'meat';
if (text.includes('pizza') || text.includes('taco') || text.includes('wrap')) return 'pizza';
if (text.includes('galleta') || text.includes('snack') || text.includes('barra') || text.includes('cereal') || text.includes('avena')) return 'cookie';
if (text.includes('gelatina') || text.includes('helado') || text.includes('postre') || text.includes('flan')) return 'ice-cream';
return 'sandwich';
}
/**
* Retorna el SVG puro del icono
*/
function getFoodSvg(rawInput, fallbackName, size = 22) {
const key = resolveIconKey(rawInput, fallbackName);
const item = FOOD_ICONS[key] || FOOD_ICONS['sandwich'];
return item.svg.replace('