1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4678],{34678:(t,e,r)=>{r.d(e,{icoToSvgHandler:()=>l});var i=r(90816),a=r(10651),o=r(119),s=r(80639);r(83433);var n=r(44134).Buffer;class h extends i.k{async loadLibraries(){{let t=await r.e(888).then(r.t.bind(r,58507,23));this.ImageTracer=t.default||t}}async performConversionWithLibraries(t,e){try{let r,i=(0,o.ST)(t);if("ico"!==i)throw new a.OD(`Expected ICO file but detected ${i||"unknown"} format`);this.reportProgress(e,.1);let n=await this.extractBestIcon(t,e.preferredSize);if(this.reportProgress(e,.2),n.length>=8&&137===n[0]&&80===n[1]&&78===n[2]&&71===n[3]){let t=n.toString("base64");r=`data:image/png;base64,${t}`}else{let t=n.toString("base64");r=`data:image/bmp;base64,${t}`}let h=await (0,s.yS)(this.ImageTracer,r,e,t=>this.reportProgress(e,.2+.7*t)),l=h;(e.width||e.height)&&(l=this.resizeSvg(h,e.width,e.height,e.preserveAspectRatio)),this.reportProgress(e,.95);let c=this.extractSvgMetadata(l);return this.createSuccessResult(l,"image/svg+xml",{...c,method:"imagetracerjs",quality:e.quality||50})}catch(e){if(e instanceof a.zx)throw e;let t=e instanceof Error?e.message:"Unknown error";throw new a.zx(`ICO to SVG conversion failed: ${t}`,"ICO_TO_SVG_FAILED")}}parseIcoHeader(t){if(t.length<6)throw new a.zx("Invalid ICO file: too small","ICO_INVALID_HEADER");return{reserved:t.readUInt16LE(0),type:t.readUInt16LE(2),count:t.readUInt16LE(4)}}parseIcoDirectory(t,e){let r=[];for(let i=0;i<e;i++){let e=6+16*i;if(e+16>t.length)throw new a.zx("Invalid ICO file: corrupted directory","ICO_INVALID_DIRECTORY");let o=t.readUInt8(e)||256,s=t.readUInt8(e+1)||256;r.push({width:o,height:s,colorCount:t.readUInt8(e+2),reserved:t.readUInt8(e+3),planes:t.readUInt16LE(e+4),bitCount:t.readUInt16LE(e+6),size:t.readUInt32LE(e+8),offset:t.readUInt32LE(e+12)})}return r}selectBestIcon(t,e){if(e){let r=t.find(t=>t.width===e);return r||[...t].sort((t,r)=>Math.abs(t.width-e)-Math.abs(r.width-e))[0]}return t.reduce((t,e)=>e.width*e.height>t.width*t.height?e:t)}async extractBestIcon(t,e){let r=this.parseIcoHeader(t);if(1!==r.type)throw new a.zx("Invalid ICO file: wrong type","ICO_INVALID_TYPE");if(0===r.count)throw new a.zx("Invalid ICO file: no icons found","ICO_NO_ICONS");let i=this.parseIcoDirectory(t,r.count),o=this.selectBestIcon(i,e);if(o.offset+o.size>t.length)throw new a.zx("Invalid ICO file: data out of bounds","ICO_INVALID_DATA");let s=t.subarray(o.offset,o.offset+o.size);if(s.length>=8&&137===s[0]&&80===s[1]&&78===s[2]&&71===s[3])return s;let h=14+s.length,l=n.alloc(h);return l.write("BM",0),l.writeUInt32LE(h,2),l.writeUInt32LE(0,6),l.writeUInt32LE(54,10),s.copy(l,14),l}resizeSvg(t,e,r,i=!0){let a=0,o=0,s=t.match(/viewBox="0 0 (\d+\.?\d*) (\d+\.?\d*)"/);if(s)a=parseFloat(s[1]),o=parseFloat(s[2]);else{let e=t.match(/width="(\d+\.?\d*)"/),r=t.match(/height="(\d+\.?\d*)"/);e&&(a=parseFloat(e[1])),r&&(o=parseFloat(r[1]))}if(!a||!o)return t;let n=e||a,h=r||o;if(i){let t=a/o;if(e&&!r)h=Math.round(e/t);else if(!e&&r)n=Math.round(r*t);else if(e&&r){let t=Math.min(e/a,r/o);n=Math.round(a*t),h=Math.round(o*t)}}let l=t.replace(/width="[^"]*"/,`width="${n}"`).replace(/height="[^"]*"/,`height="${h}"`);if(!t.includes("width=")){let e=t.indexOf(">"),r=t.slice(0,e),i=t.slice(e);return`${r} width="${n}" height="${h}"${i}`}return l}extractSvgMetadata(t){let e={},r=t.match(/viewBox="0 0 (\d+\.?\d*) (\d+\.?\d*)"/);if(r)e.width=parseFloat(r[1]),e.height=parseFloat(r[2]);else{let r=t.match(/width="(\d+\.?\d*)"/),i=t.match(/height="(\d+\.?\d*)"/);r&&(e.width=parseFloat(r[1])),i&&(e.height=parseFloat(i[1]))}return e}constructor(...t){super(...t),this.name="ICO to SVG",this.from="ico",this.to="svg",this.description="Convert ICO icon files to scalable vector graphics with transparency support",this.isClientSide=!1,this.ImageTracer=null}}let l=new h().handler},80639:(t,e,r)=>{async function i(t){return new Promise((e,r)=>{let i=new Image;i.onload=()=>{e({width:i.width,height:i.height})},i.onerror=()=>{r(Error("Failed to load image"))},i.src=t})}async function a(t,e=4e6){let r=await i(t),o=r.width*r.height;if(o<=e)return t;let s=Math.sqrt(e/o),n=Math.floor(r.width*s),h=Math.floor(r.height*s);return new Promise((e,r)=>{let i=new Image;i.onload=()=>{let t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return void r(Error("Could not get canvas context"));t.width=n,t.height=h,a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(i,0,0,n,h),e(t.toDataURL("image/jpeg",.92))},i.onerror=()=>{r(Error("Failed to load image for scaling"))},i.src=t})}async function o(t,e,r,i){return new Promise((a,o)=>{i?.(.7);try{Date.now(),t.imageToSVG(e,t=>{Date.now(),i?.(1),a(t)},r)}catch(t){o(t)}})}async function s(t,e,r,s){try{let n=await i(e);s?.(.1),function(t,e,r=16e6){let i=t*e;if(i>r){let a=Math.sqrt(r);throw Error(`Image is too large (${t}x${e} = ${(i/1e6).toFixed(1)}MP). Maximum supported size is ${(r/1e6).toFixed(0)}MP (approximately ${Math.floor(a)}x${Math.floor(a)}). Please resize your image before converting.`)}}(n.width,n.height);let h=await a(e,4e6),l=await i(h);s?.(.2);let c=function(t,e){let r=t.width*t.height,i=r>1e6,a=r>4e6,o=r>1e7,s=e.quality||50,n={numberofcolors:o?3:a?4:i?6:8,colorquantcycles:i?1:2,pathomit:o?30:a?20:i?15:12,blurradius:i?0:e.blurradius||0,blurdelta:e.blurdelta||20,strokewidth:e.strokewidth||1,linethereshold:i?e.linethreshold||15:e.linethreshold||10,quadthreshold:i?e.quadthreshold||15:e.quadthreshold||10,rightangleenhance:!i&&!1!==e.rightangleenhance,viewbox:!1,desc:!1,lcpr:0,qcpr:0};s>70&&!a?(n.numberofcolors=Math.min(16,2*(n.numberofcolors||8)),n.colorquantcycles=Math.min(3,(n.colorquantcycles||2)+1),n.pathomit=Math.max(8,(n.pathomit||12)-4)):(s<30||o)&&(n.numberofcolors=Math.max(2,(n.numberofcolors||8)/2),n.pathomit=Math.min(40,(n.pathomit||12)+10));let h=Object.fromEntries(Object.entries(e).filter(([t])=>t in n&&void 0!==e[t])),l={...n,...h};return a&&(l.numberofcolors=Math.min(l.numberofcolors||8,8),l.colorquantcycles=Math.min(l.colorquantcycles||1,1)),l}(l,r);s?.(.3);let d=await o(t,h,c,s);return s?.(1),d}catch(t){throw console.error("Image tracing failed:",t),t}}r.d(e,{yS:()=>s})},90816:(t,e,r)=>{r.d(e,{I:()=>s,k:()=>n});var i=r(10651),a=r(119),o=r(44134).Buffer;class s{get handler(){return this.handleConversion.bind(this)}async handleConversion(t,e={}){let r;try{let i=this.normalizeInput(t);r=i.length,Date.now(),await this.trackConversionStart(r,e),await this.validateInput(i,e),this.reportProgress(e,.1),await this.trackConversionProgress(.1);let a=await this.performConversion(i,e);return this.reportProgress(e,1),await this.trackConversionProgress(1),await this.trackConversionComplete(!0,a,void 0,r),a}catch(t){if(await this.trackConversionComplete(!1,null,t,r),t instanceof i.zx||t instanceof i.OD)throw t;throw new i.zx((0,i.JX)(t),`${this.from.toUpperCase()}_TO_${this.to.toUpperCase()}_FAILED`)}}normalizeInput(t){return"string"==typeof t?o.from(t,"base64"):t}
1async validateInput(t,e){let r=(0,a.nJ)(t,{allowedFormats:[this.from],targetFormat:this.to});if(!r.isValid)throw new i.OD(r.error);let o=(0,a.XN)(this.from,this.to);if(!o.supported)throw new i.zx(o.reason,"UNSUPPORTED_CONVERSION");let s=(0,a.Ln)(e,this.from,this.to);if(!s.isValid)throw new i.zx(s.error,"INVALID_PARAMETERS")}reportProgress(t,e){if(t.onProgress&&"function"==typeof t.onProgress)try{t.onProgress(Math.min(1,Math.max(0,e)))}catch(t){}}async trackConversionStart(t,e){try{let{trackConversionStart:i}=await r.e(5804).then(r.bind(r,45804));i(this.name,this.from,this.to,t,e)}catch{}}async trackConversionProgress(t){try{let{trackConversionProgress:e}=await r.e(5804).then(r.bind(r,45804));e(this.name,this.from,this.to,t)}catch{}}async trackConversionComplete(t,e,i,a){try{let{trackConversionComplete:a}=await r.e(5804).then(r.bind(r,45804));a(this.name,this.from,this.to,t,e,i)}catch{}}async trackLibraryLoad(t,e,i,a){try{let{trackLibraryLoad:o}=await r.e(5804).then(r.bind(r,45804));o(this.name,t,e,i,a)}catch{}}createSuccessResult(t,e,r){return{success:!0,data:t,mimeType:e,metadata:{format:this.to,size:"string"==typeof t?o.byteLength(t,"utf8"):t.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 s{async ensureLibrariesLoaded(){if(this.libraryLoaded)return;if(this.loadingPromise)return void await this.loadingPromise;let t=Date.now();this.loadingPromise=this.loadLibraries().then(async()=>{this.libraryLoaded=!0;let e=Date.now()-t;await this.trackLibraryLoad("main",e,!0)}).catch(async e=>{this.loadingPromise=null;let r=Date.now()-t;throw await this.trackLibraryLoad("main",r,!1,e.message),new i.zx(`Failed to load required libraries for ${this.name}: ${e.message}`,"LIBRARY_LOAD_FAILED")}),await this.loadingPromise}async performConversion(t,e){await this.ensureLibrariesLoaded(),this.reportProgress(e,.3),await this.trackConversionProgress(.3);let r=await this.performConversionWithLibraries(t,e);return this.reportProgress(e,.9),await this.trackConversionProgress(.9),r}constructor(...t){super(...t),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.