1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9325],{49325:(e,t,r)=>{r.d(t,{svgToTiffBrowserHandler:()=>a});var n=r(10651),o=r(44134).Buffer;let a=async(e,t={})=>{try{let a=await r.e(456).then(r.t.bind(r,40456,23)).then(e=>e.default||e),s=function(e){if("string"==typeof e){let t=e.trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}let t=o.from(e).toString("utf-8").trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}(e);t.onProgress&&t.onProgress(.1);let i=new DOMParser().parseFromString(s,"image/svg+xml").documentElement;if("parsererror"===i.tagName)throw new n.OD("Invalid SVG: Parse error");let g=t.width||parseInt(i.getAttribute("width")||"0"),l=t.height||parseInt(i.getAttribute("height")||"0");if(!g||!l){let e=i.getAttribute("viewBox");if(e){let[,,t,r]=e.split(" ").map(Number);g=g||t,l=l||r}}g&&l||(g=g||800,l=l||600);let c=t.dpi||300,f=c/96,d=Math.round(g*f),m=Math.round(l*f);t.onProgress&&t.onProgress(.3);let h=document.createElement("canvas");h.width=d,h.height=m;let u=h.getContext("2d");if(!u)throw new n.zx("Failed to create canvas context");let w=t.background||"#ffffff";u.fillStyle=w,u.fillRect(0,0,d,m),1!==f&&u.scale(f,f),t.onProgress&&t.onProgress(.5);let v=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),b=URL.createObjectURL(v);return new Promise((e,r)=>{let s=new Image;s.onload=async()=>{try{u.drawImage(s,0,0,g,l),t.onProgress&&t.onProgress(.7);let r=u.getImageData(0,0,d,m),n=new Uint8Array(r.data),i=a.encodeImage(n,d,m);URL.revokeObjectURL(b),t.onProgress&&t.onProgress(1),e({success:!0,data:o.from(i),mimeType:"image/tiff",metadata:{width:d,height:m,format:"tiff",size:i.byteLength,dpi:c,originalFormat:"svg",background:w}})}catch(e){URL.revokeObjectURL(b),r(e)}},s.onerror=()=>{URL.revokeObjectURL(b),r(new n.zx("Failed to load SVG image"))},s.crossOrigin="anonymous",s.src=b})}catch(e){if(e instanceof n.zx||e instanceof n.OD||e instanceof n.N$)throw e;throw new n.zx(`SVG to TIFF conversion failed: ${e instanceof Error?e.message:"Unknown error"}`)}}}}]);
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.