1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7306],{27306:(e,t,r)=>{r.d(t,{webpToSvgHandler:()=>c});var a=r(10651),i=r(119),o=r(90816),n=r(80639);r(83433),r(44134).Buffer;class s extends o.k{async loadLibraries(){let e=await r.e(888).then(r.t.bind(r,58507,23));this.ImageTracer=e.default||e}async performConversionWithLibraries(e,t){try{let r=(0,i.ST)(e);if("png"!==r)throw new a.OD(`Expected PNG file but detected ${r||"unknown"} format`);this.reportProgress(t,.05);let o=t.converter||"auto";if("imagetracer"!==o&&"auto"!==o)throw console.error("[PNG-SVG] No converter available:",{converter:o,lastError:void 0,isClientSide:this.isClientSide,environment:"browser"}),new a.zx("PNG to SVG conversion failed: No converter available","NO_CONVERTER_AVAILABLE");this.reportProgress(t,.1);let s=e.toString("base64"),l=`data:image/png;base64,${s}`;this.reportProgress(t,.2);let h=await (0,n.yS)(this.ImageTracer,l,t,e=>this.reportProgress(t,.2+.7*e)),c=h;(t.width||t.height)&&(c=this.resizeSvg(h,t.width,t.height,t.preserveAspectRatio)),this.reportProgress(t,.95);let d=this.extractSvgMetadata(c);return this.createSuccessResult(c,"image/svg+xml",{...d,method:"imagetracerjs",quality:t.quality||50})}catch(t){if(t instanceof a.zx)throw t;let e=t instanceof Error?t.message:"Unknown error";throw new a.zx(`PNG to SVG conversion failed: ${e}`,"PNG_TO_SVG_FAILED")}}resizeSvg(e,t,r,a=!0){let i=0,o=0,n=e.match(/viewBox="0 0 (\d+\.?\d*) (\d+\.?\d*)"/);if(n)i=parseFloat(n[1]),o=parseFloat(n[2]);else{let t=e.match(/width="(\d+\.?\d*)"/),r=e.match(/height="(\d+\.?\d*)"/);t&&(i=parseFloat(t[1])),r&&(o=parseFloat(r[1]))}if(!i||!o)return e;let s=t||i,l=r||o;if(a){let e=i/o;if(t&&!r)l=Math.round(t/e);else if(!t&&r)s=Math.round(r*e);else if(t&&r){let e=Math.min(t/i,r/o);s=Math.round(i*e),l=Math.round(o*e)}}let h=e.replace(/width="[^"]*"/,`width="${s}"`).replace(/height="[^"]*"/,`height="${l}"`);if(!e.includes("width=")){let t=e.indexOf(">"),r=e.slice(0,t),a=e.slice(t);return`${r} width="${s}" height="${l}"${a}`}return h}extractSvgMetadata(e){let t={},r=e.match(/viewBox="0 0 (\d+\.?\d*) (\d+\.?\d*)"/);if(r)t.width=parseFloat(r[1]),t.height=parseFloat(r[2]);else{let r=e.match(/width="(\d+\.?\d*)"/),a=e.match(/height="(\d+\.?\d*)"/);r&&(t.width=parseFloat(r[1])),a&&(t.height=parseFloat(a[1]))}return t}constructor(...e){super(...e),this.name="PNG to SVG",this.from="png",this.to="svg",this.description="Convert PNG images to scalable vector graphics using advanced tracing algorithms",this.isClientSide=!1,this.ImageTracer=null}}let l=new s().handler;var h=r(44134).Buffer;let c=async function(e,t){try{let r,o="string"==typeof e?h.from(e,"base64"):e,n=(0,i.ST)(o);if("webp"!==n)throw new a.OD(`Expected WebP file but detected ${n||"unknown"} format`);t.onProgress?.(.1);r=await d(o),t.onProgress?.(.5);if(!r)throw new a.zx("Failed to convert WebP to PNG in intermediate step","WEBP_TO_PNG_FAILED");t.onProgress?.(.5);let s={...t,onProgress:e=>{t.onProgress?.(.5+.5*e)}},c=await l(r,s);if(!c.success)throw new a.zx(`Failed to convert PNG to SVG in intermediate step: ${c.error}`,"PNG_TO_SVG_FAILED");return{...c,metadata:{...c.metadata,method:"cloudconvert-chain",conversionChain:"webp â png â svg",originalFormat:"webp"}}}catch(t){if(t instanceof a.zx||t instanceof a.OD)throw t;let e=t instanceof Error?t.message:"Unknown error";throw new a.zx(`WebP to SVG conversion failed: ${e}`,"WEBP_TO_SVG_FAILED")}};async function d(e){return new Promise((t,r)=>{try{let i=new Image,o=document.createElement("canvas"),n=o.getContext("2d");i.onload=()=>{try{o.width=i.naturalWidth,o.height=i.naturalHeight,n.drawImage(i,0,0),o.toBlob(e=>{if(!e)return void r(new a.zx("Failed to create PNG blob","PNG_CREATION_FAILED"));let i=new FileReader;i.onload=()=>{let e=i.result,r=h.from(e);t(r)},i.onerror=()=>{r(new a.zx("Failed to read PNG blob","PNG_READ_FAILED"))},i.readAsArrayBuffer(e)},"image/png")}catch(t){let e=t instanceof Error?t.message:"Unknown error";r(new a.zx(`Canvas drawing failed: ${e}`,"CANVAS_ERROR"))}},i.onerror=()=>{r(new a.zx("Failed to load WebP image","WEBP_LOAD_FAILED"))};let s=new Blob([e],{type:"image/webp"}),l=URL.createObjectURL(s);i.src=l,setTimeout(()=>URL.revokeObjectURL(l),1e4)}catch(t){let e=t instanceof Error?t.message:"Unknown error";r(new a.zx(`WebP to PNG setup failed: ${e}`,"SETUP_ERROR"))}})}},80639:(e,t,r)=>{async function a(e){return new Promise((t,r)=>{let a=new Image;a.onload=()=>{t({width:a.width,height:a.height})},a.onerror=()=>{r(Error("Failed to load image"))},a.src=e})}async function i(e,t=4e6){let r=await a(e),o=r.width*r.height;if(o<=t)return e;let n=Math.sqrt(t/o),s=Math.floor(r.width*n),l=Math.floor(r.height*n);return new Promise((t,r)=>{let a=new Image;a.onload=()=>{let e=document.createElement("canvas"),i=e.getContext("2d");if(!i)return void r(Error("Could not get canvas context"));e.width=s,e.height=l,i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high",i.drawImage(a,0,0,s,l),t(e.toDataURL("image/jpeg",.92))},a.onerror=()=>{r(Error("Failed to load image for scaling"))},a.src=e})}async function o(e,t,r,a){return new Promise((i,o)=>{a?.(.7);try{Date.now(),e.imageToSVG(t,e=>{Date.now(),a?.(1),i(e)},r)}catch(e){o(e)}})}async function n(e,t,r,n){try{let s=await a(t);n?.(.1),function(e,t,r=16e6){let a=e*t;if(a>r){let i=Math.sqrt(r);throw Error(`Image is too large (${e}x${t} = ${(a/1e6).toFixed(1)}MP). Maximum supported size is ${(r/1e6).toFixed(0)}MP (approximately ${Math.floor(i)}x${Math.floor(i)}). Please resize your image before converting.`)}}(s.width,s.height);let l=await i(t,4e6),h=await a(l);n?.(.2);let c=function(e,t){let r=e.width*e.height,a=r>1e6,i=r>4e6,o=r>1e7,n=t.quality||50,s={numberofcolors:o?3:i?4:a?6:8,colorquantcycles:a?1:2,pathomit:o?30:i?20:a?15:12,blurradius:a?0:t.blurradius||0,blurdelta:t.blurdelta||20,strokewidth:t.strokewidth||1,linethereshold:a?t.linethreshold||15:t.linethreshold||10,quadthreshold:a?t.quadthreshold||15:t.quadthreshold||10,rightangleenhance:!a&&!1!==t.rightangleenhance,viewbox:!1,desc:!1,lcpr:0,qcpr:0};n>70&&!i?(s.numberofcolors=Math.min(16,2*(s.numberofcolors||8)),s.colorquantcycles=Math.min(3,(s.colorquantcycles||2)+1),s.pathomit=Math.max(8,(s.pathomit||12)-4)):(n<30||o)&&(s.numberofcolors=Math.max(2,(s.numberofcolors||8)/2),s.pathomit=Math.min(40,(s.pathomit||12)+10));let l=Object.fromEntries(Object.entries(t).filter(([e])=>e in s&&void 0!==t[e])),h={...s,...l};return i&&(h.numberofcolors=Math.min(h.numberofcolors||8,8),h.colorquantcycles=Math.min(h.colorquantcycles||1,1)),h}(h,r);n?.(.3);let d=await o(e,l,c,n);return n?.(1),d}catch(e){throw console.error("Image tracing failed:",e),e}}r.d(t,{yS:()=>n})},90816:(e,t,r)=>{r.d(t,{I:()=>n,k:()=>s});var a=r(10651),i=r(119),o=r(44134).Buffer;class n{get handler(){return this.handleConversion.bind(this)}async handleConversion(e,t={}){let r;try{let a=this.normalizeInput(e);r=a.length,Date.now(),await this.trackConversionStart(r,t),await this.validateInput(a,t),this.reportProgress(t,.1),await this.trackConversionProgress(.1);let i=await this.performConversion(a,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 a.zx||e instanceof a.OD)throw e;throw new a.zx((0,a.JX)(e),`${this.from.toUpperCase()}_TO_${this.to.toUpperCase()}_FAILED`)}}normalizeInput(e){return"string"==typeof e?o.from(e,"base64"):e}
1async validateInput(e,t){let r=(0,i.nJ)(e,{allowedFormats:[this.from],targetFormat:this.to});if(!r.isValid)throw new a.OD(r.error);let o=(0,i.XN)(this.from,this.to);if(!o.supported)throw new a.zx(o.reason,"UNSUPPORTED_CONVERSION");let n=(0,i.Ln)(t,this.from,this.to);if(!n.isValid)throw new a.zx(n.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:a}=await r.e(5804).then(r.bind(r,45804));a(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,a,i){try{let{trackConversionComplete:i}=await r.e(5804).then(r.bind(r,45804));i(this.name,this.from,this.to,e,t,a)}catch{}}async trackLibraryLoad(e,t,a,i){try{let{trackLibraryLoad:o}=await r.e(5804).then(r.bind(r,45804));o(this.name,e,t,a,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 s extends n{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 a.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.