PageSourceSearch

https://www.svgai.org/_next/static/chunks/919.3d81c59ed694e057.js

js svgai.org collected 2026-10-04 08:37:02 UTC 10,787 bytes, 70 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[919],{10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>a,OD:()=>i,pc:()=>n,zx:()=>o});class s 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 i extends s{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class o extends s{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class a extends s{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 n extends s{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 s)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."}},20919:(e,t,r)=>{r.d(t,{svgToEpsHandler:()=>a});var s=r(90816),i=r(10651);class o extends s.I{async performConversion(e,t){try{let r=e.toString("utf8").trim();if(!r.includes("<svg")&&!r.includes("<?xml"))throw new i.pc("Invalid SVG: Missing SVG tag");let s=this.parseSVG(r);this.reportProgress(t,.5);let o=this.generateEPS(s,t);return this.reportProgress(t,.9),this.createSuccessResult(o,"application/postscript",{width:s.width,height:s.height,elementCount:s.elements.length})}catch(e){if(e instanceof i.pc)throw e;throw new i.zx(`Failed to convert SVG to EPS: ${e instanceof Error?e.message:"Unknown error"}`,"SVG_TO_EPS_FAILED")}}parseSVG(e){let t=e.match(/viewBox="([^"]+)"/),r=e.match(/width="([^"]+)"/),s=e.match(/height="([^"]+)"/),i=100,o=100,a="0 0 100 100";if(t){let e=(a=t[1]).split(/\s+/).map(Number);i=e[2]-e[0],o=e[3]-e[1]}return r&&(i=this.parseUnit(r[1])),s&&(o=this.parseUnit(s[1])),{width:i,height:o,viewBox:a,elements:this.parseSVGElements(e)}}parseSVGElements(e){let t=[];for(let r of Array.from(e.matchAll(/<path[^>]*d="([^"]+)"[^>]*>/g))){let e=this.parseAttributes(r[0]);t.push({type:"path",d:r[1],fill:e.fill||"black",stroke:e.stroke||"none",strokeWidth:e["stroke-width"]||"1",transform:e.transform||""})}for(let r of Array.from(e.matchAll(/<rect[^>]*>/g))){let e=this.parseAttributes(r[0]);t.push({type:"rect",x:parseFloat(e.x||"0"),y:parseFloat(e.y||"0"),width:parseFloat(e.width||"0"),height:parseFloat(e.height||"0"),fill:e.fill||"black",stroke:e.stroke||"none",strokeWidth:e["stroke-width"]||"1",transform:e.transform||""})}for(let r of Array.from(e.matchAll(/<circle[^>]*>/g))){let e=this.parseAttributes(r[0]);t.push({type:"circle",cx:parseFloat(e.cx||"0"),cy:parseFloat(e.cy||"0"),r:parseFloat(e.r||"0"),fill:e.fill||"black",stroke:e.stroke||"none",strokeWidth:e["stroke-width"]||"1",transform:e.transform||""})}for(let r of Array.from(e.matchAll(/<text[^>]*>([^<]*)<\/text>/g))){let e=this.parseAttributes(r[0]);t.push({type:"text",x:parseFloat(e.x||"0"),y:parseFloat(e.y||"0"),text:r[1],fontSize:e["font-size"]||"12",fontFamily:e["font-family"]||"Helvetica",fill:e.fill||"black",transform:e.transform||""})}return t}parseAttributes(e){let t={};for(let r of Array.from(e.matchAll(/(\w+(?:-\w+)?)="([^"]+)"/g)))t[r[1]]=r[2];return t}parseUnit(e){let t=parseFloat(e);return e.endsWith("px")?t:e.endsWith("pt")?1.25*t:e.endsWith("mm")?3.543307*t:e.endsWith("cm")?35.43307*t:e.endsWith("in")?90*t:t}generateEPS(e,t){let r=t.psLevel||3,s=new Date().toISOString(),i=`%!PS-Adobe-3.0 EPSF-3.0
2%%Creator: SVG to EPS Converter
3%%Title: Converted SVG
4%%CreationDate: ${s}
5%%BoundingBox: 0 0 ${Math.ceil(e.width)} ${Math.ceil(e.height)}
6%%LanguageLevel: ${r}
7%%Pages: 1
8%%EndComments
9
10%%BeginProlog
11% Define procedures for SVG-like operations
12/m {moveto} def
13/l {lineto} def
14/c {curveto} def
15/cp {closepath} def
16/f {fill} def
17/s {stroke} def
18/gs {gsave} def
19/gr {grestore} def
20/rgb {setrgbcolor} def
21/w {setlinewidth} def
22/sf {selectfont} def
23
24% SVG path command procedures
25/M {moveto} def
26/L {lineto} def
27/C {curveto} def
28/Z {closepath} def
29/H {exch dup 3 1 roll exch lineto} def
30/V {exch dup 3 1 roll lineto} def
31%%EndProlog
32
33%%Page: 1 1
34gsave
35
36% Set coordinate system (flip Y axis for SVG compatibility)
370 ${e.height} translate
381 -1 scale
39
40`;for(let t of e.elements)i+=this.elementToPS(t,e.height)+"\n";return i+`
41grestore
42showpage
43%%EOF`}elementToPS(e,t){let r="gsave\n";e.transform&&(r+=this.transformToPS(e.transform)+"\n");let s=this.colorToPS(e.fill||"black"),i=this.colorToPS(e.stroke||"none");switch(e.type){case"path":r+=this.pathToPS(e.d,s,i,e.strokeWidth||"1");break;
43case"rect":r+=`${s}
44`,r+=`${e.x} ${e.y} ${e.width} ${e.height} rectfill
45`,"none"!==e.stroke&&(r+=`${i}
46`,r+=`${e.strokeWidth} w
47`,r+=`${e.x} ${e.y} ${e.width} ${e.height} rectstroke
48`);break;case"circle":r+=`newpath
49`,r+=`${e.cx} ${e.cy} ${e.r} 0 360 arc
50`,"none"!==e.fill&&(r+=`${s}
51`,r+=`fill
52`),"none"!==e.stroke&&(r+=`${i}
53`,r+=`${e.strokeWidth} w
54`,r+=`stroke
55`);break;case"text":r+=`${s}
56`,r+=`/${e.fontFamily||"Helvetica"} findfont
57`,r+=`${e.fontSize||"12"} scalefont setfont
58`,r+=`${e.x} ${e.y} moveto
59`,r+=`(${this.escapePS(e.text||"")}) show
60`}return r+"grestore"}pathToPS(e,t,r,s){let i="newpath\n";for(let t of e.match(/[MmLlHhVvCcSsQqTtAaZz][^MmLlHhVvCcSsQqTtAaZz]*/g)||[]){let e=t[0],r=t.slice(1).trim().split(/[\s,]+/).map(Number);switch(e.toUpperCase()){case"M":i+=`${r[0]} ${r[1]} m
61`;break;case"L":i+=`${r[0]} ${r[1]} l
62`;break;case"H":i+=`${r[0]} currentpoint exch pop l
63`;break;case"V":i+=`currentpoint pop ${r[0]} l
64`;break;case"C":i+=`${r[0]} ${r[1]} ${r[2]} ${r[3]} ${r[4]} ${r[5]} c
65`;break;case"Z":i+="cp\n"}}return"none"!==t&&(i+=`${t}
66f
67`),"none"!==r&&(i+=`${r}
68${s} w
69s
70`),i}colorToPS(e){if("none"===e||"transparent"===e)return"";if(e.startsWith("#")){let t=e.slice(1),r=parseInt(t.slice(0,2),16)/255,s=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255;return`${r} ${s} ${i} rgb`}let t={black:[0,0,0],white:[1,1,1],red:[1,0,0],green:[0,1,0],blue:[0,0,1],yellow:[1,1,0],cyan:[0,1,1],magenta:[1,0,1]};if(t[e]){let[r,s,i]=t[e];return`${r} ${s} ${i} rgb`}return"0 0 0 rgb"}transformToPS(e){if(e.includes("translate")){let t=e.match(/translate\(([^)]+)\)/);if(t){let[e,r="0"]=t[1].split(/[\s,]+/);return`${e} ${r} translate`}}if(e.includes("scale")){let t=e.match(/scale\(([^)]+)\)/);if(t){let[e,r=e]=t[1].split(/[\s,]+/);return`${e} ${r} scale`}}if(e.includes("rotate")){let t=e.match(/rotate\(([^)]+)\)/);if(t){let e=parseFloat(t[1]);return`${e} rotate`}}return""}escapePS(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")}constructor(...e){super(...e),this.name="SVG to EPS",this.from="svg",this.to="eps",this.description="Convert SVG files to Encapsulated PostScript format for print and design workflows"}}let a=new o().handler},90816:(e,t,r)=>{r.d(t,{I:()=>a,k:()=>n});var s=r(10651),i=r(119),o=r(44134).Buffer;class a{get handler(){return this.handleConversion.bind(this)}async handleConversion(e,t={}){let r;try{let s=this.normalizeInput(e);r=s.length,Date.now(),await this.trackConversionStart(r,t),await this.validateInput(s,t),this.reportProgress(t,.1),await this.trackConversionProgress(.1);let i=await this.performConversion(s,t);return this.reportProgress(t,1),await this.trackConversionProgress(1),await this.trackConversionComplete(!0,i,void 0,r),i}catch(e){if(await this.trackConversionComplete(!1,null,e,r),e instanceof s.zx||e instanceof s.OD)throw e;throw new s.zx((0,s.JX)(e),`${this.from.toUpperCase()}_TO_${this.to.toUpperCase()}_FAILED`)}}normalizeInput(e){return"string"==typeof e?o.from(e,"base64"):e}async validateInput(e,t){let r=(0,i.nJ)(e,{allowedFormats:[this.from],targetFormat:this.to});if(!r.isValid)throw new s.OD(r.error);let o=(0,i.XN)(this.from,this.to);if(!o.supported)throw new s.zx(o.reason,"UNSUPPORTED_CONVERSION");let a=(0,i.Ln)(t,this.from,this.to);if(!a.isValid)throw new s.zx(a.error,"INVALID_PARAMETERS")}reportProgress(e,t){if(e.onProgress&&"function"==typeof e.onProgress)try{e.onProgress(Math.min(1,Math.max(0,t)))}catch(e){}}async trackConversionStart(e,t){try{let{trackConversionStart:s}=await r.e(5804).then(r.bind(r,45804));s(this.name,this.from,this.to,e,t)}catch{}}async trackConversionProgress(e){try{let{trackConversionProgress:t}=await r.e(5804).then(r.bind(r,45804));t(this.name,this.from,this.to,e)}catch{}}async trackConversionComplete(e,t,s,i){try{let{trackConversionComplete:i}=await r.e(5804).then(r.bind(r,45804));i(this.name,this.from,this.to,e,t,s)}catch{}}async trackLibraryLoad(e,t,s,i){try{let{trackLibraryLoad:o}=await r.e(5804).then(r.bind(r,45804));o(this.name,e,t,s,i)}catch{}}createSuccessResult(e,t,r){return{success:!0,data:e,mimeType:t,metadata:{format:this.to,size:"string"==typeof e?o.byteLength(e,"utf8"):e.length,...r}}}getOutputMimeType(){return({png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",svg:"image/svg+xml",pdf:"application/pdf",ico:"image/x-icon",tiff:"image/tiff",eps:"application/postscript",ai:"application/illustrator",dxf:"application/dxf",stl:"model/stl",avif:"image/avif",cdr:"application/x-coreldraw",mp4:"video/mp4",html:"text/html",ttf:"font/ttf",emf:"image/x-emf",wmf:"image/x-wmf",image:"application/octet-stream"})[this.to]||"application/octet-stream"}constructor(){this.isClientSide=!0,this.isPremium=!1}}class n extends a{async ensureLibrariesLoaded(){if(this.libraryLoaded)return;if(this.loadingPromise)return void await this.loadingPromise;let e=Date.now();this.loadingPromise=this.loadLibraries().then(async()=>{this.libraryLoaded=!0;let t=Date.now()-e;await this.trackLibraryLoad("main",t,!0)}).catch(async t=>{this.loadingPromise=null;let r=Date.now()-e;throw await this.trackLibraryLoad("main",r,!1,t.message),new s.zx(`Failed to load required libraries for ${this.name}: ${t.message}`,"LIBRARY_LOAD_FAILED")}),await this.loadingPromise}async performConversion(e,t){await this.ensureLibrariesLoaded(),this.reportProgress(t,.3),await this.trackConversionProgress(.3);let r=await this.performConversionWithLibraries(e,t);return this.reportProgress(t,.9),await this.trackConversionProgress(.9),r}constructor(...e){super(...e),this.libraryLoaded=!1,this.loadingPromise=null}}}}]);

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.