{#if show}
{ e.stopImmediatePropagation(); e.preventDefault(); show = false; }} on:click={(e) => { show = false; }} >
{ if (src.startsWith('data:image/')) { const base64Data = src.split(',')[1]; const blob = new Blob([Uint8Array.from(atob(base64Data), (c) => c.charCodeAt(0))], { type: 'image/png' }); saveAs(blob, alt || 'download.png'); return; } else if (src.startsWith('blob:')) { // Handle blob URLs fetch(src) .then((response) => response.blob()) .then((blob) => { saveAs(blob, alt || 'download.png'); }) .catch((error) => { console.error('Error downloading blob:', error); }); return; } else if (src.startsWith('http://') || src.startsWith('https://')) { // Handle remote URLs fetch(src) .then((response) => response.blob()) .then((blob) => { saveAs(blob, alt || 'download.png'); }) .catch((error) => { console.error('Error downloading remote image:', error); }); return; } }} >
{/if}