1import{Mc as e,ml as t,vc as n}from"./index-D0ElCQXL.js";var r=0,i=1,a=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;function o(e,t,i){let{svgData:o}=e;if(!o)return``;let s=n(t,i);if(o.includes(`fill`))return o.replace(a,()=>s);let c=o.indexOf(`>`);return`${o.substring(r,c)} fill="${s}"${o.substring(c)}`}async function s(n){return new Promise(r=>{n.loading=!0;let i=new Image;n.element=i,i.addEventListener(`load`,()=>{n.loading=!1,r()}),i.addEventListener(`error`,()=>{n.element=void 0,n.error=!0,n.loading=!1,e().error(`${t} loading image: ${n.source}`),r()}),i.src=n.source})}async function c(n){if(n.type!==`svg`){await s(n);return}n.loading=!0;let r=await fetch(n.source);r.ok?n.svgData=await r.text():(e().error(`${t} Image not found`),n.error=!0),n.loading=!1}function l(e,t,n,r){let a=o(e,n,r.opacity?.value??i),c={color:n,gif:t.gif,data:{...e,svgData:a},loaded:!1,ratio:t.width/t.height,replaceColor:t.replaceColor,source:t.src};return new Promise(t=>{let n=new Blob([a],{type:`image/svg+xml`}),r=URL||window.URL||window.webkitURL||window,i=r.createObjectURL(n),o=new Image;o.addEventListener(`load`,()=>{c.loaded=!0,c.element=o,t(c),r.revokeObjectURL(i)});let l=async()=>{r.revokeObjectURL(i);let n={...e,error:!1,loading:!0};await s(n),c.loaded=!0,c.element=n.element,t(c)};o.addEventListener(`error`,()=>void l()),o.src=i})}export{c as downloadSvgImage,s as loadImage,l as replaceImageColor};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.