PageSourceSearch

https://www.svgai.org/_next/static/chunks/5252.aa0ce33a5b481019.js

js svgai.org collected 2026-10-04 08:38:00 UTC 2,804 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5252],{65252:(e,t,a)=>{a.d(t,{Ld:()=>r,e8:()=>o,prepareImageFileForFunction:()=>m,vO:()=>l});let r=28e5,i={"image/png":"png","image/jpeg":"jpg","image/webp":"webp"};function n(e){let t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,(.+)$/);if(!t)return null;let a=t[2].replace(/\s/g,"");return{mimeType:t[1].toLowerCase(),base64:a,byteSize:o(a)}}function o(e){let t=e.replace(/\s/g,""),a=t.endsWith("==")?2:+!!t.endsWith("=");return Math.max(0,Math.floor(3*t.length/4)-a)}function l(){return"That image is too large to upload. Try a smaller file or lower-resolution image."}async function m(e,t={}){return g(await p(e),{filename:e.name,...t})}async function g(e,t={}){var a,i;let o=t.maxBytes??r,m=t.maxDimension??1600,s=t.filename||"image.png",d=n(e);if(!t.forceReencode&&d&&d.byteSize<=o&&("image/png"===(a=d.mimeType)||"image/jpeg"===a||"image/webp"===a)){let t=function(e,t){let a=n(e);if(!a)throw Error("Invalid image data");let r=atob(a.base64),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return new Blob([i],{type:t})}(e,d.mimeType);return f(e,d.mimeType,t,s)}let c=await (i=e,new Promise((e,t)=>{let a=new Image;a.onload=()=>e(a),a.onerror=()=>t(Error("Failed to load image")),a.src=i})),h=(t.preferredMimeTypes||["image/webp","image/jpeg","image/png"]).filter(u);h.includes("image/png")||h.push("image/png");let w=Math.min(1,m/Math.max(c.naturalWidth,c.naturalHeight)),b=null;for(let e=0;e<7;e++){let e=Math.max(256,Math.round(c.naturalWidth*w)),t=Math.max(256,Math.round(c.naturalHeight*w));for(let a of h)for(let r of"image/png"===a?[void 0]:[.9,.82,.74,.66,.58]){let i=await function(e,t,a,r,i){return new Promise((n,o)=>{let l=document.createElement("canvas");l.width=t,l.height=a;let m=l.getContext("2d");if(!m)return void o(Error("Failed to process image"));"image/jpeg"===r&&(m.fillStyle="#ffffff",m.fillRect(0,0,t,a)),m.drawImage(e,0,0,t,a),l.toBlob(e=>{e?n(e):o(Error("Failed to compress image"))},r,i)})}(c,e,t,a,r);if((!b||i.size<b.blob.size)&&(b={blob:i,mimeType:i.type||a}),i.size<=o)return f(await p(i),i.type||a,i,s)}w*=.82}if(b&&b.blob.size<=Math.ceil(1.1*o))return f(await p(b.blob),b.mimeType,b.blob,s);throw Error(l())}function u(e){if("undefined"==typeof document)return"image/png"===e;let t=document.createElement("canvas");return t.width=1,t.height=1,t.toDataURL(e).startsWith(`data:${e}`)}function p(e){return new Promise((t,a)=>{let r=new FileReader;r.onloadend=()=>t(String(r.result||"")),r.onerror=a,r.readAsDataURL(e)})}function f(e,t,a,r){let o=n(e);if(!o)throw Error("Invalid image data");let l=i[t]||"png",m=r.replace(/\.[^/.]+$/,"")||"image",g=new File([a],`${m}.${l}`,{type:t});return{dataUrl:e,base64:o.base64,mimeType:t,byteSize:o.byteSize,blob:a,file:g}}}}]);

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.