1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8147],{8147:(e,t,r)=>{r.d(t,{svgToDxfHandler:()=>n});var o=r(10651),i=r(119),s=r(44134).Buffer;let n=async(e,t={})=>{try{let r=function(e){if("string"==typeof e){let t=e.trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new o.OD("Invalid SVG: Missing SVG tag");return t}let t=(0,i.ST)(e);if("svg"!==t)throw new o.N$(t||"unknown",["svg"],`Expected SVG format but received ${t||"unknown format"}`);return e.toString("utf8")}(e),n=function(e){let t,r=[],o=e.match(/viewBox="([^"]+)"/);o&&o[1].split(" ").map(Number);let i=/<line[^>]*>/g;for(;null!==(t=i.exec(e));){let e,o={},i=/(\w+)="([^"]*)"/g;for(;null!==(e=i.exec(t[0]));)o[e[1]]=e[2];r.push({type:"line",attributes:o})}let s=/<circle[^>]*>/g;for(;null!==(t=s.exec(e));){let e,o={},i=/(\w+)="([^"]*)"/g;for(;null!==(e=i.exec(t[0]));)o[e[1]]=e[2];r.push({type:"circle",attributes:o})}let n=/<rect[^>]*>/g;for(;null!==(t=n.exec(e));){let e,o={},i=/(\w+)="([^"]*)"/g;for(;null!==(e=i.exec(t[0]));)o[e[1]]=e[2];r.push({type:"rect",attributes:o})}let a=/<polyline[^>]*>/g;for(;null!==(t=a.exec(e));){let e,o={},i=/(\w+)="([^"]*)"/g;for(;null!==(e=i.exec(t[0]));)o[e[1]]=e[2];r.push({type:"polyline",attributes:o})}let l=/<path[^>]*d="([^"]*)"/g;for(;null!==(t=l.exec(e));){let o,i={d:t[1]},s=/(\w+)="([^"]*)"/g,n=e.substring(e.lastIndexOf("<path",t.index),t.index+t[0].length);for(;null!==(o=s.exec(n));)i[o[1]]=o[2];r.push({type:"path",attributes:i})}return r}(r);if(0===n.length)throw new o.zx("No convertible elements found in SVG file","SVG_NO_ELEMENTS");let a=function(e,t){let r,o=t.version||"AC1015",i=(r="",e.forEach(e=>{switch(e.type){case"line":{let t=parseFloat(e.attributes.x1||"0"),o=parseFloat(e.attributes.y1||"0"),i=parseFloat(e.attributes.x2||"0"),s=parseFloat(e.attributes.y2||"0");r+=`0 2LINE 38 40 562 67 710 8${t.toFixed(6)} 920 10${o.toFixed(6)} 1130 120.0 1311 14${i.toFixed(6)} 1521 16${s.toFixed(6)} 1731 180.0 19`;break}case"circle":{let t=parseFloat(e.attributes.cx||"0"),o=parseFloat(e.attributes.cy||"0"),i=parseFloat(e.attributes.r||"0");r+=`0 20CIRCLE 218 220 2362 247 2510 26${t.toFixed(6)} 2720 28${o.toFixed(6)} 2930 300.0 3140 32${i.toFixed(6)} 33`;break}case"rect":{let t=parseFloat(e.attributes.x||"0"),o=parseFloat(e.attributes.y||"0"),i=parseFloat(e.attributes.width||"0"),s=parseFloat(e.attributes.height||"0");r+=`0 34LINE 358 360 3762 387 3910 40${t.toFixed(6)} 4120 42${o.toFixed(6)} 4330 440.0 4511 46${(t+i).toFixed(6)} 4721 48${o.toFixed(6)} 4931 500.0 510 52LINE 538 540 5562 567 5710 58${(t+i).toFixed(6)} 5920 60${o.toFixed(6)} 6130 620.0 6311 64${(t+i).toFixed(6)} 6521 66${(o+s).toFixed(6)} 6731 680.0 690 70LINE 718 720 7362 747 7510 76${(t+i).toFixed(6)} 7720 78${(o+s).toFixed(6)} 7930 800.0 8111 82${t.toFixed(6)} 8321 84${(o+s).toFixed(6)} 8531 860.0 870 88LINE 898 900 9162 927 9310 94${t.toFixed(6)} 9520 96${(o+s).toFixed(6)} 9730 980.0 9911 100${t.toFixed(6)} 10121 102${o.toFixed(6)} 10331 1040.0 105`;break}case"polyline":{let t=e.attributes.points;if(t){let e=t.trim().split(/\s+/).map(e=>e.split(",").map(Number));r+=`0 106LWPOLYLINE 1078 1080 10962 1107 11190 112${e.length} 11370 1140 115`,e.forEach(([e,t])=>{r+=`10 116${e.toFixed(6)} 11720 118${t.toFixed(6)} 119`})}break}case"path":{let t=e.attributes.d;if(t){let e=t.match(/[MLZ][^MLZ]*/g)||[],o=0,i=0,s=0,n=0;e.forEach((e,t)=>{let a=e[0],l=e.substring(1).trim().split(/[\s,]+/).map(Number);switch(a){case"M":o=l[0],i=l[1],0===t&&(s=o,n=i);break;case"L":l.length>=2&&(r+=`0 120LINE 1218 1220 12362 1247 12510 126${o.toFixed(6)} 12720 128${i.toFixed(6)} 12930 1300.0 13111 132${l[0].toFixed(6)} 13321 134${l[1].toFixed(6)} 13531 1360.0 137`,o=l[0],i=l[1]);break;case"Z":r+=`0 138LINE 1398 1400 14162 1427 14310 144${o.toFixed(6)} 14520 146${i.toFixed(6)} 14730 1480.0 14911 150${s.toFixed(6)} 15121 152${n.toFixed(6)} 15331 1540.0 155`}})}}}}),r);return`0 156SECTION 1572 158HEADER 1599 160$ACADVER 1611 162${o} 1639 164$EXTMIN 16510 1660.000000 16720 1680.000000 16930 1700.0 1719 172$EXTMAX 17310 174100.000000 17520 176100.000000 17730 1780.0 1799 180$LUNITS 18170 1822 1839 184$INSUNITS 18570 1864 1870 188ENDSEC 1890 190SECTION 1912 192ENTITIES 193${i}0 194ENDSEC 1950 196EOF`}(n,t),l=s.from(a,"utf8");return{success:!0,data:l,mimeType:"application/dxf",metadata:{format:"dxf",size:l.length,elementCount:n.length}}}catch(e){if(e instanceof o.OD||e instanceof o.N$||e instanceof o.zx)throw e;if(e instanceof Error)throw new o.zx(`SVG to DXF conversion failed: ${e.message}`,"SVG_TO_DXF_FAILED");throw new o.zx("An unexpected error occurred during SVG to DXF conversion","SVG_TO_DXF_UNKNOWN_ERROR")}};r.e(2345).then(r.bind(r,32345)).then(e=>{e.svgToDxfBrowserConverter.handler}).catch(()=>{})},10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>n,OD:()=>i,pc:()=>a,zx:()=>s});
196class 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 i 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 n 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 a 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 c(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."}}}]);
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.