PageSourceSearch

https://www.svgai.org/_next/static/chunks/3081.4db5a590d639dd44.js

js svgai.org collected 2026-10-04 08:37:35 UTC 3,909 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3081],{10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>a,OD:()=>o,pc:()=>i,zx:()=>s});class n extends Error{constructor(e,t,r=400){super(e),this.name=this.constructor.name,this.code=t,this.statusCode=r,Object.setPrototypeOf(this,new.target.prototype)}}class o extends n{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class s extends n{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class a extends n{constructor(e,t,r){super(r||(e?`Format '${e}' is not supported`:"Unsupported file format"),"UNSUPPORTED_FORMAT",400),this.format=e,this.supportedFormats=t}}class i extends n{constructor(e,t){super(e?`The ${e.toUpperCase()} file appears to be corrupted or invalid. ${t||"Please try with a different file."}`:`The file appears to be corrupted or invalid. ${t||"Please try with a different file."}`,"CORRUPTED_FILE",400)}}let l={NETWORK_ERROR:"Network error occurred during conversion",TIMEOUT:"Conversion timed out. Please try with a smaller file",ENCODING_ERROR:"Unable to process the file encoding. Please ensure the file is not corrupted."};function c(e){if(e instanceof n)return e.message;if(e instanceof Error){let t=e.message.toLowerCase();return t.includes("memory")||t.includes("heap")?"The file is too large to process. Please try with a smaller file or reduce its dimensions.":t.includes("timeout")?l.TIMEOUT:t.includes("network")||t.includes("fetch")?l.NETWORK_ERROR:t.includes("encoding")||t.includes("decode")?l.ENCODING_ERROR:e.message}return"An unexpected error occurred. Please try again."}},73081:(e,t,r)=>{r.d(t,{svgToWebpHandler:()=>s});var n=r(10651),o=r(44134).Buffer;let s=async(e,t={})=>{try{!function(e){let t=("string"==typeof e?e:e.toString("utf8")).trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.N$("unknown",["svg"],"Input does not appear to be a valid SVG file")}(e),t.onProgress&&t.onProgress(.1);let r="string"==typeof e?e:e.toString("utf8"),o=function(e){return e.startsWith("<?xml")||(e='<?xml version="1.0" encoding="UTF-8"?>\n'+e),e.includes("xmlns=")||(e=e.replace("<svg",'<svg xmlns="http://www.w3.org/2000/svg"')),e}(r);t.onProgress&&t.onProgress(.3);let s=await a(o,t);return t.onProgress&&t.onProgress(1),{success:!0,data:s,mimeType:"image/webp",metadata:{size:s.length,format:"webp",method:"canvas-api",quality:t.quality??85}}}catch(e){if(e instanceof n.N$||e instanceof n.zx)throw e;if(e instanceof Error)throw new n.zx(`SVG to WebP conversion failed: ${e.message}`,"SVG_TO_WEBP_FAILED");throw new n.zx("An unexpected error occurred during SVG to WebP conversion","SVG_TO_WEBP_UNKNOWN_ERROR")}};async function a(e,t={}){return new Promise((r,s)=>{try{let a=new Image,i=document.createElement("canvas"),l=i.getContext("2d");a.onload=()=>{try{let e=t.width||a.naturalWidth||300,c=t.height||a.naturalHeight||300;if(i.width=e,i.height=c,t.background&&!t.background.toLowerCase().includes("transparent")&&(l.fillStyle=t.background,l.fillRect(0,0,e,c)),!1!==t.preserveAspectRatio){let t=Math.min(e/a.naturalWidth,c/a.naturalHeight),r=a.naturalWidth*t,n=a.naturalHeight*t,o=(e-r)/2,s=(c-n)/2;l.drawImage(a,o,s,r,n)}else l.drawImage(a,0,0,e,c);i.toBlob(e=>{if(!e)return void s(new n.zx("Failed to create WebP blob","WEBP_CREATION_FAILED"));let t=new FileReader;t.onload=()=>{let e=t.result,n=o.from(e);r(n)},t.onerror=()=>{s(new n.zx("Failed to read WebP blob","WEBP_READ_FAILED"))},t.readAsArrayBuffer(e)},"image/webp",(t.quality??85)/100)}catch(t){let e=t instanceof Error?t.message:"Unknown error";s(new n.zx(`Canvas drawing failed: ${e}`,"CANVAS_ERROR"))}},a.onerror=()=>{s(new n.zx("Failed to load SVG image","SVG_LOAD_FAILED"))};let c=new Blob([e],{type:"image/svg+xml"}),u=URL.createObjectURL(c);a.src=u,setTimeout(()=>URL.revokeObjectURL(u),1e4)}catch(t){let e=t instanceof Error?t.message:"Unknown error";s(new n.zx(`SVG to WebP setup failed: ${e}`,"SETUP_ERROR"))}})}}}]);

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.