PageSourceSearch

https://www.svgai.org/_next/static/chunks/3503.4d938f10da25b440.js

js svgai.org collected 2026-10-04 08:37:42 UTC 2,134 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3503],{33503:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s,svgToJpgBrowserHandler:()=>a});var n=r(10651),o=r(44134).Buffer;let a=async(e,t={})=>{try{let r=function(e){if("string"==typeof e){let t=e.trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}let t=o.from(e).toString("utf-8").trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}(e);t.onProgress&&t.onProgress(.1);let a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if("parsererror"===a.tagName)throw new n.OD("Invalid SVG: Parse error");let s=t.width||parseInt(a.getAttribute("width")||"0"),i=t.height||parseInt(a.getAttribute("height")||"0");if(!s||!i){let e=a.getAttribute("viewBox");if(e){let[,,t,r]=e.split(" ").map(Number);s=s||t,i=i||r}}s&&i||(s=s||800,i=i||600),t.onProgress&&t.onProgress(.3);let l=document.createElement("canvas");l.width=s,l.height=i;let g=l.getContext("2d");if(!g)throw new n.zx("Failed to create canvas context");let c=t.background||"#ffffff";g.fillStyle=c,g.fillRect(0,0,s,i),t.onProgress&&t.onProgress(.5);let f=new Blob([r],{type:"image/svg+xml;charset=utf-8"}),m=URL.createObjectURL(f);return new Promise((e,r)=>{let a=new Image;a.onload=async()=>{try{g.drawImage(a,0,0,s,i),t.onProgress&&t.onProgress(.8);let f=Math.min(100,Math.max(0,t.quality??85))/100;l.toBlob(a=>{if(URL.revokeObjectURL(m),!a)return void r(new n.zx("Failed to convert canvas to blob"));t.onProgress&&t.onProgress(1),a.arrayBuffer().then(r=>{let n=o.from(r);e({success:!0,data:n,mimeType:"image/jpeg",metadata:{width:s,height:i,format:"jpg",size:n.length,originalFormat:"svg",background:c,quality:t.quality??85}})}).catch(r)},"image/jpeg",f)}catch(e){URL.revokeObjectURL(m),r(e)}},a.onerror=()=>{URL.revokeObjectURL(m),r(new n.zx("Failed to load SVG image"))},a.crossOrigin="anonymous",a.src=m})}catch(e){if(e instanceof n.zx||e instanceof n.OD||e instanceof n.N$)throw e;throw new n.zx(`SVG to JPG conversion failed: ${e instanceof Error?e.message:"Unknown error"}`)}},s=a}}]);

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.