${function(){
const remove_variant_images_on = false;
let product_swatches_name = [];
product_swatches_name = product_swatches_name.map((name) => name.toLowerCase());
const variantsNamesSet = new Set(data.options.map((opt) => opt.name.toLowerCase()) || []);
const containsSwatches = product_swatches_name.some((name) => variantsNamesSet.has(name));
const mouseoutevent = data.options.map((opt) => `@${opt.name}Mouseout="qv-selected-render-${opt.name}.rerender(data=event,redo=true);"`).join(' ');
const mouseoverevent = data.options.map((opt) => `@${opt.name}Mouseover="qv-selected-render-${opt.name}.rerender(data=event,redo=true);"`).join(' ');
const variants = data?.variants?.map((item) => item.image.path) || [];
const productData = data;
let images = data.images;
if(remove_variant_images_on && containsSwatches) {
images = data.images.filter((img) => !variants.includes(img.path));
}
const selectedVariant = data.variants.find(v => v.available) || data.variants[0];
const selectedIndex = !!selectedVariant ? images.findIndex(img => img.src === (selectedVariant.image && selectedVariant.image.src)) : 0;
const initialSlide = selectedIndex === -1 ? 0 : selectedIndex;
return `
${images.map((image, index) => `
`).join('')}
${images.map(image => `
`).join('')}
${images.length > 1 ? `
` : ''}
`
}()}