PageSourceSearch

https://www.svgai.org/_next/static/chunks/8632.052a15b9301aba51.js

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

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8632],{8632:(t,e,i)=>{i.d(e,{svgToTiffHandler:()=>l});var r=i(90816),a=i(10651),s=i(119),o=i(83433),n=i(44134).Buffer;class h extends r.k{async loadLibraries(){}validateSvgInput(t){if("string"==typeof t){let e=t.trim();if(!e.includes("<svg")&&!e.includes("<?xml"))throw new a.OD("Invalid SVG: Missing SVG tag");return e}let e=(0,s.ST)(t);if("svg"!==e)throw new a.N$(e||"unknown",["svg"],`Expected SVG format but received ${e||"unknown format"}`);return t.toString("utf8")}processSvgString(t,e){let i={},r=t.match(/width="([^"]+)"/),a=t.match(/height="([^"]+)"/),s=t.match(/viewBox="([^"]+)"/),o=t;if(r){let t=parseFloat(r[1]);isNaN(t)||(i.width=t)}if(a){let t=parseFloat(a[1]);isNaN(t)||(i.height=t)}if(!i.width&&!i.height&&s){let[,,t,e]=s[1].split(" ").map(parseFloat);isNaN(t)||isNaN(e)||(i.width=t,i.height=e)}if(e.width||e.height){let t=e.width||i.width,s=e.height||i.height;t&&s&&(o=r?o.replace(/width="[^"]+"/,`width="${t}"`):o.replace("<svg",`<svg width="${t}"`),o=a?o.replace(/height="[^"]+"/,`height="${s}"`):o.replace("<svg",`<svg height="${s}"`),i.width=t,i.height=s)}return i.width&&i.height||(i.width=i.width||512,i.height=i.height||512,r||(o=o.replace("<svg",`<svg width="${i.width}"`)),a||(o=o.replace("<svg",`<svg height="${i.height}"`))),{svg:o,metadata:i}}async convertViaConvertio(t,e){try{let i=this.validateSvgInput(t),r=n.from(i,"utf8");this.reportProgress(e,.1);let s=await (0,o.b2)(r,"svg","tiff","input.svg",{width:e.width,height:e.height,preserveAspectRatio:e.preserveAspectRatio,quality:e.quality,onProgress:t=>{this.reportProgress(e,.1+.9*t)}});if(!s.success)throw new a.zx(`Convertio SVG to TIFF failed: ${s.error}`,"CONVERTIO_SVG_TO_TIFF_FAILED");return{...s,metadata:{...s.metadata,method:"convertio",compression:e.compression||"lzw",dpi:e.dpi||300}}}catch(t){if(t instanceof a.zx)throw t;throw new a.zx(`Convertio SVG to TIFF failed: ${t instanceof Error?t.message:"Unknown error"}`,"CONVERTIO_FAILED")}}async performConversionWithLibraries(t,e){try{let{svgToTiffBrowserHandler:r}=await i.e(9325).then(i.bind(i,49325));return r(t,e)}catch(t){throw t}}constructor(...t){super(...t),this.name="SVG to TIFF",this.from="svg",this.to="tiff",this.description="Convert scalable vector graphics to TIFF format with various compression options and high DPI support",this.sharp=null}}let l=new h().handler},90816:(t,e,i)=>{i.d(e,{I:()=>o,k:()=>n});var r=i(10651),a=i(119),s=i(44134).Buffer;class o{get handler(){return this.handleConversion.bind(this)}async handleConversion(t,e={}){let i;try{let r=this.normalizeInput(t);i=r.length,Date.now(),await this.trackConversionStart(i,e),await this.validateInput(r,e),this.reportProgress(e,.1),await this.trackConversionProgress(.1);let a=await this.performConversion(r,e);return this.reportProgress(e,1),await this.trackConversionProgress(1),await this.trackConversionComplete(!0,a,void 0,i),a}catch(t){if(await this.trackConversionComplete(!1,null,t,i),t instanceof r.zx||t instanceof r.OD)throw t;throw new r.zx((0,r.JX)(t),`${this.from.toUpperCase()}_TO_${this.to.toUpperCase()}_FAILED`)}}normalizeInput(t){return"string"==typeof t?s.from(t,"base64"):t}async validateInput(t,e){let i=(0,a.nJ)(t,{allowedFormats:[this.from],targetFormat:this.to});if(!i.isValid)throw new r.OD(i.error);let s=(0,a.XN)(this.from,this.to);if(!s.supported)throw new r.zx(s.reason,"UNSUPPORTED_CONVERSION");let o=(0,a.Ln)(e,this.from,this.to);if(!o.isValid)throw new r.zx(o.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:r}=await i.e(5804).then(i.bind(i,45804));r(this.name,this.from,this.to,t,e)}catch{}}async trackConversionProgress(t){try{let{trackConversionProgress:e}=await i.e(5804).then(i.bind(i,45804));e(this.name,this.from,this.to,t)}catch{}}async trackConversionComplete(t,e,r,a){try{let{trackConversionComplete:a}=await i.e(5804).then(i.bind(i,45804));a(this.name,this.from,this.to,t,e,r)}catch{}}async trackLibraryLoad(t,e,r,a){try{let{trackLibraryLoad:s}=await i.e(5804).then(i.bind(i,45804));s(this.name,t,e,r,a)}catch{}}createSuccessResult(t,e,i){return{success:!0,data:t,mimeType:e,metadata:{format:this.to,size:"string"==typeof t?s.byteLength(t,"utf8"):t.length,...i}}}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 o{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 i=Date.now()-t;throw await this.trackLibraryLoad("main",i,!1,e.message),new r.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 i=await this.performConversionWithLibraries(t,e);return this.reportProgress(e,.9),await this.trackConversionProgress(.9),i}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.