PageSourceSearch

https://www.svgai.org/_next/static/chunks/9829.4e5b94fe410e5815.js

js svgai.org collected 2026-10-04 08:38:46 UTC 5,921 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9829],{10651:(e,t,r)=>{r.d(t,{JX:()=>u,N$:()=>i,OD:()=>a,pc:()=>n,zx:()=>s});class o 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 a extends o{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class s extends o{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class i extends o{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 o{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 u(e){if(e instanceof o)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."}},99829:(e,t,r)=>{r.d(t,{svgToAiHandler:()=>u});var o=r(10651),a=r(119),s=r(44134).Buffer;let i=new Set(["svg","g","defs","path","rect","circle","ellipse","line","polyline","polygon","clippath","lineargradient","radialgradient","stop","pattern","marker","symbol","use","style","title","desc","metadata"]);function n(e){return Array.from(e.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/gi)).some(e=>!e[2].trim().startsWith("#"))}function l(e){if(!e)return;let t=e.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|q)?$/i);if(t)return Number(t[1])*({px:1,pt:96/72,pc:16,in:96,cm:96/2.54,mm:96/25.4,q:96/101.6})[(t[2]||"px").toLowerCase()]}let u=async(e,t={})=>{let u="string"==typeof e?s.from(e,"utf8"):e,c=(0,a.nJ)(u,{allowedFormats:["svg"],targetFormat:"ai"});if(!c.isValid)throw new o.OD(c.error);if("undefined"==typeof DOMParser||"undefined"==typeof document)throw new o.zx("SVG to AI conversion requires a browser. Open the SVG to AI converter to export your artwork.","BROWSER_REQUIRED");if(t.preserveLayers||t.includeAiMetadata||t.aiVersion)throw new o.zx("Native Illustrator layers, metadata, and version targeting are not supported. Open the original SVG in Illustrator and save it as AI for those features.","SVG_TO_AI_NATIVE_OPTIONS_UNSUPPORTED");t.onProgress?.(.1);let p=function(e){let t=new DOMParser().parseFromString(e,"image/svg+xml"),r=t.documentElement;if(t.querySelector("parsererror")||"svg"!==r.localName||"http://www.w3.org/2000/svg"!==r.namespaceURI)throw new o.OD("Invalid SVG: upload a complete SVG document with the SVG namespace.");for(let e of[r,...Array.from(r.querySelectorAll("*"))]){if(e.closest("metadata"))continue;let t=e.localName.toLowerCase();if(!i.has(t)){let r="text"===t||"tspan"===t?"Convert text to outlines in your vector editor first.":"Open the original SVG in Illustrator to preserve these features.";throw new o.zx(`SVG to AI cannot preserve <${e.localName}> elements. ${r}`,"SVG_TO_AI_UNSUPPORTED_FEATURE")}for(let t of Array.from(e.attributes)){if(/^on/i.test(t.name)||/^(filter|mask)$/i.test(t.localName))throw new o.zx(`SVG to AI does not support ${t.name}. Open the original SVG in Illustrator.`,"SVG_TO_AI_UNSUPPORTED_FEATURE");if("href"===t.localName&&!t.value.startsWith("#")||n(t.value))throw new o.zx("SVG to AI requires self-contained SVG artwork. External references are not supported.","SVG_TO_AI_EXTERNAL_RESOURCE")}}let a=[...Array.from(r.querySelectorAll("style")).map(e=>e.textContent||""),...Array.from(r.querySelectorAll("[style]")).map(e=>e.getAttribute("style")||"")].join("\n");if(/@import|@font-face|\b(filter|mask|mix-blend-mode|animation)\s*:/i.test(a)||n(a))throw new o.zx("SVG to AI does not support external styles, fonts, filters, masks, or animation. Open the original SVG in Illustrator.","SVG_TO_AI_UNSUPPORTED_FEATURE");return r}(u.toString("utf8")),d=function(e,t){let r=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number),a=r?.length===4&&r.every(Number.isFinite)&&r[2]>0&&r[3]>0,s=t.artboard?.width??t.width??l(e.getAttribute("width"))??(a?r[2]:300),i=t.artboard?.height??t.height??l(e.getAttribute("height"))??(a?r[3]:150);if(!Number.isFinite(s)||!Number.isFinite(i)||s<=0||i<=0||.75*s>14400||.75*i>14400)throw new o.OD("SVG dimensions must be positive and no larger than 19,200 pixels per side for this PDF-compatible export.");return{width:s,height:i}}(p,t),m=.75*d.width,f=.75*d.height;try{let{jsPDF:e}=await Promise.all([r.e(1260),r.e(6597)]).then(r.bind(r,26597));await Promise.all([r.e(1260),r.e(6597),r.e(3829)]).then(r.bind(r,53829));let o=new e({orientation:m>f?"landscape":"portrait",unit:"pt",format:[m,f]});o.setProperties({title:t.artboard?.name||"SVG artwork",subject:"PDF-compatible artwork",creator:"SVG AI"}),t.onProgress?.(.3),await o.svg(p,{width:m,height:f,loadExternalStyleSheets:!1});let a=s.from(o.output("arraybuffer"));return t.onProgress?.(1),{success:!0,data:a,mimeType:"application/illustrator",warning:"This is PDF-compatible artwork, not a native Illustrator document. Illustrator layers and editing data are not included. Open and inspect the result in Illustrator before use.",metadata:{...d,format:"ai",size:a.length,method:"svg2pdf",pdfCompatible:!0,nativeAi:!1,preservedLayers:!1}}}catch(e){throw new o.zx(`SVG to AI conversion failed: ${e instanceof Error?e.message:"Unable to render the artwork"}`,"SVG_TO_AI_FAILED")}}}}]);

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.