@flyfish-dev/cad-viewer 0.6.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- var Kn=Object.defineProperty;var $n=(t,n,a)=>n in t?Kn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var S=(t,n,a)=>$n(t,typeof n!="symbol"?n+"":n,a);const zn="modulepreload",Jn=function(t){return"/"+t},Ht={},Vt=function(n,a,e){let i=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");i=Promise.allSettled(a.map(_=>{if(_=Jn(_),_ in Ht)return;Ht[_]=!0;const d=_.endsWith(".css"),l=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${l}`))return;const c=document.createElement("link");if(c.rel=d?"stylesheet":zn,d||(c.as="script"),c.crossOrigin="",c.href=_,s&&c.setAttribute("nonce",s),document.head.appendChild(c),d)return new Promise((E,u)=>{c.addEventListener("load",E),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${_}`)))})}))}function r(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&r(s.reason);return n().catch(r)})};function Zn(t){return{format:t.format,sourceName:t.sourceName,units:t.units,header:t.header??{},layers:t.layers??{},lineTypes:t.lineTypes??{},blocks:t.blocks??{},entities:t.entities??[],pages:t.pages,savedView:t.savedView,metadata:t.metadata??{},warnings:t.warnings??[],raw:t.raw}}function Kt(t){switch(String(t??"").toUpperCase()){case"LINE":return"line";case"CIRCLE":return"circle";case"ARC":return"arc";case"LWPOLYLINE":case"POLYLINE":case"POLYLINE_2D":case"POLYLINE2D":case"POLYLINE_3D":case"POLYLINE3D":case"LEADER":case"MULTILEADER":return"polyline";case"ELLIPSE":return"ellipse";case"TEXT":case"MTEXT":case"ATTRIB":case"ATTDEF":case"DIMENSION":return"text";case"POINT":return"point";case"INSERT":return"insert";case"SOLID":case"TRACE":case"3DFACE":return"solid";case"HATCH":return"hatch";case"SPLINE":return"spline";case"PATH":case"XPS_PATH":case"DWF_PATH":return"path";case"IMAGE":case"RASTER_IMAGE":case"DWF_IMAGE":return"image";case"VIEWPORT":return"viewport";default:return"unsupported"}}function Qt(t,n,a={}){const e=n??String(t.type??t.entityType??t.objectName??"UNKNOWN").toUpperCase(),i=a.includeUnknownProperties===!1?{type:e,kind:Kt(e)}:{...t,type:e,kind:Kt(e)};a.keepRaw&&(i.raw=t),i.handle=G(t.handle??t.id),i.layer=G(t.layer??t.layerName),i.lineType=G(t.lineType??t.linetype),i.lineTypeScale=g(t.lineTypeScale??t.linetypeScale??t.ltscale)??i.lineTypeScale,i.flag=g(t.flag??t.flags)??i.flag;const r=t.isClosed===!0||t.closed===!0||t.shape===!0,o=/^(POLYLINE|POLYLINE_2D|POLYLINE2D|POLYLINE_3D|POLYLINE3D|SPLINE)$/.test(e),s=e==="LWPOLYLINE";(r||o&&(Number(i.flag??0)&1)===1||s&&(Number(i.flag??0)&512)===512)&&(i.isClosed=!0);const _=a.numericColorMode??"auto",d=g(t.color),l=g(t.colorIndex??t.colorNumber??t.aci??t.aciColor??t.color_index);i.colorIndex=l??(_!=="rgb"&&d!==void 0&&Math.abs(d)<=257?d:void 0);const c=t.trueColor??t.true_color??t.truecolor??t.colorRGB??t.colorRgb??t.rgbColor??t.rgb,E=d!==void 0&&d>=0&&d<=16777215&&(_==="rgb"||_==="auto"&&Math.abs(d)>257);i.trueColor=c??(E?d:void 0),(typeof t.color=="string"||typeof t.color=="number")&&(i.color=t.color),i.colorNumber=g(t.colorNumber)??i.colorNumber,i.colorName=G(t.colorName??t.color_name)??i.colorName,i.fillColor=t.fillColor??t.fill_color,i.fillColorIndex=g(t.fillColorIndex??t.fill_color_index??t.fillColorNumber)??i.fillColorIndex,i.opacity=g(t.opacity??t.alpha)??i.opacity,i.lineweight=g(t.lineweight??t.lineWeight),i.isVisible=!(t.isVisible===!1||t.visible===!1),i.startPoint=D(t.startPoint??t.start??t.p0??t.from)??i.startPoint,i.endPoint=D(t.endPoint??t.end??t.p1??t.to)??i.endPoint,i.center=D(t.center??t.centerPoint)??i.center,i.insertionPoint=D(t.insertionPoint??t.position??t.location??t.point??t.basePoint)??i.insertionPoint,i.radius=g(t.radius)??i.radius,i.startAngle=g(t.startAngle??t.start_angle)??i.startAngle,i.endAngle=g(t.endAngle??t.end_angle)??i.endAngle,i.majorAxisEndPoint=D(t.majorAxisEndPoint??t.majorAxis??t.major)??i.majorAxisEndPoint,i.axisRatio=g(t.axisRatio??t.ratio)??i.axisRatio,i.height=g(t.height??t.textHeight)??i.height,i.textHeight=g(t.textHeight??t.height)??i.textHeight,i.rotation=g(t.rotation??t.angle)??i.rotation,i.text=G(t.text??t.value??t.string??t.contents)??i.text,i.name=G(t.name??t.blockName)??i.name,i.blockName=G(t.blockName??t.name)??i.blockName;const u=Tt(t.vertices??t.points);u.length>0&&(i.vertices=u);const P=Tt(t.controlPoints??t.control_points);P.length>0&&(i.controlPoints=P);const A=Tt(t.fitPoints??t.fit_points);A.length>0&&(i.fitPoints=A);const I=t.attribs??t.attributes;return Array.isArray(I)&&(i.attribs=I.filter(T=>!!T&&typeof T=="object").map(T=>Qt(T,void 0,a))),i}function D(t){if(!t||typeof t!="object")return;const n=t,a=Number(n.x??n.X??n[0]),e=Number(n.y??n.Y??n[1]),i=n.z??n.Z??n[2],r=i===void 0?void 0:Number(i);if(!(!Number.isFinite(a)||!Number.isFinite(e)))return Number.isFinite(r)?{x:a,y:e,z:r}:{x:a,y:e}}function Tt(t){if(!Array.isArray(t))return[];const n=[];for(const a of t){const e=D(a);if(!e)continue;const i=a,r=e,o=g(i.bulge);o!==void 0&&(r.bulge=o);const s=g(i.startWidth??i.start_width);s!==void 0&&(r.startWidth=s);const _=g(i.endWidth??i.end_width);_!==void 0&&(r.endWidth=_),n.push(r)}return n}function qn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function Qn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function jn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n,n.handle&&(t[n.handle]=n,t[n.handle.toLowerCase()]=n))}function g(t){const n=Number(t);return Number.isFinite(n)?n:void 0}function G(t){if(typeof t!="string"&&typeof t!="number")return;const n=String(t);return n.length>0?n:void 0}function te(t){return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.slice().buffer}function ne(t,n){return{a:t.a*n.a+t.c*n.b,b:t.b*n.a+t.d*n.b,c:t.a*n.c+t.c*n.d,d:t.b*n.c+t.d*n.d,e:t.a*n.e+t.c*n.f+t.e,f:t.b*n.e+t.d*n.f+t.f}}function ee(t){const n=Math.cos(t),a=Math.sin(t);return{a:n,b:a,c:-a,d:n,e:0,f:0}}const ae={AC1009:"R12",AC1012:"R13",AC1014:"R14",AC1015:"R2000",AC1018:"R2004",AC1021:"R2007",AC1024:"R2010",AC1027:"R2013",AC1032:"R2018"};function ie(t){const n=Array.from(t.slice(0,6),e=>String.fromCharCode(e)).join(""),a=ae[n]??"UNKNOWN";return{signature:n,release:a,supportedByOpenDesignSpec:a!=="UNKNOWN",notes:a==="UNKNOWN"?"Unknown or unsupported DWG signature.":void 0}}const $t=new Map;async function oe(t,n={}){const a=performance.now(),e=n.sourceName;n.onProgress?.({phase:"detect",format:"dwg",message:"Validating DWG header…",total:t.byteLength});const i=ie(t);if(!i.signature.startsWith("AC"))throw new Error(`Invalid DWG header: ${JSON.stringify(i.signature)}.`);n.onProgress?.({phase:"wasm-init",format:"dwg",message:"Initializing LibreDWG WebAssembly…",total:t.byteLength});const r=await jt(n.wasmPath??"/wasm/");n.onProgress?.({phase:"parse",format:"dwg",message:`Decoding ${i.signature} DWG…`,total:t.byteLength,percent:35});const o=te(t),s=r.Dwg_File_Type?.DWG??0,_=r.instance.dwg_read_data(o,s);if(!_)throw new Error("LibreDWG returned an empty DWG result.");if(typeof _.error=="number"&&_.error!==0)throw new Error(`LibreDWG parse error code: ${_.error}.`);n.onProgress?.({phase:"normalize",format:"dwg",message:"Normalizing DWG database…",total:t.byteLength,percent:72});const d=typeof r.instance.convert=="function"?r.instance.convert(_):_;try{typeof r.instance.dwg_free=="function"&&r.instance.dwg_free(_)}catch{}const l=re(d,e,i,{keepRaw:!!n.keepRaw}),c=performance.now()-a;return n.onProgress?.({phase:"done",format:"dwg",message:"DWG loaded.",total:t.byteLength,percent:100,elapsedMs:c}),{document:l,raw:n.keepRaw?d:void 0,bytes:t.byteLength,elapsedMs:c,format:"dwg",warnings:l.warnings}}async function jt(t="/wasm/"){const n=Pe(t);let a=$t.get(n);a||(a=Vt(()=>Promise.resolve().then(()=>qt),[]).then(async r=>{const o=r,s=o.LibreDwg;if(!s||typeof s.create!="function")throw new Error("@mlightcad/libredwg-web did not expose LibreDwg.create().");try{if(typeof o.createModule=="function"&&typeof s.createByWasmInstance=="function"){const _=zt(n),d=await fe(_),l=await o.createModule({wasmBinary:d,locateFile:c=>new URL(c,nn(n)).href});return s.createByWasmInstance(l)}return await s.create(n)}catch(_){const d=_ instanceof Error?_.message:String(_);throw new Error(`Failed to initialize LibreDWG WebAssembly from ${n}. Ensure libredwg-web.wasm is deployed at ${zt(n)} and wasmPath is resolved relative to the page, not the worker script. Run npm run copy:wasm before dev/build. Original error: ${d}`)}}),$t.set(n,a));const e=await a,i=await Vt(()=>Promise.resolve().then(()=>qt),void 0);return{module:i,instance:e,Dwg_File_Type:i.Dwg_File_Type}}function re(t,n,a,e={}){const i=t&&typeof t=="object"?t:{},r=de(i,e),o=le(i,e),s=Ae(i,e),_=_e(i.header,a),d=ce(i,_),l=d.view,c=Array.isArray(i.entities)?i.entities:[],E={keepRaw:!!e.keepRaw,includeUnknownProperties:!!e.keepRaw},u=c.filter(I=>!!I&&typeof I=="object").map(I=>tn(I,E)),P=Zn({format:"dwg",sourceName:n,header:_,layers:r,lineTypes:o,blocks:s,entities:u,savedView:l,metadata:{parser:"@mlightcad/libredwg-web",parserMode:"wasm",version:a,savedView:l},warnings:d.warning?[d.warning]:[],raw:e.keepRaw?t:void 0});return u.length===0&&P.warnings.push("DWG parsed successfully but no model-space entities were exposed by the converter. Check layout/paper-space content or unsupported proxy objects."),[...new Set(Object.values(o))].some(I=>I.pattern.some(T=>Number(T.elementTypeFlag??0)!==0))&&P.warnings.push("Complex SHX linetype glyphs are preserved in the normalized LTYPE definition and rendered as a dash/dot approximation; embedded shape glyph fidelity is not available yet."),P}function tn(t,n){const a=Qt(t,void 0,{...n,numericColorMode:"rgb"}),e=g(t.color);e!==void 0&&e>=0&&e<=16777215&&(a.color=e,a.trueColor=e),a.colorIndex=g(t.colorIndex??t.colorNumber??t.aci)??a.colorIndex,a.colorName=G(t.colorName??t.color_name)??a.colorName;const i=g(t.flag??t.flags);i!==void 0&&(a.flag=i);const r=String(t.type??t.entityType??"").toUpperCase(),o=/^(POLYLINE|POLYLINE_2D|POLYLINE2D|POLYLINE_3D|POLYLINE3D)$/.test(r);return(t.isClosed===!0||t.closed===!0||o&&(Number(i??0)&1)===1||r==="LWPOLYLINE"&&(Number(i??0)&512)===512)&&(a.isClosed=!0),a}function se(t){return typeof t=="number"&&Number.isFinite(t)&&Math.abs(Math.trunc(t))>=1&&Math.abs(Math.trunc(t))<=255}function _e(t,n){const a=t&&typeof t=="object"?{...t}:{};return n&&(a.dwgVersion=n),a}function de(t,n){const a={},e=[],i=t.tables;for(const r of["LAYER","layer","layers"]){const o=t[r]??i?.[r];o&&e.push(o)}for(const r of e)for(const o of st(r)){const s=o,_=G(s.name??s.layerName??s.entryName);if(!_)continue;const d=g(s.colorIndex??s.colorNumber),l=g(s.trueColor??s.true_color??s.truecolor??s.colorRGB??s.colorRgb??s.rgbColor??s.rgb),c=g(s.color),E=se(d),u=l??(!E&&c!==void 0&&c>=0&&c<=16777215?c:void 0),P={name:_,color:E?void 0:s.color??s.colorName,colorIndex:d??(c!==void 0&&Math.abs(c)<=257?c:void 0),trueColor:u,lineType:G(s.lineType??s.linetype),lineweight:g(s.lineweight??s.lineWeight),isVisible:!(s.isVisible===!1||s.off===!0||Number(d??s.color??1)<0),isFrozen:!!(s.isFrozen??s.frozen),isLocked:!!(s.isLocked??s.locked),raw:n.keepRaw?s:void 0};qn(a,P)}return a}function le(t,n){const a={},e=t.tables,i=[t.LTYPE,t.ltype,t.lineTypes,e?.LTYPE,e?.ltype,e?.lineTypes];for(const r of i)for(const o of st(r)){const s=o,_=G(s.name??s.lineTypeName??s.entryName);if(!_)continue;const l=(Array.isArray(s.pattern)?s.pattern:Array.isArray(s.dashes)?s.dashes:[]).flatMap(c=>{if(typeof c=="number")return[{length:c}];if(!c||typeof c!="object")return[];const E=c,u=g(E.elementLength??E.length??E.dashLength);if(u===void 0)return[];const P=g(E.elementTypeFlag),A=g(E.shapeNumber),I=P!==void 0&&A!==void 0;return[{length:u,elementTypeFlag:I?A:g(E.typeFlag??E.elementTypeFlag),shapeNumber:I?P:g(E.shapeCode??E.shapeNumber),scale:g(E.scale),rotation:g(E.rotation),offsetX:g(E.offsetX),offsetY:g(E.offsetY),text:G(E.text)}]});jn(a,{name:_,handle:G(s.handle??s.id),description:G(s.description),totalPatternLength:g(s.totalPatternLength??s.patternLength),pattern:l,raw:n.keepRaw?s:void 0})}return a}function ce(t,n){const a=t.tables,i=st(t.VPORT??t.vports??a?.VPORT??a?.vports).filter(T=>!!T&&typeof T=="object").find(T=>String(T.name??"").trim().toLowerCase()==="*active"),r=i?"vport":"header-ucs",o=i??n,s=D(o.ucsOrigin??o.UCSORG??n.UCSORG),_=D(o.ucsXAxis??o.UCSXDIR??n.UCSXDIR),d=D(o.ucsYAxis??o.UCSYDIR??n.UCSYDIR),l=g(o.viewTwistAngle??o.twistAngle??o.VIEWTWIST)??0,c=D(o.viewDirectionFromTarget??o.viewDirection??o.direction??o.VIEWDIR),E=!Ie(s,_,d);if(!(!!i||!!c||E||Math.abs(l)>1e-12))return{};const P=ue(c),A=P?Ee(s,_,d,l):{a:1,b:0,c:0,d:1,e:0,f:0},I={source:r,name:G(o.name),handle:G(o.handle),center:D(o.center??o.VIEWCTR),target:D(o.viewTarget??o.target??o.TARGET),direction:c,viewHeight:g(o.viewHeight??o.height??o.VIEWSIZE),aspectRatio:g(o.aspectRatio),twistAngle:l,ucsOrigin:s,ucsXAxis:_,ucsYAxis:d,sceneTransformApplied:P,sceneTransform:A};return P?{view:I}:{view:I,warning:"The saved CAD view has a missing, non-finite, or tilted VIEWDIR. File Viewer kept world coordinates instead of applying an unsafe 2D UCS/PLAN rotation."}}function Ee(t,n,a,e){const i=ft(n)??{x:1,y:0},r=ft(a)??{x:-i.y,y:i.x},o=i.x*r.x+i.y*r.y,s=ft({x:r.x-i.x*o,y:r.y-i.y*o})??{x:-i.y,y:i.x},_={a:i.x,b:s.x,c:i.y,d:s.y,e:t?-(t.x*i.x+t.y*i.y):0,f:t?-(t.x*s.x+t.y*s.y):0};return ne(ee(Number.isFinite(e)?e:0),_)}function ft(t){if(!t||Math.abs(Number(t.z??0))>1e-6)return;const n=Math.hypot(t.x,t.y);if(!(!Number.isFinite(n)||n<1e-12))return{x:t.x/n,y:t.y/n}}function ue(t){if(!t||!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.z))return!1;const n=Math.hypot(t.x,t.y,Number(t.z));return!Number.isFinite(n)||n<1e-12?!1:Math.hypot(t.x,t.y)/n<=1e-4&&Math.abs(Number(t.z))/n>=1-1e-8}function Ie(t,n,a){const e=(s,_)=>Number.isFinite(s)&&Math.abs(Number(s)-_)<=1e-10,i=!t||e(t.x,0)&&e(t.y,0)&&e(t.z??0,0),r=!n||e(n.x,1)&&e(n.y,0)&&e(n.z??0,0),o=!a||e(a.x,0)&&e(a.y,1)&&e(a.z??0,0);return i&&r&&o}function Ae(t,n){const a={},e=[t.blocks,t.blockHeaders,t.block_records,t.blockRecords],i=t.tables;e.push(i?.BLOCK,i?.BLOCK_RECORD,i?.blocks);const r={keepRaw:!!n.keepRaw,includeUnknownProperties:!!n.keepRaw};for(const o of e)for(const s of st(o)){const _=s,d=G(_.name??_.blockName??_.name2);if(!d)continue;const c=(Array.isArray(_.entities)?_.entities:Array.isArray(_.ownedObjects)?_.ownedObjects:[]).filter(E=>!!E&&typeof E=="object").map(E=>tn(E,r));Qn(a,{name:d,basePoint:D(_.basePoint??_.origin)??{x:0,y:0},entities:c,raw:n.keepRaw?_:void 0})}return a}function st(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t!="object")return[];const n=t,a=Object.values(n).filter(i=>i&&typeof i=="object"),e=["entries","records","items","values","layers","blocks"].flatMap(i=>Array.isArray(n[i])?n[i]:[]);return e.length>0?e:a}function Pe(t){const n=t.trim()||"/wasm";if(n==="/")return Jt();const a=n.replace(/\/+$/,"");return Te(a)?a:a.startsWith("/")?`${Jt()}${a}`:new URL(a,en()).href.replace(/\/+$/,"")}function zt(t){return new URL("libredwg-web.wasm",nn(t)).href}function nn(t){return t.endsWith("/")?t:`${t}/`}function Te(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)}function en(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"&&location.href?location.href:"http://localhost/"}function Jt(){return typeof location<"u"&&location.origin?location.origin:new URL(en()).origin}async function fe(t){if(typeof fetch!="function")throw new Error("fetch() is not available, so the LibreDWG WASM binary cannot be loaded.");const n=await fetch(t,{credentials:"same-origin",cache:"force-cache"});if(!n.ok)throw new Error(`WASM asset request failed with HTTP ${n.status} for ${t}.`);const a=new Uint8Array(await n.arrayBuffer());if(!he(a)){const e=Re(a),i=n.headers.get("content-type")??"unknown content-type";throw new Error(`Invalid WASM asset at ${t}. Expected bytes 00 61 73 6d, got ${Ce(a)} (${i}). The server probably returned an HTML fallback page instead of libredwg-web.wasm. Response preview: ${e}`)}return a}function he(t){return t.length>=4&&t[0]===0&&t[1]===97&&t[2]===115&&t[3]===109}function Ce(t){return Array.from(t.slice(0,4)).map(n=>n.toString(16).padStart(2,"0")).join(" ")}function Re(t){const n=Array.from(t.slice(0,32)).map(a=>a>=32&&a<=126?String.fromCharCode(a):".").join("");return JSON.stringify(n)}const H=self;H.postMessage({type:"ready"});H.onmessage=async t=>{const n=t.data;if(!n)return;const a=performance.now(),e=i=>{H.postMessage({type:"progress",requestId:n.requestId,progress:i})};try{if(n.type==="warmup"){e({phase:"wasm-init",format:"dwg",message:"Warming LibreDWG WebAssembly instance…"}),await jt(n.options?.wasmPath??"/wasm/"),H.postMessage({type:"warmup-result",requestId:n.requestId,elapsedMs:performance.now()-a});return}if(n.type!=="load")return;e({phase:"worker-ready",format:"dwg",message:"DWG worker received file bytes.",total:n.bytes.byteLength});const i=await oe(new Uint8Array(n.bytes),{...n.options,sourceName:n.fileName,keepRaw:!!n.options?.keepRaw,onProgress:e});i.document.metadata.loaderMode="worker",i.elapsedMs=performance.now()-a,H.postMessage({type:"result",requestId:n.requestId,result:i})}catch(i){const r=Le(i);H.postMessage({type:"error",requestId:n.requestId,error:r})}};function Le(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:{message:String(t)}}var Ct;(function(t){t[t.CP_UTF8=0]="CP_UTF8",t[t.CP_US_ASCII=1]="CP_US_ASCII",t[t.CP_ISO_8859_1=2]="CP_ISO_8859_1",t[t.CP_ISO_8859_2=3]="CP_ISO_8859_2",t[t.CP_ISO_8859_3=4]="CP_ISO_8859_3",t[t.CP_ISO_8859_4=5]="CP_ISO_8859_4",t[t.CP_ISO_8859_5=6]="CP_ISO_8859_5",t[t.CP_ISO_8859_6=7]="CP_ISO_8859_6",t[t.CP_ISO_8859_7=8]="CP_ISO_8859_7",t[t.CP_ISO_8859_8=9]="CP_ISO_8859_8",t[t.CP_ISO_8859_9=10]="CP_ISO_8859_9",t[t.CP_CP437=11]="CP_CP437",t[t.CP_CP850=12]="CP_CP850",t[t.CP_CP852=13]="CP_CP852",t[t.CP_CP855=14]="CP_CP855",t[t.CP_CP857=15]="CP_CP857",t[t.CP_CP860=16]="CP_CP860",t[t.CP_CP861=17]="CP_CP861",t[t.CP_CP863=18]="CP_CP863",t[t.CP_CP864=19]="CP_CP864",t[t.CP_CP865=20]="CP_CP865",t[t.CP_CP869=21]="CP_CP869",t[t.CP_CP932=22]="CP_CP932",t[t.CP_MACINTOSH=23]="CP_MACINTOSH",t[t.CP_BIG5=24]="CP_BIG5",t[t.CP_CP949=25]="CP_CP949",t[t.CP_JOHAB=26]="CP_JOHAB",t[t.CP_CP866=27]="CP_CP866",t[t.CP_ANSI_1250=28]="CP_ANSI_1250",t[t.CP_ANSI_1251=29]="CP_ANSI_1251",t[t.CP_ANSI_1252=30]="CP_ANSI_1252",t[t.CP_GB2312=31]="CP_GB2312",t[t.CP_ANSI_1253=32]="CP_ANSI_1253",t[t.CP_ANSI_1254=33]="CP_ANSI_1254",t[t.CP_ANSI_1255=34]="CP_ANSI_1255",t[t.CP_ANSI_1256=35]="CP_ANSI_1256",t[t.CP_ANSI_1257=36]="CP_ANSI_1257",t[t.CP_ANSI_874=37]="CP_ANSI_874",t[t.CP_ANSI_932=38]="CP_ANSI_932",t[t.CP_ANSI_936=39]="CP_ANSI_936",t[t.CP_ANSI_949=40]="CP_ANSI_949",t[t.CP_ANSI_950=41]="CP_ANSI_950",t[t.CP_ANSI_1361=42]="CP_ANSI_1361",t[t.CP_UTF16=43]="CP_UTF16",t[t.CP_ANSI_1258=44]="CP_ANSI_1258",t[t.CP_UNDEFINED=255]="CP_UNDEFINED"})(Ct||(Ct={}));const ge=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],Rt=t=>ge[t];var Lt;(function(t){t[t.Rotated=0]="Rotated",t[t.Aligned=1]="Aligned",t[t.Angular=2]="Angular",t[t.Diameter=3]="Diameter",t[t.Radius=4]="Radius",t[t.Angular3Point=5]="Angular3Point",t[t.Ordinate=6]="Ordinate",t[t.ReferenceIsExclusive=32]="ReferenceIsExclusive",t[t.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",t[t.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag"})(Lt||(Lt={}));var B;(function(t){t[t.TopLeft=1]="TopLeft",t[t.TopCenter=2]="TopCenter",t[t.TopRight=3]="TopRight",t[t.MiddleLeft=4]="MiddleLeft",t[t.MiddleCenter=5]="MiddleCenter",t[t.MiddleRight=6]="MiddleRight",t[t.BottomLeft=7]="BottomLeft",t[t.BottomCenter=8]="BottomCenter",t[t.BottomRight=9]="BottomRight"})(B||(B={}));var gt;(function(t){t[t.AtLeast=1]="AtLeast",t[t.Exact=2]="Exact"})(gt||(gt={}));var Yt;(function(t){t[t.Center=0]="Center",t[t.Above=1]="Above",t[t.Outside=2]="Outside",t[t.JIS=3]="JIS",t[t.Below=4]="Below"})(Yt||(Yt={}));var vt;(function(t){t[t.Feet=0]="Feet",t[t.None=1]="None",t[t.Inch=2]="Inch",t[t.FeetAndInch=3]="FeetAndInch",t[t.Leading=4]="Leading",t[t.Trailing=8]="Trailing",t[t.LeadingAndTrailing=12]="LeadingAndTrailing"})(vt||(vt={}));var Nt;(function(t){t[t.None=0]="None",t[t.Leading=1]="Leading",t[t.Trailing=2]="Trailing",t[t.LeadingAndTrailing=3]="LeadingAndTrailing"})(Nt||(Nt={}));var St;(function(t){t[t.Center=0]="Center",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.OverFirst=3]="OverFirst",t[t.OverSecond=4]="OverSecond"})(St||(St={}));var pt;(function(t){t[t.Bottom=0]="Bottom",t[t.Center=1]="Center",t[t.Top=2]="Top"})(pt||(pt={}));var Q;(function(t){t[t.PatternFill=0]="PatternFill",t[t.SolidFill=1]="SolidFill"})(Q||(Q={}));var j;(function(t){t[t.NonAssociative=0]="NonAssociative",t[t.Associative=1]="Associative"})(j||(j={}));var Gt;(function(t){t[t.Normal=0]="Normal",t[t.Outer=1]="Outer",t[t.Ignore=2]="Ignore"})(Gt||(Gt={}));var Dt;(function(t){t[t.UserDefined=0]="UserDefined",t[t.Predefined=1]="Predefined",t[t.Custom=2]="Custom"})(Dt||(Dt={}));var yt;(function(t){t[t.NotAnnotated=0]="NotAnnotated",t[t.Annotated=1]="Annotated"})(yt||(yt={}));var at;(function(t){t[t.Solid=0]="Solid",t[t.Gradient=1]="Gradient"})(at||(at={}));var tt;(function(t){t[t.TwoColor=0]="TwoColor",t[t.OneColor=1]="OneColor"})(tt||(tt={}));var Wt;(function(t){t[t.Default=0]="Default",t[t.External=1]="External",t[t.Polyline=2]="Polyline",t[t.Derived=4]="Derived",t[t.Textbox=8]="Textbox",t[t.Outermost=16]="Outermost"})(Wt||(Wt={}));var F;(function(t){t[t.Line=1]="Line",t[t.Circular=2]="Circular",t[t.Elliptic=3]="Elliptic",t[t.Spline=4]="Spline"})(F||(F={}));var mt;(function(t){t[t.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",t[t.CURVE_FIT=2]="CURVE_FIT",t[t.SPLINE_FIT=4]="SPLINE_FIT",t[t.POLYLINE_3D=8]="POLYLINE_3D",t[t.POLYGON_3D=16]="POLYGON_3D",t[t.CLOSED_POLYGON=32]="CLOSED_POLYGON",t[t.POLYFACE=64]="POLYFACE",t[t.CONTINUOUS=128]="CONTINUOUS"})(mt||(mt={}));var Mt;(function(t){t[t.NONE=0]="NONE",t[t.QUADRATIC=5]="QUADRATIC",t[t.CUBIC=6]="CUBIC",t[t.BEZIER=8]="BEZIER"})(Mt||(Mt={}));var xt;(function(t){t[t.NONE=0]="NONE",t[t.MIRRORED_X=2]="MIRRORED_X",t[t.MIRRORED_Y=4]="MIRRORED_Y"})(xt||(xt={}));var nt;(function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT",t[t.ALIGNED=3]="ALIGNED",t[t.MIDDLE=4]="MIDDLE",t[t.FIT=5]="FIT"})(nt||(nt={}));var Ot;(function(t){t[t.BASELINE=0]="BASELINE",t[t.BOTTOM=1]="BOTTOM",t[t.MIDDLE=2]="MIDDLE",t[t.TOP=3]="TOP"})(Ot||(Ot={}));const an=Object.freeze(["ACADMAINTVER","ACADVER","ANGBASE","ANGDIR","ATTMODE","AUNITS","AUPREC","CECOLOR","CELTSCALE","CELTYPE","CELWEIGHT","CEPSNID","CEPSNTYPE","CHAMFERA","CHAMFERB","CHAMFERC","CHAMFERD","CLAYER","CMLJUST","CMLSCALE","CMLSTYLE","CSHADOW","DIMADEC","DIMALT","DIMALTD","DIMALTF","DIMALTRND","DIMALTTD","DIMALTTZ","DIMALTU","DIMALTZ","DIMAPOST","DIMASO","DIMASSOC","DIMASZ","DIMATFIT","DIMAUNIT","DIMAZIN","DIMBLK","DIMBLK1","DIMBLK2","DIMCEN","DIMCLRD","DIMCLRE","DIMCLRT","DIMDEC","DIMDLE","DIMDLI","DIMDSEP","DIMEXE","DIMEXO","DIMFAC","DIMGAP","DIMJUST","DIMLDRBLK","DIMLFAC","DIMLIM","DIMLUNIT","DIMLWD","DIMLWE","DIMPOST","DIMRND","DIMSAH","DIMSCALE","DIMSD1","DIMSD2","DIMSE1","DIMSE2","DIMSHO","DIMSOXD","DIMSTYLE","DIMTAD","DIMTDEC","DIMTFAC","DIMTIH","DIMTIX","DIMTM","DIMTMOVE","DIMTOFL","DIMTOH","DIMTOL","DIMTOLJ","DIMTP","DIMTSZ","DIMTVP","DIMTXSTY","DIMTXT","DIMTZIN","DIMUPT","DIMZIN","DISPSILH","DRAGVS","DWGCODEPAGE","ELEVATION","ENDCAPS","EXTMAX","EXTMIN","EXTNAMES","FILLETRAD","FILLMODE","FINGERPRINTGUID","HALOGAP","HANDSEED","HIDETEXT","HYPERLINKBASE","INDEXCTL","INSBASE","INSUNITS","INTERFERECOLOR","INTERFEREOBJVS","INTERFEREVPVS","INTERSECTIONCOLOR","INTERSECTIONDISPLAY","JOINSTYLE","LIMCHECK","LIMMAX","LIMMIN","LTSCALE","LUNITS","LUPREC","LWDISPLAY","MAXACTVP","MEASUREMENT","MENU","MIRRTEXT","OBSCOLOR","OBSLTYPE","ORTHOMODE","PDMODE","PDSIZE","PELEVATION","PEXTMAX","PEXTMIN","PINSBASE","PLIMCHECK","PLIMMAX","PLIMMIN","PLINEGEN","PLINEWID","PROJECTNAME","PROXYGRAPHICS","PSLTSCALE","PSTYLEMODE","PSVPSCALE","PUCSBASE","PUCSNAME","PUCSORG","PUCSORGBACK","PUCSORGBOTTOM","PUCSORGFRONT","PUCSORGLEFT","PUCSORGRIGHT","PUCSORGTOP","PUCSORTHOREF","PUCSORTHOVIEW","PUCSXDIR","PUCSYDIR","QTEXTMODE","REGENMODE","SHADEDGE","SHADEDIF","SHADOWPLANELOCATION","SKETCHINC","SKPOLY","SORTENTS","SPLINESEGS","SPLINETYPE","SURFTAB1","SURFTAB2","SURFTYPE","SURFU","SURFV","TDCREATE","TDINDWG","TDUCREATE","TDUPDATE","TDUSRTIMER","TDUUPDATE","TEXTSIZE","TEXTSTYLE","THICKNESS","TILEMODE","TRACEWID","TREEDEPTH","UCSBASE","UCSNAME","UCSORG","UCSORGBACK","UCSORGBOTTOM","UCSORGFRONT","UCSORGLEFT","UCSORGRIGHT","UCSORGTOP","UCSORTHOREF","UCSORTHOVIEW","UCSXDIR","UCSYDIR","UNITMODE","USERI1","USERI2","USERI3","USERI4","USERI5","USERR1","USERR2","USERR3","USERR4","USERR5","USRTIMER","VERSIONGUID","VISRETAIN","WORLDVIEW","XCLIPFRAME","XEDIT"]);var wt;(function(t){t[t.NotApplicable=0]="NotApplicable",t[t.KeepExisting=1]="KeepExisting",t[t.UseClone=2]="UseClone",t[t.XrefName=3]="XrefName",t[t.Name=4]="Name",t[t.UnmangleName=5]="UnmangleName"})(wt||(wt={}));const on=[{type:"invalid",hdr:"INVALI",description:"No DWG",version:0},{type:"r1.1",hdr:"MC0.0",description:"MicroCAD Release 1.1",version:0},{type:"r1.2",hdr:"AC1.2",description:"AutoCAD Release 1.2",version:0},{type:"r1.3",hdr:"AC1.3",description:"AutoCAD Release 1.3",version:1},{type:"r1.4",hdr:"AC1.40",description:"AutoCAD Release 1.4",version:2},{type:"r2.0b",hdr:"AC1.50",description:"AutoCAD 2.0 beta",version:3},{type:"r2.0",hdr:"AC1.50",description:"AutoCAD Release 2.0",version:4},{type:"r2.10",hdr:"AC2.10",description:"AutoCAD Release 2.10",version:5},{type:"r2.21",hdr:"AC2.21",description:"AutoCAD Release 2.21",version:6},{type:"r2.22",hdr:"AC2.22",description:"AutoCAD Release 2.22",version:7},{type:"r2.4",hdr:"AC1001",description:"AutoCAD Release 2.4",version:8},{type:"r2.5",hdr:"AC1002",description:"AutoCAD Release 2.5",version:9},{type:"r2.6",hdr:"AC1003",description:"AutoCAD Release 2.6",version:10},{type:"r9",hdr:"AC1004",description:"AutoCAD Release 9",version:11},{type:"r9c1",hdr:"AC1005",description:"AutoCAD Release 9c1",version:12},{type:"r10",hdr:"AC1006",description:"AutoCAD Release 10",version:13},{type:"r11b1",hdr:"AC1007",description:"AutoCAD 11 beta 1",version:14},{type:"r11b2",hdr:"AC1008",description:"AutoCAD 11 beta 2",version:15},{type:"r11",hdr:"AC1009",description:"AutoCAD Release 11/12 (LT R1/R2)",version:16},{type:"r13b1",hdr:"AC1010",description:"AutoCAD pre-R13 a",version:17},{type:"r13b2",hdr:"AC1011",description:"AutoCAD pre-R13 b",version:18},{type:"r13",hdr:"AC1012",description:"AutoCAD Release 13",version:19},{type:"r13c3",hdr:"AC1013",description:"AutoCAD Release 13c3",version:20},{type:"r14",hdr:"AC1014",description:"AutoCAD Release 14",version:21},{type:"r2000b",hdr:"AC1500",description:"AutoCAD 2000 beta",version:22},{type:"r2000",hdr:"AC1015",description:"AutoCAD Release 2000",version:23},{type:"r2000i",hdr:"AC1016",description:"AutoCAD Release 2000i",version:23},{type:"r2002",hdr:"AC1017",description:"AutoCAD Release 2002",version:23},{type:"r2004a",hdr:"AC402a",description:"AutoCAD 2004 alpha a",version:24},{type:"r2004b",hdr:"AC402b",description:"AutoCAD 2004 alpha b",version:24},{type:"r2004c",hdr:"AC1018",description:"AutoCAD 2004 beta",version:24},{type:"r2004",hdr:"AC1018",description:"AutoCAD Release 2004",version:25},{type:"r2007a",hdr:"AC701a",description:"AutoCAD 2007 alpha",version:26},{type:"r2007b",hdr:"AC1021",description:"AutoCAD 2007 beta",version:26},{type:"r2007",hdr:"AC1021",description:"AutoCAD Release 2007",version:27},{type:"r2010b",hdr:"AC1024",description:"AutoCAD 2010 beta",version:28},{type:"r2010",hdr:"AC1024",description:"AutoCAD Release 2010",version:29},{type:"r2013b",hdr:"AC1027",description:"AutoCAD 2013 beta",version:30},{type:"r2013",hdr:"AC1027",description:"AutoCAD Release 2013",version:31},{type:"r2018b",hdr:"AC1032",description:"AutoCAD 2018 beta",version:32},{type:"r2018",hdr:"AC1032",description:"AutoCAD Release 2018",version:33},{type:"r2022b",hdr:"AC103-4",description:"AutoCAD 2022 beta",version:36},{type:"r>2022",hdr:"",description:"AutoCAD Release >2022",version:0}];async function Bt(t={}){const n=Ye(t),a=await import(n),e=a.default??a.createModule??a;if(typeof e!="function")throw new Error(`LibreDWG runtime module at ${n} did not export a createModule function.`);return e(t)}function Ye(t){const n=t.locateFile;if(typeof n=="function")try{const a=n("libredwg-web.js","");if(typeof a=="string"&&a.length>0)return a}catch{}return typeof document<"u"&&document.baseURI?new URL("wasm/libredwg-web.js",document.baseURI).href:typeof location<"u"&&location.href?new URL("/wasm/libredwg-web.js",location.origin).href:"/wasm/libredwg-web.js"}var bt;(function(t){t[t.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",t[t.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT"})(bt||(bt={}));var f;(function(t){t[t.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",t[t.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",t[t.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",t[t.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",t[t.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",t[t.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",t[t.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",t[t.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",t[t.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",t[t.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",t[t.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",t[t.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",t[t.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",t[t.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",t[t.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",t[t.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",t[t.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",t[t.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",t[t.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",t[t.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",t[t.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",t[t.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",t[t.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",t[t.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",t[t.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",t[t.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",t[t.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",t[t.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",t[t.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",t[t.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",t[t.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",t[t.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",t[t.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",t[t.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",t[t.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",t[t.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",t[t.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",t[t.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",t[t.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",t[t.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",t[t.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",t[t.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",t[t.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",t[t.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",t[t.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",t[t.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",t[t.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",t[t.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",t[t.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",t[t.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",t[t.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",t[t.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",t[t.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",t[t.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",t[t.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",t[t.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",t[t.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",t[t.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",t[t.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",t[t.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",t[t.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",t[t.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",t[t.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",t[t.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",t[t.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",t[t.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",t[t.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",t[t.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",t[t.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",t[t.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",t[t.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",t[t.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",t[t.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",t[t.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",t[t.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",t[t.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",t[t.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",t[t.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",t[t.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",t[t.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",t[t.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",t[t.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",t[t.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",t[t.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",t[t.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",t[t.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",t[t.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",t[t.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",t[t.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",t[t.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",t[t.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",t[t.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",t[t.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",t[t.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",t[t.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",t[t.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",t[t.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",t[t.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",t[t.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",t[t.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",t[t.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",t[t.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",t[t.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",t[t.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",t[t.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",t[t.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",t[t.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",t[t.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",t[t.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",t[t.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",t[t.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",t[t.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",t[t.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",t[t.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",t[t.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",t[t.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",t[t.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",t[t.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",t[t.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",t[t.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",t[t.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",t[t.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",t[t.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",t[t.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",t[t.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",t[t.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",t[t.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",t[t.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",t[t.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",t[t.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",t[t.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",t[t.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",t[t.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",t[t.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",t[t.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",t[t.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",t[t.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",t[t.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",t[t.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",t[t.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",t[t.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",t[t.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",t[t.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",t[t.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",t[t.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",t[t.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",t[t.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",t[t.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",t[t.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",t[t.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",t[t.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",t[t.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",t[t.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",t[t.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",t[t.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",t[t.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",t[t.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",t[t.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",t[t.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",t[t.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",t[t.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",t[t.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",t[t.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",t[t.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",t[t.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",t[t.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",t[t.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",t[t.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",t[t.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",t[t.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",t[t.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",t[t.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",t[t.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",t[t.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",t[t.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",t[t.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",t[t.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",t[t.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",t[t.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",t[t.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",t[t.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",t[t.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",t[t.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",t[t.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",t[t.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",t[t.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",t[t.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",t[t.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",t[t.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",t[t.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",t[t.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",t[t.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",t[t.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",t[t.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",t[t.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",t[t.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",t[t.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",t[t.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",t[t.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",t[t.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",t[t.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",t[t.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",t[t.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",t[t.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",t[t.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",t[t.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",t[t.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",t[t.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",t[t.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",t[t.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",t[t.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",t[t.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",t[t.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",t[t.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",t[t.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",t[t.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",t[t.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",t[t.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",t[t.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",t[t.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",t[t.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",t[t.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",t[t.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",t[t.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",t[t.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",t[t.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",t[t.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",t[t.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",t[t.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",t[t.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",t[t.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",t[t.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",t[t.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",t[t.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",t[t.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",t[t.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",t[t.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",t[t.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",t[t.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",t[t.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",t[t.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",t[t.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",t[t.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",t[t.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",t[t.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",t[t.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",t[t.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",t[t.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",t[t.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",t[t.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",t[t.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",t[t.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",t[t.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",t[t.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",t[t.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",t[t.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",t[t.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",t[t.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",t[t.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",t[t.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",t[t.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",t[t.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",t[t.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",t[t.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",t[t.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",t[t.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",t[t.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",t[t.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",t[t.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",t[t.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",t[t.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",t[t.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",t[t.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",t[t.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",t[t.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",t[t.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",t[t.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",t[t.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",t[t.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",t[t.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",t[t.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",t[t.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",t[t.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",t[t.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",t[t.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",t[t.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",t[t.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",t[t.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",t[t.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ"})(f||(f={}));const ve=Object.fromEntries(Object.entries(f).map(([t,n])=>[n,t]));var it;(function(t){t[t.DWG=0]="DWG",t[t.DXF=1]="DXF"})(it||(it={}));var U;(function(t){t[t.Line=1]="Line",t[t.CircularArc=2]="CircularArc",t[t.EllipticArc=3]="EllipticArc",t[t.Spline=4]="Spline"})(U||(U={}));var Ft;(function(t){t[t.ByLayer=192]="ByLayer",t[t.ByBlock=193]="ByBlock",t[t.Entities=194]="Entities",t[t.TrueColor=195]="TrueColor",t[t.ForegroundColor=197]="ForegroundColor",t[t.None=200]="None"})(Ft||(Ft={}));const Ne="*MODEL_SPACE",Se="*PAPER_SPACE",rn=t=>t&&t.toUpperCase()==Ne,pe=t=>t&&t.toUpperCase().startsWith(Se),v=t=>t.toString(16).toUpperCase();class Ge{constructor(n){S(this,"libredwg");S(this,"layers",new Map);S(this,"ltypes",new Map);S(this,"unknownEntityCount");this.libredwg=n,this.unknownEntityCount=0}prepare(n,a=!1){(a||this.layers.size==0)&&(this.layers.clear(),n.tables.LAYER.entries.forEach(e=>{this.layers.set(e.handle,e.name)})),(a||this.ltypes.size==0)&&(this.ltypes.clear(),n.tables.LTYPE.entries.forEach(e=>{this.ltypes.set(e.handle,e.name)})),this.unknownEntityCount=0}clear(){this.layers.clear(),this.ltypes.clear(),this.unknownEntityCount=0}convert(n){const a=this.libredwg,e=a.dwg_object_to_entity(n),i=a.dwg_object_to_entity_tio(n);if(e&&i){const r=this.getCommonAttrs(e),o=a.dwg_object_get_fixedtype(n);if(o==f.DWG_TYPE_3DFACE)return this.convert3dFace(i,r);if(o==f.DWG_TYPE_ARC)return this.convertArc(i,r);if(o==f.DWG_TYPE_ATTDEF)return this.convertAttdef(i,r);if(o==f.DWG_TYPE_CIRCLE)return this.convertCircle(i,r);if(o==f.DWG_TYPE_DIMENSION_ALIGNED||o==f.DWG_TYPE_DIMENSION_LINEAR)return this.convertAlignedDimension(i,r);if(o==f.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(i,r);if(o==f.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(i,r);if(o==f.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(i,r);if(o==f.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(i,r);if(o==f.DWG_TYPE_ELLIPSE)return this.convertEllise(i,r);if(o==f.DWG_TYPE_HATCH)return this.convertHatch(i,r);if(o==f.DWG_TYPE_IMAGE)return this.convertImage(i,r);if(o==f.DWG_TYPE_INSERT)return this.convertInsert(i,r);if(o==f.DWG_TYPE_LEADER)return this.convertLeader(i,r);if(o==f.DWG_TYPE_LINE)return this.convertLine(i,r);if(o==f.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(i,r);if(o==f.DWG_TYPE_MLINE)return this.convertMLine(i,r);if(o==f.DWG_TYPE_MTEXT)return this.convertMText(i,r);if(o==f.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(i,r);if(o==f.DWG_TYPE_OLEFRAME)return this.convertOleFrame(i,r);if(o==f.DWG_TYPE_POINT)return this.convertPoint(i,r);if(o==f.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(i,r,n);if(o==f.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(i,r,n);if(o==f.DWG_TYPE_PROXY_ENTITY)return this.convertProxy(i,r);if(o==f.DWG_TYPE_RAY)return this.convertRay(i,r);if(o==f.DWG_TYPE_SECTIONOBJECT)return this.convertSection(i,r);if(o==f.DWG_TYPE_SOLID)return this.convertSolid(i,r);if(o==f.DWG_TYPE_SPLINE)return this.convertSpline(i,r);if(o==f.DWG_TYPE_TABLE)return this.convertTable(i,r);if(o==f.DWG_TYPE_TEXT)return this.convertText(i,r);if(o==f.DWG_TYPE_TOLERANCE)return this.convertTolerance(i,r);if(o==f.DWG_TYPE_VIEWPORT)return this.convertViewport(i,r);if(o==f.DWG_TYPE_WIPEOUT)return this.convertWipeout(i,r);if(o==f.DWG_TYPE_XLINE)return this.convertXline(i,r);o===f.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,r=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,s=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"invis_flags").data;return{type:"3DFACE",...a,corner1:i,corner2:r,corner3:o,corner4:s,flag:_}}convertArc(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ARC",...a,thickness:o,center:i,radius:r,startAngle:_,endAngle:d,extrusionDirection:s}}convertEmbeddedMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,a,"attachment").data,r=e.dwg_dynapi_subclass_value(n,a,"ins_pt").data,o=e.dwg_dynapi_subclass_value(n,a,"x_axis_dir").data,s=e.dwg_dynapi_subclass_value(n,a,"rect_height").data,_=e.dwg_dynapi_subclass_value(n,a,"rect_width").data,d=e.dwg_dynapi_subclass_value(n,a,"extents_height").data,l=e.dwg_dynapi_subclass_value(n,a,"extents_width").data;return{insertionPoint:r,rectHeight:s,rectWidth:_,extentsHeight:d,extentsWidth:l,attachmentPoint:i,direction:o}}convertAttdef(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"default_value").data,r=this.convertTextBase(n);r.text=i;const o=e.dwg_dynapi_entity_value(n,"prompt").data,s=e.dwg_dynapi_entity_value(n,"tag").data,_=e.dwg_dynapi_entity_value(n,"flags").data,d=e.dwg_dynapi_entity_value(n,"field_length").data,l=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,c=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,E=e.dwg_dynapi_entity_value(n,"is_really_locked").data,u=e.dwg_dynapi_entity_value(n,"mtext_type").data,P=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTDEF",...a,text:this.convertTextBase(n),prompt:o,tag:s,flags:_,fieldLength:d,lockPositionFlag:l>0,duplicateRecordCloningFlag:c>0,mtextFlag:u,isReallyLocked:E>0,alignmentPoint:P,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertAttrib(n,a){const e=this.libredwg,i=this.convertTextBase(n),r=e.dwg_dynapi_entity_value(n,"tag").data,o=e.dwg_dynapi_entity_value(n,"flags").data,s=e.dwg_dynapi_entity_value(n,"field_length").data,_=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,d=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,l=e.dwg_dynapi_entity_value(n,"mtext_type").data,c=e.dwg_dynapi_entity_value(n,"is_really_locked").data,E=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTRIB",...a,text:i,tag:r,flags:o,fieldLength:s,lockPositionFlag:!!_,duplicateRecordCloningFlag:!!d,mtextFlag:l,isReallyLocked:!!c,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...E,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertCircle(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"CIRCLE",...a,thickness:o,center:i,radius:r,extrusionDirection:s}}convertAlignedDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"clone_ins_pt").data,o=e.dwg_dynapi_entity_value(n,"xline1_pt").data,s=e.dwg_dynapi_entity_value(n,"xline2_pt").data,_=e.dwg_dynapi_entity_value(n,"ins_rotation").data,d=e.dwg_dynapi_entity_value(n,"oblique_angle").data;return{subclassMarker:"AcDbAlignedDimension",...a,...i,insertionPoint:r,subDefinitionPoint1:o,subDefinitionPoint2:s,rotationAngle:_??0,obliqueAngle:d}}convert3PointAngularDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"xline1_pt").data,o=e.dwg_dynapi_entity_value(n,"xline2_pt").data,s=e.dwg_dynapi_entity_value(n,"center_pt").data,_=e.dwg_dynapi_entity_value(n,"xline2end_pt").data;return{subclassMarker:"AcDb3PointAngularDimension",...a,...i,subDefinitionPoint1:r,subDefinitionPoint2:o,centerPoint:s,arcPoint:_}}convertDiameterDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbDiametricDimension",...a,...i,centerPoint:r,leaderLength:o}}convertOrdinateDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"feature_location_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_endpt").data;return{subclassMarker:"AcDbOrdinateDimension",...a,...i,subDefinitionPoint1:r,subDefinitionPoint2:o}}convertRadiusDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbRadialDimension",...a,...i,centerPoint:r,leaderLength:o}}convertEllise(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"sm_axis").data,o=e.dwg_dynapi_entity_value(n,"extrusion").data,s=e.dwg_dynapi_entity_value(n,"axis_ratio").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ELLIPSE",...a,center:i,majorAxisEndPoint:r,extrusionDirection:o,axisRatio:s,startAngle:_,endAngle:d}}convertHatch(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"extrusion").data,r=e.dwg_dynapi_entity_value(n,"name").data,o=e.dwg_dynapi_entity_value(n,"is_solid_fill").data,s=e.dwg_dynapi_entity_value(n,"is_associative").data,_=e.dwg_dynapi_entity_value(n,"num_paths").data,d=e.dwg_dynapi_entity_value(n,"paths").data,l=e.dwg_ptr_to_hatch_path_array(d,_),c=e.dwg_dynapi_entity_value(n,"style").data,E=e.dwg_dynapi_entity_value(n,"pattern_type").data,u=e.dwg_dynapi_entity_value(n,"angle").data,P=e.dwg_dynapi_entity_value(n,"scale_spacing").data,A=e.dwg_dynapi_entity_value(n,"num_deflines").data,I=e.dwg_dynapi_entity_value(n,"deflines").data,T=e.dwg_ptr_to_hatch_defline_array(I,A),h=e.dwg_dynapi_entity_value(n,"pixel_size").data,C=e.dwg_dynapi_entity_value(n,"num_seeds").data,R=e.dwg_dynapi_entity_value(n,"seeds").data,L=e.dwg_ptr_to_point2d_array(R,C),Y={...a,extrusionDirection:i,patternName:r,solidFill:o?Q.SolidFill:Q.PatternFill,associativity:s?j.Associative:j.NonAssociative,numberOfBoundaryPaths:_,boundaryPaths:this.convertHatchBoundaryPaths(l),hatchStyle:c,patternType:E,patternAngle:u,patternScale:P,numberOfDefinitionLines:A,definitionLines:T.map(N=>({angle:N.angle,base:N.pt0,offset:N.offset,numberOfDashLengths:N.dashes.length,dashLengths:N.dashes})),pixelSize:h,numberOfSeedPoints:C,seedPoints:L};if(e.dwg_dynapi_entity_value(n,"is_gradient_fill").data>0){const N=e.dwg_dynapi_entity_value(n,"gradient_name").data,x=e.dwg_dynapi_entity_value(n,"gradient_angle").data,O=e.dwg_dynapi_entity_value(n,"gradient_shift").data,m=e.dwg_dynapi_entity_value(n,"gradient_tint").data,M=e.dwg_dynapi_entity_value(n,"single_color_gradient").data,w=e.dwg_dynapi_entity_value(n,"colors").data,b=e.dwg_ptr_to_hatch_gradient_color_array(w,M==1?1:2);return{type:"HATCH",...Y,gradientFlag:at.Gradient,gradientColorFlag:M==1?tt.OneColor:tt.TwoColor,gradientName:N,gradientRotation:x,gradientDefinition:O,colorTint:m,gradientColors:b}}else return{type:"HATCH",...Y}}convertHatchBoundaryPaths(n){return n.filter(e=>e.num_segs_or_paths>0).map(e=>{const i={boundaryPathTypeFlag:e.flag};if(e.flag&2)return{...i,hasBulge:e.bulges_present,isClosed:e.closed,numberOfVertices:e.num_segs_or_paths,vertices:e.polyline_paths.map(r=>({x:r.point.x,y:r.point.y,bulge:r.bulge}))};{const r=e.segs.map(o=>{if(o.curve_type==U.Line)return{type:F.Line,start:o.first_endpoint,end:o.second_endpoint};if(o.curve_type==U.CircularArc)return{type:F.Circular,center:o.center,radius:o.radius,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.EllipticArc)return{type:F.Elliptic,center:o.center,end:o.endpoint,lengthOfMinorAxis:o.minor_major_ratio,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.Spline)return{type:F.Spline,degree:o.degree,isRational:o.is_rational,isPeriodic:o.is_periodic,numberOfKnots:o.num_knots,numberOfControlPoints:o.num_control_points,knots:o.knots,controlPoints:o.control_points,numberOfFitData:o.num_fitpts,fitDatum:o.fitpts,startTangent:o.start_tangent,endTangent:o.end_tangent}});return{...i,numberOfEdges:e.num_segs_or_paths,edges:r}}})}convertImage(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,r=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,s=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,c=e.dwg_dynapi_entity_value(n,"brightness").data,E=e.dwg_dynapi_entity_value(n,"contrast").data,u=e.dwg_dynapi_entity_value(n,"fade").data,P=e.dwg_dynapi_entity_value(n,"clip_mode").data,A=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,I=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,T=e.dwg_dynapi_entity_value(n,"clip_verts").data,h=e.dwg_ptr_to_point3d_array(T,I),C=e.dwg_dynapi_entity_value(n,"imagedef").data,R=v(e.dwg_ref_get_absref(C)),L=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,Y=v(e.dwg_ref_get_absref(L));return{type:"IMAGE",...a,version:i,position:r,uPixel:o,vPixel:s,imageSize:_,imageDefHandle:R,flags:d,clipping:l,brightness:c,contrast:E,fade:u,imageDefReactorHandle:Y,clippingBoundaryType:A,countBoundaryPoints:I,clippingBoundaryPath:h,clipMode:P}}convertInsert(n,a){const e=this.libredwg;let i="";const r=e.dwg_dynapi_entity_value(n,"block_header").data;if(r){const I=e.dwg_ref_get_object(r);if(I){const T=e.dwg_object_to_object_tio(I);T&&(i=e.dwg_entity_block_header_get_block(T).name)}}i||(i=e.dwg_dynapi_entity_value(n,"block_name").data);const o=e.dwg_dynapi_entity_value(n,"ins_pt").data,s=e.dwg_dynapi_entity_value(n,"scale").data,_=e.dwg_dynapi_entity_value(n,"rotation").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"num_rows").data,c=e.dwg_dynapi_entity_value(n,"col_spacing").data,E=e.dwg_dynapi_entity_value(n,"row_spacing").data,u=e.dwg_dynapi_entity_value(n,"extrusion").data,P=e.dwg_entity_insert_get_attribs(n),A=[];return P.forEach(I=>{const T=e.dwg_object_to_entity(I),h=e.dwg_object_to_entity_tio(I);if(T&&h){const C=this.getCommonAttrs(T);e.dwg_object_get_fixedtype(I)==f.DWG_TYPE_ATTRIB&&A.push(this.convertAttrib(h,C))}}),{type:"INSERT",...a,name:i,insertionPoint:o,xScale:s?s.x:1,yScale:s?s.y:1,zScale:s?s.z:1,rotation:_,columnCount:d,rowCount:l,columnSpacing:c,rowSpacing:E,extrusionDirection:u,attribs:A}}convertLeader(n,a){const e=this.libredwg,i=e.dwg_entity_mtext_get_style_name(n),r=e.dwg_dynapi_entity_value(n,"arrowhead_type").data,o=e.dwg_dynapi_entity_value(n,"path_type").data,s=e.dwg_dynapi_entity_value(n,"annot_type").data,_=e.dwg_dynapi_entity_value(n,"hookline_dir").data,d=e.dwg_dynapi_entity_value(n,"hookline_on").data,l=e.dwg_dynapi_entity_value(n,"box_height").data,c=e.dwg_dynapi_entity_value(n,"box_width").data,E=e.dwg_dynapi_entity_value(n,"num_points").data,u=e.dwg_dynapi_entity_value(n,"points").data,P=E>0?e.dwg_ptr_to_point3d_array(u,E):[],A=e.dwg_dynapi_entity_value(n,"byblock_color").data,I=e.dwg_dynapi_entity_value(n,"extrusion").data,T=e.dwg_dynapi_entity_value(n,"x_direction").data,h=e.dwg_dynapi_entity_value(n,"inspt_offset").data,C=e.dwg_dynapi_entity_value(n,"endptproj").data;return{type:"LEADER",...a,styleName:i,isArrowheadEnabled:r>0,isSpline:o>0,leaderCreationFlag:s,isHooklineSameDirection:_>0,isHooklineExists:d>0,textHeight:l,textWidth:c,numberOfVertices:E,vertices:P,byBlockColor:A,normal:I,horizontalDirection:T,offsetFromBlock:h,offsetFromAnnotation:C}}convertLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"start").data,r=e.dwg_dynapi_entity_value(n,"end").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"LINE",...a,thickness:o,startPoint:i,endPoint:r,extrusionDirection:s}}convertLWPolyline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"num_points").data,r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"const_width").data,s=e.dwg_dynapi_entity_value(n,"elevation").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=[],c=e.dwg_dynapi_entity_value(n,"num_points").data,E=e.dwg_dynapi_entity_value(n,"points").data,u=e.dwg_ptr_to_point2d_array(E,c),P=e.dwg_dynapi_entity_value(n,"num_bulges").data,A=e.dwg_dynapi_entity_value(n,"bulges").data,I=e.dwg_ptr_to_double_array(A,P);return u.forEach((T,h)=>{l.push({id:h,x:T.x,y:T.y,bulge:I.length>h?I[h]:0})}),{type:"LWPOLYLINE",...a,numberOfVertices:i,flag:r,constantWidth:o,elevation:s,thickness:_,extrusionDirection:d,vertices:l}}convertMLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"scale").data,r=e.dwg_dynapi_entity_value(n,"flags").data,o=e.dwg_dynapi_entity_value(n,"justification").data,s=e.dwg_dynapi_entity_value(n,"base_point").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"num_lines").data,l=e.dwg_dynapi_entity_value(n,"num_verts").data,c=e.dwg_dynapi_entity_value(n,"verts").data,E=e.dwg_ptr_to_mline_vertex_array(c,l),u=[];return E.forEach(P=>{u.push({vertex:P.vertex,vertexDirection:P.vertex_direction,miterDirection:P.miter_direction,numberOfLines:P.num_lines,lines:P.lines.map(A=>({numberOfSegmentParams:A.num_segparms,segmentParams:A.segparms,numberOfAreaFillParams:A.num_areafillparms,areaFillParams:A.areafillparms}))})}),{type:"MLINE",...a,scale:i,flags:r,justification:o,startPoint:s,extrusionDirection:_,numberOfLines:d,numberOfVertices:l,vertices:u,mlineStyle:""}}convertOle2Frame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"oleversion").data,r=e.dwg_dynapi_entity_value(n,"oleclient").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,s=e.dwg_dynapi_entity_value(n,"pt1").data,_=e.dwg_dynapi_entity_value(n,"pt2").data,d=e.dwg_dynapi_entity_value(n,"lock_aspect").data,l=e.dwg_dynapi_entity_value(n,"type").data,c=e.dwg_dynapi_entity_value(n,"mode").data,E=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLE2FRAME",...a,oleVersion:i,oleClient:r,dataSize:o,leftUpPoint:s,rightDownPoint:_,lockAspect:d,oleObjectType:l,tileModeDescriptor:c,binaryData:E}}convertOleFrame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"flag").data,r=e.dwg_dynapi_entity_value(n,"mode").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,s=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLEFRAME",...a,flag:i,mode:r,dataSize:o,binaryData:s}}convertMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,r=e.dwg_dynapi_entity_value(n,"text_height").data,o=e.dwg_dynapi_entity_value(n,"rect_height").data,s=e.dwg_dynapi_entity_value(n,"rect_width").data,_=e.dwg_dynapi_entity_value(n,"extents_width").data,d=e.dwg_dynapi_entity_value(n,"extents_height").data,l=e.dwg_dynapi_entity_value(n,"attachment").data,c=e.dwg_dynapi_entity_value(n,"flow_dir").data,E=e.dwg_dynapi_entity_value(n,"text").data,u=e.dwg_entity_mtext_get_style_name(n),P=e.dwg_dynapi_entity_value(n,"extrusion").data,A=e.dwg_dynapi_entity_value(n,"x_axis_dir").data,I=e.dwg_dynapi_entity_value(n,"linespace_style").data,T=e.dwg_dynapi_entity_value(n,"linespace_factor").data,h=e.dwg_dynapi_entity_value(n,"bg_fill_flag").data,C=e.dwg_dynapi_entity_value(n,"bg_fill_scale").data,R=e.dwg_dynapi_entity_value(n,"bg_fill_color").data,L=e.dwg_dynapi_entity_value(n,"bg_fill_trans").data,Y=e.dwg_dynapi_entity_value(n,"column_type").data,p=e.dwg_dynapi_entity_value(n,"flow_reversed").data,N=e.dwg_dynapi_entity_value(n,"auto_height").data,x=e.dwg_dynapi_entity_value(n,"column_width").data,O=e.dwg_dynapi_entity_value(n,"gutter").data,m=e.dwg_dynapi_entity_value(n,"num_column_heights").data,M=e.dwg_dynapi_entity_value(n,"column_heights").data,w=e.dwg_ptr_to_double_array(M,m);return{type:"MTEXT",...a,insertionPoint:i,textHeight:r,rectHeight:o,rectWidth:s,extentsHeight:d,extentsWidth:_,attachmentPoint:l,drawingDirection:c,text:E,styleName:u,extrusionDirection:P,direction:A,rotation:0,lineSpacingStyle:I,lineSpacing:T,backgroundFill:h,fillBoxScale:C,backgroundFillColor:R.rgb,backgroundFillTransparency:L,columnType:Y,columnFlowReversed:p,columnAutoHeight:N,columnWidth:x,columnGutter:O,columnHeightCount:m,columnHeights:w}}convertPoint(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"x").data,r=e.dwg_dynapi_entity_value(n,"y").data,o=e.dwg_dynapi_entity_value(n,"z").data,s=e.dwg_dynapi_entity_value(n,"thickness").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"x_ang").data;return{type:"POINT",...a,position:{x:i,y:r,z:o},thickness:s,extrusionDirection:_,angle:d}}convertPolyline2d(n,a,e){const i=this.libredwg,r=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,s=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"elevation").data,l=i.dwg_dynapi_entity_value(n,"thickness").data,c=i.dwg_dynapi_entity_value(n,"extrusion").data,E=i.dwg_entity_polyline_2d_get_vertices(e);return{type:"POLYLINE2D",...a,flag:r,smoothType:o,startWidth:s,endWidth:_,elevation:d,thickness:l,extrusionDirection:c,vertices:E.map(u=>({x:u.point.x,y:u.point.y,z:u.point.z,startWidth:u.start_width,endWidth:u.end_width,bulge:u.bulge,flag:u.flag,tangentDirection:u.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(n,a,e){const i=this.libredwg,r=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,s=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"extrusion").data,l=i.dwg_entity_polyline_3d_get_vertices(e);return{type:"POLYLINE3D",...a,flag:r,smoothType:o,startWidth:s,endWidth:_,extrusionDirection:d,vertices:l.map(c=>({x:c.point.x,y:c.point.y,z:c.point.z,flag:c.flag}))}}convertProxy(n,a){const i=this.libredwg.dwg_dynapi_entity_value(n,"class_id").data;return{type:"PROXY",...a,applicationEntityClassId:i}}convertRay(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,r=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"RAY",...a,firstPoint:i,unitDirection:r}}convertSection(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"state").data,r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"name").data,s=e.dwg_dynapi_entity_value(n,"vert_dir").data,_=e.dwg_dynapi_entity_value(n,"top_height").data,d=e.dwg_dynapi_entity_value(n,"bottom_height").data,l=e.dwg_dynapi_entity_value(n,"indicator_alpha").data,c=e.dwg_dynapi_entity_value(n,"indicator_color").data,E=e.dwg_dynapi_entity_value(n,"num_verts").data,u=e.dwg_dynapi_entity_value(n,"verts").data,P=E>0?e.dwg_ptr_to_point3d_array(u,E):[],A=e.dwg_dynapi_entity_value(n,"num_blverts").data,I=e.dwg_dynapi_entity_value(n,"blverts").data,T=A>0?e.dwg_ptr_to_point3d_array(I,A):[],h=e.dwg_dynapi_entity_value(n,"geometrySettingHardId").data,C=e.dwg_ref_get_handle_absolute_ref(h);return{type:"SECTION",...a,state:i,flags:r,name:o,verticalDirection:s,topHeight:_,bottomHeight:d,indicatorTransparency:l,indicatorColor:c.rgb,numberOfVertices:E,vertices:P,numberOfBackLineVertices:A,backLineVertices:T,geometrySettingHardId:C}}convertSolid(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,r=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,s=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"SOLID",...a,corner1:i,corner2:r,corner3:o,corner4:s,thickness:_,extrusionDirection:d}}convertSpline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"splineflags").data,r=e.dwg_dynapi_entity_value(n,"degree").data,o=e.dwg_dynapi_entity_value(n,"knot_tol").data,s=e.dwg_dynapi_entity_value(n,"num_knots").data,_=e.dwg_dynapi_entity_value(n,"knots").data,d=e.dwg_ptr_to_double_array(_,s),l=e.dwg_dynapi_entity_value(n,"fit_tol").data,c=e.dwg_dynapi_entity_value(n,"num_fit_pts").data,E=e.dwg_dynapi_entity_value(n,"fit_pts").data,u=e.dwg_ptr_to_point3d_array(E,c),P=e.dwg_dynapi_entity_value(n,"weighted").data,A=e.dwg_dynapi_entity_value(n,"ctrl_tol").data,I=e.dwg_dynapi_entity_value(n,"num_ctrl_pts").data,T=e.dwg_dynapi_entity_value(n,"ctrl_pts").data,h=e.dwg_ptr_to_point4d_array(T,I),C=e.dwg_dynapi_entity_value(n,"beg_tan_vec").data,R=e.dwg_dynapi_entity_value(n,"end_tan_vec").data;return{type:"SPLINE",...a,flag:i,degree:r,numberOfKnots:s,numberOfControlPoints:I,numberOfFitPoints:c,knotTolerance:o,controlTolerance:A,fitTolerance:l,startTangent:C,endTangent:R,knots:d,weights:P?h.map(L=>L.w):void 0,controlPoints:h.map(L=>({x:L.x,y:L.y,z:L.z})),fitPoints:u}}convertTable(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,"ldata","name").data,r=e.dwg_dynapi_entity_value(n,"ins_pt").data,o=e.dwg_dynapi_entity_value(n,"horiz_direction").data,s=e.dwg_dynapi_entity_value(n,"flag_for_table_value").data,_=e.dwg_dynapi_entity_value(n,"num_rows").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"row_heights").data,c=e.dwg_ptr_to_double_array(l,_),E=e.dwg_dynapi_entity_value(n,"col_widths").data,u=e.dwg_ptr_to_double_array(E,d),P=e.dwg_dynapi_entity_value(n,"tablestyle").data,A=v(e.dwg_ref_get_absref(P)),I=e.dwg_dynapi_entity_value(n,"block_header").data,T=v(e.dwg_ref_get_absref(I)),h=e.dwg_dynapi_entity_value(n,"table_flag_override").data,C=e.dwg_dynapi_entity_value(n,"border_color_overrides_flag").data,R=e.dwg_dynapi_entity_value(n,"border_lineweight_overrides_flag").data,L=e.dwg_dynapi_entity_value(n,"border_visibility_overrides_flag").data,Y=e.dwg_dynapi_entity_value(n,"num_cells").data,p=e.dwg_dynapi_entity_value(n,"cells").data,N=e.dwg_ptr_to_table_cell_array(p,Y);return{type:"ACAD_TABLE",...a,name:i,startPoint:r,directionVector:o,tableValue:s,rowCount:_,columnCount:d,overrideFlag:h,borderColorOverrideFlag:C,borderLineWeightOverrideFlag:R,borderVisibilityOverrideFlag:L,rowHeightArr:c,columnWidthArr:u,tableStyleId:A,blockRecordHandle:T,cells:this.convertTableCells(N),bmpPreview:""}}convertTableCells(n){const a=[];return n.forEach(e=>({text:e.text_value,attachmentPoint:e.cell_alignment,textStyle:e.text_style,rotation:e.rotation,cellType:e.type,flagValue:e.flags,mergedValue:e.is_merged_value,autoFit:e.is_autofit_flag,topBorderVisibility:e.top_visibility,bottomBorderVisibility:e.bottom_visibility,leftBorderVisibility:e.left_visibility,rightBorderVisibility:e.right_visibility,overrideFlag:e.cell_flag_override,virtualEdgeFlag:e.virtual_edge_flag,blockTableRecordI:e.block_handle.absolute_ref,blockScale:e.block_scale,blockAttrNum:e.attr_defs.length,attrDefineId:e.attr_defs.map(i=>i.attdef.absolute_ref),extendedCellFlags:e.additional_data_flag})),a}convertTextBase(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"text_value").data,i=a.dwg_dynapi_entity_value(n,"thickness").data,r=a.dwg_dynapi_entity_value(n,"ins_pt").data,o=a.dwg_dynapi_entity_value(n,"alignment_pt").data,s=a.dwg_dynapi_entity_value(n,"rotation").data,_=a.dwg_dynapi_entity_value(n,"height").data,d=a.dwg_dynapi_entity_value(n,"width_factor").data,l=a.dwg_dynapi_entity_value(n,"oblique_angle").data,c=a.dwg_entity_text_get_style_name(n),E=a.dwg_dynapi_entity_value(n,"generation").data,u=a.dwg_dynapi_entity_value(n,"horiz_alignment").data,P=a.dwg_dynapi_entity_value(n,"vert_alignment").data,A=a.dwg_dynapi_entity_value(n,"extrusion").data;return{text:e,thickness:i,startPoint:r,endPoint:o,textHeight:_,rotation:s,xScale:d,obliqueAngle:l,styleName:c,generationFlag:E,halign:u,valign:P,extrusionDirection:A}}convertText(n,a){return{type:"TEXT",...a,...this.convertTextBase(n)}}convertTolerance(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,r=e.dwg_dynapi_entity_value(n,"text_value").data,o=e.dwg_dynapi_entity_value(n,"x_direction").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_entity_get_dimstyle_name(n);return{type:"TOLERANCE",...a,styleName:_,insertionPoint:i,text:r,extrusionDirection:s,xAxisDirection:o}}convertViewport(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"width").data,o=e.dwg_dynapi_entity_value(n,"height").data,s=e.dwg_dynapi_entity_value(n,"on_off").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,l=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,c=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,E=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,u=e.dwg_dynapi_entity_value(n,"view_target").data,P=e.dwg_dynapi_entity_value(n,"lens_length").data,A=e.dwg_dynapi_entity_value(n,"front_clip_z").data,I=e.dwg_dynapi_entity_value(n,"back_clip_z").data,T=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,h=e.dwg_dynapi_entity_value(n,"SNAPANG").data,C=e.dwg_dynapi_entity_value(n,"twist_angle").data,R=e.dwg_dynapi_entity_value(n,"circle_zoom").data,L=e.dwg_dynapi_entity_value(n,"status_flag").data,Y=e.dwg_dynapi_entity_value(n,"style_sheet").data,p=e.dwg_dynapi_entity_value(n,"render_mode").data,N=e.dwg_dynapi_entity_value(n,"UCSVP").data,x=e.dwg_dynapi_entity_value(n,"ucsorg").data,O=e.dwg_dynapi_entity_value(n,"ucsxdir").data,m=e.dwg_dynapi_entity_value(n,"ucsydir").data,M=e.dwg_dynapi_entity_value(n,"named_ucs").data,w=e.dwg_ref_get_absref(M),b=e.dwg_dynapi_entity_value(n,"base_ucs").data,V=e.dwg_ref_get_absref(b),K=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"shadeplot_mode").data,k=e.dwg_dynapi_entity_value(n,"use_default_lights").data,J=e.dwg_dynapi_entity_value(n,"default_lighting_type").data,X=e.dwg_dynapi_entity_value(n,"brightness").data,Z=e.dwg_dynapi_entity_value(n,"contrast").data,_t=e.dwg_dynapi_entity_value(n,"grid_major").data,dt=e.dwg_dynapi_entity_value(n,"background").data,lt=e.dwg_ref_get_absref(dt),ct=e.dwg_dynapi_entity_value(n,"shadeplot").data,Et=e.dwg_ref_get_absref(ct),ut=e.dwg_dynapi_entity_value(n,"visualstyle").data,It=e.dwg_ref_get_absref(ut),At=e.dwg_dynapi_entity_value(n,"sun").data,Pt=e.dwg_ref_get_absref(At);return{type:"VIEWPORT",...a,viewportCenter:i,width:r,height:o,status:s,viewportId:0,displayCenter:_,snapBase:d,snapSpacing:l,gridSpacing:c,viewDirection:E,targetPoint:u,perspectiveLensLength:P,frontClipZ:A,backClipZ:I,viewHeight:T,snapAngle:h,viewTwistAngle:C,circleZoomPercent:R,statusBitFlags:L,sheetName:Y,renderMode:p,ucsPerViewport:N,ucsOrigin:x,ucsXAxis:O,ucsYAxis:m,ucsId:v(w),ucsBaseId:v(V),orthographicType:K,elevation:$,shadePlotMode:z,majorGridFrequency:_t,backgroundId:v(lt),shadePlotId:v(Et),visualStyleId:v(It),isDefaultLighting:!!k,defaultLightingType:J,brightness:X,contrast:Z,sunId:v(Pt)}}convertWipeout(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,r=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,s=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,c=e.dwg_dynapi_entity_value(n,"brightness").data,E=e.dwg_dynapi_entity_value(n,"contrast").data,u=e.dwg_dynapi_entity_value(n,"fade").data,P=e.dwg_dynapi_entity_value(n,"clip_mode").data,A=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,I=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,T=e.dwg_dynapi_entity_value(n,"clip_verts").data,h=e.dwg_ptr_to_point2d_array(T,I),C=e.dwg_dynapi_entity_value(n,"imagedef").data,R=e.dwg_ref_get_absref(C),L=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,Y=e.dwg_ref_get_absref(L);return{type:"WIPEOUT",...a,version:i,position:r,uPixel:o,vPixel:s,imageSize:_,imageDefHandle:R,flags:d,clipping:l,brightness:c,contrast:E,fade:u,imageDefReactorHandle:Y,clippingBoundaryType:A,countBoundaryPoints:I,clippingBoundaryPath:h,clipMode:P}}convertXline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,r=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"XLINE",...a,firstPoint:i,unitDirection:r}}getDimensionCommonAttrs(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"class_version").data,i=a.dwg_entity_get_block_name(n,"block"),r=a.dwg_dynapi_entity_value(n,"def_pt").data,o=a.dwg_dynapi_entity_value(n,"text_midpt").data,s=a.dwg_dynapi_entity_value(n,"attachmentPoint").data,_=a.dwg_dynapi_entity_value(n,"flag").data,d=a.dwg_dynapi_entity_value(n,"lspace_factor").data,l=a.dwg_dynapi_entity_value(n,"lspace_factor").data,c=a.dwg_dynapi_entity_value(n,"act_measurement").data,E=a.dwg_dynapi_entity_value(n,"user_text").data,u=a.dwg_dynapi_entity_value(n,"text_rotation").data,P=a.dwg_dynapi_entity_value(n,"ins_rotation").data,A=a.dwg_dynapi_entity_value(n,"extrusion").data,I=a.dwg_entity_get_dimstyle_name(n);return{type:"DIMENSION",version:e,name:i,definitionPoint:r,textPoint:o,dimensionType:_,attachmentPoint:s,textLineSpacingStyle:d,textLineSpacingFactor:l||1,measurement:c,text:E,textRotation:u,ocsRotation:P,extrusionDirection:A,styleName:I}}getCommonAttrs(n){const a=this.libredwg,e=a.dwg_object_entity_get_color_object(n),i=e.method,r=e.index;let o;(i==194||(e.rgb>>>24&255)===194)&&(o=e.rgb&16777215);const s=this.getLayerName(n),_=a.dwg_object_entity_get_handle_object(n),d=a.dwg_object_entity_get_ownerhandle_object(n),l=a.dwg_object_entity_get_xdicobjhandle_object(n),c=this.getLtypeName(n),E=a.dwg_object_entity_get_line_weight(n),u=a.dwg_object_entity_get_ltype_scale(n),P=!a.dwg_object_entity_get_invisible(n),A=a.dwg_object_entity_get_xdata(n);return{handle:v(_.value),ownerDictionaryHardId:v(l.absolute_ref),ownerBlockRecordSoftId:v(d.absolute_ref),layer:s,color:o,colorIndex:r,colorName:e.name,lineType:c,lineweight:E,lineTypeScale:u,isVisible:P,transparency:e.alpha,transparencyType:e.alpha_type,xdata:A}}getLayerName(n){const e=this.libredwg.dwg_object_entity_get_layer_object_ref(n);return this.layers.get(v(e.handleref.value))??"0"}getLtypeName(n){const e=this.libredwg.dwg_object_entity_get_ltype_object_ref(n);return this.ltypes.get(v(e.handleref.value))??""}}class Zt{constructor(n){S(this,"libredwg");S(this,"entityConverter");this.libredwg=n,this.entityConverter=new Ge(n)}convert(n){this.entityConverter.clear();const a={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],IMAGEDEF:[],LAYOUT:[],SPATIAL_FILTER:[]},header:{},entities:[],classes:[]},e=this.libredwg;this.convertHeader(n,a.header),this.convertClasses(n,a.classes);const i=e.dwg_get_num_objects(n);for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o);if(s){const _=e.dwg_object_to_object_tio(s);if(_)switch(e.dwg_object_get_fixedtype(s)){case f.DWG_TYPE_LAYER:{const l=this.convertLayer(_,s);a.tables.LAYER.entries.push(l),this.entityConverter.layers.set(l.handle,l.name)}break;case f.DWG_TYPE_LTYPE:{const l=this.convertLineType(_,s);a.tables.LTYPE.entries.push(l),this.entityConverter.ltypes.set(l.handle,l.name)}break}}}for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o);if(s){const _=e.dwg_object_to_object_tio(s);if(_)switch(e.dwg_object_get_fixedtype(s)){case f.DWG_TYPE_APPID:a.tables.APPID.entries.push(this.convertAppId(_));break;case f.DWG_TYPE_BLOCK_HEADER:{const l=this.convertBlockRecord(_,s);a.tables.BLOCK_RECORD.entries.push(l),(rn(l.name)||pe(l.name))&&l.entities.forEach(c=>{a.entities.push(c),c.type==="INSERT"&&c.attribs.forEach(E=>{a.entities.push(E)})})}break;case f.DWG_TYPE_DIMSTYLE:a.tables.DIMSTYLE.entries.push(this.convertDimStyle(_,s));break;case f.DWG_TYPE_STYLE:a.tables.STYLE.entries.push(this.convertStyle(_,s));break;case f.DWG_TYPE_VPORT:a.tables.VPORT.entries.push(this.convertViewport(_,s));break;case f.DWG_TYPE_DICTIONARY:a.objects.DICTIONARY.push(this.convertDictionary(_,s));break;case f.DWG_TYPE_IMAGEDEF:a.objects.IMAGEDEF.push(this.convertImageDef(_,s));break;case f.DWG_TYPE_LAYOUT:a.objects.LAYOUT.push(this.convertLayout(_,s));break;case f.DWG_TYPE_SPATIAL_FILTER:a.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(_,s));break}}}const r=a.entities.filter(o=>o.type==="VIEWPORT");return r.sort((o,s)=>{const _=parseInt(o.handle,16),d=parseInt(s.handle,16);return _-d}),r.forEach((o,s)=>{o.viewportId=s+1}),a}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}convertHeader(n,a){const e=this.libredwg;an.forEach(i=>{let r=i;(i=="DIMBLK"||i=="DIMBLK1"||i=="DIMBLK2")&&(r=r+"_T");let o=e.dwg_dynapi_header_value(n,r).data;i=="CELTYPE"||i=="CLAYER"||i=="CLAYER"||i=="DIMSTYLE"||i=="DIMTXSTY"||i=="TEXTSTYLE"?o=o?e.dwg_ref_get_object_name(o):"":i=="DRAGVS"&&(o=o?e.dwg_ref_get_absref(o):2),a[i]=o})}convertClasses(n,a){const e=this.libredwg,i=e.dwg_get_num_classes(n);for(let r=0;r<i;r++){const o=e.dwg_get_class(n,r);a.push({dxfName:o.dxfname,cppName:o.cppname,appName:o.appname,capabilitiesFlag:o.proxyflag,instanceCount:o.num_instances,wasAProxyFlag:o.s_zombie,isAnEntityFlag:o.item_class_id===498})}}convertAppId(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"name").data,i=a.dwg_dynapi_entity_value(n,"flag").data;return{name:e,standardFlag:i}}convertBlockRecord(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_entity_block_header_get_block(n);r.name&&(i.name=r.name);const o=e.dwg_dynapi_entity_value(n,"num_owned").data,s=e.dwg_dynapi_entity_value(n,"flag").data,_=e.dwg_dynapi_entity_value(n,"description").data,d=e.dwg_dynapi_entity_value(n,"base_pt").data,l=e.dwg_dynapi_entity_value(n,"insert_units").data,c=e.dwg_dynapi_entity_value(n,"explodable").data,E=e.dwg_dynapi_entity_value(n,"block_scaling").data,u=e.dwg_dynapi_entity_value(n,"layout").data,P=v(e.dwg_ref_get_absref(u));let A="";const I=C=>{const R=new Array(C.length);for(let L=0;L<C.length;L++)R[L]=C[L].toString(16).toUpperCase();return R.join("")},T=e.dwg_entity_block_header_get_preview(n);T&&T.length>0&&(A=I(T));let h=this.convertEntities(a,i.handle);if(!h||h.length==0){h=[];const C=e.dwg_dynapi_entity_value(n,"entities").data;if(C){const R=e.dwg_ptr_to_object_ref_ptr_array(C,o),L=this.entityConverter;for(let Y=0;Y<o;Y++){const p=e.dwg_ref_get_object(R[Y]),N=L.convert(p);N&&(N.ownerBlockRecordSoftId=i.handle,h.push(N))}}}return{...i,flags:s,description:_,basePoint:d,layout:P,insertionUnits:l,explodability:c,scalability:E,bmpPreview:A,entities:h}}convertEntities(n,a){const e=this.libredwg,i=this.entityConverter,r=[];let o=e.get_first_owned_entity(n);for(;o;){const s=i.convert(o);s&&(s.ownerBlockRecordSoftId=a,r.push(s)),o=e.get_next_owned_entity(n,o)}return r}convertDimStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"DIMTOL").data,o=e.dwg_dynapi_entity_value(n,"DIMLIM").data,s=e.dwg_dynapi_entity_value(n,"DIMTIH").data,_=e.dwg_dynapi_entity_value(n,"DIMTOH").data,d=e.dwg_dynapi_entity_value(n,"DIMSE1").data,l=e.dwg_dynapi_entity_value(n,"DIMSE2").data,c=e.dwg_dynapi_entity_value(n,"DIMALT").data,E=e.dwg_dynapi_entity_value(n,"DIMTOFL").data,u=e.dwg_dynapi_entity_value(n,"DIMSAH").data,P=e.dwg_dynapi_entity_value(n,"DIMTIX").data,A=e.dwg_dynapi_entity_value(n,"DIMSOXD").data,I=e.dwg_dynapi_entity_value(n,"DIMALTD").data,T=e.dwg_dynapi_entity_value(n,"DIMZIN").data,h=e.dwg_dynapi_entity_value(n,"DIMSD1").data,C=e.dwg_dynapi_entity_value(n,"DIMSD2").data,R=e.dwg_dynapi_entity_value(n,"DIMTOLJ").data,L=e.dwg_dynapi_entity_value(n,"DIMJUST").data,Y=e.dwg_dynapi_entity_value(n,"DIMFIT").data,p=e.dwg_dynapi_entity_value(n,"DIMUPT").data,N=e.dwg_dynapi_entity_value(n,"DIMTZIN").data,x=e.dwg_dynapi_entity_value(n,"DIMALTZ").data,O=e.dwg_dynapi_entity_value(n,"DIMALTTZ").data,m=e.dwg_dynapi_entity_value(n,"DIMTAD").data,M=e.dwg_dynapi_entity_value(n,"DIMUNIT").data,w=e.dwg_dynapi_entity_value(n,"DIMAUNIT").data,b=e.dwg_dynapi_entity_value(n,"DIMDEC").data,V=e.dwg_dynapi_entity_value(n,"DIMTDEC").data,K=e.dwg_dynapi_entity_value(n,"DIMALTU").data,$=e.dwg_dynapi_entity_value(n,"DIMALTTD").data,z=e.dwg_dynapi_entity_value(n,"DIMSCALE").data,k=e.dwg_dynapi_entity_value(n,"DIMASZ").data,J=e.dwg_dynapi_entity_value(n,"DIMEXO").data,X=e.dwg_dynapi_entity_value(n,"DIMDLI").data,Z=e.dwg_dynapi_entity_value(n,"DIMEXE").data,_t=e.dwg_dynapi_entity_value(n,"DIMRND").data,dt=e.dwg_dynapi_entity_value(n,"DIMDLE").data,lt=e.dwg_dynapi_entity_value(n,"DIMTP").data,ct=e.dwg_dynapi_entity_value(n,"DIMTM").data,Et=e.dwg_dynapi_entity_value(n,"DIMFXL").data,ut=e.dwg_dynapi_entity_value(n,"DIMJOGANG").data,It=e.dwg_dynapi_entity_value(n,"DIMTFILL").data,At=e.dwg_dynapi_entity_value(n,"DIMTFILLCLR").data,Pt=e.dwg_dynapi_entity_value(n,"DIMAZIN").data,sn=e.dwg_dynapi_entity_value(n,"DIMARCSYM").data,_n=e.dwg_dynapi_entity_value(n,"DIMTXT").data,dn=e.dwg_dynapi_entity_value(n,"DIMCEN").data,ln=e.dwg_dynapi_entity_value(n,"DIMTSZ").data,cn=e.dwg_dynapi_entity_value(n,"DIMALTF").data,En=e.dwg_dynapi_entity_value(n,"DIMLFAC").data,un=e.dwg_dynapi_entity_value(n,"DIMTVP").data,In=e.dwg_dynapi_entity_value(n,"DIMTFAC").data,An=e.dwg_dynapi_entity_value(n,"DIMGAP").data,Pn=e.dwg_dynapi_entity_value(n,"DIMPOST").data,Tn=e.dwg_dynapi_entity_value(n,"DIMAPOST").data,fn=e.dwg_dynapi_entity_value(n,"DIMBLK_T").data,hn=e.dwg_dynapi_entity_value(n,"DIMBLK1_T").data,Cn=e.dwg_dynapi_entity_value(n,"DIMBLK2_T").data,Rn=e.dwg_dynapi_entity_value(n,"DIMALTRND").data,Ln=e.dwg_dynapi_entity_value(n,"DIMCLRD_N").data,gn=e.dwg_dynapi_entity_value(n,"DIMCLRE_N").data,Yn=e.dwg_dynapi_entity_value(n,"DIMCLRT_N").data,vn=e.dwg_dynapi_entity_value(n,"DIMCLRD").data,Nn=e.dwg_dynapi_entity_value(n,"DIMCLRE").data,Sn=e.dwg_dynapi_entity_value(n,"DIMCLRT").data,pn=e.dwg_dynapi_entity_value(n,"DIMADEC").data,Gn=e.dwg_dynapi_entity_value(n,"DIMFRAC").data,Dn=e.dwg_dynapi_entity_value(n,"DIMLUNIT").data,yn=e.dwg_dynapi_entity_value(n,"DIMDSEP").data,Wn=e.dwg_dynapi_entity_value(n,"DIMTMOVE").data,mn=e.dwg_dynapi_entity_value(n,"DIMATFIT").data,Mn=e.dwg_dynapi_entity_value(n,"DIMFXLON").data,xn=e.dwg_dynapi_entity_value(n,"DIMTXTDIRECTION").data,On=e.dwg_dynapi_entity_value(n,"DIMALTMZF").data,wn=e.dwg_dynapi_entity_value(n,"DIMALTMZS").data,Bn=e.dwg_dynapi_entity_value(n,"DIMMZF").data,bn=e.dwg_dynapi_entity_value(n,"DIMMZS").data,Fn=e.dwg_dynapi_entity_value(n,"DIMLWD").data,Un=e.dwg_dynapi_entity_value(n,"DIMLWE").data,kn=e.dwg_dynapi_entity_value(n,"DIMTXSTY").data,Xn=e.dwg_ref_get_absref(kn),Hn=e.dwg_dynapi_entity_value(n,"DIMLDRBLK").data,Vn=e.dwg_ref_get_absref(Hn);return{...i,DIMPOST:Pn,DIMAPOST:Tn,DIMBLK:fn,DIMBLK1:hn,DIMBLK2:Cn,DIMSCALE:z,DIMASZ:k,DIMEXO:J,DIMDLI:X,DIMEXE:Z,DIMRND:_t,DIMDLE:dt,DIMTP:lt,DIMTM:ct,DIMTXT:_n,DIMCEN:dn,DIMTSZ:ln,DIMALTF:cn,DIMLFAC:En,DIMTVP:un,DIMTFAC:In,DIMGAP:An,DIMALTRND:Rn,DIMTOL:r,DIMLIM:o,DIMTIH:s,DIMTOH:_,DIMSE1:d,DIMSE2:l,DIMTAD:m,DIMZIN:T,DIMAZIN:Pt,DIMALT:c,DIMALTD:I,DIMTOFL:E,DIMSAH:u,DIMTIX:P,DIMSOXD:A,DIMCLRD:vn,DIMCLRE:Nn,DIMCLRT:Sn,DIMADEC:pn,DIMUNIT:M,DIMDEC:b,DIMTDEC:V,DIMALTU:K,DIMALTTD:$,DIMAUNIT:w,DIMFRAC:Gn,DIMLUNIT:Dn,DIMDSEP:String.fromCharCode(yn),DIMTMOVE:Wn,DIMJUST:L,DIMSD1:h,DIMSD2:C,DIMTOLJ:R,DIMTZIN:N,DIMALTZ:x,DIMALTTZ:O,DIMFIT:Y,DIMUPT:p,DIMATFIT:mn,DIMTXSTY:Xn,DIMLDRBLK:Vn,DIMLWD:Fn,DIMLWE:Un,DIMFXL:Et,DIMJOGANG:ut,DIMTFILL:It,DIMTFILLCLR:At,DIMARCSYM:sn,DIMCLRD_N:Ln,DIMCLRE_N:gn,DIMCLRT_N:Yn,DIMFXLON:Mn,DIMTXTDIRECTION:xn,DIMALTMZF:On,DIMALTMZS:wn,DIMMZF:Bn,DIMMZS:bn}}convertLayer(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"frozen").data,s=e.dwg_dynapi_entity_value(n,"off").data,_=e.dwg_dynapi_entity_value(n,"frozen_in_new").data,d=e.dwg_dynapi_entity_value(n,"plotflockedlag").data,l=e.dwg_dynapi_entity_value(n,"plotflag").data,c=e.dwg_dynapi_entity_value(n,"linewt").data,E=e.dwg_dynapi_entity_value(n,"color").data,u=e.dwg_dynapi_entity_value(n,"ltype").data;let P="Continuous";if(u)try{P=e.dwg_ref_get_object_name(u)}catch{}const A=E.method;let I=256,T=16777215;return A===195||(E.rgb>>>24&255)===195?I=E.rgb&255:A==194||(E.rgb>>>24&255)===194?T=E.rgb&16777215:E.index>=1&&E.index<=255&&(I=E.index),{...i,standardFlag:r,colorIndex:I,color:T,colorName:E.name,transparency:E.alpha,lineType:P,frozen:o!=0,off:s!=0,frozenInNew:_!=0,locked:d!=0,plotFlag:l,lineweight:c,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"description").data,s=e.dwg_dynapi_entity_value(n,"numdashes").data,_=e.dwg_dynapi_entity_value(n,"pattern_len").data,d=e.dwg_dynapi_entity_value(n,"dashes").data,l=d?e.dwg_ptr_to_ltype_dash_array(d,s):[];return{...i,description:o,standardFlag:r,numberOfLineTypes:s,totalPatternLength:_,pattern:this.convertLineTypePattern(l)}}convertLineTypePattern(n){const a=[];return n.forEach(e=>{a.push({elementLength:e.length||0,elementTypeFlag:e.complex_shapecode,shapeNumber:e.shape_flag,scale:e.scale,rotation:e.rotation,offsetX:e.x_offset,offsetY:e.y_offset,text:e.text})}),a}convertStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"width_factor").data,s=e.dwg_dynapi_entity_value(n,"oblique_angle").data,_=e.dwg_dynapi_entity_value(n,"generation").data,d=e.dwg_dynapi_entity_value(n,"last_height").data,l=e.dwg_dynapi_entity_value(n,"font_file").data,c=e.dwg_dynapi_entity_value(n,"bigfont_file").data;return{...i,standardFlag:r,fixedTextHeight:0,widthFactor:o,obliqueAngle:s,textGenerationFlag:_,lastHeight:d,font:l,bigFont:c}}convertViewport(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,s=e.dwg_dynapi_entity_value(n,"aspect_ratio").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"view_target").data,l=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,c=e.dwg_dynapi_entity_value(n,"view_twist").data,E=e.dwg_dynapi_entity_value(n,"lens_length").data,u=e.dwg_dynapi_entity_value(n,"front_clip_z").data,P=e.dwg_dynapi_entity_value(n,"back_clip_z").data,A=e.dwg_dynapi_entity_value(n,"VIEWMODE").data,I=e.dwg_dynapi_entity_value(n,"render_mode").data,T=e.dwg_dynapi_entity_value(n,"use_default_lights").data!=0,h=e.dwg_dynapi_entity_value(n,"default_lightning_type").data,C=e.dwg_dynapi_entity_value(n,"brightness").data,R=e.dwg_dynapi_entity_value(n,"contrast").data,L=e.dwg_dynapi_entity_value(n,"ambient_color").data,Y=e.dwg_dynapi_entity_value(n,"lower_left").data,p=e.dwg_dynapi_entity_value(n,"upper_right").data,N=e.dwg_dynapi_entity_value(n,"circle_zoom").data,x=e.dwg_dynapi_entity_value(n,"UCSICON").data,O=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,m=e.dwg_dynapi_entity_value(n,"SNAPANG").data,M=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,w=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,b=e.dwg_dynapi_entity_value(n,"ucsorg").data,V=e.dwg_dynapi_entity_value(n,"ucsxdir").data,K=e.dwg_dynapi_entity_value(n,"ucsydir").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"grid_major").data,k=e.dwg_dynapi_entity_value(n,"background").data,J=k?v(e.dwg_ref_get_absref(k)):void 0,X=e.dwg_dynapi_entity_value(n,"visualstyle").data,Z=X?v(e.dwg_ref_get_absref(X)):void 0;return{...i,standardFlag:r,lowerLeftCorner:Y,upperRightCorner:p,center:_,snapBasePoint:M,snapSpacing:w,gridSpacing:O,viewDirectionFromTarget:l,viewTarget:d,lensLength:E,frontClippingPlane:u,backClippingPlane:P,viewHeight:o,aspectRatio:s,snapRotationAngle:m,viewTwistAngle:c,circleSides:N,frozenLayers:[],styleSheet:"",renderMode:I,viewMode:A,ucsIconSetting:x,ucsOrigin:b,ucsXAxis:V,ucsYAxis:K,orthographicType:0,elevation:$,shadePlotSetting:0,majorGridLines:z,backgroundObjectId:J,visualStyleObjectId:Z,isDefaultLightingOn:T,defaultLightingType:h,brightness:C,contrast:R,ambientColor:L.index}}getCommonTableEntryAttrs(n,a){const e=this.libredwg,i=e.dwg_object_get_tio(a),r=e.dwg_object_object_get_ownerhandle_object(i),o=e.dwg_object_get_handle_object(a);return{handle:v(o.value),ownerHandle:v(r.absolute_ref),name:e.dwg_dynapi_entity_value(n,"name").data}}convertDictionary(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"is_hardowner").data,o=e.dwg_dynapi_entity_value(n,"cloning").data,s=e.dwg_dynapi_entity_value(n,"numitems").data,_=e.dwg_dynapi_entity_value(n,"itemhandles").data,d=e.dwg_ptr_to_object_ref_array(_,s),l=e.dwg_object_dictionary_get_texts(a),c={};return d.forEach((E,u)=>c[l[u]]=v(E.absolute_ref)),{...i,isHardOwner:!!r,cloningFlag:o,entries:c}}convertImageDef(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"image_size").data,o=e.dwg_dynapi_entity_value(n,"file_path").data,s=e.dwg_dynapi_entity_value(n,"is_loaded").data,_=e.dwg_dynapi_entity_value(n,"pixel_size").data,d=e.dwg_dynapi_entity_value(n,"resunits").data;return{...i,fileName:o,size:r,sizeOfOnePixel:_,isLoaded:s,resolutionUnits:d}}convertLayout(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"layout_name").data,o=e.dwg_dynapi_entity_value(n,"tab_order").data,s=e.dwg_dynapi_entity_value(n,"layout_flags").data,_=e.dwg_dynapi_entity_value(n,"INSBASE").data,d=e.dwg_dynapi_entity_value(n,"LIMMIN").data,l=e.dwg_dynapi_entity_value(n,"LIMMAX").data,c=e.dwg_dynapi_entity_value(n,"UCSORG").data,E=e.dwg_dynapi_entity_value(n,"UCSXDIR").data,u=e.dwg_dynapi_entity_value(n,"UCSYDIR").data,P=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,A=e.dwg_dynapi_entity_value(n,"EXTMIN").data,I=e.dwg_dynapi_entity_value(n,"EXTMAX").data,T=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,h=e.dwg_dynapi_entity_value(n,"block_header").data,C=v(e.dwg_ref_get_absref(h)),R=e.dwg_dynapi_entity_value(n,"active_viewport").data,L=v(e.dwg_ref_get_absref(R)),Y=e.dwg_dynapi_entity_value(n,"named_ucs").data,p=Y?v(e.dwg_ref_get_absref(Y)):void 0;return{...i,layoutName:r,controlFlag:s,tabOrder:o,minLimit:d,maxLimit:l,insertionPoint:_,minExtent:A,maxExtent:I,elevation:T,ucsOrigin:c,ucsXAxis:E,ucsYAxis:u,orthographicType:P,paperSpaceTableId:C,viewportId:L,namedUcsId:p,shadePlotId:""}}convertSpatialFilter(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"origin").data,o=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,s=e.dwg_dynapi_entity_value(n,"clip_verts").data,_=e.dwg_ptr_to_point2d_array(s,o),d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=e.dwg_dynapi_entity_value(n,"display_boundary_on").data,c=e.dwg_dynapi_entity_value(n,"front_clip_on").data,E=e.dwg_dynapi_entity_value(n,"front_clip_z").data,u=e.dwg_dynapi_entity_value(n,"back_clip_on").data,P=e.dwg_dynapi_entity_value(n,"back_clip_z").data,A=e.dwg_dynapi_entity_value(n,"transform").data,I=e.dwg_ptr_to_double_array(A,12),T=e.dwg_dynapi_entity_value(n,"inverse_transform").data,h=e.dwg_ptr_to_double_array(T,12);return{...i,origin:r,numberOfPointsOnClipBoundary:o,vertices:_,extrusionDirection:d,clipBoundaryVisible:!!l,frontClippingPlaneFlag:!!c,frontClippingPlaneDistance:E,backClippingPlaneFlag:!!u,backClippingPlaneDistance:P,matrix:I,invertBlockMatrix:h}}getCommonObjectAttrs(n){const a=this.libredwg,e=a.dwg_object_get_tio(n),i=a.dwg_object_object_get_ownerhandle_object(e),r=a.dwg_object_get_handle_object(n);return{handle:v(r.value),ownerHandle:v(i.absolute_ref)}}}class y{constructor(){S(this,"min");S(this,"max");S(this,"valid");this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(n){return this.min.x=Math.min(this.min.x,n.x),this.min.y=Math.min(this.min.y,n.y),this.max.x=Math.max(this.max.x,n.x),this.max.y=Math.max(this.max.y,n.y),this.valid=!0,this}transform(n,a){const e=this.getCorners().map(i=>({x:i.x*n.x+a.x,y:i.y*n.y+a.y}));this.reset();for(const i of e)this.expandByPoint(i);return this}rotate(n,a){const e=Math.cos(n),i=Math.sin(n),r=this.getCorners().map(o=>{const s=o.x-a.x,_=o.y-a.y;return{x:a.x+s*e-_*i,y:a.y+s*i+_*e}});this.reset();for(const o of r)this.expandByPoint(o);return this}clone(){const n=new y;return n.min={x:this.min.x,y:this.min.y},n.max={x:this.max.x,y:this.max.y},n.valid=this.valid,n}reset(){this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}getCorners(){return[{x:this.min.x,y:this.min.y},{x:this.min.x,y:this.max.y},{x:this.max.x,y:this.min.y},{x:this.max.x,y:this.max.y}]}}function De(t,n,a,e,i){const r=a.length;if(r===0)throw new Error("points must not be empty");const o=a[0].length;if(t<0||t>1)throw new Error(`t out of bounds [0,1]: ${t}`);if(n<1)throw new Error("degree must be at least 1 (linear)");if(n>r-1)throw new Error("degree must be less than or equal to point count - 1");const s=i??new Array(r).fill(1),_=e??(()=>{const A=[];for(let I=0;I<r+n+1;I++)A.push(I);return A})();if(_.length!==r+n+1)throw new Error("bad knot vector length");const d=[n,_.length-1-n],l=_[d[0]],c=_[d[1]];t=t*(c-l)+l,t=Math.max(t,l),t=Math.min(t,c);let E=d[0];for(;E<d[1]&&!(t>=_[E]&&t<=_[E+1]);E++);const u=new Array(r);for(let A=0;A<r;A++){u[A]=new Array(o+1);for(let I=0;I<o;I++)u[A][I]=a[A][I]*s[A];u[A][o]=s[A]}for(let A=1;A<=n+1;A++)for(let I=E;I>E-n-1+A;I--){const T=_[I+n+1-A]-_[I],h=T===0?0:(t-_[I])/T;for(let C=0;C<o+1;C++)u[I][C]=(1-h)*u[I-1][C]+h*u[I][C]}const P=new Array(o);for(let A=0;A<o;A++)P[A]=ye(u[E][A]/u[E][o],-9);return P}function ye(t,n){if(isNaN(t)||!Number.isInteger(n))return NaN;const[a,e="0"]=t.toString().split("e"),i=Math.round(+`${a}e${+e-n}`),[r,o="0"]=i.toString().split("e");return+`${r}e${+o+n}`}const et={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ht=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function q(t,n,a){return Math.max(n,Math.min(a,t))}const ot=class ot{constructor(){S(this,"_colorIndex");S(this,"_color");S(this,"_colorName");this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(n){n==null?this._color=null:(this._color=Math.round(q(n,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let n=this._color.toString(16).toUpperCase();for(;n.length<6;)n="0"+n;return`0x${n}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color!=null?this.color>>16&255:null}get green(){return this.color!=null?this.color>>8&255:null}get blue(){return this.color!=null?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(n){n==null?this._colorIndex=null:(this._colorIndex=q(n,0,256),this._color=ht[n],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(n){if(n){const a=et[n.toLowerCase()];a!==void 0?(this._colorName=n,this._color=a,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+n)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(n){return this.setRGB(n,n,n),this}setRGB(n,a,e){const i=Math.round(q(n,0,255)),r=Math.round(q(a,0,255)),o=Math.round(q(e,0,255));return this.color=(i<<16)+(r<<8)+o,this}setColorName(n){const a=et[n.toLowerCase()];return a!==void 0?this.color=a:console.warn("Unknown color "+n),this}clone(){const n=new ot;return n.colorIndex=this.colorIndex,n.color=this.color,n._colorName=this._colorName,this}copy(n){return this.colorIndex=n.colorIndex,this.color=n.color,this._colorName=n._colorName,this}equals(n){return n.color==this.color&&n.colorIndex==this.colorIndex&&n._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(n){for(const[a,e]of Object.entries(et))if(e===n)return a;return null}getColorIndexByValue(n){const a=ht.length-1;for(let e=1;e<a;++e)if(ht[e]===n)return e;return null}};S(ot,"NAMES",et);let Ut=ot;class W{constructor(n,a){S(this,"x");S(this,"y");this.x=n,this.y=a}add(n){return new W(this.x+n.x,this.y+n.y)}sub(n){return new W(this.x-n.x,this.y-n.y)}multiply(n){return new W(this.x*n,this.y*n)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const n=this.length();return n===0?new W(0,0):new W(this.x/n,this.y/n)}}function We(t,n,a,e=5){let i,r,o;a<0?(i=Math.atan(-a)*4,r=new W(t.x,t.y),o=new W(n.x,n.y)):(i=Math.atan(a)*4,r=new W(n.x,n.y),o=new W(t.x,t.y));const s=o.sub(r),_=s.length(),d=r.add(s.multiply(.5)),l=Math.abs(_/2/Math.tan(i/2)),c=s.norm(),E=new W(c.x*Math.cos(Math.PI/2)-c.y*Math.sin(Math.PI/2),c.y*Math.cos(Math.PI/2)+c.x*Math.sin(Math.PI/2)),u=i<Math.PI?d.add(E.multiply(-l)):d.add(E.multiply(l)),P=Math.atan2(o.y-u.y,o.x-u.x)/Math.PI*180;let A=Math.atan2(r.y-u.y,r.x-u.x)/Math.PI*180;A<P&&(A+=360);const I=o.sub(u).length(),T=Math.floor(P/e)*e+e,h=Math.ceil(A/e)*e-e,C=[];for(let R=T;R<=h;R+=e){const L=R/180*Math.PI,Y=u.add(new W(Math.cos(L)*I,Math.sin(L)*I));C.push(Y)}return a<0&&C.reverse(),C}function me(t,n=!1){let a=[];const e=t.vertices.map(i=>({x:i.x,y:i.y,bulge:i.bulge}));n&&e.push(e[0]);for(let i=0,r=e.length;i<r-1;++i){const o=e[i],s=e[i+1];a.push(o),e[i].bulge&&(a=a.concat(We(o,s,t.vertices[i].bulge))),i===r-2&&a.push(s)}return a}class Me{constructor(){S(this,"blockMap",new Map)}rotate(n,a){const e=Math.cos(a),i=Math.sin(a);return{x:n.x*e-n.y*i,y:n.x*i+n.y*e}}interpolateBSpline(n,a,e,i=25,r){const o=[],s=n.map(l=>[l.x,l.y]),_=[e[a]],d=[e[a],e[e.length-1-a]];for(let l=a+1;l<e.length-a;++l)_[_.length-1]!==e[l]&&_.push(e[l]);for(let l=1;l<_.length;++l){const c=_[l-1],E=_[l];for(let u=0;u<=i;++u){let A=(u/i*(E-c)+c-d[0])/(d[1]-d[0]);A=Math.max(0,Math.min(1,A));const I=De(A,a,s,e,r);o.push({x:I[0],y:I[1]})}}return o}addFlipXIfApplicable(n,{bbox:a,element:e}){return"extrusionDirection"in n&&n.extrusionDirection.z===-1?{bbox:new y().expandByPoint({x:-a.min.x,y:a.min.y}).expandByPoint({x:-a.max.x,y:a.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${e}</g>`}:{bbox:a,element:e}}line(n){const a=new y().expandByPoint({x:n.startPoint.x,y:n.startPoint.y}).expandByPoint({x:n.endPoint.x,y:n.endPoint.y}),e=`<line x1="${n.startPoint.x}" y1="${n.startPoint.y}" x2="${n.endPoint.x}" y2="${n.endPoint.y}" />`;return{bbox:a,element:e}}ray(n){const e=n.firstPoint,i={x:e.x+n.unitDirection.x*1e4,y:e.y+n.unitDirection.y*1e4},r=new y().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:r,element:o}}xline(n){const e={x:n.firstPoint.x-n.unitDirection.x*1e4,y:n.firstPoint.y-n.unitDirection.y*1e4},i={x:n.firstPoint.x+n.unitDirection.x*1e4,y:n.firstPoint.y+n.unitDirection.y*1e4},r=new y().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:r,element:o}}extractMTextLines(n){return n.replace(/\\U\+([0-9A-Fa-f]{4})/g,(a,e)=>String.fromCharCode(parseInt(e,16))).replace(/\\P/g,`
1
+ var $n=Object.defineProperty;var zn=(t,n,a)=>n in t?$n(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var S=(t,n,a)=>zn(t,typeof n!="symbol"?n+"":n,a);const Jn="modulepreload",Zn=function(t){return"/"+t},Ht={},Vt=function(n,a,e){let i=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),r=o?.nonce||o?.getAttribute("nonce");i=Promise.allSettled(a.map(_=>{if(_=Zn(_),_ in Ht)return;Ht[_]=!0;const d=_.endsWith(".css"),l=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${l}`))return;const E=document.createElement("link");if(E.rel=d?"stylesheet":Jn,d||(E.as="script"),E.crossOrigin="",E.href=_,r&&E.setAttribute("nonce",r),document.head.appendChild(E),d)return new Promise((u,c)=>{E.addEventListener("load",u),E.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${_}`)))})}))}function s(o){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=o,window.dispatchEvent(r),!r.defaultPrevented)throw o}return i.then(o=>{for(const r of o||[])r.status==="rejected"&&s(r.reason);return n().catch(s)})};function qn(t){return{format:t.format,sourceName:t.sourceName,units:t.units,header:t.header??{},layers:t.layers??{},lineTypes:t.lineTypes??{},blocks:t.blocks??{},entities:t.entities??[],pages:t.pages,savedView:t.savedView,metadata:t.metadata??{},warnings:t.warnings??[],raw:t.raw}}function Kt(t){switch(String(t??"").toUpperCase()){case"LINE":return"line";case"CIRCLE":return"circle";case"ARC":return"arc";case"LWPOLYLINE":case"POLYLINE":case"POLYLINE_2D":case"POLYLINE2D":case"POLYLINE_3D":case"POLYLINE3D":case"LEADER":case"MULTILEADER":return"polyline";case"ELLIPSE":return"ellipse";case"TEXT":case"MTEXT":case"ATTRIB":case"ATTDEF":case"DIMENSION":return"text";case"POINT":return"point";case"INSERT":return"insert";case"SOLID":case"TRACE":case"3DFACE":return"solid";case"HATCH":return"hatch";case"SPLINE":return"spline";case"PATH":case"XPS_PATH":case"DWF_PATH":return"path";case"IMAGE":case"RASTER_IMAGE":case"DWF_IMAGE":return"image";case"VIEWPORT":return"viewport";default:return"unsupported"}}function Qt(t,n,a={}){const e=n??String(t.type??t.entityType??t.objectName??"UNKNOWN").toUpperCase(),i=a.includeUnknownProperties===!1?{type:e,kind:Kt(e)}:{...t,type:e,kind:Kt(e)};a.keepRaw&&(i.raw=t),i.handle=y(t.handle??t.id),i.layer=y(t.layer??t.layerName),i.lineType=y(t.lineType??t.linetype),i.lineTypeScale=R(t.lineTypeScale??t.linetypeScale??t.ltscale)??i.lineTypeScale,i.flag=R(t.flag??t.flags)??i.flag,i.constantWidth=R(t.constantWidth??t.constWidth??t.const_width)??i.constantWidth,i.thickness=R(t.thickness)??i.thickness;const s=t.isClosed===!0||t.closed===!0||t.shape===!0,o=/^(POLYLINE|POLYLINE_2D|POLYLINE2D|POLYLINE_3D|POLYLINE3D|SPLINE)$/.test(e),r=e==="LWPOLYLINE";(s||o&&(Number(i.flag??0)&1)===1||r&&(Number(i.flag??0)&512)===512)&&(i.isClosed=!0);const _=a.numericColorMode??"auto",d=R(t.color),l=R(t.colorIndex??t.colorNumber??t.aci??t.aciColor??t.color_index);i.colorIndex=l??(_!=="rgb"&&d!==void 0&&Math.abs(d)<=257?d:void 0);const E=t.trueColor??t.true_color??t.truecolor??t.colorRGB??t.colorRgb??t.rgbColor??t.rgb,u=d!==void 0&&d>=0&&d<=16777215&&(_==="rgb"||_==="auto"&&Math.abs(d)>257);if(i.trueColor=E??(u?d:void 0),(typeof t.color=="string"||typeof t.color=="number")&&(i.color=t.color),i.colorNumber=R(t.colorNumber)??i.colorNumber,i.colorName=y(t.colorName??t.color_name)??i.colorName,i.fillColor=t.fillColor??t.fill_color,i.fillColorIndex=R(t.fillColorIndex??t.fill_color_index??t.fillColorNumber)??i.fillColorIndex,i.opacity=R(t.opacity??t.alpha)??i.opacity,i.lineweight=R(t.lineweight??t.lineWeight),i.isVisible=!(t.isVisible===!1||t.visible===!1),i.startPoint=G(t.startPoint??t.start??t.p0??t.from)??i.startPoint,i.endPoint=G(t.endPoint??t.end??t.p1??t.to)??i.endPoint,i.center=G(t.center??t.centerPoint)??i.center,i.insertionPoint=G(t.insertionPoint??t.position??t.location??t.point??t.basePoint)??i.insertionPoint,i.radius=R(t.radius)??i.radius,i.startAngle=R(t.startAngle??t.start_angle)??i.startAngle,i.endAngle=R(t.endAngle??t.end_angle)??i.endAngle,i.majorAxisEndPoint=G(t.majorAxisEndPoint??t.majorAxis??t.major)??i.majorAxisEndPoint,i.axisRatio=R(t.axisRatio??t.ratio)??i.axisRatio,i.height=R(t.height??t.textHeight)??i.height,i.textHeight=R(t.textHeight??t.height)??i.textHeight,i.xScale=R(t.xScale??t.widthFactor)??i.xScale,i.generationFlag=R(t.generationFlag??t.textGenerationFlag)??i.generationFlag,i.halign=R(t.halign??t.horizontalAlignment)??i.halign,i.valign=R(t.valign??t.verticalAlignment)??i.valign,i.extrusionDirection=G(t.extrusionDirection??t.extrusion)??i.extrusionDirection,i.rotation=R(t.rotation??t.angle)??i.rotation,i.text=y(t.text??t.value??t.string??t.contents)??i.text,i.name=y(t.name??t.blockName)??i.name,i.blockName=y(t.blockName??t.name)??i.blockName,e==="INSERT"){const P=G(t.scale);if(P)i.scale=P;else{const f=R(t.scaleX??t.xScale),C=R(t.scaleY??t.yScale)??f,g=R(t.scaleZ??t.zScale);f!==void 0&&C!==void 0&&(i.scale=g===void 0?{x:f,y:C}:{x:f,y:C,z:g})}}const c=Tt(t.vertices??t.points);c.length>0&&(i.vertices=c);const T=Tt(t.controlPoints??t.control_points);T.length>0&&(i.controlPoints=T);const A=Tt(t.fitPoints??t.fit_points);A.length>0&&(i.fitPoints=A);const I=t.attribs??t.attributes;return Array.isArray(I)&&(i.attribs=I.filter(P=>!!P&&typeof P=="object").map(P=>Qt(P,void 0,a))),i}function G(t){if(!t||typeof t!="object")return;const n=t,a=Number(n.x??n.X??n[0]),e=Number(n.y??n.Y??n[1]),i=n.z??n.Z??n[2],s=i===void 0?void 0:Number(i);if(!(!Number.isFinite(a)||!Number.isFinite(e)))return Number.isFinite(s)?{x:a,y:e,z:s}:{x:a,y:e}}function Tt(t){if(!Array.isArray(t))return[];const n=[];for(const a of t){const e=G(a);if(!e)continue;const i=a,s=e,o=R(i.bulge);o!==void 0&&(s.bulge=o);const r=R(i.startWidth??i.start_width);r!==void 0&&(s.startWidth=r);const _=R(i.endWidth??i.end_width);_!==void 0&&(s.endWidth=_),n.push(s)}return n}function Qn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function jn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function te(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n,n.handle&&(t[n.handle]=n,t[n.handle.toLowerCase()]=n))}function R(t){const n=Number(t);return Number.isFinite(n)?n:void 0}function y(t){if(typeof t!="string"&&typeof t!="number")return;const n=String(t);return n.length>0?n:void 0}function ne(t){return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.slice().buffer}function ee(t,n){return{a:t.a*n.a+t.c*n.b,b:t.b*n.a+t.d*n.b,c:t.a*n.c+t.c*n.d,d:t.b*n.c+t.d*n.d,e:t.a*n.e+t.c*n.f+t.e,f:t.b*n.e+t.d*n.f+t.f}}function ae(t){const n=Math.cos(t),a=Math.sin(t);return{a:n,b:a,c:-a,d:n,e:0,f:0}}const ie={AC1009:"R12",AC1012:"R13",AC1014:"R14",AC1015:"R2000",AC1018:"R2004",AC1021:"R2007",AC1024:"R2010",AC1027:"R2013",AC1032:"R2018"};function oe(t){const n=Array.from(t.slice(0,6),e=>String.fromCharCode(e)).join(""),a=ie[n]??"UNKNOWN";return{signature:n,release:a,supportedByOpenDesignSpec:a!=="UNKNOWN",notes:a==="UNKNOWN"?"Unknown or unsupported DWG signature.":void 0}}const $t=new Map;async function se(t,n={}){const a=performance.now(),e=n.sourceName;n.onProgress?.({phase:"detect",format:"dwg",message:"Validating DWG header…",total:t.byteLength});const i=oe(t);if(!i.signature.startsWith("AC"))throw new Error(`Invalid DWG header: ${JSON.stringify(i.signature)}.`);n.onProgress?.({phase:"wasm-init",format:"dwg",message:"Initializing LibreDWG WebAssembly…",total:t.byteLength});const s=await jt(n.wasmPath??"/wasm/");n.onProgress?.({phase:"parse",format:"dwg",message:`Decoding ${i.signature} DWG…`,total:t.byteLength,percent:35});const o=ne(t),r=s.Dwg_File_Type?.DWG??0,_=s.instance.dwg_read_data(o,r);if(!_)throw new Error("LibreDWG returned an empty DWG result.");if(typeof _.error=="number"&&_.error!==0)throw new Error(`LibreDWG parse error code: ${_.error}.`);n.onProgress?.({phase:"normalize",format:"dwg",message:"Normalizing DWG database…",total:t.byteLength,percent:72});const d=typeof s.instance.convert=="function"?s.instance.convert(_):_;try{typeof s.instance.dwg_free=="function"&&s.instance.dwg_free(_)}catch{}const l=re(d,e,i,{keepRaw:!!n.keepRaw}),E=performance.now()-a;return n.onProgress?.({phase:"done",format:"dwg",message:"DWG loaded.",total:t.byteLength,percent:100,elapsedMs:E}),{document:l,raw:n.keepRaw?d:void 0,bytes:t.byteLength,elapsedMs:E,format:"dwg",warnings:l.warnings}}async function jt(t="/wasm/"){const n=he(t);let a=$t.get(n);a||(a=Vt(()=>Promise.resolve().then(()=>qt),[]).then(async s=>{const o=s,r=o.LibreDwg;if(!r||typeof r.create!="function")throw new Error("@mlightcad/libredwg-web did not expose LibreDwg.create().");try{if(typeof o.createModule=="function"&&typeof r.createByWasmInstance=="function"){const _=zt(n),d=await ge(_),l=await o.createModule({wasmBinary:d,locateFile:E=>new URL(E,en(n)).href});return r.createByWasmInstance(l)}return await r.create(n)}catch(_){const d=_ instanceof Error?_.message:String(_);throw new Error(`Failed to initialize LibreDWG WebAssembly from ${n}. Ensure libredwg-web.wasm is deployed at ${zt(n)} and wasmPath is resolved relative to the page, not the worker script. Run npm run copy:wasm before dev/build. Original error: ${d}`)}}),$t.set(n,a));const e=await a,i=await Vt(()=>Promise.resolve().then(()=>qt),void 0);return{module:i,instance:e,Dwg_File_Type:i.Dwg_File_Type}}function re(t,n,a,e={}){const i=t&&typeof t=="object"?t:{},s=Ee(i,e),o=de(i),r=ue(i,e,o),_=fe(i,e),d=ce(i.header,a),l=_e(r),E=Ie(i,d),u=E.view,c=Array.isArray(i.entities)?i.entities:[],T={keepRaw:!!e.keepRaw,includeUnknownProperties:!!e.keepRaw},A=c.filter(f=>!!f&&typeof f=="object").map(f=>tn(f,T)),I=qn({format:"dwg",sourceName:n,header:d,layers:s,lineTypes:r,blocks:_,entities:A,savedView:u,metadata:{parser:"@mlightcad/libredwg-web",parserMode:"wasm",version:a,savedView:u,requiredShxFonts:l},warnings:E.warning?[E.warning]:[],raw:e.keepRaw?t:void 0});if(A.length===0&&I.warnings.push("DWG parsed successfully but no model-space entities were exposed by the converter. Check layout/paper-space content or unsupported proxy objects."),[...new Set(Object.values(r))].some(f=>f.pattern.some(C=>Number(C.elementTypeFlag??0)!==0))){const f=l.length>0?` This drawing references external shape font${l.length===1?"":"s"} ${l.join(", ")}, whose outlines are not embedded in the DWG.`:"";I.warnings.push(`Complex SHX linetype glyphs are preserved in the normalized LTYPE definition and rendered as a dash/dot approximation.${f}`)}return I}function _e(t){const n=new Set;for(const a of new Set(Object.values(t)))for(const e of a.pattern)Number(e.elementTypeFlag??0)!==0&&e.fontName&&n.add(e.fontName);return[...n].sort((a,e)=>a.localeCompare(e))}function de(t){const n=t.tables,a=[t.STYLE,t.styles,n?.STYLE,n?.styles],e=new Map,i=new Set;for(const s of a)for(const o of et(s)){if(!o||typeof o!="object")continue;const r=o,_=y(r.font??r.fontFileName??r.primaryFontFileName);if(!_||!/\.shx$/i.test(_))continue;((R(r.standardFlag??r.flag)??0)&1)===1&&i.add(_);for(const l of[r.handle,r.id,r.name]){const E=nn(l);E&&e.set(E,_)}}return{byReference:e,shapeFonts:[...i]}}function tn(t,n){const a=Qt(t,void 0,{...n,numericColorMode:"rgb"}),e=R(t.color);e!==void 0&&e>=0&&e<=16777215&&(a.color=e,a.trueColor=e),a.colorIndex=R(t.colorIndex??t.colorNumber??t.aci)??a.colorIndex,a.colorName=y(t.colorName??t.color_name)??a.colorName;const i=R(t.flag??t.flags);i!==void 0&&(a.flag=i);const s=String(t.type??t.entityType??"").toUpperCase(),o=/^(POLYLINE|POLYLINE_2D|POLYLINE2D|POLYLINE_3D|POLYLINE3D)$/.test(s);return(t.isClosed===!0||t.closed===!0||o&&(Number(i??0)&1)===1||s==="LWPOLYLINE"&&(Number(i??0)&512)===512)&&(a.isClosed=!0),a}function le(t){return typeof t=="number"&&Number.isFinite(t)&&Math.abs(Math.trunc(t))>=1&&Math.abs(Math.trunc(t))<=255}function ce(t,n){const a=t&&typeof t=="object"?{...t}:{};return n&&(a.dwgVersion=n),a}function Ee(t,n){const a={},e=[],i=t.tables;for(const s of["LAYER","layer","layers"]){const o=t[s]??i?.[s];o&&e.push(o)}for(const s of e)for(const o of et(s)){const r=o,_=y(r.name??r.layerName??r.entryName);if(!_)continue;const d=R(r.colorIndex??r.colorNumber),l=R(r.trueColor??r.true_color??r.truecolor??r.colorRGB??r.colorRgb??r.rgbColor??r.rgb),E=R(r.color),u=le(d),c=l??(!u&&E!==void 0&&E>=0&&E<=16777215?E:void 0),T={name:_,color:u?void 0:r.color??r.colorName,colorIndex:d??(E!==void 0&&Math.abs(E)<=257?E:void 0),trueColor:c,lineType:y(r.lineType??r.linetype),lineweight:R(r.lineweight??r.lineWeight),isVisible:!(r.isVisible===!1||r.off===!0||Number(d??r.color??1)<0),isFrozen:!!(r.isFrozen??r.frozen),isLocked:!!(r.isLocked??r.locked),raw:n.keepRaw?r:void 0};Qn(a,T)}return a}function ue(t,n,a){const e={},i=t.tables,s=[t.LTYPE,t.ltype,t.lineTypes,i?.LTYPE,i?.ltype,i?.lineTypes];for(const o of s)for(const r of et(o)){const _=r,d=y(_.name??_.lineTypeName??_.entryName);if(!d)continue;const E=(Array.isArray(_.pattern)?_.pattern:Array.isArray(_.dashes)?_.dashes:[]).flatMap(u=>{if(typeof u=="number")return[{length:u}];if(!u||typeof u!="object")return[];const c=u,T=R(c.elementLength??c.length??c.dashLength);if(T===void 0)return[];const A=R(c.elementTypeFlag),I=R(c.shapeNumber),P=A!==void 0&&I!==void 0,f=P?I:R(c.typeFlag??c.elementTypeFlag),C=y(c.styleObjectId??c.styleHandle??c.style),g=(C?a.byReference.get(nn(C)):void 0)??((Number(f??0)&4)===4&&a.shapeFonts.length===1?a.shapeFonts[0]:void 0);return[{length:T,elementTypeFlag:f,shapeNumber:P?A:R(c.shapeCode??c.shapeNumber),scale:R(c.scale),rotation:R(c.rotation),offsetX:R(c.offsetX),offsetY:R(c.offsetY),text:y(c.text),styleHandle:C,fontName:g}]});te(e,{name:d,handle:y(_.handle??_.id),description:y(_.description),totalPatternLength:R(_.totalPatternLength??_.patternLength),pattern:E,raw:n.keepRaw?_:void 0})}return e}function nn(t){return String(t??"").trim().replace(/^0x/i,"").replace(/^0+(?=[0-9a-f])/i,"").toLowerCase()}function Ie(t,n){const a=t.tables,i=et(t.VPORT??t.vports??a?.VPORT??a?.vports).filter(P=>!!P&&typeof P=="object").find(P=>String(P.name??"").trim().toLowerCase()==="*active"),s=i?"vport":"header-ucs",o=i??n,r=G(o.ucsOrigin??o.UCSORG??n.UCSORG),_=G(o.ucsXAxis??o.UCSXDIR??n.UCSXDIR),d=G(o.ucsYAxis??o.UCSYDIR??n.UCSYDIR),l=R(o.viewTwistAngle??o.twistAngle??o.VIEWTWIST)??0,E=G(o.viewDirectionFromTarget??o.viewDirection??o.direction??o.VIEWDIR),u=!Te(r,_,d);if(!(!!i||!!E||u||Math.abs(l)>1e-12))return{};const T=Pe(E),A=T?Ae(r,_,d,l):{a:1,b:0,c:0,d:1,e:0,f:0},I={source:s,name:y(o.name),handle:y(o.handle),center:G(o.center??o.VIEWCTR),target:G(o.viewTarget??o.target??o.TARGET),direction:E,viewHeight:R(o.viewHeight??o.height??o.VIEWSIZE),aspectRatio:R(o.aspectRatio),twistAngle:l,ucsOrigin:r,ucsXAxis:_,ucsYAxis:d,sceneTransformApplied:T,sceneTransform:A};return T?{view:I}:{view:I,warning:"The saved CAD view has a missing, non-finite, or tilted VIEWDIR. File Viewer kept world coordinates instead of applying an unsafe 2D UCS/PLAN rotation."}}function Ae(t,n,a,e){const i=ft(n)??{x:1,y:0},s=ft(a)??{x:-i.y,y:i.x},o=i.x*s.x+i.y*s.y,r=ft({x:s.x-i.x*o,y:s.y-i.y*o})??{x:-i.y,y:i.x},_={a:i.x,b:r.x,c:i.y,d:r.y,e:t?-(t.x*i.x+t.y*i.y):0,f:t?-(t.x*r.x+t.y*r.y):0};return ee(ae(Number.isFinite(e)?e:0),_)}function ft(t){if(!t||Math.abs(Number(t.z??0))>1e-6)return;const n=Math.hypot(t.x,t.y);if(!(!Number.isFinite(n)||n<1e-12))return{x:t.x/n,y:t.y/n}}function Pe(t){if(!t||!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.z))return!1;const n=Math.hypot(t.x,t.y,Number(t.z));return!Number.isFinite(n)||n<1e-12?!1:Math.hypot(t.x,t.y)/n<=1e-4&&Math.abs(Number(t.z))/n>=1-1e-8}function Te(t,n,a){const e=(r,_)=>Number.isFinite(r)&&Math.abs(Number(r)-_)<=1e-10,i=!t||e(t.x,0)&&e(t.y,0)&&e(t.z??0,0),s=!n||e(n.x,1)&&e(n.y,0)&&e(n.z??0,0),o=!a||e(a.x,0)&&e(a.y,1)&&e(a.z??0,0);return i&&s&&o}function fe(t,n){const a={},e=[t.blocks,t.blockHeaders,t.block_records,t.blockRecords],i=t.tables;e.push(i?.BLOCK,i?.BLOCK_RECORD,i?.blocks);const s={keepRaw:!!n.keepRaw,includeUnknownProperties:!!n.keepRaw};for(const o of e)for(const r of et(o)){const _=r,d=y(_.name??_.blockName??_.name2);if(!d)continue;const E=(Array.isArray(_.entities)?_.entities:Array.isArray(_.ownedObjects)?_.ownedObjects:[]).filter(u=>!!u&&typeof u=="object").map(u=>tn(u,s));jn(a,{name:d,basePoint:G(_.basePoint??_.origin)??{x:0,y:0},entities:E,raw:n.keepRaw?_:void 0})}return a}function et(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t!="object")return[];const n=t,a=Object.values(n).filter(i=>i&&typeof i=="object"),e=["entries","records","items","values","layers","blocks"].flatMap(i=>Array.isArray(n[i])?n[i]:[]);return e.length>0?e:a}function he(t){const n=t.trim()||"/wasm";if(n==="/")return Jt();const a=n.replace(/\/+$/,"");return Ce(a)?a:a.startsWith("/")?`${Jt()}${a}`:new URL(a,an()).href.replace(/\/+$/,"")}function zt(t){return new URL("libredwg-web.wasm",en(t)).href}function en(t){return t.endsWith("/")?t:`${t}/`}function Ce(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)}function an(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"&&location.href?location.href:"http://localhost/"}function Jt(){return typeof location<"u"&&location.origin?location.origin:new URL(an()).origin}async function ge(t){if(typeof fetch!="function")throw new Error("fetch() is not available, so the LibreDWG WASM binary cannot be loaded.");const n=await fetch(t,{credentials:"same-origin",cache:"force-cache"});if(!n.ok)throw new Error(`WASM asset request failed with HTTP ${n.status} for ${t}.`);const a=new Uint8Array(await n.arrayBuffer());if(!Re(a)){const e=Ye(a),i=n.headers.get("content-type")??"unknown content-type";throw new Error(`Invalid WASM asset at ${t}. Expected bytes 00 61 73 6d, got ${Le(a)} (${i}). The server probably returned an HTML fallback page instead of libredwg-web.wasm. Response preview: ${e}`)}return a}function Re(t){return t.length>=4&&t[0]===0&&t[1]===97&&t[2]===115&&t[3]===109}function Le(t){return Array.from(t.slice(0,4)).map(n=>n.toString(16).padStart(2,"0")).join(" ")}function Ye(t){const n=Array.from(t.slice(0,32)).map(a=>a>=32&&a<=126?String.fromCharCode(a):".").join("");return JSON.stringify(n)}const H=self;H.postMessage({type:"ready"});H.onmessage=async t=>{const n=t.data;if(!n)return;const a=performance.now(),e=i=>{H.postMessage({type:"progress",requestId:n.requestId,progress:i})};try{if(n.type==="warmup"){e({phase:"wasm-init",format:"dwg",message:"Warming LibreDWG WebAssembly instance…"}),await jt(n.options?.wasmPath??"/wasm/"),H.postMessage({type:"warmup-result",requestId:n.requestId,elapsedMs:performance.now()-a});return}if(n.type!=="load")return;e({phase:"worker-ready",format:"dwg",message:"DWG worker received file bytes.",total:n.bytes.byteLength});const i=await se(new Uint8Array(n.bytes),{...n.options,sourceName:n.fileName,keepRaw:!!n.options?.keepRaw,onProgress:e});i.document.metadata.loaderMode="worker",i.elapsedMs=performance.now()-a,H.postMessage({type:"result",requestId:n.requestId,result:i})}catch(i){const s=ve(i);H.postMessage({type:"error",requestId:n.requestId,error:s})}};function ve(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:{message:String(t)}}var Ct;(function(t){t[t.CP_UTF8=0]="CP_UTF8",t[t.CP_US_ASCII=1]="CP_US_ASCII",t[t.CP_ISO_8859_1=2]="CP_ISO_8859_1",t[t.CP_ISO_8859_2=3]="CP_ISO_8859_2",t[t.CP_ISO_8859_3=4]="CP_ISO_8859_3",t[t.CP_ISO_8859_4=5]="CP_ISO_8859_4",t[t.CP_ISO_8859_5=6]="CP_ISO_8859_5",t[t.CP_ISO_8859_6=7]="CP_ISO_8859_6",t[t.CP_ISO_8859_7=8]="CP_ISO_8859_7",t[t.CP_ISO_8859_8=9]="CP_ISO_8859_8",t[t.CP_ISO_8859_9=10]="CP_ISO_8859_9",t[t.CP_CP437=11]="CP_CP437",t[t.CP_CP850=12]="CP_CP850",t[t.CP_CP852=13]="CP_CP852",t[t.CP_CP855=14]="CP_CP855",t[t.CP_CP857=15]="CP_CP857",t[t.CP_CP860=16]="CP_CP860",t[t.CP_CP861=17]="CP_CP861",t[t.CP_CP863=18]="CP_CP863",t[t.CP_CP864=19]="CP_CP864",t[t.CP_CP865=20]="CP_CP865",t[t.CP_CP869=21]="CP_CP869",t[t.CP_CP932=22]="CP_CP932",t[t.CP_MACINTOSH=23]="CP_MACINTOSH",t[t.CP_BIG5=24]="CP_BIG5",t[t.CP_CP949=25]="CP_CP949",t[t.CP_JOHAB=26]="CP_JOHAB",t[t.CP_CP866=27]="CP_CP866",t[t.CP_ANSI_1250=28]="CP_ANSI_1250",t[t.CP_ANSI_1251=29]="CP_ANSI_1251",t[t.CP_ANSI_1252=30]="CP_ANSI_1252",t[t.CP_GB2312=31]="CP_GB2312",t[t.CP_ANSI_1253=32]="CP_ANSI_1253",t[t.CP_ANSI_1254=33]="CP_ANSI_1254",t[t.CP_ANSI_1255=34]="CP_ANSI_1255",t[t.CP_ANSI_1256=35]="CP_ANSI_1256",t[t.CP_ANSI_1257=36]="CP_ANSI_1257",t[t.CP_ANSI_874=37]="CP_ANSI_874",t[t.CP_ANSI_932=38]="CP_ANSI_932",t[t.CP_ANSI_936=39]="CP_ANSI_936",t[t.CP_ANSI_949=40]="CP_ANSI_949",t[t.CP_ANSI_950=41]="CP_ANSI_950",t[t.CP_ANSI_1361=42]="CP_ANSI_1361",t[t.CP_UTF16=43]="CP_UTF16",t[t.CP_ANSI_1258=44]="CP_ANSI_1258",t[t.CP_UNDEFINED=255]="CP_UNDEFINED"})(Ct||(Ct={}));const Ne=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],gt=t=>Ne[t];var Rt;(function(t){t[t.Rotated=0]="Rotated",t[t.Aligned=1]="Aligned",t[t.Angular=2]="Angular",t[t.Diameter=3]="Diameter",t[t.Radius=4]="Radius",t[t.Angular3Point=5]="Angular3Point",t[t.Ordinate=6]="Ordinate",t[t.ReferenceIsExclusive=32]="ReferenceIsExclusive",t[t.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",t[t.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag"})(Rt||(Rt={}));var B;(function(t){t[t.TopLeft=1]="TopLeft",t[t.TopCenter=2]="TopCenter",t[t.TopRight=3]="TopRight",t[t.MiddleLeft=4]="MiddleLeft",t[t.MiddleCenter=5]="MiddleCenter",t[t.MiddleRight=6]="MiddleRight",t[t.BottomLeft=7]="BottomLeft",t[t.BottomCenter=8]="BottomCenter",t[t.BottomRight=9]="BottomRight"})(B||(B={}));var Lt;(function(t){t[t.AtLeast=1]="AtLeast",t[t.Exact=2]="Exact"})(Lt||(Lt={}));var Yt;(function(t){t[t.Center=0]="Center",t[t.Above=1]="Above",t[t.Outside=2]="Outside",t[t.JIS=3]="JIS",t[t.Below=4]="Below"})(Yt||(Yt={}));var vt;(function(t){t[t.Feet=0]="Feet",t[t.None=1]="None",t[t.Inch=2]="Inch",t[t.FeetAndInch=3]="FeetAndInch",t[t.Leading=4]="Leading",t[t.Trailing=8]="Trailing",t[t.LeadingAndTrailing=12]="LeadingAndTrailing"})(vt||(vt={}));var Nt;(function(t){t[t.None=0]="None",t[t.Leading=1]="Leading",t[t.Trailing=2]="Trailing",t[t.LeadingAndTrailing=3]="LeadingAndTrailing"})(Nt||(Nt={}));var St;(function(t){t[t.Center=0]="Center",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.OverFirst=3]="OverFirst",t[t.OverSecond=4]="OverSecond"})(St||(St={}));var pt;(function(t){t[t.Bottom=0]="Bottom",t[t.Center=1]="Center",t[t.Top=2]="Top"})(pt||(pt={}));var Q;(function(t){t[t.PatternFill=0]="PatternFill",t[t.SolidFill=1]="SolidFill"})(Q||(Q={}));var j;(function(t){t[t.NonAssociative=0]="NonAssociative",t[t.Associative=1]="Associative"})(j||(j={}));var yt;(function(t){t[t.Normal=0]="Normal",t[t.Outer=1]="Outer",t[t.Ignore=2]="Ignore"})(yt||(yt={}));var Gt;(function(t){t[t.UserDefined=0]="UserDefined",t[t.Predefined=1]="Predefined",t[t.Custom=2]="Custom"})(Gt||(Gt={}));var Dt;(function(t){t[t.NotAnnotated=0]="NotAnnotated",t[t.Annotated=1]="Annotated"})(Dt||(Dt={}));var it;(function(t){t[t.Solid=0]="Solid",t[t.Gradient=1]="Gradient"})(it||(it={}));var tt;(function(t){t[t.TwoColor=0]="TwoColor",t[t.OneColor=1]="OneColor"})(tt||(tt={}));var Wt;(function(t){t[t.Default=0]="Default",t[t.External=1]="External",t[t.Polyline=2]="Polyline",t[t.Derived=4]="Derived",t[t.Textbox=8]="Textbox",t[t.Outermost=16]="Outermost"})(Wt||(Wt={}));var F;(function(t){t[t.Line=1]="Line",t[t.Circular=2]="Circular",t[t.Elliptic=3]="Elliptic",t[t.Spline=4]="Spline"})(F||(F={}));var mt;(function(t){t[t.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",t[t.CURVE_FIT=2]="CURVE_FIT",t[t.SPLINE_FIT=4]="SPLINE_FIT",t[t.POLYLINE_3D=8]="POLYLINE_3D",t[t.POLYGON_3D=16]="POLYGON_3D",t[t.CLOSED_POLYGON=32]="CLOSED_POLYGON",t[t.POLYFACE=64]="POLYFACE",t[t.CONTINUOUS=128]="CONTINUOUS"})(mt||(mt={}));var Mt;(function(t){t[t.NONE=0]="NONE",t[t.QUADRATIC=5]="QUADRATIC",t[t.CUBIC=6]="CUBIC",t[t.BEZIER=8]="BEZIER"})(Mt||(Mt={}));var xt;(function(t){t[t.NONE=0]="NONE",t[t.MIRRORED_X=2]="MIRRORED_X",t[t.MIRRORED_Y=4]="MIRRORED_Y"})(xt||(xt={}));var nt;(function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT",t[t.ALIGNED=3]="ALIGNED",t[t.MIDDLE=4]="MIDDLE",t[t.FIT=5]="FIT"})(nt||(nt={}));var Ot;(function(t){t[t.BASELINE=0]="BASELINE",t[t.BOTTOM=1]="BOTTOM",t[t.MIDDLE=2]="MIDDLE",t[t.TOP=3]="TOP"})(Ot||(Ot={}));const on=Object.freeze(["ACADMAINTVER","ACADVER","ANGBASE","ANGDIR","ATTMODE","AUNITS","AUPREC","CECOLOR","CELTSCALE","CELTYPE","CELWEIGHT","CEPSNID","CEPSNTYPE","CHAMFERA","CHAMFERB","CHAMFERC","CHAMFERD","CLAYER","CMLJUST","CMLSCALE","CMLSTYLE","CSHADOW","DIMADEC","DIMALT","DIMALTD","DIMALTF","DIMALTRND","DIMALTTD","DIMALTTZ","DIMALTU","DIMALTZ","DIMAPOST","DIMASO","DIMASSOC","DIMASZ","DIMATFIT","DIMAUNIT","DIMAZIN","DIMBLK","DIMBLK1","DIMBLK2","DIMCEN","DIMCLRD","DIMCLRE","DIMCLRT","DIMDEC","DIMDLE","DIMDLI","DIMDSEP","DIMEXE","DIMEXO","DIMFAC","DIMGAP","DIMJUST","DIMLDRBLK","DIMLFAC","DIMLIM","DIMLUNIT","DIMLWD","DIMLWE","DIMPOST","DIMRND","DIMSAH","DIMSCALE","DIMSD1","DIMSD2","DIMSE1","DIMSE2","DIMSHO","DIMSOXD","DIMSTYLE","DIMTAD","DIMTDEC","DIMTFAC","DIMTIH","DIMTIX","DIMTM","DIMTMOVE","DIMTOFL","DIMTOH","DIMTOL","DIMTOLJ","DIMTP","DIMTSZ","DIMTVP","DIMTXSTY","DIMTXT","DIMTZIN","DIMUPT","DIMZIN","DISPSILH","DRAGVS","DWGCODEPAGE","ELEVATION","ENDCAPS","EXTMAX","EXTMIN","EXTNAMES","FILLETRAD","FILLMODE","FINGERPRINTGUID","HALOGAP","HANDSEED","HIDETEXT","HYPERLINKBASE","INDEXCTL","INSBASE","INSUNITS","INTERFERECOLOR","INTERFEREOBJVS","INTERFEREVPVS","INTERSECTIONCOLOR","INTERSECTIONDISPLAY","JOINSTYLE","LIMCHECK","LIMMAX","LIMMIN","LTSCALE","LUNITS","LUPREC","LWDISPLAY","MAXACTVP","MEASUREMENT","MENU","MIRRTEXT","OBSCOLOR","OBSLTYPE","ORTHOMODE","PDMODE","PDSIZE","PELEVATION","PEXTMAX","PEXTMIN","PINSBASE","PLIMCHECK","PLIMMAX","PLIMMIN","PLINEGEN","PLINEWID","PROJECTNAME","PROXYGRAPHICS","PSLTSCALE","PSTYLEMODE","PSVPSCALE","PUCSBASE","PUCSNAME","PUCSORG","PUCSORGBACK","PUCSORGBOTTOM","PUCSORGFRONT","PUCSORGLEFT","PUCSORGRIGHT","PUCSORGTOP","PUCSORTHOREF","PUCSORTHOVIEW","PUCSXDIR","PUCSYDIR","QTEXTMODE","REGENMODE","SHADEDGE","SHADEDIF","SHADOWPLANELOCATION","SKETCHINC","SKPOLY","SORTENTS","SPLINESEGS","SPLINETYPE","SURFTAB1","SURFTAB2","SURFTYPE","SURFU","SURFV","TDCREATE","TDINDWG","TDUCREATE","TDUPDATE","TDUSRTIMER","TDUUPDATE","TEXTSIZE","TEXTSTYLE","THICKNESS","TILEMODE","TRACEWID","TREEDEPTH","UCSBASE","UCSNAME","UCSORG","UCSORGBACK","UCSORGBOTTOM","UCSORGFRONT","UCSORGLEFT","UCSORGRIGHT","UCSORGTOP","UCSORTHOREF","UCSORTHOVIEW","UCSXDIR","UCSYDIR","UNITMODE","USERI1","USERI2","USERI3","USERI4","USERI5","USERR1","USERR2","USERR3","USERR4","USERR5","USRTIMER","VERSIONGUID","VISRETAIN","WORLDVIEW","XCLIPFRAME","XEDIT"]);var wt;(function(t){t[t.NotApplicable=0]="NotApplicable",t[t.KeepExisting=1]="KeepExisting",t[t.UseClone=2]="UseClone",t[t.XrefName=3]="XrefName",t[t.Name=4]="Name",t[t.UnmangleName=5]="UnmangleName"})(wt||(wt={}));const sn=[{type:"invalid",hdr:"INVALI",description:"No DWG",version:0},{type:"r1.1",hdr:"MC0.0",description:"MicroCAD Release 1.1",version:0},{type:"r1.2",hdr:"AC1.2",description:"AutoCAD Release 1.2",version:0},{type:"r1.3",hdr:"AC1.3",description:"AutoCAD Release 1.3",version:1},{type:"r1.4",hdr:"AC1.40",description:"AutoCAD Release 1.4",version:2},{type:"r2.0b",hdr:"AC1.50",description:"AutoCAD 2.0 beta",version:3},{type:"r2.0",hdr:"AC1.50",description:"AutoCAD Release 2.0",version:4},{type:"r2.10",hdr:"AC2.10",description:"AutoCAD Release 2.10",version:5},{type:"r2.21",hdr:"AC2.21",description:"AutoCAD Release 2.21",version:6},{type:"r2.22",hdr:"AC2.22",description:"AutoCAD Release 2.22",version:7},{type:"r2.4",hdr:"AC1001",description:"AutoCAD Release 2.4",version:8},{type:"r2.5",hdr:"AC1002",description:"AutoCAD Release 2.5",version:9},{type:"r2.6",hdr:"AC1003",description:"AutoCAD Release 2.6",version:10},{type:"r9",hdr:"AC1004",description:"AutoCAD Release 9",version:11},{type:"r9c1",hdr:"AC1005",description:"AutoCAD Release 9c1",version:12},{type:"r10",hdr:"AC1006",description:"AutoCAD Release 10",version:13},{type:"r11b1",hdr:"AC1007",description:"AutoCAD 11 beta 1",version:14},{type:"r11b2",hdr:"AC1008",description:"AutoCAD 11 beta 2",version:15},{type:"r11",hdr:"AC1009",description:"AutoCAD Release 11/12 (LT R1/R2)",version:16},{type:"r13b1",hdr:"AC1010",description:"AutoCAD pre-R13 a",version:17},{type:"r13b2",hdr:"AC1011",description:"AutoCAD pre-R13 b",version:18},{type:"r13",hdr:"AC1012",description:"AutoCAD Release 13",version:19},{type:"r13c3",hdr:"AC1013",description:"AutoCAD Release 13c3",version:20},{type:"r14",hdr:"AC1014",description:"AutoCAD Release 14",version:21},{type:"r2000b",hdr:"AC1500",description:"AutoCAD 2000 beta",version:22},{type:"r2000",hdr:"AC1015",description:"AutoCAD Release 2000",version:23},{type:"r2000i",hdr:"AC1016",description:"AutoCAD Release 2000i",version:23},{type:"r2002",hdr:"AC1017",description:"AutoCAD Release 2002",version:23},{type:"r2004a",hdr:"AC402a",description:"AutoCAD 2004 alpha a",version:24},{type:"r2004b",hdr:"AC402b",description:"AutoCAD 2004 alpha b",version:24},{type:"r2004c",hdr:"AC1018",description:"AutoCAD 2004 beta",version:24},{type:"r2004",hdr:"AC1018",description:"AutoCAD Release 2004",version:25},{type:"r2007a",hdr:"AC701a",description:"AutoCAD 2007 alpha",version:26},{type:"r2007b",hdr:"AC1021",description:"AutoCAD 2007 beta",version:26},{type:"r2007",hdr:"AC1021",description:"AutoCAD Release 2007",version:27},{type:"r2010b",hdr:"AC1024",description:"AutoCAD 2010 beta",version:28},{type:"r2010",hdr:"AC1024",description:"AutoCAD Release 2010",version:29},{type:"r2013b",hdr:"AC1027",description:"AutoCAD 2013 beta",version:30},{type:"r2013",hdr:"AC1027",description:"AutoCAD Release 2013",version:31},{type:"r2018b",hdr:"AC1032",description:"AutoCAD 2018 beta",version:32},{type:"r2018",hdr:"AC1032",description:"AutoCAD Release 2018",version:33},{type:"r2022b",hdr:"AC103-4",description:"AutoCAD 2022 beta",version:36},{type:"r>2022",hdr:"",description:"AutoCAD Release >2022",version:0}];async function Bt(t={}){const n=Se(t),a=await import(n),e=a.default??a.createModule??a;if(typeof e!="function")throw new Error(`LibreDWG runtime module at ${n} did not export a createModule function.`);return e(t)}function Se(t){const n=t.locateFile;if(typeof n=="function")try{const a=n("libredwg-web.js","");if(typeof a=="string"&&a.length>0)return a}catch{}return typeof document<"u"&&document.baseURI?new URL("wasm/libredwg-web.js",document.baseURI).href:typeof location<"u"&&location.href?new URL("/wasm/libredwg-web.js",location.origin).href:"/wasm/libredwg-web.js"}var bt;(function(t){t[t.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",t[t.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT"})(bt||(bt={}));var h;(function(t){t[t.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",t[t.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",t[t.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",t[t.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",t[t.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",t[t.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",t[t.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",t[t.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",t[t.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",t[t.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",t[t.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",t[t.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",t[t.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",t[t.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",t[t.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",t[t.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",t[t.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",t[t.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",t[t.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",t[t.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",t[t.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",t[t.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",t[t.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",t[t.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",t[t.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",t[t.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",t[t.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",t[t.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",t[t.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",t[t.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",t[t.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",t[t.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",t[t.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",t[t.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",t[t.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",t[t.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",t[t.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",t[t.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",t[t.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",t[t.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",t[t.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",t[t.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",t[t.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",t[t.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",t[t.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",t[t.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",t[t.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",t[t.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",t[t.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",t[t.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",t[t.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",t[t.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",t[t.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",t[t.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",t[t.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",t[t.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",t[t.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",t[t.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",t[t.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",t[t.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",t[t.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",t[t.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",t[t.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",t[t.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",t[t.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",t[t.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",t[t.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",t[t.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",t[t.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",t[t.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",t[t.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",t[t.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",t[t.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",t[t.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",t[t.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",t[t.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",t[t.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",t[t.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",t[t.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",t[t.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",t[t.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",t[t.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",t[t.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",t[t.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",t[t.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",t[t.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",t[t.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",t[t.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",t[t.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",t[t.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",t[t.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",t[t.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",t[t.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",t[t.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",t[t.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",t[t.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",t[t.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",t[t.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",t[t.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",t[t.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",t[t.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",t[t.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",t[t.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",t[t.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",t[t.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",t[t.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",t[t.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",t[t.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",t[t.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",t[t.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",t[t.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",t[t.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",t[t.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",t[t.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",t[t.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",t[t.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",t[t.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",t[t.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",t[t.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",t[t.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",t[t.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",t[t.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",t[t.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",t[t.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",t[t.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",t[t.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",t[t.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",t[t.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",t[t.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",t[t.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",t[t.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",t[t.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",t[t.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",t[t.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",t[t.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",t[t.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",t[t.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",t[t.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",t[t.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",t[t.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",t[t.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",t[t.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",t[t.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",t[t.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",t[t.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",t[t.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",t[t.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",t[t.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",t[t.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",t[t.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",t[t.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",t[t.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",t[t.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",t[t.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",t[t.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",t[t.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",t[t.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",t[t.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",t[t.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",t[t.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",t[t.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",t[t.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",t[t.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",t[t.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",t[t.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",t[t.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",t[t.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",t[t.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",t[t.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",t[t.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",t[t.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",t[t.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",t[t.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",t[t.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",t[t.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",t[t.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",t[t.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",t[t.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",t[t.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",t[t.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",t[t.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",t[t.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",t[t.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",t[t.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",t[t.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",t[t.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",t[t.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",t[t.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",t[t.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",t[t.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",t[t.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",t[t.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",t[t.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",t[t.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",t[t.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",t[t.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",t[t.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",t[t.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",t[t.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",t[t.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",t[t.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",t[t.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",t[t.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",t[t.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",t[t.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",t[t.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",t[t.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",t[t.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",t[t.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",t[t.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",t[t.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",t[t.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",t[t.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",t[t.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",t[t.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",t[t.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",t[t.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",t[t.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",t[t.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",t[t.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",t[t.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",t[t.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",t[t.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",t[t.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",t[t.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",t[t.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",t[t.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",t[t.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",t[t.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",t[t.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",t[t.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",t[t.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",t[t.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",t[t.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",t[t.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",t[t.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",t[t.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",t[t.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",t[t.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",t[t.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",t[t.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",t[t.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",t[t.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",t[t.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",t[t.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",t[t.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",t[t.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",t[t.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",t[t.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",t[t.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",t[t.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",t[t.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",t[t.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",t[t.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",t[t.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",t[t.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",t[t.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",t[t.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",t[t.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",t[t.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",t[t.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",t[t.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",t[t.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",t[t.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",t[t.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",t[t.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",t[t.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",t[t.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",t[t.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",t[t.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",t[t.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",t[t.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",t[t.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",t[t.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",t[t.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",t[t.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",t[t.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",t[t.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",t[t.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",t[t.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",t[t.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",t[t.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",t[t.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",t[t.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",t[t.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",t[t.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",t[t.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",t[t.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",t[t.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ"})(h||(h={}));const pe=Object.fromEntries(Object.entries(h).map(([t,n])=>[n,t]));var ot;(function(t){t[t.DWG=0]="DWG",t[t.DXF=1]="DXF"})(ot||(ot={}));var U;(function(t){t[t.Line=1]="Line",t[t.CircularArc=2]="CircularArc",t[t.EllipticArc=3]="EllipticArc",t[t.Spline=4]="Spline"})(U||(U={}));var Ft;(function(t){t[t.ByLayer=192]="ByLayer",t[t.ByBlock=193]="ByBlock",t[t.Entities=194]="Entities",t[t.TrueColor=195]="TrueColor",t[t.ForegroundColor=197]="ForegroundColor",t[t.None=200]="None"})(Ft||(Ft={}));const ye="*MODEL_SPACE",Ge="*PAPER_SPACE",rn=t=>t&&t.toUpperCase()==ye,De=t=>t&&t.toUpperCase().startsWith(Ge),v=t=>t.toString(16).toUpperCase();class We{constructor(n){S(this,"libredwg");S(this,"layers",new Map);S(this,"ltypes",new Map);S(this,"unknownEntityCount");this.libredwg=n,this.unknownEntityCount=0}prepare(n,a=!1){(a||this.layers.size==0)&&(this.layers.clear(),n.tables.LAYER.entries.forEach(e=>{this.layers.set(e.handle,e.name)})),(a||this.ltypes.size==0)&&(this.ltypes.clear(),n.tables.LTYPE.entries.forEach(e=>{this.ltypes.set(e.handle,e.name)})),this.unknownEntityCount=0}clear(){this.layers.clear(),this.ltypes.clear(),this.unknownEntityCount=0}convert(n){const a=this.libredwg,e=a.dwg_object_to_entity(n),i=a.dwg_object_to_entity_tio(n);if(e&&i){const s=this.getCommonAttrs(e),o=a.dwg_object_get_fixedtype(n);if(o==h.DWG_TYPE_3DFACE)return this.convert3dFace(i,s);if(o==h.DWG_TYPE_ARC)return this.convertArc(i,s);if(o==h.DWG_TYPE_ATTDEF)return this.convertAttdef(i,s);if(o==h.DWG_TYPE_CIRCLE)return this.convertCircle(i,s);if(o==h.DWG_TYPE_DIMENSION_ALIGNED||o==h.DWG_TYPE_DIMENSION_LINEAR)return this.convertAlignedDimension(i,s);if(o==h.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(i,s);if(o==h.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(i,s);if(o==h.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(i,s);if(o==h.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(i,s);if(o==h.DWG_TYPE_ELLIPSE)return this.convertEllise(i,s);if(o==h.DWG_TYPE_HATCH)return this.convertHatch(i,s);if(o==h.DWG_TYPE_IMAGE)return this.convertImage(i,s);if(o==h.DWG_TYPE_INSERT)return this.convertInsert(i,s);if(o==h.DWG_TYPE_LEADER)return this.convertLeader(i,s);if(o==h.DWG_TYPE_LINE)return this.convertLine(i,s);if(o==h.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(i,s);if(o==h.DWG_TYPE_MLINE)return this.convertMLine(i,s);if(o==h.DWG_TYPE_MTEXT)return this.convertMText(i,s);if(o==h.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(i,s);if(o==h.DWG_TYPE_OLEFRAME)return this.convertOleFrame(i,s);if(o==h.DWG_TYPE_POINT)return this.convertPoint(i,s);if(o==h.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(i,s,n);if(o==h.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(i,s,n);if(o==h.DWG_TYPE_PROXY_ENTITY)return this.convertProxy(i,s);if(o==h.DWG_TYPE_RAY)return this.convertRay(i,s);if(o==h.DWG_TYPE_SECTIONOBJECT)return this.convertSection(i,s);if(o==h.DWG_TYPE_SOLID)return this.convertSolid(i,s);if(o==h.DWG_TYPE_SPLINE)return this.convertSpline(i,s);if(o==h.DWG_TYPE_TABLE)return this.convertTable(i,s);if(o==h.DWG_TYPE_TEXT)return this.convertText(i,s);if(o==h.DWG_TYPE_TOLERANCE)return this.convertTolerance(i,s);if(o==h.DWG_TYPE_VIEWPORT)return this.convertViewport(i,s);if(o==h.DWG_TYPE_WIPEOUT)return this.convertWipeout(i,s);if(o==h.DWG_TYPE_XLINE)return this.convertXline(i,s);o===h.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,s=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,r=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"invis_flags").data;return{type:"3DFACE",...a,corner1:i,corner2:s,corner3:o,corner4:r,flag:_}}convertArc(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,s=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,r=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ARC",...a,thickness:o,center:i,radius:s,startAngle:_,endAngle:d,extrusionDirection:r}}convertEmbeddedMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,a,"attachment").data,s=e.dwg_dynapi_subclass_value(n,a,"ins_pt").data,o=e.dwg_dynapi_subclass_value(n,a,"x_axis_dir").data,r=e.dwg_dynapi_subclass_value(n,a,"rect_height").data,_=e.dwg_dynapi_subclass_value(n,a,"rect_width").data,d=e.dwg_dynapi_subclass_value(n,a,"extents_height").data,l=e.dwg_dynapi_subclass_value(n,a,"extents_width").data;return{insertionPoint:s,rectHeight:r,rectWidth:_,extentsHeight:d,extentsWidth:l,attachmentPoint:i,direction:o}}convertAttdef(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"default_value").data,s=this.convertTextBase(n);s.text=i;const o=e.dwg_dynapi_entity_value(n,"prompt").data,r=e.dwg_dynapi_entity_value(n,"tag").data,_=e.dwg_dynapi_entity_value(n,"flags").data,d=e.dwg_dynapi_entity_value(n,"field_length").data,l=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,E=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,u=e.dwg_dynapi_entity_value(n,"is_really_locked").data,c=e.dwg_dynapi_entity_value(n,"mtext_type").data,T=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTDEF",...a,text:this.convertTextBase(n),prompt:o,tag:r,flags:_,fieldLength:d,lockPositionFlag:l>0,duplicateRecordCloningFlag:E>0,mtextFlag:c,isReallyLocked:u>0,alignmentPoint:T,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertAttrib(n,a){const e=this.libredwg,i=this.convertTextBase(n),s=e.dwg_dynapi_entity_value(n,"tag").data,o=e.dwg_dynapi_entity_value(n,"flags").data,r=e.dwg_dynapi_entity_value(n,"field_length").data,_=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,d=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,l=e.dwg_dynapi_entity_value(n,"mtext_type").data,E=e.dwg_dynapi_entity_value(n,"is_really_locked").data,u=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTRIB",...a,text:i,tag:s,flags:o,fieldLength:r,lockPositionFlag:!!_,duplicateRecordCloningFlag:!!d,mtextFlag:l,isReallyLocked:!!E,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...u,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertCircle(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,s=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,r=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"CIRCLE",...a,thickness:o,center:i,radius:s,extrusionDirection:r}}convertAlignedDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),s=e.dwg_dynapi_entity_value(n,"clone_ins_pt").data,o=e.dwg_dynapi_entity_value(n,"xline1_pt").data,r=e.dwg_dynapi_entity_value(n,"xline2_pt").data,_=e.dwg_dynapi_entity_value(n,"ins_rotation").data,d=e.dwg_dynapi_entity_value(n,"oblique_angle").data;return{subclassMarker:"AcDbAlignedDimension",...a,...i,insertionPoint:s,subDefinitionPoint1:o,subDefinitionPoint2:r,rotationAngle:_??0,obliqueAngle:d}}convert3PointAngularDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),s=e.dwg_dynapi_entity_value(n,"xline1_pt").data,o=e.dwg_dynapi_entity_value(n,"xline2_pt").data,r=e.dwg_dynapi_entity_value(n,"center_pt").data,_=e.dwg_dynapi_entity_value(n,"xline2end_pt").data;return{subclassMarker:"AcDb3PointAngularDimension",...a,...i,subDefinitionPoint1:s,subDefinitionPoint2:o,centerPoint:r,arcPoint:_}}convertDiameterDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),s=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbDiametricDimension",...a,...i,centerPoint:s,leaderLength:o}}convertOrdinateDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),s=e.dwg_dynapi_entity_value(n,"feature_location_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_endpt").data;return{subclassMarker:"AcDbOrdinateDimension",...a,...i,subDefinitionPoint1:s,subDefinitionPoint2:o}}convertRadiusDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),s=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbRadialDimension",...a,...i,centerPoint:s,leaderLength:o}}convertEllise(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,s=e.dwg_dynapi_entity_value(n,"sm_axis").data,o=e.dwg_dynapi_entity_value(n,"extrusion").data,r=e.dwg_dynapi_entity_value(n,"axis_ratio").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ELLIPSE",...a,center:i,majorAxisEndPoint:s,extrusionDirection:o,axisRatio:r,startAngle:_,endAngle:d}}convertHatch(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"extrusion").data,s=e.dwg_dynapi_entity_value(n,"name").data,o=e.dwg_dynapi_entity_value(n,"is_solid_fill").data,r=e.dwg_dynapi_entity_value(n,"is_associative").data,_=e.dwg_dynapi_entity_value(n,"num_paths").data,d=e.dwg_dynapi_entity_value(n,"paths").data,l=e.dwg_ptr_to_hatch_path_array(d,_),E=e.dwg_dynapi_entity_value(n,"style").data,u=e.dwg_dynapi_entity_value(n,"pattern_type").data,c=e.dwg_dynapi_entity_value(n,"angle").data,T=e.dwg_dynapi_entity_value(n,"scale_spacing").data,A=e.dwg_dynapi_entity_value(n,"num_deflines").data,I=e.dwg_dynapi_entity_value(n,"deflines").data,P=e.dwg_ptr_to_hatch_defline_array(I,A),f=e.dwg_dynapi_entity_value(n,"pixel_size").data,C=e.dwg_dynapi_entity_value(n,"num_seeds").data,g=e.dwg_dynapi_entity_value(n,"seeds").data,L=e.dwg_ptr_to_point2d_array(g,C),Y={...a,extrusionDirection:i,patternName:s,solidFill:o?Q.SolidFill:Q.PatternFill,associativity:r?j.Associative:j.NonAssociative,numberOfBoundaryPaths:_,boundaryPaths:this.convertHatchBoundaryPaths(l),hatchStyle:E,patternType:u,patternAngle:c,patternScale:T,numberOfDefinitionLines:A,definitionLines:P.map(N=>({angle:N.angle,base:N.pt0,offset:N.offset,numberOfDashLengths:N.dashes.length,dashLengths:N.dashes})),pixelSize:f,numberOfSeedPoints:C,seedPoints:L};if(e.dwg_dynapi_entity_value(n,"is_gradient_fill").data>0){const N=e.dwg_dynapi_entity_value(n,"gradient_name").data,x=e.dwg_dynapi_entity_value(n,"gradient_angle").data,O=e.dwg_dynapi_entity_value(n,"gradient_shift").data,m=e.dwg_dynapi_entity_value(n,"gradient_tint").data,M=e.dwg_dynapi_entity_value(n,"single_color_gradient").data,w=e.dwg_dynapi_entity_value(n,"colors").data,b=e.dwg_ptr_to_hatch_gradient_color_array(w,M==1?1:2);return{type:"HATCH",...Y,gradientFlag:it.Gradient,gradientColorFlag:M==1?tt.OneColor:tt.TwoColor,gradientName:N,gradientRotation:x,gradientDefinition:O,colorTint:m,gradientColors:b}}else return{type:"HATCH",...Y}}convertHatchBoundaryPaths(n){return n.filter(e=>e.num_segs_or_paths>0).map(e=>{const i={boundaryPathTypeFlag:e.flag};if(e.flag&2)return{...i,hasBulge:e.bulges_present,isClosed:e.closed,numberOfVertices:e.num_segs_or_paths,vertices:e.polyline_paths.map(s=>({x:s.point.x,y:s.point.y,bulge:s.bulge}))};{const s=e.segs.map(o=>{if(o.curve_type==U.Line)return{type:F.Line,start:o.first_endpoint,end:o.second_endpoint};if(o.curve_type==U.CircularArc)return{type:F.Circular,center:o.center,radius:o.radius,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.EllipticArc)return{type:F.Elliptic,center:o.center,end:o.endpoint,lengthOfMinorAxis:o.minor_major_ratio,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.Spline)return{type:F.Spline,degree:o.degree,isRational:o.is_rational,isPeriodic:o.is_periodic,numberOfKnots:o.num_knots,numberOfControlPoints:o.num_control_points,knots:o.knots,controlPoints:o.control_points,numberOfFitData:o.num_fitpts,fitDatum:o.fitpts,startTangent:o.start_tangent,endTangent:o.end_tangent}});return{...i,numberOfEdges:e.num_segs_or_paths,edges:s}}})}convertImage(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,s=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,r=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,E=e.dwg_dynapi_entity_value(n,"brightness").data,u=e.dwg_dynapi_entity_value(n,"contrast").data,c=e.dwg_dynapi_entity_value(n,"fade").data,T=e.dwg_dynapi_entity_value(n,"clip_mode").data,A=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,I=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,P=e.dwg_dynapi_entity_value(n,"clip_verts").data,f=e.dwg_ptr_to_point3d_array(P,I),C=e.dwg_dynapi_entity_value(n,"imagedef").data,g=v(e.dwg_ref_get_absref(C)),L=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,Y=v(e.dwg_ref_get_absref(L));return{type:"IMAGE",...a,version:i,position:s,uPixel:o,vPixel:r,imageSize:_,imageDefHandle:g,flags:d,clipping:l,brightness:E,contrast:u,fade:c,imageDefReactorHandle:Y,clippingBoundaryType:A,countBoundaryPoints:I,clippingBoundaryPath:f,clipMode:T}}convertInsert(n,a){const e=this.libredwg;let i="";const s=e.dwg_dynapi_entity_value(n,"block_header").data;if(s){const I=e.dwg_ref_get_object(s);if(I){const P=e.dwg_object_to_object_tio(I);P&&(i=e.dwg_entity_block_header_get_block(P).name)}}i||(i=e.dwg_dynapi_entity_value(n,"block_name").data);const o=e.dwg_dynapi_entity_value(n,"ins_pt").data,r=e.dwg_dynapi_entity_value(n,"scale").data,_=e.dwg_dynapi_entity_value(n,"rotation").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"num_rows").data,E=e.dwg_dynapi_entity_value(n,"col_spacing").data,u=e.dwg_dynapi_entity_value(n,"row_spacing").data,c=e.dwg_dynapi_entity_value(n,"extrusion").data,T=e.dwg_entity_insert_get_attribs(n),A=[];return T.forEach(I=>{const P=e.dwg_object_to_entity(I),f=e.dwg_object_to_entity_tio(I);if(P&&f){const C=this.getCommonAttrs(P);e.dwg_object_get_fixedtype(I)==h.DWG_TYPE_ATTRIB&&A.push(this.convertAttrib(f,C))}}),{type:"INSERT",...a,name:i,insertionPoint:o,xScale:r?r.x:1,yScale:r?r.y:1,zScale:r?r.z:1,rotation:_,columnCount:d,rowCount:l,columnSpacing:E,rowSpacing:u,extrusionDirection:c,attribs:A}}convertLeader(n,a){const e=this.libredwg,i=e.dwg_entity_mtext_get_style_name(n),s=e.dwg_dynapi_entity_value(n,"arrowhead_type").data,o=e.dwg_dynapi_entity_value(n,"path_type").data,r=e.dwg_dynapi_entity_value(n,"annot_type").data,_=e.dwg_dynapi_entity_value(n,"hookline_dir").data,d=e.dwg_dynapi_entity_value(n,"hookline_on").data,l=e.dwg_dynapi_entity_value(n,"box_height").data,E=e.dwg_dynapi_entity_value(n,"box_width").data,u=e.dwg_dynapi_entity_value(n,"num_points").data,c=e.dwg_dynapi_entity_value(n,"points").data,T=u>0?e.dwg_ptr_to_point3d_array(c,u):[],A=e.dwg_dynapi_entity_value(n,"byblock_color").data,I=e.dwg_dynapi_entity_value(n,"extrusion").data,P=e.dwg_dynapi_entity_value(n,"x_direction").data,f=e.dwg_dynapi_entity_value(n,"inspt_offset").data,C=e.dwg_dynapi_entity_value(n,"endptproj").data;return{type:"LEADER",...a,styleName:i,isArrowheadEnabled:s>0,isSpline:o>0,leaderCreationFlag:r,isHooklineSameDirection:_>0,isHooklineExists:d>0,textHeight:l,textWidth:E,numberOfVertices:u,vertices:T,byBlockColor:A,normal:I,horizontalDirection:P,offsetFromBlock:f,offsetFromAnnotation:C}}convertLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"start").data,s=e.dwg_dynapi_entity_value(n,"end").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,r=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"LINE",...a,thickness:o,startPoint:i,endPoint:s,extrusionDirection:r}}convertLWPolyline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"num_points").data,s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"const_width").data,r=e.dwg_dynapi_entity_value(n,"elevation").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=[],E=e.dwg_dynapi_entity_value(n,"num_points").data,u=e.dwg_dynapi_entity_value(n,"points").data,c=e.dwg_ptr_to_point2d_array(u,E),T=e.dwg_dynapi_entity_value(n,"num_bulges").data,A=e.dwg_dynapi_entity_value(n,"bulges").data,I=e.dwg_ptr_to_double_array(A,T);return c.forEach((P,f)=>{l.push({id:f,x:P.x,y:P.y,bulge:I.length>f?I[f]:0})}),{type:"LWPOLYLINE",...a,numberOfVertices:i,flag:s,constantWidth:o,elevation:r,thickness:_,extrusionDirection:d,vertices:l}}convertMLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"scale").data,s=e.dwg_dynapi_entity_value(n,"flags").data,o=e.dwg_dynapi_entity_value(n,"justification").data,r=e.dwg_dynapi_entity_value(n,"base_point").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"num_lines").data,l=e.dwg_dynapi_entity_value(n,"num_verts").data,E=e.dwg_dynapi_entity_value(n,"verts").data,u=e.dwg_ptr_to_mline_vertex_array(E,l),c=[];return u.forEach(T=>{c.push({vertex:T.vertex,vertexDirection:T.vertex_direction,miterDirection:T.miter_direction,numberOfLines:T.num_lines,lines:T.lines.map(A=>({numberOfSegmentParams:A.num_segparms,segmentParams:A.segparms,numberOfAreaFillParams:A.num_areafillparms,areaFillParams:A.areafillparms}))})}),{type:"MLINE",...a,scale:i,flags:s,justification:o,startPoint:r,extrusionDirection:_,numberOfLines:d,numberOfVertices:l,vertices:c,mlineStyle:""}}convertOle2Frame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"oleversion").data,s=e.dwg_dynapi_entity_value(n,"oleclient").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,r=e.dwg_dynapi_entity_value(n,"pt1").data,_=e.dwg_dynapi_entity_value(n,"pt2").data,d=e.dwg_dynapi_entity_value(n,"lock_aspect").data,l=e.dwg_dynapi_entity_value(n,"type").data,E=e.dwg_dynapi_entity_value(n,"mode").data,u=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLE2FRAME",...a,oleVersion:i,oleClient:s,dataSize:o,leftUpPoint:r,rightDownPoint:_,lockAspect:d,oleObjectType:l,tileModeDescriptor:E,binaryData:u}}convertOleFrame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"flag").data,s=e.dwg_dynapi_entity_value(n,"mode").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,r=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLEFRAME",...a,flag:i,mode:s,dataSize:o,binaryData:r}}convertMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,s=e.dwg_dynapi_entity_value(n,"text_height").data,o=e.dwg_dynapi_entity_value(n,"rect_height").data,r=e.dwg_dynapi_entity_value(n,"rect_width").data,_=e.dwg_dynapi_entity_value(n,"extents_width").data,d=e.dwg_dynapi_entity_value(n,"extents_height").data,l=e.dwg_dynapi_entity_value(n,"attachment").data,E=e.dwg_dynapi_entity_value(n,"flow_dir").data,u=e.dwg_dynapi_entity_value(n,"text").data,c=e.dwg_entity_mtext_get_style_name(n),T=e.dwg_dynapi_entity_value(n,"extrusion").data,A=e.dwg_dynapi_entity_value(n,"x_axis_dir").data,I=e.dwg_dynapi_entity_value(n,"linespace_style").data,P=e.dwg_dynapi_entity_value(n,"linespace_factor").data,f=e.dwg_dynapi_entity_value(n,"bg_fill_flag").data,C=e.dwg_dynapi_entity_value(n,"bg_fill_scale").data,g=e.dwg_dynapi_entity_value(n,"bg_fill_color").data,L=e.dwg_dynapi_entity_value(n,"bg_fill_trans").data,Y=e.dwg_dynapi_entity_value(n,"column_type").data,p=e.dwg_dynapi_entity_value(n,"flow_reversed").data,N=e.dwg_dynapi_entity_value(n,"auto_height").data,x=e.dwg_dynapi_entity_value(n,"column_width").data,O=e.dwg_dynapi_entity_value(n,"gutter").data,m=e.dwg_dynapi_entity_value(n,"num_column_heights").data,M=e.dwg_dynapi_entity_value(n,"column_heights").data,w=e.dwg_ptr_to_double_array(M,m);return{type:"MTEXT",...a,insertionPoint:i,textHeight:s,rectHeight:o,rectWidth:r,extentsHeight:d,extentsWidth:_,attachmentPoint:l,drawingDirection:E,text:u,styleName:c,extrusionDirection:T,direction:A,rotation:0,lineSpacingStyle:I,lineSpacing:P,backgroundFill:f,fillBoxScale:C,backgroundFillColor:g.rgb,backgroundFillTransparency:L,columnType:Y,columnFlowReversed:p,columnAutoHeight:N,columnWidth:x,columnGutter:O,columnHeightCount:m,columnHeights:w}}convertPoint(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"x").data,s=e.dwg_dynapi_entity_value(n,"y").data,o=e.dwg_dynapi_entity_value(n,"z").data,r=e.dwg_dynapi_entity_value(n,"thickness").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"x_ang").data;return{type:"POINT",...a,position:{x:i,y:s,z:o},thickness:r,extrusionDirection:_,angle:d}}convertPolyline2d(n,a,e){const i=this.libredwg,s=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,r=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"elevation").data,l=i.dwg_dynapi_entity_value(n,"thickness").data,E=i.dwg_dynapi_entity_value(n,"extrusion").data,u=i.dwg_entity_polyline_2d_get_vertices(e);return{type:"POLYLINE2D",...a,flag:s,smoothType:o,startWidth:r,endWidth:_,elevation:d,thickness:l,extrusionDirection:E,vertices:u.map(c=>({x:c.point.x,y:c.point.y,z:c.point.z,startWidth:c.start_width,endWidth:c.end_width,bulge:c.bulge,flag:c.flag,tangentDirection:c.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(n,a,e){const i=this.libredwg,s=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,r=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"extrusion").data,l=i.dwg_entity_polyline_3d_get_vertices(e);return{type:"POLYLINE3D",...a,flag:s,smoothType:o,startWidth:r,endWidth:_,extrusionDirection:d,vertices:l.map(E=>({x:E.point.x,y:E.point.y,z:E.point.z,flag:E.flag}))}}convertProxy(n,a){const i=this.libredwg.dwg_dynapi_entity_value(n,"class_id").data;return{type:"PROXY",...a,applicationEntityClassId:i}}convertRay(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,s=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"RAY",...a,firstPoint:i,unitDirection:s}}convertSection(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"state").data,s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"name").data,r=e.dwg_dynapi_entity_value(n,"vert_dir").data,_=e.dwg_dynapi_entity_value(n,"top_height").data,d=e.dwg_dynapi_entity_value(n,"bottom_height").data,l=e.dwg_dynapi_entity_value(n,"indicator_alpha").data,E=e.dwg_dynapi_entity_value(n,"indicator_color").data,u=e.dwg_dynapi_entity_value(n,"num_verts").data,c=e.dwg_dynapi_entity_value(n,"verts").data,T=u>0?e.dwg_ptr_to_point3d_array(c,u):[],A=e.dwg_dynapi_entity_value(n,"num_blverts").data,I=e.dwg_dynapi_entity_value(n,"blverts").data,P=A>0?e.dwg_ptr_to_point3d_array(I,A):[],f=e.dwg_dynapi_entity_value(n,"geometrySettingHardId").data,C=e.dwg_ref_get_handle_absolute_ref(f);return{type:"SECTION",...a,state:i,flags:s,name:o,verticalDirection:r,topHeight:_,bottomHeight:d,indicatorTransparency:l,indicatorColor:E.rgb,numberOfVertices:u,vertices:T,numberOfBackLineVertices:A,backLineVertices:P,geometrySettingHardId:C}}convertSolid(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,s=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,r=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"SOLID",...a,corner1:i,corner2:s,corner3:o,corner4:r,thickness:_,extrusionDirection:d}}convertSpline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"splineflags").data,s=e.dwg_dynapi_entity_value(n,"degree").data,o=e.dwg_dynapi_entity_value(n,"knot_tol").data,r=e.dwg_dynapi_entity_value(n,"num_knots").data,_=e.dwg_dynapi_entity_value(n,"knots").data,d=e.dwg_ptr_to_double_array(_,r),l=e.dwg_dynapi_entity_value(n,"fit_tol").data,E=e.dwg_dynapi_entity_value(n,"num_fit_pts").data,u=e.dwg_dynapi_entity_value(n,"fit_pts").data,c=e.dwg_ptr_to_point3d_array(u,E),T=e.dwg_dynapi_entity_value(n,"weighted").data,A=e.dwg_dynapi_entity_value(n,"ctrl_tol").data,I=e.dwg_dynapi_entity_value(n,"num_ctrl_pts").data,P=e.dwg_dynapi_entity_value(n,"ctrl_pts").data,f=e.dwg_ptr_to_point4d_array(P,I),C=e.dwg_dynapi_entity_value(n,"beg_tan_vec").data,g=e.dwg_dynapi_entity_value(n,"end_tan_vec").data;return{type:"SPLINE",...a,flag:i,degree:s,numberOfKnots:r,numberOfControlPoints:I,numberOfFitPoints:E,knotTolerance:o,controlTolerance:A,fitTolerance:l,startTangent:C,endTangent:g,knots:d,weights:T?f.map(L=>L.w):void 0,controlPoints:f.map(L=>({x:L.x,y:L.y,z:L.z})),fitPoints:c}}convertTable(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,"ldata","name").data,s=e.dwg_dynapi_entity_value(n,"ins_pt").data,o=e.dwg_dynapi_entity_value(n,"horiz_direction").data,r=e.dwg_dynapi_entity_value(n,"flag_for_table_value").data,_=e.dwg_dynapi_entity_value(n,"num_rows").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"row_heights").data,E=e.dwg_ptr_to_double_array(l,_),u=e.dwg_dynapi_entity_value(n,"col_widths").data,c=e.dwg_ptr_to_double_array(u,d),T=e.dwg_dynapi_entity_value(n,"tablestyle").data,A=v(e.dwg_ref_get_absref(T)),I=e.dwg_dynapi_entity_value(n,"block_header").data,P=v(e.dwg_ref_get_absref(I)),f=e.dwg_dynapi_entity_value(n,"table_flag_override").data,C=e.dwg_dynapi_entity_value(n,"border_color_overrides_flag").data,g=e.dwg_dynapi_entity_value(n,"border_lineweight_overrides_flag").data,L=e.dwg_dynapi_entity_value(n,"border_visibility_overrides_flag").data,Y=e.dwg_dynapi_entity_value(n,"num_cells").data,p=e.dwg_dynapi_entity_value(n,"cells").data,N=e.dwg_ptr_to_table_cell_array(p,Y);return{type:"ACAD_TABLE",...a,name:i,startPoint:s,directionVector:o,tableValue:r,rowCount:_,columnCount:d,overrideFlag:f,borderColorOverrideFlag:C,borderLineWeightOverrideFlag:g,borderVisibilityOverrideFlag:L,rowHeightArr:E,columnWidthArr:c,tableStyleId:A,blockRecordHandle:P,cells:this.convertTableCells(N),bmpPreview:""}}convertTableCells(n){const a=[];return n.forEach(e=>({text:e.text_value,attachmentPoint:e.cell_alignment,textStyle:e.text_style,rotation:e.rotation,cellType:e.type,flagValue:e.flags,mergedValue:e.is_merged_value,autoFit:e.is_autofit_flag,topBorderVisibility:e.top_visibility,bottomBorderVisibility:e.bottom_visibility,leftBorderVisibility:e.left_visibility,rightBorderVisibility:e.right_visibility,overrideFlag:e.cell_flag_override,virtualEdgeFlag:e.virtual_edge_flag,blockTableRecordI:e.block_handle.absolute_ref,blockScale:e.block_scale,blockAttrNum:e.attr_defs.length,attrDefineId:e.attr_defs.map(i=>i.attdef.absolute_ref),extendedCellFlags:e.additional_data_flag})),a}convertTextBase(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"text_value").data,i=a.dwg_dynapi_entity_value(n,"thickness").data,s=a.dwg_dynapi_entity_value(n,"ins_pt").data,o=a.dwg_dynapi_entity_value(n,"alignment_pt").data,r=a.dwg_dynapi_entity_value(n,"rotation").data,_=a.dwg_dynapi_entity_value(n,"height").data,d=a.dwg_dynapi_entity_value(n,"width_factor").data,l=a.dwg_dynapi_entity_value(n,"oblique_angle").data,E=a.dwg_entity_text_get_style_name(n),u=a.dwg_dynapi_entity_value(n,"generation").data,c=a.dwg_dynapi_entity_value(n,"horiz_alignment").data,T=a.dwg_dynapi_entity_value(n,"vert_alignment").data,A=a.dwg_dynapi_entity_value(n,"extrusion").data;return{text:e,thickness:i,startPoint:s,endPoint:o,textHeight:_,rotation:r,xScale:d,obliqueAngle:l,styleName:E,generationFlag:u,halign:c,valign:T,extrusionDirection:A}}convertText(n,a){return{type:"TEXT",...a,...this.convertTextBase(n)}}convertTolerance(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,s=e.dwg_dynapi_entity_value(n,"text_value").data,o=e.dwg_dynapi_entity_value(n,"x_direction").data,r=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_entity_get_dimstyle_name(n);return{type:"TOLERANCE",...a,styleName:_,insertionPoint:i,text:s,extrusionDirection:r,xAxisDirection:o}}convertViewport(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,s=e.dwg_dynapi_entity_value(n,"width").data,o=e.dwg_dynapi_entity_value(n,"height").data,r=e.dwg_dynapi_entity_value(n,"on_off").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,l=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,E=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,u=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,c=e.dwg_dynapi_entity_value(n,"view_target").data,T=e.dwg_dynapi_entity_value(n,"lens_length").data,A=e.dwg_dynapi_entity_value(n,"front_clip_z").data,I=e.dwg_dynapi_entity_value(n,"back_clip_z").data,P=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,f=e.dwg_dynapi_entity_value(n,"SNAPANG").data,C=e.dwg_dynapi_entity_value(n,"twist_angle").data,g=e.dwg_dynapi_entity_value(n,"circle_zoom").data,L=e.dwg_dynapi_entity_value(n,"status_flag").data,Y=e.dwg_dynapi_entity_value(n,"style_sheet").data,p=e.dwg_dynapi_entity_value(n,"render_mode").data,N=e.dwg_dynapi_entity_value(n,"UCSVP").data,x=e.dwg_dynapi_entity_value(n,"ucsorg").data,O=e.dwg_dynapi_entity_value(n,"ucsxdir").data,m=e.dwg_dynapi_entity_value(n,"ucsydir").data,M=e.dwg_dynapi_entity_value(n,"named_ucs").data,w=e.dwg_ref_get_absref(M),b=e.dwg_dynapi_entity_value(n,"base_ucs").data,V=e.dwg_ref_get_absref(b),K=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"shadeplot_mode").data,k=e.dwg_dynapi_entity_value(n,"use_default_lights").data,J=e.dwg_dynapi_entity_value(n,"default_lighting_type").data,X=e.dwg_dynapi_entity_value(n,"brightness").data,Z=e.dwg_dynapi_entity_value(n,"contrast").data,_t=e.dwg_dynapi_entity_value(n,"grid_major").data,dt=e.dwg_dynapi_entity_value(n,"background").data,lt=e.dwg_ref_get_absref(dt),ct=e.dwg_dynapi_entity_value(n,"shadeplot").data,Et=e.dwg_ref_get_absref(ct),ut=e.dwg_dynapi_entity_value(n,"visualstyle").data,It=e.dwg_ref_get_absref(ut),At=e.dwg_dynapi_entity_value(n,"sun").data,Pt=e.dwg_ref_get_absref(At);return{type:"VIEWPORT",...a,viewportCenter:i,width:s,height:o,status:r,viewportId:0,displayCenter:_,snapBase:d,snapSpacing:l,gridSpacing:E,viewDirection:u,targetPoint:c,perspectiveLensLength:T,frontClipZ:A,backClipZ:I,viewHeight:P,snapAngle:f,viewTwistAngle:C,circleZoomPercent:g,statusBitFlags:L,sheetName:Y,renderMode:p,ucsPerViewport:N,ucsOrigin:x,ucsXAxis:O,ucsYAxis:m,ucsId:v(w),ucsBaseId:v(V),orthographicType:K,elevation:$,shadePlotMode:z,majorGridFrequency:_t,backgroundId:v(lt),shadePlotId:v(Et),visualStyleId:v(It),isDefaultLighting:!!k,defaultLightingType:J,brightness:X,contrast:Z,sunId:v(Pt)}}convertWipeout(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,s=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,r=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,E=e.dwg_dynapi_entity_value(n,"brightness").data,u=e.dwg_dynapi_entity_value(n,"contrast").data,c=e.dwg_dynapi_entity_value(n,"fade").data,T=e.dwg_dynapi_entity_value(n,"clip_mode").data,A=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,I=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,P=e.dwg_dynapi_entity_value(n,"clip_verts").data,f=e.dwg_ptr_to_point2d_array(P,I),C=e.dwg_dynapi_entity_value(n,"imagedef").data,g=e.dwg_ref_get_absref(C),L=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,Y=e.dwg_ref_get_absref(L);return{type:"WIPEOUT",...a,version:i,position:s,uPixel:o,vPixel:r,imageSize:_,imageDefHandle:g,flags:d,clipping:l,brightness:E,contrast:u,fade:c,imageDefReactorHandle:Y,clippingBoundaryType:A,countBoundaryPoints:I,clippingBoundaryPath:f,clipMode:T}}convertXline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,s=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"XLINE",...a,firstPoint:i,unitDirection:s}}getDimensionCommonAttrs(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"class_version").data,i=a.dwg_entity_get_block_name(n,"block"),s=a.dwg_dynapi_entity_value(n,"def_pt").data,o=a.dwg_dynapi_entity_value(n,"text_midpt").data,r=a.dwg_dynapi_entity_value(n,"attachmentPoint").data,_=a.dwg_dynapi_entity_value(n,"flag").data,d=a.dwg_dynapi_entity_value(n,"lspace_factor").data,l=a.dwg_dynapi_entity_value(n,"lspace_factor").data,E=a.dwg_dynapi_entity_value(n,"act_measurement").data,u=a.dwg_dynapi_entity_value(n,"user_text").data,c=a.dwg_dynapi_entity_value(n,"text_rotation").data,T=a.dwg_dynapi_entity_value(n,"ins_rotation").data,A=a.dwg_dynapi_entity_value(n,"extrusion").data,I=a.dwg_entity_get_dimstyle_name(n);return{type:"DIMENSION",version:e,name:i,definitionPoint:s,textPoint:o,dimensionType:_,attachmentPoint:r,textLineSpacingStyle:d,textLineSpacingFactor:l||1,measurement:E,text:u,textRotation:c,ocsRotation:T,extrusionDirection:A,styleName:I}}getCommonAttrs(n){const a=this.libredwg,e=a.dwg_object_entity_get_color_object(n),i=e.method,s=e.index;let o;(i==194||(e.rgb>>>24&255)===194)&&(o=e.rgb&16777215);const r=this.getLayerName(n),_=a.dwg_object_entity_get_handle_object(n),d=a.dwg_object_entity_get_ownerhandle_object(n),l=a.dwg_object_entity_get_xdicobjhandle_object(n),E=this.getLtypeName(n),u=a.dwg_object_entity_get_line_weight(n),c=a.dwg_object_entity_get_ltype_scale(n),T=!a.dwg_object_entity_get_invisible(n),A=a.dwg_object_entity_get_xdata(n);return{handle:v(_.value),ownerDictionaryHardId:v(l.absolute_ref),ownerBlockRecordSoftId:v(d.absolute_ref),layer:r,color:o,colorIndex:s,colorName:e.name,lineType:E,lineweight:u,lineTypeScale:c,isVisible:T,transparency:e.alpha,transparencyType:e.alpha_type,xdata:A}}getLayerName(n){const e=this.libredwg.dwg_object_entity_get_layer_object_ref(n);return this.layers.get(v(e.handleref.value))??"0"}getLtypeName(n){const e=this.libredwg.dwg_object_entity_get_ltype_object_ref(n);return this.ltypes.get(v(e.handleref.value))??""}}class Zt{constructor(n){S(this,"libredwg");S(this,"entityConverter");this.libredwg=n,this.entityConverter=new We(n)}convert(n){this.entityConverter.clear();const a={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],IMAGEDEF:[],LAYOUT:[],SPATIAL_FILTER:[]},header:{},entities:[],classes:[]},e=this.libredwg;this.convertHeader(n,a.header),this.convertClasses(n,a.classes);const i=e.dwg_get_num_objects(n);for(let o=0;o<i;o++){const r=e.dwg_get_object(n,o);if(r){const _=e.dwg_object_to_object_tio(r);if(_)switch(e.dwg_object_get_fixedtype(r)){case h.DWG_TYPE_LAYER:{const l=this.convertLayer(_,r);a.tables.LAYER.entries.push(l),this.entityConverter.layers.set(l.handle,l.name)}break;case h.DWG_TYPE_LTYPE:{const l=this.convertLineType(_,r);a.tables.LTYPE.entries.push(l),this.entityConverter.ltypes.set(l.handle,l.name)}break}}}for(let o=0;o<i;o++){const r=e.dwg_get_object(n,o);if(r){const _=e.dwg_object_to_object_tio(r);if(_)switch(e.dwg_object_get_fixedtype(r)){case h.DWG_TYPE_APPID:a.tables.APPID.entries.push(this.convertAppId(_));break;case h.DWG_TYPE_BLOCK_HEADER:{const l=this.convertBlockRecord(_,r);a.tables.BLOCK_RECORD.entries.push(l),(rn(l.name)||De(l.name))&&l.entities.forEach(E=>{a.entities.push(E),E.type==="INSERT"&&E.attribs.forEach(u=>{a.entities.push(u)})})}break;case h.DWG_TYPE_DIMSTYLE:a.tables.DIMSTYLE.entries.push(this.convertDimStyle(_,r));break;case h.DWG_TYPE_STYLE:a.tables.STYLE.entries.push(this.convertStyle(_,r));break;case h.DWG_TYPE_VPORT:a.tables.VPORT.entries.push(this.convertViewport(_,r));break;case h.DWG_TYPE_DICTIONARY:a.objects.DICTIONARY.push(this.convertDictionary(_,r));break;case h.DWG_TYPE_IMAGEDEF:a.objects.IMAGEDEF.push(this.convertImageDef(_,r));break;case h.DWG_TYPE_LAYOUT:a.objects.LAYOUT.push(this.convertLayout(_,r));break;case h.DWG_TYPE_SPATIAL_FILTER:a.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(_,r));break}}}const s=a.entities.filter(o=>o.type==="VIEWPORT");return s.sort((o,r)=>{const _=parseInt(o.handle,16),d=parseInt(r.handle,16);return _-d}),s.forEach((o,r)=>{o.viewportId=r+1}),a}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}convertHeader(n,a){const e=this.libredwg;on.forEach(i=>{let s=i;(i=="DIMBLK"||i=="DIMBLK1"||i=="DIMBLK2")&&(s=s+"_T");let o=e.dwg_dynapi_header_value(n,s).data;i=="CELTYPE"||i=="CLAYER"||i=="CLAYER"||i=="DIMSTYLE"||i=="DIMTXSTY"||i=="TEXTSTYLE"?o=o?e.dwg_ref_get_object_name(o):"":i=="DRAGVS"&&(o=o?e.dwg_ref_get_absref(o):2),a[i]=o})}convertClasses(n,a){const e=this.libredwg,i=e.dwg_get_num_classes(n);for(let s=0;s<i;s++){const o=e.dwg_get_class(n,s);a.push({dxfName:o.dxfname,cppName:o.cppname,appName:o.appname,capabilitiesFlag:o.proxyflag,instanceCount:o.num_instances,wasAProxyFlag:o.s_zombie,isAnEntityFlag:o.item_class_id===498})}}convertAppId(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"name").data,i=a.dwg_dynapi_entity_value(n,"flag").data;return{name:e,standardFlag:i}}convertBlockRecord(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_entity_block_header_get_block(n);s.name&&(i.name=s.name);const o=e.dwg_dynapi_entity_value(n,"num_owned").data,r=e.dwg_dynapi_entity_value(n,"flag").data,_=e.dwg_dynapi_entity_value(n,"description").data,d=e.dwg_dynapi_entity_value(n,"base_pt").data,l=e.dwg_dynapi_entity_value(n,"insert_units").data,E=e.dwg_dynapi_entity_value(n,"explodable").data,u=e.dwg_dynapi_entity_value(n,"block_scaling").data,c=e.dwg_dynapi_entity_value(n,"layout").data,T=v(e.dwg_ref_get_absref(c));let A="";const I=C=>{const g=new Array(C.length);for(let L=0;L<C.length;L++)g[L]=C[L].toString(16).toUpperCase();return g.join("")},P=e.dwg_entity_block_header_get_preview(n);P&&P.length>0&&(A=I(P));let f=this.convertEntities(a,i.handle);if(!f||f.length==0){f=[];const C=e.dwg_dynapi_entity_value(n,"entities").data;if(C){const g=e.dwg_ptr_to_object_ref_ptr_array(C,o),L=this.entityConverter;for(let Y=0;Y<o;Y++){const p=e.dwg_ref_get_object(g[Y]),N=L.convert(p);N&&(N.ownerBlockRecordSoftId=i.handle,f.push(N))}}}return{...i,flags:r,description:_,basePoint:d,layout:T,insertionUnits:l,explodability:E,scalability:u,bmpPreview:A,entities:f}}convertEntities(n,a){const e=this.libredwg,i=this.entityConverter,s=[];let o=e.get_first_owned_entity(n);for(;o;){const r=i.convert(o);r&&(r.ownerBlockRecordSoftId=a,s.push(r)),o=e.get_next_owned_entity(n,o)}return s}convertDimStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_dynapi_entity_value(n,"DIMTOL").data,o=e.dwg_dynapi_entity_value(n,"DIMLIM").data,r=e.dwg_dynapi_entity_value(n,"DIMTIH").data,_=e.dwg_dynapi_entity_value(n,"DIMTOH").data,d=e.dwg_dynapi_entity_value(n,"DIMSE1").data,l=e.dwg_dynapi_entity_value(n,"DIMSE2").data,E=e.dwg_dynapi_entity_value(n,"DIMALT").data,u=e.dwg_dynapi_entity_value(n,"DIMTOFL").data,c=e.dwg_dynapi_entity_value(n,"DIMSAH").data,T=e.dwg_dynapi_entity_value(n,"DIMTIX").data,A=e.dwg_dynapi_entity_value(n,"DIMSOXD").data,I=e.dwg_dynapi_entity_value(n,"DIMALTD").data,P=e.dwg_dynapi_entity_value(n,"DIMZIN").data,f=e.dwg_dynapi_entity_value(n,"DIMSD1").data,C=e.dwg_dynapi_entity_value(n,"DIMSD2").data,g=e.dwg_dynapi_entity_value(n,"DIMTOLJ").data,L=e.dwg_dynapi_entity_value(n,"DIMJUST").data,Y=e.dwg_dynapi_entity_value(n,"DIMFIT").data,p=e.dwg_dynapi_entity_value(n,"DIMUPT").data,N=e.dwg_dynapi_entity_value(n,"DIMTZIN").data,x=e.dwg_dynapi_entity_value(n,"DIMALTZ").data,O=e.dwg_dynapi_entity_value(n,"DIMALTTZ").data,m=e.dwg_dynapi_entity_value(n,"DIMTAD").data,M=e.dwg_dynapi_entity_value(n,"DIMUNIT").data,w=e.dwg_dynapi_entity_value(n,"DIMAUNIT").data,b=e.dwg_dynapi_entity_value(n,"DIMDEC").data,V=e.dwg_dynapi_entity_value(n,"DIMTDEC").data,K=e.dwg_dynapi_entity_value(n,"DIMALTU").data,$=e.dwg_dynapi_entity_value(n,"DIMALTTD").data,z=e.dwg_dynapi_entity_value(n,"DIMSCALE").data,k=e.dwg_dynapi_entity_value(n,"DIMASZ").data,J=e.dwg_dynapi_entity_value(n,"DIMEXO").data,X=e.dwg_dynapi_entity_value(n,"DIMDLI").data,Z=e.dwg_dynapi_entity_value(n,"DIMEXE").data,_t=e.dwg_dynapi_entity_value(n,"DIMRND").data,dt=e.dwg_dynapi_entity_value(n,"DIMDLE").data,lt=e.dwg_dynapi_entity_value(n,"DIMTP").data,ct=e.dwg_dynapi_entity_value(n,"DIMTM").data,Et=e.dwg_dynapi_entity_value(n,"DIMFXL").data,ut=e.dwg_dynapi_entity_value(n,"DIMJOGANG").data,It=e.dwg_dynapi_entity_value(n,"DIMTFILL").data,At=e.dwg_dynapi_entity_value(n,"DIMTFILLCLR").data,Pt=e.dwg_dynapi_entity_value(n,"DIMAZIN").data,_n=e.dwg_dynapi_entity_value(n,"DIMARCSYM").data,dn=e.dwg_dynapi_entity_value(n,"DIMTXT").data,ln=e.dwg_dynapi_entity_value(n,"DIMCEN").data,cn=e.dwg_dynapi_entity_value(n,"DIMTSZ").data,En=e.dwg_dynapi_entity_value(n,"DIMALTF").data,un=e.dwg_dynapi_entity_value(n,"DIMLFAC").data,In=e.dwg_dynapi_entity_value(n,"DIMTVP").data,An=e.dwg_dynapi_entity_value(n,"DIMTFAC").data,Pn=e.dwg_dynapi_entity_value(n,"DIMGAP").data,Tn=e.dwg_dynapi_entity_value(n,"DIMPOST").data,fn=e.dwg_dynapi_entity_value(n,"DIMAPOST").data,hn=e.dwg_dynapi_entity_value(n,"DIMBLK_T").data,Cn=e.dwg_dynapi_entity_value(n,"DIMBLK1_T").data,gn=e.dwg_dynapi_entity_value(n,"DIMBLK2_T").data,Rn=e.dwg_dynapi_entity_value(n,"DIMALTRND").data,Ln=e.dwg_dynapi_entity_value(n,"DIMCLRD_N").data,Yn=e.dwg_dynapi_entity_value(n,"DIMCLRE_N").data,vn=e.dwg_dynapi_entity_value(n,"DIMCLRT_N").data,Nn=e.dwg_dynapi_entity_value(n,"DIMCLRD").data,Sn=e.dwg_dynapi_entity_value(n,"DIMCLRE").data,pn=e.dwg_dynapi_entity_value(n,"DIMCLRT").data,yn=e.dwg_dynapi_entity_value(n,"DIMADEC").data,Gn=e.dwg_dynapi_entity_value(n,"DIMFRAC").data,Dn=e.dwg_dynapi_entity_value(n,"DIMLUNIT").data,Wn=e.dwg_dynapi_entity_value(n,"DIMDSEP").data,mn=e.dwg_dynapi_entity_value(n,"DIMTMOVE").data,Mn=e.dwg_dynapi_entity_value(n,"DIMATFIT").data,xn=e.dwg_dynapi_entity_value(n,"DIMFXLON").data,On=e.dwg_dynapi_entity_value(n,"DIMTXTDIRECTION").data,wn=e.dwg_dynapi_entity_value(n,"DIMALTMZF").data,Bn=e.dwg_dynapi_entity_value(n,"DIMALTMZS").data,bn=e.dwg_dynapi_entity_value(n,"DIMMZF").data,Fn=e.dwg_dynapi_entity_value(n,"DIMMZS").data,Un=e.dwg_dynapi_entity_value(n,"DIMLWD").data,kn=e.dwg_dynapi_entity_value(n,"DIMLWE").data,Xn=e.dwg_dynapi_entity_value(n,"DIMTXSTY").data,Hn=e.dwg_ref_get_absref(Xn),Vn=e.dwg_dynapi_entity_value(n,"DIMLDRBLK").data,Kn=e.dwg_ref_get_absref(Vn);return{...i,DIMPOST:Tn,DIMAPOST:fn,DIMBLK:hn,DIMBLK1:Cn,DIMBLK2:gn,DIMSCALE:z,DIMASZ:k,DIMEXO:J,DIMDLI:X,DIMEXE:Z,DIMRND:_t,DIMDLE:dt,DIMTP:lt,DIMTM:ct,DIMTXT:dn,DIMCEN:ln,DIMTSZ:cn,DIMALTF:En,DIMLFAC:un,DIMTVP:In,DIMTFAC:An,DIMGAP:Pn,DIMALTRND:Rn,DIMTOL:s,DIMLIM:o,DIMTIH:r,DIMTOH:_,DIMSE1:d,DIMSE2:l,DIMTAD:m,DIMZIN:P,DIMAZIN:Pt,DIMALT:E,DIMALTD:I,DIMTOFL:u,DIMSAH:c,DIMTIX:T,DIMSOXD:A,DIMCLRD:Nn,DIMCLRE:Sn,DIMCLRT:pn,DIMADEC:yn,DIMUNIT:M,DIMDEC:b,DIMTDEC:V,DIMALTU:K,DIMALTTD:$,DIMAUNIT:w,DIMFRAC:Gn,DIMLUNIT:Dn,DIMDSEP:String.fromCharCode(Wn),DIMTMOVE:mn,DIMJUST:L,DIMSD1:f,DIMSD2:C,DIMTOLJ:g,DIMTZIN:N,DIMALTZ:x,DIMALTTZ:O,DIMFIT:Y,DIMUPT:p,DIMATFIT:Mn,DIMTXSTY:Hn,DIMLDRBLK:Kn,DIMLWD:Un,DIMLWE:kn,DIMFXL:Et,DIMJOGANG:ut,DIMTFILL:It,DIMTFILLCLR:At,DIMARCSYM:_n,DIMCLRD_N:Ln,DIMCLRE_N:Yn,DIMCLRT_N:vn,DIMFXLON:xn,DIMTXTDIRECTION:On,DIMALTMZF:wn,DIMALTMZS:Bn,DIMMZF:bn,DIMMZS:Fn}}convertLayer(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"frozen").data,r=e.dwg_dynapi_entity_value(n,"off").data,_=e.dwg_dynapi_entity_value(n,"frozen_in_new").data,d=e.dwg_dynapi_entity_value(n,"plotflockedlag").data,l=e.dwg_dynapi_entity_value(n,"plotflag").data,E=e.dwg_dynapi_entity_value(n,"linewt").data,u=e.dwg_dynapi_entity_value(n,"color").data,c=e.dwg_dynapi_entity_value(n,"ltype").data;let T="Continuous";if(c)try{T=e.dwg_ref_get_object_name(c)}catch{}const A=u.method;let I=256,P=16777215;return A===195||(u.rgb>>>24&255)===195?I=u.rgb&255:A==194||(u.rgb>>>24&255)===194?P=u.rgb&16777215:u.index>=1&&u.index<=255&&(I=u.index),{...i,standardFlag:s,colorIndex:I,color:P,colorName:u.name,transparency:u.alpha,lineType:T,frozen:o!=0,off:r!=0,frozenInNew:_!=0,locked:d!=0,plotFlag:l,lineweight:E,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"description").data,r=e.dwg_dynapi_entity_value(n,"numdashes").data,_=e.dwg_dynapi_entity_value(n,"pattern_len").data,d=e.dwg_dynapi_entity_value(n,"dashes").data,l=d?e.dwg_ptr_to_ltype_dash_array(d,r):[];return{...i,description:o,standardFlag:s,numberOfLineTypes:r,totalPatternLength:_,pattern:this.convertLineTypePattern(l)}}convertLineTypePattern(n){const a=[];return n.forEach(e=>{a.push({elementLength:e.length||0,elementTypeFlag:e.complex_shapecode,shapeNumber:e.shape_flag,styleObjectId:e.style?v(this.libredwg.dwg_ref_get_absref(e.style)):void 0,scale:e.scale,rotation:e.rotation,offsetX:e.x_offset,offsetY:e.y_offset,text:e.text})}),a}convertStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"width_factor").data,r=e.dwg_dynapi_entity_value(n,"oblique_angle").data,_=e.dwg_dynapi_entity_value(n,"generation").data,d=e.dwg_dynapi_entity_value(n,"last_height").data,l=e.dwg_dynapi_entity_value(n,"font_file").data,E=e.dwg_dynapi_entity_value(n,"bigfont_file").data;return{...i,standardFlag:s,fixedTextHeight:0,widthFactor:o,obliqueAngle:r,textGenerationFlag:_,lastHeight:d,font:l,bigFont:E}}convertViewport(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),s=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,r=e.dwg_dynapi_entity_value(n,"aspect_ratio").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"view_target").data,l=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,E=e.dwg_dynapi_entity_value(n,"view_twist").data,u=e.dwg_dynapi_entity_value(n,"lens_length").data,c=e.dwg_dynapi_entity_value(n,"front_clip_z").data,T=e.dwg_dynapi_entity_value(n,"back_clip_z").data,A=e.dwg_dynapi_entity_value(n,"VIEWMODE").data,I=e.dwg_dynapi_entity_value(n,"render_mode").data,P=e.dwg_dynapi_entity_value(n,"use_default_lights").data!=0,f=e.dwg_dynapi_entity_value(n,"default_lightning_type").data,C=e.dwg_dynapi_entity_value(n,"brightness").data,g=e.dwg_dynapi_entity_value(n,"contrast").data,L=e.dwg_dynapi_entity_value(n,"ambient_color").data,Y=e.dwg_dynapi_entity_value(n,"lower_left").data,p=e.dwg_dynapi_entity_value(n,"upper_right").data,N=e.dwg_dynapi_entity_value(n,"circle_zoom").data,x=e.dwg_dynapi_entity_value(n,"UCSICON").data,O=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,m=e.dwg_dynapi_entity_value(n,"SNAPANG").data,M=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,w=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,b=e.dwg_dynapi_entity_value(n,"ucsorg").data,V=e.dwg_dynapi_entity_value(n,"ucsxdir").data,K=e.dwg_dynapi_entity_value(n,"ucsydir").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"grid_major").data,k=e.dwg_dynapi_entity_value(n,"background").data,J=k?v(e.dwg_ref_get_absref(k)):void 0,X=e.dwg_dynapi_entity_value(n,"visualstyle").data,Z=X?v(e.dwg_ref_get_absref(X)):void 0;return{...i,standardFlag:s,lowerLeftCorner:Y,upperRightCorner:p,center:_,snapBasePoint:M,snapSpacing:w,gridSpacing:O,viewDirectionFromTarget:l,viewTarget:d,lensLength:u,frontClippingPlane:c,backClippingPlane:T,viewHeight:o,aspectRatio:r,snapRotationAngle:m,viewTwistAngle:E,circleSides:N,frozenLayers:[],styleSheet:"",renderMode:I,viewMode:A,ucsIconSetting:x,ucsOrigin:b,ucsXAxis:V,ucsYAxis:K,orthographicType:0,elevation:$,shadePlotSetting:0,majorGridLines:z,backgroundObjectId:J,visualStyleObjectId:Z,isDefaultLightingOn:P,defaultLightingType:f,brightness:C,contrast:g,ambientColor:L.index}}getCommonTableEntryAttrs(n,a){const e=this.libredwg,i=e.dwg_object_get_tio(a),s=e.dwg_object_object_get_ownerhandle_object(i),o=e.dwg_object_get_handle_object(a);return{handle:v(o.value),ownerHandle:v(s.absolute_ref),name:e.dwg_dynapi_entity_value(n,"name").data}}convertDictionary(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),s=e.dwg_dynapi_entity_value(n,"is_hardowner").data,o=e.dwg_dynapi_entity_value(n,"cloning").data,r=e.dwg_dynapi_entity_value(n,"numitems").data,_=e.dwg_dynapi_entity_value(n,"itemhandles").data,d=e.dwg_ptr_to_object_ref_array(_,r),l=e.dwg_object_dictionary_get_texts(a),E={};return d.forEach((u,c)=>E[l[c]]=v(u.absolute_ref)),{...i,isHardOwner:!!s,cloningFlag:o,entries:E}}convertImageDef(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),s=e.dwg_dynapi_entity_value(n,"image_size").data,o=e.dwg_dynapi_entity_value(n,"file_path").data,r=e.dwg_dynapi_entity_value(n,"is_loaded").data,_=e.dwg_dynapi_entity_value(n,"pixel_size").data,d=e.dwg_dynapi_entity_value(n,"resunits").data;return{...i,fileName:o,size:s,sizeOfOnePixel:_,isLoaded:r,resolutionUnits:d}}convertLayout(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),s=e.dwg_dynapi_entity_value(n,"layout_name").data,o=e.dwg_dynapi_entity_value(n,"tab_order").data,r=e.dwg_dynapi_entity_value(n,"layout_flags").data,_=e.dwg_dynapi_entity_value(n,"INSBASE").data,d=e.dwg_dynapi_entity_value(n,"LIMMIN").data,l=e.dwg_dynapi_entity_value(n,"LIMMAX").data,E=e.dwg_dynapi_entity_value(n,"UCSORG").data,u=e.dwg_dynapi_entity_value(n,"UCSXDIR").data,c=e.dwg_dynapi_entity_value(n,"UCSYDIR").data,T=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,A=e.dwg_dynapi_entity_value(n,"EXTMIN").data,I=e.dwg_dynapi_entity_value(n,"EXTMAX").data,P=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,f=e.dwg_dynapi_entity_value(n,"block_header").data,C=v(e.dwg_ref_get_absref(f)),g=e.dwg_dynapi_entity_value(n,"active_viewport").data,L=v(e.dwg_ref_get_absref(g)),Y=e.dwg_dynapi_entity_value(n,"named_ucs").data,p=Y?v(e.dwg_ref_get_absref(Y)):void 0;return{...i,layoutName:s,controlFlag:r,tabOrder:o,minLimit:d,maxLimit:l,insertionPoint:_,minExtent:A,maxExtent:I,elevation:P,ucsOrigin:E,ucsXAxis:u,ucsYAxis:c,orthographicType:T,paperSpaceTableId:C,viewportId:L,namedUcsId:p,shadePlotId:""}}convertSpatialFilter(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),s=e.dwg_dynapi_entity_value(n,"origin").data,o=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,r=e.dwg_dynapi_entity_value(n,"clip_verts").data,_=e.dwg_ptr_to_point2d_array(r,o),d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=e.dwg_dynapi_entity_value(n,"display_boundary_on").data,E=e.dwg_dynapi_entity_value(n,"front_clip_on").data,u=e.dwg_dynapi_entity_value(n,"front_clip_z").data,c=e.dwg_dynapi_entity_value(n,"back_clip_on").data,T=e.dwg_dynapi_entity_value(n,"back_clip_z").data,A=e.dwg_dynapi_entity_value(n,"transform").data,I=e.dwg_ptr_to_double_array(A,12),P=e.dwg_dynapi_entity_value(n,"inverse_transform").data,f=e.dwg_ptr_to_double_array(P,12);return{...i,origin:s,numberOfPointsOnClipBoundary:o,vertices:_,extrusionDirection:d,clipBoundaryVisible:!!l,frontClippingPlaneFlag:!!E,frontClippingPlaneDistance:u,backClippingPlaneFlag:!!c,backClippingPlaneDistance:T,matrix:I,invertBlockMatrix:f}}getCommonObjectAttrs(n){const a=this.libredwg,e=a.dwg_object_get_tio(n),i=a.dwg_object_object_get_ownerhandle_object(e),s=a.dwg_object_get_handle_object(n);return{handle:v(s.value),ownerHandle:v(i.absolute_ref)}}}class D{constructor(){S(this,"min");S(this,"max");S(this,"valid");this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(n){return this.min.x=Math.min(this.min.x,n.x),this.min.y=Math.min(this.min.y,n.y),this.max.x=Math.max(this.max.x,n.x),this.max.y=Math.max(this.max.y,n.y),this.valid=!0,this}transform(n,a){const e=this.getCorners().map(i=>({x:i.x*n.x+a.x,y:i.y*n.y+a.y}));this.reset();for(const i of e)this.expandByPoint(i);return this}rotate(n,a){const e=Math.cos(n),i=Math.sin(n),s=this.getCorners().map(o=>{const r=o.x-a.x,_=o.y-a.y;return{x:a.x+r*e-_*i,y:a.y+r*i+_*e}});this.reset();for(const o of s)this.expandByPoint(o);return this}clone(){const n=new D;return n.min={x:this.min.x,y:this.min.y},n.max={x:this.max.x,y:this.max.y},n.valid=this.valid,n}reset(){this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}getCorners(){return[{x:this.min.x,y:this.min.y},{x:this.min.x,y:this.max.y},{x:this.max.x,y:this.min.y},{x:this.max.x,y:this.max.y}]}}function me(t,n,a,e,i){const s=a.length;if(s===0)throw new Error("points must not be empty");const o=a[0].length;if(t<0||t>1)throw new Error(`t out of bounds [0,1]: ${t}`);if(n<1)throw new Error("degree must be at least 1 (linear)");if(n>s-1)throw new Error("degree must be less than or equal to point count - 1");const r=i??new Array(s).fill(1),_=e??(()=>{const A=[];for(let I=0;I<s+n+1;I++)A.push(I);return A})();if(_.length!==s+n+1)throw new Error("bad knot vector length");const d=[n,_.length-1-n],l=_[d[0]],E=_[d[1]];t=t*(E-l)+l,t=Math.max(t,l),t=Math.min(t,E);let u=d[0];for(;u<d[1]&&!(t>=_[u]&&t<=_[u+1]);u++);const c=new Array(s);for(let A=0;A<s;A++){c[A]=new Array(o+1);for(let I=0;I<o;I++)c[A][I]=a[A][I]*r[A];c[A][o]=r[A]}for(let A=1;A<=n+1;A++)for(let I=u;I>u-n-1+A;I--){const P=_[I+n+1-A]-_[I],f=P===0?0:(t-_[I])/P;for(let C=0;C<o+1;C++)c[I][C]=(1-f)*c[I-1][C]+f*c[I][C]}const T=new Array(o);for(let A=0;A<o;A++)T[A]=Me(c[u][A]/c[u][o],-9);return T}function Me(t,n){if(isNaN(t)||!Number.isInteger(n))return NaN;const[a,e="0"]=t.toString().split("e"),i=Math.round(+`${a}e${+e-n}`),[s,o="0"]=i.toString().split("e");return+`${s}e${+o+n}`}const at={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ht=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function q(t,n,a){return Math.max(n,Math.min(a,t))}const st=class st{constructor(){S(this,"_colorIndex");S(this,"_color");S(this,"_colorName");this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(n){n==null?this._color=null:(this._color=Math.round(q(n,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let n=this._color.toString(16).toUpperCase();for(;n.length<6;)n="0"+n;return`0x${n}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color!=null?this.color>>16&255:null}get green(){return this.color!=null?this.color>>8&255:null}get blue(){return this.color!=null?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(n){n==null?this._colorIndex=null:(this._colorIndex=q(n,0,256),this._color=ht[n],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(n){if(n){const a=at[n.toLowerCase()];a!==void 0?(this._colorName=n,this._color=a,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+n)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(n){return this.setRGB(n,n,n),this}setRGB(n,a,e){const i=Math.round(q(n,0,255)),s=Math.round(q(a,0,255)),o=Math.round(q(e,0,255));return this.color=(i<<16)+(s<<8)+o,this}setColorName(n){const a=at[n.toLowerCase()];return a!==void 0?this.color=a:console.warn("Unknown color "+n),this}clone(){const n=new st;return n.colorIndex=this.colorIndex,n.color=this.color,n._colorName=this._colorName,this}copy(n){return this.colorIndex=n.colorIndex,this.color=n.color,this._colorName=n._colorName,this}equals(n){return n.color==this.color&&n.colorIndex==this.colorIndex&&n._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(n){for(const[a,e]of Object.entries(at))if(e===n)return a;return null}getColorIndexByValue(n){const a=ht.length-1;for(let e=1;e<a;++e)if(ht[e]===n)return e;return null}};S(st,"NAMES",at);let Ut=st;class W{constructor(n,a){S(this,"x");S(this,"y");this.x=n,this.y=a}add(n){return new W(this.x+n.x,this.y+n.y)}sub(n){return new W(this.x-n.x,this.y-n.y)}multiply(n){return new W(this.x*n,this.y*n)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const n=this.length();return n===0?new W(0,0):new W(this.x/n,this.y/n)}}function xe(t,n,a,e=5){let i,s,o;a<0?(i=Math.atan(-a)*4,s=new W(t.x,t.y),o=new W(n.x,n.y)):(i=Math.atan(a)*4,s=new W(n.x,n.y),o=new W(t.x,t.y));const r=o.sub(s),_=r.length(),d=s.add(r.multiply(.5)),l=Math.abs(_/2/Math.tan(i/2)),E=r.norm(),u=new W(E.x*Math.cos(Math.PI/2)-E.y*Math.sin(Math.PI/2),E.y*Math.cos(Math.PI/2)+E.x*Math.sin(Math.PI/2)),c=i<Math.PI?d.add(u.multiply(-l)):d.add(u.multiply(l)),T=Math.atan2(o.y-c.y,o.x-c.x)/Math.PI*180;let A=Math.atan2(s.y-c.y,s.x-c.x)/Math.PI*180;A<T&&(A+=360);const I=o.sub(c).length(),P=Math.floor(T/e)*e+e,f=Math.ceil(A/e)*e-e,C=[];for(let g=P;g<=f;g+=e){const L=g/180*Math.PI,Y=c.add(new W(Math.cos(L)*I,Math.sin(L)*I));C.push(Y)}return a<0&&C.reverse(),C}function Oe(t,n=!1){let a=[];const e=t.vertices.map(i=>({x:i.x,y:i.y,bulge:i.bulge}));n&&e.push(e[0]);for(let i=0,s=e.length;i<s-1;++i){const o=e[i],r=e[i+1];a.push(o),e[i].bulge&&(a=a.concat(xe(o,r,t.vertices[i].bulge))),i===s-2&&a.push(r)}return a}class we{constructor(){S(this,"blockMap",new Map)}rotate(n,a){const e=Math.cos(a),i=Math.sin(a);return{x:n.x*e-n.y*i,y:n.x*i+n.y*e}}interpolateBSpline(n,a,e,i=25,s){const o=[],r=n.map(l=>[l.x,l.y]),_=[e[a]],d=[e[a],e[e.length-1-a]];for(let l=a+1;l<e.length-a;++l)_[_.length-1]!==e[l]&&_.push(e[l]);for(let l=1;l<_.length;++l){const E=_[l-1],u=_[l];for(let c=0;c<=i;++c){let A=(c/i*(u-E)+E-d[0])/(d[1]-d[0]);A=Math.max(0,Math.min(1,A));const I=me(A,a,r,e,s);o.push({x:I[0],y:I[1]})}}return o}addFlipXIfApplicable(n,{bbox:a,element:e}){return"extrusionDirection"in n&&n.extrusionDirection.z===-1?{bbox:new D().expandByPoint({x:-a.min.x,y:a.min.y}).expandByPoint({x:-a.max.x,y:a.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${e}</g>`}:{bbox:a,element:e}}line(n){const a=new D().expandByPoint({x:n.startPoint.x,y:n.startPoint.y}).expandByPoint({x:n.endPoint.x,y:n.endPoint.y}),e=`<line x1="${n.startPoint.x}" y1="${n.startPoint.y}" x2="${n.endPoint.x}" y2="${n.endPoint.y}" />`;return{bbox:a,element:e}}ray(n){const e=n.firstPoint,i={x:e.x+n.unitDirection.x*1e4,y:e.y+n.unitDirection.y*1e4},s=new D().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:s,element:o}}xline(n){const e={x:n.firstPoint.x-n.unitDirection.x*1e4,y:n.firstPoint.y-n.unitDirection.y*1e4},i={x:n.firstPoint.x+n.unitDirection.x*1e4,y:n.firstPoint.y+n.unitDirection.y*1e4},s=new D().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:s,element:o}}extractMTextLines(n){return n.replace(/\\U\+([0-9A-Fa-f]{4})/g,(a,e)=>String.fromCharCode(parseInt(e,16))).replace(/\\P/g,`
2
2
  `).replace(/\\[LOlo]/g,"").replace(/\\[Ff][^;\\]*?(?:\|[^;\\]*)*;/g,"").replace(/\\[KkCcHhWwTtAa][^;\\]*;?/g,"").replace(/\\[a-zA-Z]+;?/g,"").replace(/%%(d|p|c|%)/gi,"").replace(/\\\\/g,"\\").replace(/\\~/g," ").replace(/[{}]/g,"").split(`
3
- `).map(a=>a.trim()).filter(a=>a.length>0)}lines(n,a,e,i,r="start"){const o=new y().expandByPoint({x:e.x,y:e.y}).expandByPoint({x:e.x+i,y:e.y-n.length*a*1.5}),s=n.map((_,d)=>{const l=e.x,c=e.y-d*a*1.5,E=`translate(${l},${c}) scale(1,-1) translate(${-l},${-c})`;return`<text x="${l}" y="${c}" font-size="${a}" text-anchor="${r}" transform="${E}">${_}</text>`});return{bbox:o,element:s.join(`
4
- `)}}mtext(n){const a=n.textHeight,e=n.insertionPoint,i=this.extractMTextLines(n.text),r=n.attachmentPoint;let o="start";return r==B.BottomCenter||r==B.MiddleCenter||r==B.TopCenter?o="middle":(r==B.BottomRight||r==B.MiddleRight||r==B.TopRight)&&(o="end"),this.lines(i,a,e,n.extentsWidth,o)}table(n){const{rowCount:a,columnCount:e,rowHeightArr:i,columnWidthArr:r,startPoint:o,cells:s}=n,_=o.x,d=o.y,l=[];for(let I=0,T=d;I<a;I++){const h=i[I];let C=_;for(let R=0;R<e;R++){const L=I*e+R,Y=s[L],p=r[R];l.push({x:C,y:T,width:p,height:h,cell:Y,row:I,col:R}),C+=p}T+=h}const c=l.map(({x:I,y:T,width:h,height:C,cell:R})=>{const L=[];R.topBorderVisibility&&L.push(`<line x1="${I}" y1="${T}" x2="${I+h}" y2="${T}" stroke="black" />`),R.bottomBorderVisibility&&L.push(`<line x1="${I}" y1="${T+C}" x2="${I+h}" y2="${T+C}" stroke="black" />`),R.leftBorderVisibility&&L.push(`<line x1="${I}" y1="${T}" x2="${I}" y2="${T+C}" stroke="black" />`),R.rightBorderVisibility&&L.push(`<line x1="${I+h}" y1="${T}" x2="${I+h}" y2="${T+C}" stroke="black" />`);const Y=I+h/2,p=T+C/2+R.textHeight/3,N=`<text x="${Y}" y="${p}" font-size="${R.textHeight}" text-anchor="middle" dominant-baseline="middle">${R.text}</text>`;return[...L,N].join(`
3
+ `).map(a=>a.trim()).filter(a=>a.length>0)}lines(n,a,e,i,s="start"){const o=new D().expandByPoint({x:e.x,y:e.y}).expandByPoint({x:e.x+i,y:e.y-n.length*a*1.5}),r=n.map((_,d)=>{const l=e.x,E=e.y-d*a*1.5,u=`translate(${l},${E}) scale(1,-1) translate(${-l},${-E})`;return`<text x="${l}" y="${E}" font-size="${a}" text-anchor="${s}" transform="${u}">${_}</text>`});return{bbox:o,element:r.join(`
4
+ `)}}mtext(n){const a=n.textHeight,e=n.insertionPoint,i=this.extractMTextLines(n.text),s=n.attachmentPoint;let o="start";return s==B.BottomCenter||s==B.MiddleCenter||s==B.TopCenter?o="middle":(s==B.BottomRight||s==B.MiddleRight||s==B.TopRight)&&(o="end"),this.lines(i,a,e,n.extentsWidth,o)}table(n){const{rowCount:a,columnCount:e,rowHeightArr:i,columnWidthArr:s,startPoint:o,cells:r}=n,_=o.x,d=o.y,l=[];for(let I=0,P=d;I<a;I++){const f=i[I];let C=_;for(let g=0;g<e;g++){const L=I*e+g,Y=r[L],p=s[g];l.push({x:C,y:P,width:p,height:f,cell:Y,row:I,col:g}),C+=p}P+=f}const E=l.map(({x:I,y:P,width:f,height:C,cell:g})=>{const L=[];g.topBorderVisibility&&L.push(`<line x1="${I}" y1="${P}" x2="${I+f}" y2="${P}" stroke="black" />`),g.bottomBorderVisibility&&L.push(`<line x1="${I}" y1="${P+C}" x2="${I+f}" y2="${P+C}" stroke="black" />`),g.leftBorderVisibility&&L.push(`<line x1="${I}" y1="${P}" x2="${I}" y2="${P+C}" stroke="black" />`),g.rightBorderVisibility&&L.push(`<line x1="${I+f}" y1="${P}" x2="${I+f}" y2="${P+C}" stroke="black" />`);const Y=I+f/2,p=P+C/2+g.textHeight/3,N=`<text x="${Y}" y="${p}" font-size="${g.textHeight}" text-anchor="middle" dominant-baseline="middle">${g.text}</text>`;return[...L,N].join(`
5
5
  `)}).join(`
6
- `),E=r.reduce((I,T)=>I+T,0),u=i.reduce((I,T)=>I+T,0),P=new y().expandByPoint({x:_,y:d}).expandByPoint({x:_+E,y:d+u}),A=`
7
- <svg xmlns="http://www.w3.org/2000/svg" width="${E}" height="${u}" viewBox="${_} ${d} ${E} ${u}">
8
- ${c}
6
+ `),u=s.reduce((I,P)=>I+P,0),c=i.reduce((I,P)=>I+P,0),T=new D().expandByPoint({x:_,y:d}).expandByPoint({x:_+u,y:d+c}),A=`
7
+ <svg xmlns="http://www.w3.org/2000/svg" width="${u}" height="${c}" viewBox="${_} ${d} ${u} ${c}">
8
+ ${E}
9
9
  </svg>
10
- `.trim();return{bbox:P,element:A}}text(n){const a=n.textHeight,e=n.startPoint,i=[n.text];let r=n.endPoint.x-n.endPoint.x;n.halign==0&&(r=n.text.length*a+n.startPoint.x);let o="start";return n.halign==nt.CENTER?o="middle":n.halign==nt.RIGHT&&(o="end"),this.lines(i,a,e,r,o)}vertices(n,a=!1){const e=n.reduce((r,o)=>r.expandByPoint(o),new y);let i=n.reduce((r,o,s)=>(r+=s===0?"M":"L",r+=o.x+","+o.y,r),"");return a&&(i+="Z"),{bbox:e,element:`<path d="${i}" />`}}circle(n){const a=new y().expandByPoint({x:n.center.x+n.radius,y:n.center.y+n.radius}).expandByPoint({x:n.center.x-n.radius,y:n.center.y-n.radius}),e=`<circle cx="${n.center.x}" cy="${n.center.y}" r="${n.radius}" />`;return{bbox:a,element:e}}ellipseOrArc(n,a,e,i,r,o,s){const _=Math.sqrt(e*e+i*i),d=r*_,l=-Math.atan2(-i,e),c=this.bboxEllipseOrArc(n,a,e,i,r,o,s);if(Math.abs(o-s)<1e-9||Math.abs(o-s+Math.PI*2)<1e-9){const E=`<g transform="rotate(${l/Math.PI*180} ${n}, ${a})"><ellipse cx="${n}" cy="${a}" rx="${_}" ry="${d}" /></g>`;return{bbox:c,element:E}}else{const E=this.rotate({x:Math.cos(o)*_,y:Math.sin(o)*d},l),u={x:n+E.x,y:a+E.y},P=this.rotate({x:Math.cos(s)*_,y:Math.sin(s)*d},l),A={x:n+P.x,y:a+P.y},T=(s<o?s+Math.PI*2:s)-o<Math.PI?0:1,C=`<path d="${`M ${u.x} ${u.y} A ${_} ${d} ${l/Math.PI*180} ${T} 1 ${A.x} ${A.y}`}" />`;return{bbox:c,element:C}}}bboxEllipseOrArc(n,a,e,i,r,o,s){for(;o<0;)o+=Math.PI*2;for(;s<=o;)s+=Math.PI*2;const _=[];if(Math.abs(e)<1e-12||Math.abs(i)<1e-12)for(let u=0;u<4;u++)_.push(u/2*Math.PI);else _[0]=Math.atan(-i*r/e)-Math.PI,_[1]=Math.atan(e*r/i)-Math.PI,_[2]=_[0]-Math.PI,_[3]=_[1]-Math.PI;for(let u=4;u>=0;u--){for(;_[u]<o;)_[u]+=Math.PI*2;_[u]>s&&_.splice(u,1)}_.push(o),_.push(s);const d=_.map(u=>({x:Math.cos(u),y:Math.sin(u)})),l=[[e,-i*r],[i,e*r]];return d.map(u=>({x:u.x*l[0][0]+u.y*l[0][1]+n,y:u.x*l[1][0]+u.y*l[1][1]+a})).reduce((u,P)=>(u.expandByPoint(P),u),new y)}ellipse(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.majorAxisEndPoint.x,n.majorAxisEndPoint.y,n.axisRatio,n.startAngle,n.endAngle);return{bbox:a,element:e}}arc(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.radius,0,1,n.startAngle,n.endAngle);return{bbox:a,element:e}}dimension(n){const a=this.blockMap.get(n.name);return a?{bbox:a.bbox,element:`<use href="#${n.name}" />`}:null}insert(n){const a=this.blockMap.get(n.name);if(a){const e=n.insertionPoint,i=n.rotation*(180/Math.PI),r=`translate(${e.x},${e.y}) rotate(${i}) scale(${n.xScale},${n.yScale})`;return{bbox:a.bbox.clone().transform({x:n.xScale,y:n.yScale},{x:e.x,y:e.y}).rotate(n.rotation,e),element:`<use href="#${n.name}" transform="${r}" />`}}return null}block(n,a){const e=n.entities,{bbox:i,elements:r}=e.reduce((o,s)=>{const _=this.entityToBoundsAndElement(s);if(_){const{bbox:d,element:l}=_;d.valid&&(o.bbox.expandByPoint(d.min),o.bbox.expandByPoint(d.max));const c=this.getEntityColor(a.tables.LAYER.entries,s),E=s.type=="TEXT"||s.type=="MTEXT"?c.cssColor:"none";c.isByBlock?o.elements.push(`<g id="${s.handle}">${l}</g>`):o.elements.push(`<g id="${s.handle}" stroke="${c.cssColor}" fill="${E}">${l}</g>`)}return o},{bbox:new y,elements:[]});return i.valid?{bbox:i,element:`<g id="${n.name}">${r.join(`
11
- `)}</g>`}:null}entityToBoundsAndElement(n){let a=null;switch(n.type){case"ARC":a=this.arc(n);break;case"CIRCLE":a=this.circle(n);break;case"DIMENSION":a=this.dimension(n);break;case"ELLIPSE":a=this.ellipse(n);break;case"INSERT":a=this.insert(n);break;case"LINE":a=this.line(n);break;case"LWPOLYLINE":{const e=n,i=!!(e.flag&512),r=me(e,i);a=this.vertices(r,i);break}case"MTEXT":a=this.mtext(n);break;case"SPLINE":{const e=n;a=this.vertices(this.interpolateBSpline(e.controlPoints,e.degree,e.knots,25,e.weights));break}case"POLYLINE":break;case"RAY":a=this.ray(n);break;case"TABLE":a=this.table(n);break;case"TEXT":a=this.text(n);break;case"XLINE":a=this.xline(n);break;default:a=null;break}return a?this.addFlipXIfApplicable(n,a):null}getEntityColor(n,a){const e=new Ut;if(a.colorIndex!=null?e.colorIndex=a.colorIndex:a.colorName?e.colorName=a.colorName:a.color!=null&&(e.color=a.color),e.colorIndex==7&&(e.colorIndex=256),e.isByLayer){const i=n.find(r=>r.name===a.layer);i!=null&&(e.colorIndex=i.colorIndex)}return e.color==null&&(e.color=16777215),e}convert(n){let a=null;this.blockMap.clear();let e="";n.tables.BLOCK_RECORD.entries.forEach(o=>{if(rn(o.name))a=o;else{const s=this.block(o,n);s&&(e+=s.element,this.blockMap.set(o.name,s))}});const i=this.block(a,n),r=i&&i.bbox.valid?{x:i.bbox.min.x,y:-i.bbox.max.y,width:i.bbox.max.x-i.bbox.min.x,height:i.bbox.max.y-i.bbox.min.y}:{x:0,y:0,width:0,height:0};return`<?xml version="1.0"?>
10
+ `.trim();return{bbox:T,element:A}}text(n){const a=n.textHeight,e=n.startPoint,i=[n.text];let s=n.endPoint.x-n.endPoint.x;n.halign==0&&(s=n.text.length*a+n.startPoint.x);let o="start";return n.halign==nt.CENTER?o="middle":n.halign==nt.RIGHT&&(o="end"),this.lines(i,a,e,s,o)}vertices(n,a=!1){const e=n.reduce((s,o)=>s.expandByPoint(o),new D);let i=n.reduce((s,o,r)=>(s+=r===0?"M":"L",s+=o.x+","+o.y,s),"");return a&&(i+="Z"),{bbox:e,element:`<path d="${i}" />`}}circle(n){const a=new D().expandByPoint({x:n.center.x+n.radius,y:n.center.y+n.radius}).expandByPoint({x:n.center.x-n.radius,y:n.center.y-n.radius}),e=`<circle cx="${n.center.x}" cy="${n.center.y}" r="${n.radius}" />`;return{bbox:a,element:e}}ellipseOrArc(n,a,e,i,s,o,r){const _=Math.sqrt(e*e+i*i),d=s*_,l=-Math.atan2(-i,e),E=this.bboxEllipseOrArc(n,a,e,i,s,o,r);if(Math.abs(o-r)<1e-9||Math.abs(o-r+Math.PI*2)<1e-9){const u=`<g transform="rotate(${l/Math.PI*180} ${n}, ${a})"><ellipse cx="${n}" cy="${a}" rx="${_}" ry="${d}" /></g>`;return{bbox:E,element:u}}else{const u=this.rotate({x:Math.cos(o)*_,y:Math.sin(o)*d},l),c={x:n+u.x,y:a+u.y},T=this.rotate({x:Math.cos(r)*_,y:Math.sin(r)*d},l),A={x:n+T.x,y:a+T.y},P=(r<o?r+Math.PI*2:r)-o<Math.PI?0:1,C=`<path d="${`M ${c.x} ${c.y} A ${_} ${d} ${l/Math.PI*180} ${P} 1 ${A.x} ${A.y}`}" />`;return{bbox:E,element:C}}}bboxEllipseOrArc(n,a,e,i,s,o,r){for(;o<0;)o+=Math.PI*2;for(;r<=o;)r+=Math.PI*2;const _=[];if(Math.abs(e)<1e-12||Math.abs(i)<1e-12)for(let c=0;c<4;c++)_.push(c/2*Math.PI);else _[0]=Math.atan(-i*s/e)-Math.PI,_[1]=Math.atan(e*s/i)-Math.PI,_[2]=_[0]-Math.PI,_[3]=_[1]-Math.PI;for(let c=4;c>=0;c--){for(;_[c]<o;)_[c]+=Math.PI*2;_[c]>r&&_.splice(c,1)}_.push(o),_.push(r);const d=_.map(c=>({x:Math.cos(c),y:Math.sin(c)})),l=[[e,-i*s],[i,e*s]];return d.map(c=>({x:c.x*l[0][0]+c.y*l[0][1]+n,y:c.x*l[1][0]+c.y*l[1][1]+a})).reduce((c,T)=>(c.expandByPoint(T),c),new D)}ellipse(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.majorAxisEndPoint.x,n.majorAxisEndPoint.y,n.axisRatio,n.startAngle,n.endAngle);return{bbox:a,element:e}}arc(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.radius,0,1,n.startAngle,n.endAngle);return{bbox:a,element:e}}dimension(n){const a=this.blockMap.get(n.name);return a?{bbox:a.bbox,element:`<use href="#${n.name}" />`}:null}insert(n){const a=this.blockMap.get(n.name);if(a){const e=n.insertionPoint,i=n.rotation*(180/Math.PI),s=`translate(${e.x},${e.y}) rotate(${i}) scale(${n.xScale},${n.yScale})`;return{bbox:a.bbox.clone().transform({x:n.xScale,y:n.yScale},{x:e.x,y:e.y}).rotate(n.rotation,e),element:`<use href="#${n.name}" transform="${s}" />`}}return null}block(n,a){const e=n.entities,{bbox:i,elements:s}=e.reduce((o,r)=>{const _=this.entityToBoundsAndElement(r);if(_){const{bbox:d,element:l}=_;d.valid&&(o.bbox.expandByPoint(d.min),o.bbox.expandByPoint(d.max));const E=this.getEntityColor(a.tables.LAYER.entries,r),u=r.type=="TEXT"||r.type=="MTEXT"?E.cssColor:"none";E.isByBlock?o.elements.push(`<g id="${r.handle}">${l}</g>`):o.elements.push(`<g id="${r.handle}" stroke="${E.cssColor}" fill="${u}">${l}</g>`)}return o},{bbox:new D,elements:[]});return i.valid?{bbox:i,element:`<g id="${n.name}">${s.join(`
11
+ `)}</g>`}:null}entityToBoundsAndElement(n){let a=null;switch(n.type){case"ARC":a=this.arc(n);break;case"CIRCLE":a=this.circle(n);break;case"DIMENSION":a=this.dimension(n);break;case"ELLIPSE":a=this.ellipse(n);break;case"INSERT":a=this.insert(n);break;case"LINE":a=this.line(n);break;case"LWPOLYLINE":{const e=n,i=!!(e.flag&512),s=Oe(e,i);a=this.vertices(s,i);break}case"MTEXT":a=this.mtext(n);break;case"SPLINE":{const e=n;a=this.vertices(this.interpolateBSpline(e.controlPoints,e.degree,e.knots,25,e.weights));break}case"POLYLINE":break;case"RAY":a=this.ray(n);break;case"TABLE":a=this.table(n);break;case"TEXT":a=this.text(n);break;case"XLINE":a=this.xline(n);break;default:a=null;break}return a?this.addFlipXIfApplicable(n,a):null}getEntityColor(n,a){const e=new Ut;if(a.colorIndex!=null?e.colorIndex=a.colorIndex:a.colorName?e.colorName=a.colorName:a.color!=null&&(e.color=a.color),e.colorIndex==7&&(e.colorIndex=256),e.isByLayer){const i=n.find(s=>s.name===a.layer);i!=null&&(e.colorIndex=i.colorIndex)}return e.color==null&&(e.color=16777215),e}convert(n){let a=null;this.blockMap.clear();let e="";n.tables.BLOCK_RECORD.entries.forEach(o=>{if(rn(o.name))a=o;else{const r=this.block(o,n);r&&(e+=r.element,this.blockMap.set(o.name,r))}});const i=this.block(a,n),s=i&&i.bbox.valid?{x:i.bbox.min.x,y:-i.bbox.max.y,width:i.bbox.max.x-i.bbox.min.x,height:i.bbox.max.y-i.bbox.min.y}:{x:0,y:0,width:0,height:0};return`<?xml version="1.0"?>
12
12
  <svg
13
13
  xmlns="http://www.w3.org/2000/svg"
14
14
  xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
15
15
  preserveAspectRatio="xMinYMin meet"
16
- viewBox="${r.x} ${r.y} ${r.width} ${r.height}"
16
+ viewBox="${s.x} ${s.y} ${s.width} ${s.height}"
17
17
  width="100%" height="100%"
18
18
  >
19
19
  <defs>${e}</defs>
20
20
  <g stroke="#000000" stroke-width="0.1%" fill="none" transform="matrix(1,0,0,-1,0,0)">
21
21
  ${i?i.element:""}
22
22
  </g>
23
- </svg>`}}var kt;(function(t){t[t.BMP=2]="BMP",t[t.WMF=3]="WMF",t[t.PNG=6]="PNG"})(kt||(kt={}));const rt=class rt{constructor(n){S(this,"wasmInstance");S(this,"decoder");return this.wasmInstance=n,new Proxy(this,{get:(a,e,i)=>e in a?Reflect.get(a,e,i):Reflect.get(a.wasmInstance,e,i)})}dwg_read_data(n,a){if(a==it.DWG){const e="tmp.dwg";try{this.wasmInstance.FS.writeFile(e,new Uint8Array(n));const i=this.wasmInstance.dwg_read_file(e);return i.error!=0&&console.log("Open dwg file with error code: ",i.error),i.data}finally{this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}}dwg_write_dxf(n){const a="tmp.dwg",e="tmp.dxf";try{this.wasmInstance.FS.writeFile(a,new Uint8Array(n));const i=this.wasmInstance.dwg_write_dxf(a,e);return i!=0?(console.log("Convert dwg to dxf with error code: ",i),null):this.wasmInstance.FS.readFile(e)}finally{this.wasmInstance.FS.analyzePath(a,!1).exists&&this.wasmInstance.FS.unlink(a),this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}dwg_get_version_type(n){const a=this.wasmInstance.dwg_get_version_type(n);return on[a]}dwg_get_codepage(n){return this.wasmInstance.dwg_get_codepage(n)}dwg_bmp(n){return this.wasmInstance.dwg_bmp(n)}dwg_get_num_classes(n){return this.wasmInstance.dwg_get_num_classes(n)}dwg_get_class(n,a){return this.wasmInstance.dwg_get_class(n,a)}convert(n){const a=this.dwg_get_codepage(n),e=Rt(a);return this.decoder=new TextDecoder(e),new Zt(this).convert(n)}convertEx(n){const a=this.dwg_get_codepage(n),e=Rt(a);this.decoder=new TextDecoder(e);const i=new Zt(this);return{database:i.convert(n),stats:i.getConversionStats()}}dwg_to_svg(n){return new Me().convert(n)}dwg_free(n){this.wasmInstance.dwg_free(n)}dwg_free_object(n){this.wasmInstance.dwg_free_object(n)}dwg_ref_object(n,a){return this.wasmInstance.dwg_ref_object(n,a)}dwg_ref_object_silent(n,a){return this.wasmInstance.dwg_ref_object_silent(n,a)}dwg_ref_object_relative(n,a,e){return this.wasmInstance.dwg_ref_object_relative(n,a,e)}dwg_resolve_handle(n,a){return this.wasmInstance.dwg_resolve_handle(n,a)}dwg_resolve_handle_silent(n,a){return this.wasmInstance.dwg_resolve_handle_silent(n,a)}dwg_resolve_handleref(n,a){return this.wasmInstance.dwg_resolve_handleref(n,a)}dwg_ref_get_object_name(n){const a=this.wasmInstance,e=a.dwg_ref_get_object(n),i=a.dwg_object_to_object_tio(e);return this.dwg_dynapi_entity_value(i,"name").data}dwg_obj_obj_to_object(n){return this.wasmInstance.dwg_obj_obj_to_object(n)}dwg_obj_generic_to_object(n){return this.wasmInstance.dwg_obj_generic_to_object(n)}dwg_object_to_object(n){return this.wasmInstance.dwg_object_to_object(n)}dwg_object_to_object_tio(n){return this.wasmInstance.dwg_object_to_object_tio(n)}dwg_object_to_entity(n){return this.wasmInstance.dwg_object_to_entity(n)}dwg_object_to_entity_tio(n){return this.wasmInstance.dwg_object_to_entity_tio(n)}dwg_getall_entities_in_model_space(n){const a=this.wasmInstance,e=a.dwg_model_space_object(n),i=[];let r=a.get_first_owned_entity(e);for(;r;)i.push(r),r=a.get_next_owned_entity(e,r);return i}dwg_getall_object_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),r=[];for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o),_=e.dwg_object_to_object_tio(s);_&&e.dwg_object_get_fixedtype(s)==a&&r.push(_)}return r}dwg_getall_entity_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),r=[];for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o),_=e.dwg_object_to_entity_tio(s);_&&e.dwg_object_get_fixedtype(s)==a&&r.push(_)}return r}dwg_getall_LAYER(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_LAYER)}dwg_getall_LTYPE(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_LTYPE)}dwg_getall_STYLE(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(n){return this.dwg_getall_object_by_type(n,f.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(n){return this.dwg_getall_entity_by_type(n,f.DWG_TYPE_LWPOLYLINE)}dwg_ptr_to_object_ref_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_array(n,a)}dwg_ptr_to_object_ref_ptr_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(n,a)}dwg_ptr_to_wchar_string_array(n,a){return this.wasmInstance.dwg_ptr_to_wchar_string_array(n,a)}dwg_ptr_to_unsigned_char_array(n,a){return this.wasmInstance.dwg_ptr_to_unsigned_char_array(n,a)}dwg_ptr_to_signed_char_array(n,a){return this.wasmInstance.dwg_ptr_to_signed_char_array(n,a)}dwg_ptr_to_uint16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint16_t_array(n,a)}dwg_ptr_to_int16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int16_t_array(n,a)}dwg_ptr_to_uint32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint32_t_array(n,a)}dwg_ptr_to_int32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int32_t_array(n,a)}dwg_ptr_to_uint64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint64_t_array(n,a)}dwg_ptr_to_int64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int64_t_array(n,a)}dwg_ptr_to_double_array(n,a){return this.wasmInstance.dwg_ptr_to_double_array(n,a)}dwg_ptr_to_point2d_array(n,a){return this.wasmInstance.dwg_ptr_to_point2d_array(n,a)}dwg_ptr_to_point3d_array(n,a){return this.wasmInstance.dwg_ptr_to_point3d_array(n,a)}dwg_ptr_to_point4d_array(n,a){return this.wasmInstance.dwg_ptr_to_point4d_array(n,a)}dwg_ptr_to_ltype_dash_array(n,a){return this.wasmInstance.dwg_ptr_to_ltype_dash_array(n,a)}dwg_ptr_to_table_cell_array(n,a){return this.wasmInstance.dwg_ptr_to_table_cell_array(n,a)}dwg_ptr_to_hatch_defline_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_defline_array(n,a)}dwg_ptr_to_hatch_path_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_path_array(n,a)}dwg_ptr_to_hatch_gradient_color_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(n,a)}dwg_ptr_to_mline_vertex_array(n,a){return this.wasmInstance.dwg_ptr_to_mline_vertex_array(n,a)}dwg_dynapi_entity_value(n,a){const e=this.wasmInstance.dwg_dynapi_entity_value(n,a);return e.bin&&this.decoder&&(e.data=this.decoder.decode(e.bin)),e}dwg_dynapi_header_value(n,a){return this.wasmInstance.dwg_dynapi_header_value(n,a)}dwg_dynapi_common_value(n,a){return this.wasmInstance.dwg_dynapi_common_value(n,a)}dwg_dynapi_subclass_value(n,a,e){return this.wasmInstance.dwg_dynapi_subclass_value(n,a,e)}dwg_object_get_handle_object(n){return this.wasmInstance.dwg_object_get_handle_object(n)}dwg_object_object_get_handle_object(n){return this.wasmInstance.dwg_object_object_get_handle_object(n)}dwg_object_object_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_object_get_ownerhandle_object(n)}dwg_object_entity_get_handle_object(n){return this.wasmInstance.dwg_object_entity_get_handle_object(n)}dwg_object_entity_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(n)}dwg_object_entity_get_xdicobjhandle_object(n){return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(n)}dwg_object_entity_get_layer_object_ref(n){return this.wasmInstance.dwg_object_entity_get_layer_object_ref(n)}dwg_object_entity_get_ltype_object_ref(n){return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(n)}dwg_object_entity_get_color_object(n){return this.wasmInstance.dwg_object_entity_get_color_object(n)}dwg_object_entity_get_xdata(n){return this.wasmInstance.dwg_object_entity_get_xdata(n)}dwg_entity_owner(n){return this.wasmInstance.dwg_entity_owner(n)}dwg_entity_get_block_name(n,a){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,r=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(r);return this.dwg_entity_block_header_get_block(o).name}dwg_entity_get_dimstyle_name(n,a="dimstyle"){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,r=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(r);return this.dwg_dynapi_entity_value(o,"name").data}dwg_entity_block_header_get_block(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"block_entity").data,i=a.dwg_ref_get_object(e),r=a.dwg_object_to_entity_tio(i),o=a.dwg_dynapi_entity_value(r,"name").data,s=a.dwg_dynapi_entity_value(r,"base_pt").data;return{name:o,base_pt:s}}dwg_entity_block_header_get_preview(n){return this.wasmInstance.dwg_entity_block_header_get_preview(n).data}get_first_owned_entity(n){return this.wasmInstance.get_first_owned_entity(n)}get_next_owned_entity(n,a){return this.wasmInstance.get_next_owned_entity(n,a)}dwg_entity_mtext_get_style_name(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"style").data,i=a.dwg_ref_get_object(e),r=a.dwg_object_to_object_tio(i);return a.dwg_dynapi_entity_value(r,"name").data}dwg_entity_text_get_style_name(n){return this.dwg_entity_mtext_get_style_name(n)}dwg_entity_polyline_2d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(n).data}dwg_entity_polyline_2d_get_points(n){return this.wasmInstance.dwg_entity_polyline_2d_get_points(n).data}dwg_entity_polyline_2d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(n).data}dwg_entity_polyline_3d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(n).data}dwg_entity_polyline_3d_get_points(n){return this.wasmInstance.dwg_entity_polyline_3d_get_points(n).data}dwg_entity_polyline_3d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(n).data}dwg_entity_insert_get_attribs(n){return this.wasmInstance.dwg_entity_insert_get_attribs(n).data}dwg_object_dictionary_get_texts(n){return this.wasmInstance.dwg_object_dictionary_get_texts(n).data}static createByWasmInstance(n){return this.instance==null?new rt(n):this.instance}static async create(n){const a=n==null?await Bt():await Bt({locateFile:e=>`${n}/${e}`});return this.createByWasmInstance(a)}};S(rt,"instance");let Xt=rt;const qt=Object.freeze(Object.defineProperty({__proto__:null,get DwgAttachmentPoint(){return B},get DwgBoundaryPathEdgeType(){return F},get DwgBoundaryPathTypeFlag(){return Wt},get DwgCodePage(){return Ct},get DwgDictionaryCloningFlags(){return wt},get DwgDimensionTextHorizontal(){return St},get DwgDimensionTextLineSpacing(){return gt},get DwgDimensionTextVertical(){return Yt},get DwgDimensionToleranceTextVertical(){return pt},get DwgDimensionType(){return Lt},get DwgDimensionZeroSuppression(){return vt},get DwgDimensionZeroSuppressionAngular(){return Nt},get DwgHatchAssociativity(){return j},get DwgHatchBoundaryAnnotation(){return yt},get DwgHatchGradientColorFlag(){return tt},get DwgHatchGradientFlag(){return at},get DwgHatchPatternType(){return Dt},get DwgHatchSolidFill(){return Q},get DwgHatchStyle(){return Gt},get DwgPolylineFlag(){return mt},get DwgSmoothType(){return Mt},get DwgTextGenerationFlag(){return xt},get DwgTextHorizontalAlign(){return nt},get DwgTextVerticalAlign(){return Ot},get DwgThumbnailImageType(){return kt},get Dwg_Color_Method(){return Ft},get Dwg_File_Type(){return it},get Dwg_Hatch_Edge_Type(){return U},get Dwg_Object_Supertype(){return bt},get Dwg_Object_Type(){return f},Dwg_Object_Type_Inverted:ve,HEADER_VARIABLES:an,LibreDwg:Xt,createModule:Bt,dwgCodePageToEncoding:Rt,dwgVersions:on},Symbol.toStringTag,{value:"Module"}));
23
+ </svg>`}}var kt;(function(t){t[t.BMP=2]="BMP",t[t.WMF=3]="WMF",t[t.PNG=6]="PNG"})(kt||(kt={}));const rt=class rt{constructor(n){S(this,"wasmInstance");S(this,"decoder");return this.wasmInstance=n,new Proxy(this,{get:(a,e,i)=>e in a?Reflect.get(a,e,i):Reflect.get(a.wasmInstance,e,i)})}dwg_read_data(n,a){if(a==ot.DWG){const e="tmp.dwg";try{this.wasmInstance.FS.writeFile(e,new Uint8Array(n));const i=this.wasmInstance.dwg_read_file(e);return i.error!=0&&console.log("Open dwg file with error code: ",i.error),i.data}finally{this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}}dwg_write_dxf(n){const a="tmp.dwg",e="tmp.dxf";try{this.wasmInstance.FS.writeFile(a,new Uint8Array(n));const i=this.wasmInstance.dwg_write_dxf(a,e);return i!=0?(console.log("Convert dwg to dxf with error code: ",i),null):this.wasmInstance.FS.readFile(e)}finally{this.wasmInstance.FS.analyzePath(a,!1).exists&&this.wasmInstance.FS.unlink(a),this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}dwg_get_version_type(n){const a=this.wasmInstance.dwg_get_version_type(n);return sn[a]}dwg_get_codepage(n){return this.wasmInstance.dwg_get_codepage(n)}dwg_bmp(n){return this.wasmInstance.dwg_bmp(n)}dwg_get_num_classes(n){return this.wasmInstance.dwg_get_num_classes(n)}dwg_get_class(n,a){return this.wasmInstance.dwg_get_class(n,a)}convert(n){const a=this.dwg_get_codepage(n),e=gt(a);return this.decoder=new TextDecoder(e),new Zt(this).convert(n)}convertEx(n){const a=this.dwg_get_codepage(n),e=gt(a);this.decoder=new TextDecoder(e);const i=new Zt(this);return{database:i.convert(n),stats:i.getConversionStats()}}dwg_to_svg(n){return new we().convert(n)}dwg_free(n){this.wasmInstance.dwg_free(n)}dwg_free_object(n){this.wasmInstance.dwg_free_object(n)}dwg_ref_object(n,a){return this.wasmInstance.dwg_ref_object(n,a)}dwg_ref_object_silent(n,a){return this.wasmInstance.dwg_ref_object_silent(n,a)}dwg_ref_object_relative(n,a,e){return this.wasmInstance.dwg_ref_object_relative(n,a,e)}dwg_resolve_handle(n,a){return this.wasmInstance.dwg_resolve_handle(n,a)}dwg_resolve_handle_silent(n,a){return this.wasmInstance.dwg_resolve_handle_silent(n,a)}dwg_resolve_handleref(n,a){return this.wasmInstance.dwg_resolve_handleref(n,a)}dwg_ref_get_object_name(n){const a=this.wasmInstance,e=a.dwg_ref_get_object(n),i=a.dwg_object_to_object_tio(e);return this.dwg_dynapi_entity_value(i,"name").data}dwg_obj_obj_to_object(n){return this.wasmInstance.dwg_obj_obj_to_object(n)}dwg_obj_generic_to_object(n){return this.wasmInstance.dwg_obj_generic_to_object(n)}dwg_object_to_object(n){return this.wasmInstance.dwg_object_to_object(n)}dwg_object_to_object_tio(n){return this.wasmInstance.dwg_object_to_object_tio(n)}dwg_object_to_entity(n){return this.wasmInstance.dwg_object_to_entity(n)}dwg_object_to_entity_tio(n){return this.wasmInstance.dwg_object_to_entity_tio(n)}dwg_getall_entities_in_model_space(n){const a=this.wasmInstance,e=a.dwg_model_space_object(n),i=[];let s=a.get_first_owned_entity(e);for(;s;)i.push(s),s=a.get_next_owned_entity(e,s);return i}dwg_getall_object_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),s=[];for(let o=0;o<i;o++){const r=e.dwg_get_object(n,o),_=e.dwg_object_to_object_tio(r);_&&e.dwg_object_get_fixedtype(r)==a&&s.push(_)}return s}dwg_getall_entity_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),s=[];for(let o=0;o<i;o++){const r=e.dwg_get_object(n,o),_=e.dwg_object_to_entity_tio(r);_&&e.dwg_object_get_fixedtype(r)==a&&s.push(_)}return s}dwg_getall_LAYER(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_LAYER)}dwg_getall_LTYPE(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_LTYPE)}dwg_getall_STYLE(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(n){return this.dwg_getall_object_by_type(n,h.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(n){return this.dwg_getall_entity_by_type(n,h.DWG_TYPE_LWPOLYLINE)}dwg_ptr_to_object_ref_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_array(n,a)}dwg_ptr_to_object_ref_ptr_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(n,a)}dwg_ptr_to_wchar_string_array(n,a){return this.wasmInstance.dwg_ptr_to_wchar_string_array(n,a)}dwg_ptr_to_unsigned_char_array(n,a){return this.wasmInstance.dwg_ptr_to_unsigned_char_array(n,a)}dwg_ptr_to_signed_char_array(n,a){return this.wasmInstance.dwg_ptr_to_signed_char_array(n,a)}dwg_ptr_to_uint16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint16_t_array(n,a)}dwg_ptr_to_int16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int16_t_array(n,a)}dwg_ptr_to_uint32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint32_t_array(n,a)}dwg_ptr_to_int32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int32_t_array(n,a)}dwg_ptr_to_uint64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint64_t_array(n,a)}dwg_ptr_to_int64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int64_t_array(n,a)}dwg_ptr_to_double_array(n,a){return this.wasmInstance.dwg_ptr_to_double_array(n,a)}dwg_ptr_to_point2d_array(n,a){return this.wasmInstance.dwg_ptr_to_point2d_array(n,a)}dwg_ptr_to_point3d_array(n,a){return this.wasmInstance.dwg_ptr_to_point3d_array(n,a)}dwg_ptr_to_point4d_array(n,a){return this.wasmInstance.dwg_ptr_to_point4d_array(n,a)}dwg_ptr_to_ltype_dash_array(n,a){return this.wasmInstance.dwg_ptr_to_ltype_dash_array(n,a)}dwg_ptr_to_table_cell_array(n,a){return this.wasmInstance.dwg_ptr_to_table_cell_array(n,a)}dwg_ptr_to_hatch_defline_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_defline_array(n,a)}dwg_ptr_to_hatch_path_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_path_array(n,a)}dwg_ptr_to_hatch_gradient_color_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(n,a)}dwg_ptr_to_mline_vertex_array(n,a){return this.wasmInstance.dwg_ptr_to_mline_vertex_array(n,a)}dwg_dynapi_entity_value(n,a){const e=this.wasmInstance.dwg_dynapi_entity_value(n,a);return e.bin&&this.decoder&&(e.data=this.decoder.decode(e.bin)),e}dwg_dynapi_header_value(n,a){return this.wasmInstance.dwg_dynapi_header_value(n,a)}dwg_dynapi_common_value(n,a){return this.wasmInstance.dwg_dynapi_common_value(n,a)}dwg_dynapi_subclass_value(n,a,e){return this.wasmInstance.dwg_dynapi_subclass_value(n,a,e)}dwg_object_get_handle_object(n){return this.wasmInstance.dwg_object_get_handle_object(n)}dwg_object_object_get_handle_object(n){return this.wasmInstance.dwg_object_object_get_handle_object(n)}dwg_object_object_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_object_get_ownerhandle_object(n)}dwg_object_entity_get_handle_object(n){return this.wasmInstance.dwg_object_entity_get_handle_object(n)}dwg_object_entity_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(n)}dwg_object_entity_get_xdicobjhandle_object(n){return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(n)}dwg_object_entity_get_layer_object_ref(n){return this.wasmInstance.dwg_object_entity_get_layer_object_ref(n)}dwg_object_entity_get_ltype_object_ref(n){return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(n)}dwg_object_entity_get_color_object(n){return this.wasmInstance.dwg_object_entity_get_color_object(n)}dwg_object_entity_get_xdata(n){return this.wasmInstance.dwg_object_entity_get_xdata(n)}dwg_entity_owner(n){return this.wasmInstance.dwg_entity_owner(n)}dwg_entity_get_block_name(n,a){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,s=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(s);return this.dwg_entity_block_header_get_block(o).name}dwg_entity_get_dimstyle_name(n,a="dimstyle"){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,s=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(s);return this.dwg_dynapi_entity_value(o,"name").data}dwg_entity_block_header_get_block(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"block_entity").data,i=a.dwg_ref_get_object(e),s=a.dwg_object_to_entity_tio(i),o=a.dwg_dynapi_entity_value(s,"name").data,r=a.dwg_dynapi_entity_value(s,"base_pt").data;return{name:o,base_pt:r}}dwg_entity_block_header_get_preview(n){return this.wasmInstance.dwg_entity_block_header_get_preview(n).data}get_first_owned_entity(n){return this.wasmInstance.get_first_owned_entity(n)}get_next_owned_entity(n,a){return this.wasmInstance.get_next_owned_entity(n,a)}dwg_entity_mtext_get_style_name(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"style").data,i=a.dwg_ref_get_object(e),s=a.dwg_object_to_object_tio(i);return a.dwg_dynapi_entity_value(s,"name").data}dwg_entity_text_get_style_name(n){return this.dwg_entity_mtext_get_style_name(n)}dwg_entity_polyline_2d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(n).data}dwg_entity_polyline_2d_get_points(n){return this.wasmInstance.dwg_entity_polyline_2d_get_points(n).data}dwg_entity_polyline_2d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(n).data}dwg_entity_polyline_3d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(n).data}dwg_entity_polyline_3d_get_points(n){return this.wasmInstance.dwg_entity_polyline_3d_get_points(n).data}dwg_entity_polyline_3d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(n).data}dwg_entity_insert_get_attribs(n){return this.wasmInstance.dwg_entity_insert_get_attribs(n).data}dwg_object_dictionary_get_texts(n){return this.wasmInstance.dwg_object_dictionary_get_texts(n).data}static createByWasmInstance(n){return this.instance==null?new rt(n):this.instance}static async create(n){const a=n==null?await Bt():await Bt({locateFile:e=>`${n}/${e}`});return this.createByWasmInstance(a)}};S(rt,"instance");let Xt=rt;const qt=Object.freeze(Object.defineProperty({__proto__:null,get DwgAttachmentPoint(){return B},get DwgBoundaryPathEdgeType(){return F},get DwgBoundaryPathTypeFlag(){return Wt},get DwgCodePage(){return Ct},get DwgDictionaryCloningFlags(){return wt},get DwgDimensionTextHorizontal(){return St},get DwgDimensionTextLineSpacing(){return Lt},get DwgDimensionTextVertical(){return Yt},get DwgDimensionToleranceTextVertical(){return pt},get DwgDimensionType(){return Rt},get DwgDimensionZeroSuppression(){return vt},get DwgDimensionZeroSuppressionAngular(){return Nt},get DwgHatchAssociativity(){return j},get DwgHatchBoundaryAnnotation(){return Dt},get DwgHatchGradientColorFlag(){return tt},get DwgHatchGradientFlag(){return it},get DwgHatchPatternType(){return Gt},get DwgHatchSolidFill(){return Q},get DwgHatchStyle(){return yt},get DwgPolylineFlag(){return mt},get DwgSmoothType(){return Mt},get DwgTextGenerationFlag(){return xt},get DwgTextHorizontalAlign(){return nt},get DwgTextVerticalAlign(){return Ot},get DwgThumbnailImageType(){return kt},get Dwg_Color_Method(){return Ft},get Dwg_File_Type(){return ot},get Dwg_Hatch_Edge_Type(){return U},get Dwg_Object_Supertype(){return bt},get Dwg_Object_Type(){return h},Dwg_Object_Type_Inverted:pe,HEADER_VARIABLES:on,LibreDwg:Xt,createModule:Bt,dwgCodePageToEncoding:gt,dwgVersions:sn},Symbol.toStringTag,{value:"Module"}));
24
24
  //# sourceMappingURL=dwg-worker.js.map