@mlightcad/cad-simple-viewer-cli 1.7.4 → 1.7.5

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.
@@ -14,7 +14,7 @@ return ret;
14
14
  `,f+=s[D].argPackAdvance;var N=o===1?"new func":"func.call";u+=` var rv = ${N}(${T.join(", ")});
15
15
  `,c.isVoid||(y.push("emval_returnValue"),C.push(ha),u+=` return emval_returnValue(retType, destructorsRef, rv);
16
16
  `),u+=`};
17
- `,y.push(u);var O=Hn(Function,y)(...C),G=`methodCaller<(${s.map(b=>b.name).join(", ")}) => ${c.name}>`;return ua(me(G,O))}function Aa(e){e>>>=0,e>9&&(Ot[e+1]+=1)}function Ta(){return Et.toHandle([])}function Pa(e){return e>>>=0,Et.toHandle(Xn(e))}function ya(){return Et.toHandle({})}function pa(e){e>>>=0;var r=Et.toValue(e);hn(r),An(e)}function va(e,r,o){e>>>=0,r>>>=0,o>>>=0,e=Et.toValue(e),r=Et.toValue(r),o=Et.toValue(o),e[r]=o}function Ia(e,r){e>>>=0,r>>>=0,e=Tn(e,"_emval_take_value");var o=e.readValueFromPointer(r);return Et.toHandle(o)}function ma(e,r){e=re(e),r>>>=0;var o=new Date(e*1e3);Y[r>>>2>>>0]=o.getUTCSeconds(),Y[r+4>>>2>>>0]=o.getUTCMinutes(),Y[r+8>>>2>>>0]=o.getUTCHours(),Y[r+12>>>2>>>0]=o.getUTCDate(),Y[r+16>>>2>>>0]=o.getUTCMonth(),Y[r+20>>>2>>>0]=o.getUTCFullYear()-1900,Y[r+24>>>2>>>0]=o.getUTCDay();var s=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-s)/(1e3*60*60*24)|0;Y[r+28>>>2>>>0]=c}var wa=e=>e%4===0&&(e%100!==0||e%400===0),Ca=[0,31,60,91,121,152,182,213,244,274,305,335],Da=[0,31,59,90,120,151,181,212,243,273,304,334],Ra=e=>{var r=wa(e.getFullYear()),o=r?Ca:Da,s=o[e.getMonth()]+e.getDate()-1;return s},Sa=function(e){e>>>=0;var r=(()=>{var o=new Date(Y[e+20>>>2>>>0]+1900,Y[e+16>>>2>>>0],Y[e+12>>>2>>>0],Y[e+8>>>2>>>0],Y[e+4>>>2>>>0],Y[e>>>2>>>0],0),s=Y[e+32>>>2>>>0],c=o.getTimezoneOffset(),u=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),T=u.getTimezoneOffset(),y=Math.min(T,f);if(s<0)Y[e+32>>>2>>>0]=+(f!=T&&y==c);else if(s>0!=(y==c)){var C=Math.max(T,f),D=s>0?y:C;o.setTime(o.getTime()+(D-c)*6e4)}Y[e+24>>>2>>>0]=o.getDay();var N=Ra(o)|0;Y[e+28>>>2>>>0]=N,Y[e>>>2>>>0]=o.getSeconds(),Y[e+4>>>2>>>0]=o.getMinutes(),Y[e+8>>>2>>>0]=o.getHours(),Y[e+12>>>2>>>0]=o.getDate(),Y[e+16>>>2>>>0]=o.getMonth(),Y[e+20>>>2>>>0]=o.getYear();var O=o.getTime();return isNaN(O)?-1:O/1e3})();return BigInt(r)},La=function(e,r,o,s){e>>>=0,r>>>=0,o>>>=0,s>>>=0;var c=new Date().getFullYear(),u=new Date(c,0,1),f=new Date(c,6,1),T=u.getTimezoneOffset(),y=f.getTimezoneOffset(),C=Math.max(T,y);U[e>>>2>>>0]=C*60,Y[r>>>2>>>0]=+(T!=y);var D=G=>{var b=G>=0?"-":"+",z=Math.abs(G),_t=String(Math.floor(z/60)).padStart(2,"0"),rt=String(z%60).padStart(2,"0");return`UTC${b}${_t}${rt}`},N=D(T),O=D(y);y<T?(ce(N,o,17),ce(O,s,17)):(ce(N,s,17),ce(O,o,17))},Kn=()=>performance.now(),zn=()=>Date.now(),Ya=e=>e>=0&&e<=3;function Na(e,r,o){if(o>>>=0,!Ya(e))return 28;var s;e===0?s=zn():s=Kn();var c=Math.round(s*1e3*1e3);return st[o>>>3]=BigInt(c),0}function Ga(e){return e>>>=0,x(xt(e))}var Wa=()=>4294901760,Ma=e=>{var r=V.buffer,o=(e-r.byteLength+65535)/65536|0;try{return V.grow(o),ht(),1}catch{}};function xa(e){e>>>=0;var r=Z.length,o=Wa();if(e>o)return!1;for(var s=1;s<=4;s*=2){var c=r*(1+.2/s);c=Math.min(c,e+100663296);var u=Math.min(o,pe(Math.max(e,c),65536)),f=Ma(u);if(f)return!0}return!1}var nn={},ba=()=>p||"./this.program",Oe=()=>{if(!Oe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:ba()};for(var o in nn)nn[o]===void 0?delete r[o]:r[o]=nn[o];var s=[];for(var o in r)s.push(`${o}=${r[o]}`);Oe.strings=s}return Oe.strings},ka=(e,r)=>{for(var o=0;o<e.length;++o)$[r++>>>0]=e.charCodeAt(o);$[r>>>0]=0},Oa=function(e,r){e>>>=0,r>>>=0;var o=0;return Oe().forEach((s,c)=>{var u=r+o;U[e+c*4>>>2>>>0]=u,ka(s,u),o+=s.length+1}),0},Ba=function(e,r){e>>>=0,r>>>=0;var o=Oe();U[e>>>2>>>0]=o.length;var s=0;return o.forEach(c=>s+=c.length+1),U[r>>>2>>>0]=s,0};function Fa(e){try{var r=F.getStreamFromFD(e);return l.close(r),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var Ua=(e,r,o,s)=>{for(var c=0,u=0;u<o;u++){var f=U[r>>>2>>>0],T=U[r+4>>>2>>>0];r+=8;var y=l.read(e,$,f,T,s);if(y<0)return-1;if(c+=y,y<T)break}return c};function $a(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=F.getStreamFromFD(e),u=Ua(c,r,o);return U[s>>>2>>>0]=u,0}catch(f){if(typeof l>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function Ha(e,r,o,s){r=re(r),s>>>=0;try{if(isNaN(r))return 61;var c=F.getStreamFromFD(e);return l.llseek(c,r,o),st[s>>>3]=BigInt(c.position),c.getdents&&r===0&&o===0&&(c.getdents=null),0}catch(u){if(typeof l>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Va=(e,r,o,s)=>{for(var c=0,u=0;u<o;u++){var f=U[r>>>2>>>0],T=U[r+4>>>2>>>0];r+=8;var y=l.write(e,$,f,T,s);if(y<0)return-1;if(c+=y,y<T)break}return c};function Xa(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=F.getStreamFromFD(e),u=Va(c,r,o);return U[s>>>2>>>0]=u,0}catch(f){if(typeof l>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function Ka(e,r){e>>>=0,r>>>=0;try{return Ht(Z.subarray(e>>>0,e+r>>>0)),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var Jn=e=>{var r=n["_"+e];return r},za=(e,r)=>{$.set(e,r>>>0)},Zn=e=>to(e),Ja=e=>{var r=St(e)+1,o=Zn(r);return ce(e,o,r),o},qn=(e,r,o,s,c)=>{var u={string:b=>{var z=0;return b!=null&&b!==0&&(z=Ja(b)),z},array:b=>{var z=Zn(b.length);return za(b,z),z}};function f(b){return r==="string"?xt(b):r==="boolean"?!!b:b}var T=Jn(e),y=[],C=0;if(s)for(var D=0;D<s.length;D++){var N=u[o[D]];N?(C===0&&(C=ge()),y[D]=N(s[D])):y[D]=s[D]}var O=T(...y);function G(b){return C!==0&&he(C),f(b)}return O=G(O),O},Za=(e,r,o,s)=>{var c=!o||o.every(f=>f==="number"||f==="boolean"),u=r!=="string";return u&&c&&!s?Jn(e):(...f)=>qn(e,r,o,f)},qa=e=>{var r=St(e)+1,o=yn(r);return o&&ce(e,o,r),o};l.createPreloadedFile=on,l.staticInit(),B.doesNotExistError=new l.ErrnoError(44),B.doesNotExistError.stack="<generic error, no stack>",bt(),_e=n.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Ie=n.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},wr(),Wr(),Bn=n.UnboundTypeError=br(Error,"UnboundTypeError"),Fr();var Qn={__cxa_throw:Te,__syscall_fcntl64:j,__syscall_fstat64:Kt,__syscall_ioctl:Ke,__syscall_lstat64:_n,__syscall_newfstatat:dn,__syscall_openat:be,__syscall_stat64:ln,_abort_js:cn,_embind_register_bigint:Ar,_embind_register_bool:Tr,_embind_register_class:kr,_embind_register_class_property:Or,_embind_register_emval:$r,_embind_register_enum:Vr,_embind_register_enum_value:Xr,_embind_register_float:zr,_embind_register_function:jr,_embind_register_integer:ta,_embind_register_memory_view:ea,_embind_register_std_string:na,_embind_register_std_wstring:da,_embind_register_void:la,_emval_call_method:Ea,_emval_decref:An,_emval_get_method_caller:ga,_emval_incref:Aa,_emval_new_array:Ta,_emval_new_cstring:Pa,_emval_new_object:ya,_emval_run_destructors:pa,_emval_set_property:va,_emval_take_value:Ia,_gmtime_js:ma,_mktime_js:Sa,_tzset_js:La,clock_time_get:Na,emscripten_date_now:zn,emscripten_err:Ga,emscripten_get_now:Kn,emscripten_resize_heap:xa,environ_get:Oa,environ_sizes_get:Ba,fd_close:Fa,fd_read:$a,fd_seek:Ha,fd_write:Xa,random_get:Ka},K=await Ye();K.__wasm_call_ctors,n.__ZdlPvm=K._ZdlPvm;var yn=K.malloc,Jt=K.free;K.calloc,K.realloc;var Qa=K.__getTypeName;n._strndup=K.strndup,n.__ZdaPv=K._ZdaPv,n.__ZdaPvm=K._ZdaPvm,n.__ZdlPv=K._ZdlPv,n._emscripten_builtin_malloc=K.emscripten_builtin_malloc,n.__Znaj=K._Znaj,n.__ZnajSt11align_val_t=K._ZnajSt11align_val_t,n.__Znwj=K._Znwj,n.__ZnwjSt11align_val_t=K._ZnwjSt11align_val_t,n.___libc_calloc=K.__libc_calloc,n.___libc_free=K.__libc_free,n.___libc_malloc=K.__libc_malloc,n.___libc_realloc=K.__libc_realloc,n._emscripten_builtin_calloc=K.emscripten_builtin_calloc,n._emscripten_builtin_free=K.emscripten_builtin_free,n._emscripten_builtin_realloc=K.emscripten_builtin_realloc,n._malloc_size=K.malloc_size,n._malloc_usable_size=K.malloc_usable_size,n._reallocf=K.reallocf;var ja=K._emscripten_stack_restore,to=K._emscripten_stack_alloc,eo=K.emscripten_stack_get_current;function no(e){e=Object.assign({},e);var r=c=>u=>c(u)>>>0,o=c=>(u,f)=>c(u,f)>>>0,s=c=>()=>c()>>>0;return e.malloc=r(e.malloc),e.calloc=o(e.calloc),e.__getTypeName=r(e.__getTypeName),e.emscripten_builtin_malloc=r(e.emscripten_builtin_malloc),e.emscripten_builtin_calloc=o(e.emscripten_builtin_calloc),e._emscripten_stack_alloc=r(e._emscripten_stack_alloc),e.emscripten_stack_get_current=s(e.emscripten_stack_get_current),e}n.ENV=nn,n.ccall=qn,n.cwrap=Za,n.setValue=Ne,n.UTF8ToString=xt,n.stringToNewUTF8=qa,n.FS=l;function pn(){if(ct>0){Wt=pn;return}if(Zt(),ct>0){Wt=pn;return}function e(){var r;n.calledRun=!0,!q&&(qt(),d(n),(r=n.onRuntimeInitialized)==null||r.call(n),Qt())}n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e()}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return pn(),i=E,i})})(),Po=Object.defineProperty,yo=(a,t,i)=>t in a?Po(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,et=(a,t,i)=>yo(a,typeof t!="symbol"?t+"":t,i);const po=["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","euc-kr","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"],nr=a=>po[a];var ue=(a=>(a[a.TopLeft=1]="TopLeft",a[a.TopCenter=2]="TopCenter",a[a.TopRight=3]="TopRight",a[a.MiddleLeft=4]="MiddleLeft",a[a.MiddleCenter=5]="MiddleCenter",a[a.MiddleRight=6]="MiddleRight",a[a.BottomLeft=7]="BottomLeft",a[a.BottomCenter=8]="BottomCenter",a[a.BottomRight=9]="BottomRight",a))(ue||{}),wn=(a=>(a[a.PatternFill=0]="PatternFill",a[a.SolidFill=1]="SolidFill",a))(wn||{}),Cn=(a=>(a[a.NonAssociative=0]="NonAssociative",a[a.Associative=1]="Associative",a))(Cn||{}),dr=(a=>(a[a.Solid=0]="Solid",a[a.Gradient=1]="Gradient",a))(dr||{}),Dn=(a=>(a[a.TwoColor=0]="TwoColor",a[a.OneColor=1]="OneColor",a))(Dn||{}),Fe=(a=>(a[a.Line=1]="Line",a[a.Circular=2]="Circular",a[a.Elliptic=3]="Elliptic",a[a.Spline=4]="Spline",a))(Fe||{}),Rn=(a=>(a[a.LEFT=0]="LEFT",a[a.CENTER=1]="CENTER",a[a.RIGHT=2]="RIGHT",a[a.ALIGNED=3]="ALIGNED",a[a.MIDDLE=4]="MIDDLE",a[a.FIT=5]="FIT",a))(Rn||{});const vo=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"]),Io=/\\U\+([0-9A-Fa-f]{4})/g;function rr(a){return!a||!a.includes("\\U+")?a:a.replace(Io,(t,i)=>String.fromCharCode(parseInt(i,16)))}const mo=[{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}];var Sn=(a=>(a[a.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",a[a.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT",a))(Sn||{}),lr=(a=>(a[a.WRONGCRC=1]="WRONGCRC",a[a.NOTYETSUPPORTED=2]="NOTYETSUPPORTED",a[a.UNHANDLEDCLASS=4]="UNHANDLEDCLASS",a[a.INVALIDTYPE=8]="INVALIDTYPE",a[a.INVALIDHANDLE=16]="INVALIDHANDLE",a[a.INVALIDEED=32]="INVALIDEED",a[a.VALUEOUTOFBOUNDS=64]="VALUEOUTOFBOUNDS",a[a.CLASSESNOTFOUND=128]="CLASSESNOTFOUND",a[a.SECTIONNOTFOUND=256]="SECTIONNOTFOUND",a[a.PAGENOTFOUND=512]="PAGENOTFOUND",a[a.INTERNALERROR=1024]="INTERNALERROR",a[a.INVALIDDWG=2048]="INVALIDDWG",a[a.IOERROR=4096]="IOERROR",a[a.OUTOFMEM=8192]="OUTOFMEM",a))(lr||{}),L=(a=>(a[a.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",a[a.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",a[a.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",a[a.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",a[a.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",a[a.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",a[a.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",a[a.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",a[a.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",a[a.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",a[a.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",a[a.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",a[a.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",a[a.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",a[a.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",a[a.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",a[a.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",a[a.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",a[a.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",a[a.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",a[a.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",a[a.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",a[a.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",a[a.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",a[a.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",a[a.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",a[a.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",a[a.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",a[a.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",a[a.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",a[a.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",a[a.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",a[a.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",a[a.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",a[a.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",a[a.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",a[a.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",a[a.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",a[a.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",a[a.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",a[a.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",a[a.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",a[a.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",a[a.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",a[a.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",a[a.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",a[a.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",a[a.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",a[a.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",a[a.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",a[a.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",a[a.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",a[a.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",a[a.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",a[a.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",a[a.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",a[a.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",a[a.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",a[a.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",a[a.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",a[a.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",a[a.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",a[a.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",a[a.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",a[a.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",a[a.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",a[a.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",a[a.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",a[a.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",a[a.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",a[a.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",a[a.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",a[a.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",a[a.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",a[a.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",a[a.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",a[a.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",a[a.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",a[a.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",a[a.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",a[a.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",a[a.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",a[a.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",a[a.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",a[a.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",a[a.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",a[a.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",a[a.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",a[a.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",a[a.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",a[a.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",a[a.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",a[a.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",a[a.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",a[a.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",a[a.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",a[a.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",a[a.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",a[a.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",a[a.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",a[a.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",a[a.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",a[a.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",a[a.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",a[a.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",a[a.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",a[a.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",a[a.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",a[a.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",a[a.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",a[a.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",a[a.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",a[a.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",a[a.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",a[a.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",a[a.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",a[a.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",a[a.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",a[a.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",a[a.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",a[a.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",a[a.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",a[a.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",a[a.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",a[a.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",a[a.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",a[a.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",a[a.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",a[a.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",a[a.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",a[a.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",a[a.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",a[a.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",a[a.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",a[a.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",a[a.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",a[a.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",a[a.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",a[a.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",a[a.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",a[a.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",a[a.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",a[a.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",a[a.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",a[a.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",a[a.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",a[a.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",a[a.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",a[a.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",a[a.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",a[a.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",a[a.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",a[a.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",a[a.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",a[a.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",a[a.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",a[a.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",a[a.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",a[a.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",a[a.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",a[a.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",a[a.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",a[a.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",a[a.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",a[a.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",a[a.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",a[a.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",a[a.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",a[a.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",a[a.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",a[a.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",a[a.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",a[a.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",a[a.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",a[a.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",a[a.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",a[a.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",a[a.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",a[a.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",a[a.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",a[a.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",a[a.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",a[a.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",a[a.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",a[a.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",a[a.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",a[a.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",a[a.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",a[a.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",a[a.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",a[a.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",a[a.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",a[a.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",a[a.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",a[a.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",a[a.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",a[a.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",a[a.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",a[a.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",a[a.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",a[a.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",a[a.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",a[a.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",a[a.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",a[a.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",a[a.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",a[a.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",a[a.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",a[a.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",a[a.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",a[a.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",a[a.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",a[a.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",a[a.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",a[a.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",a[a.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",a[a.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",a[a.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",a[a.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",a[a.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",a[a.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",a[a.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",a[a.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",a[a.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",a[a.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",a[a.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",a[a.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",a[a.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",a[a.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",a[a.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",a[a.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",a[a.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",a[a.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",a[a.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",a[a.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",a[a.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",a[a.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",a[a.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",a[a.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",a[a.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",a[a.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",a[a.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",a[a.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",a[a.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",a[a.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",a[a.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",a[a.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",a[a.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",a[a.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",a[a.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",a[a.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",a[a.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",a[a.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",a[a.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",a[a.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",a[a.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",a[a.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",a[a.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",a[a.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",a[a.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",a[a.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",a[a.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",a[a.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",a[a.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",a[a.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",a[a.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",a[a.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",a[a.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",a[a.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",a[a.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",a[a.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",a[a.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",a[a.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",a[a.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",a[a.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",a[a.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",a[a.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",a[a.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",a[a.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",a[a.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",a[a.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",a[a.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",a[a.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",a[a.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",a[a.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",a[a.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",a[a.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",a[a.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",a[a.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ",a))(L||{});Object.fromEntries(Object.entries(L).map(([a,t])=>[t,a]));var Yn=(a=>(a[a.DWG=0]="DWG",a[a.DXF=1]="DXF",a))(Yn||{}),Ue=(a=>(a[a.Line=1]="Line",a[a.CircularArc=2]="CircularArc",a[a.EllipticArc=3]="EllipticArc",a[a.Spline=4]="Spline",a))(Ue||{}),fe=(a=>(a[a.ByLayer=192]="ByLayer",a[a.ByBlock=193]="ByBlock",a[a.Entities=194]="Entities",a[a.TrueColor=195]="TrueColor",a[a.ForegroundColor=197]="ForegroundColor",a[a.None=200]="None",a))(fe||{});const ar=192,or=193,wo=194,In=195,ir=200;function cr(a){if(a==null)return;const t=a.method,i=a.method!=null&&t!==0?t:a.rgb>>>24&255,n=a.index;if(a.rgb!=null&&i>=ar&&i<=ir&&(a.rgb>>>24&255)===i)return a.rgb>>0;if(i===fe.ByLayer||n===256)return ar<<24>>0;if(i===fe.ByBlock||n===0)return or<<24>>0;if(i===fe.None)return ir<<24>>0;if(i===fe.TrueColor){const d=a.rgb!=null?a.rgb&16777215:void 0;if(d!=null)return(wo<<24|d)>>0}return i===fe.ForegroundColor?(In<<24|7)>>0:i===fe.Entities&&n>0&&n<256||n>0&&n<256?(In<<24|n&255)>>0:or<<24>>0}const Co="*MODEL_SPACE",Do="*PAPER_SPACE",Ln=a=>a&&a.toUpperCase()==Co,Ro=a=>a&&a.toUpperCase().startsWith(Do),Tt=a=>a.toString(16).toUpperCase(),$e=a=>{const t=new Array(a.length);for(let i=0;i<a.length;i++)t[i]=a[i].toString(16).toUpperCase().padStart(2,"0");return t.join("")},So=a=>{if(!a||a.length<98)return null;const t=new DataView(a.buffer,a.byteOffset,a.byteLength),i=_=>({x:t.getFloat64(_,!0),y:t.getFloat64(_+8,!0),z:t.getFloat64(_+16,!0)}),n=i(2),d=i(50);return[n.x,n.y,n.z,d.x,d.y,d.z].every(Number.isFinite)?{upperLeft:n,lowerRight:d}:null};class Lo{constructor(t){et(this,"libredwg"),et(this,"layers",new Map),et(this,"ltypes",new Map),et(this,"classes",[]),et(this,"unknownEntityCount"),this.libredwg=t,this.unknownEntityCount=0}prepare(t,i=!1){(i||this.layers.size==0)&&(this.layers.clear(),t.tables.LAYER.entries.forEach(n=>{this.layers.set(n.handle,n.name)})),(i||this.ltypes.size==0)&&(this.ltypes.clear(),t.tables.LTYPE.entries.forEach(n=>{this.ltypes.set(n.handle,n.name)})),this.classes=t.classes,this.unknownEntityCount=0}setClasses(t){this.classes=t}clear(){this.layers.clear(),this.ltypes.clear(),this.classes=[],this.unknownEntityCount=0}convert(t){const i=this.libredwg,n=i.dwg_object_to_entity(t),d=i.dwg_object_to_entity_tio(t);if(n&&d){const _=this.getCommonAttrs(n),E=i.dwg_object_get_fixedtype(t);if(E==L.DWG_TYPE_3DFACE)return this.convert3dFace(d,_);if(E==L.DWG_TYPE_3DSOLID)return this.convert3dSolid(d,_);if(E==L.DWG_TYPE_ARC)return this.convertArc(d,_);if(E==L.DWG_TYPE_ARCALIGNEDTEXT)return this.convertArcAlignedText(d,_);if(E==L.DWG_TYPE_ATTDEF)return this.convertAttdef(d,_);if(E==L.DWG_TYPE_CIRCLE)return this.convertCircle(d,_);if(E==L.DWG_TYPE_DIMENSION_ALIGNED||E==L.DWG_TYPE_DIMENSION_LINEAR)return this.convertAlignedDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ANG2LN)return this.convert2LineAngularDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(d,_);if(E==L.DWG_TYPE_ELLIPSE)return this.convertEllise(d,_);if(E==L.DWG_TYPE_HATCH)return this.convertHatch(d,_);if(E==L.DWG_TYPE_IMAGE)return this.convertImage(d,_);if(E==L.DWG_TYPE_INSERT)return this.convertInsert(d,_);if(E==L.DWG_TYPE_LEADER)return this.convertLeader(d,_);if(E==L.DWG_TYPE_LINE)return this.convertLine(d,_);if(E==L.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(d,_);if(E==L.DWG_TYPE_MLINE)return this.convertMLine(d,_);if(E==L.DWG_TYPE_MULTILEADER)return this.convertMultiLeader(d,_);if(E==L.DWG_TYPE_MTEXT)return this.convertMText(d,_);if(E==L.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(d,_);if(E==L.DWG_TYPE_OLEFRAME)return this.convertOleFrame(d,_);if(E==L.DWG_TYPE_POINT)return this.convertPoint(d,_);if(E==L.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(d,_,t);if(E==L.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(d,_,t);if(E==L.DWG_TYPE_PROXY_ENTITY)return this.convertProxyEntity(d,_,t);if(E==L.DWG_TYPE_RAY)return this.convertRay(d,_);if(E==L.DWG_TYPE_SECTIONOBJECT)return this.convertSection(d,_);if(E==L.DWG_TYPE_SHAPE)return this.convertShape(d,_);if(E==L.DWG_TYPE_SOLID)return this.convertSolid(d,_);if(E==L.DWG_TYPE_SPLINE)return this.convertSpline(d,_);if(E==L.DWG_TYPE_TABLE)return this.convertTable(d,_);if(E==L.DWG_TYPE_TEXT)return this.convertText(d,_);if(E==L.DWG_TYPE_TOLERANCE)return this.convertTolerance(d,_);if(E==L.DWG_TYPE_VIEWPORT)return this.convertViewport(d,_);if(E==L.DWG_TYPE_WIPEOUT)return this.convertWipeout(d,_);if(E==L.DWG_TYPE_XLINE)return this.convertXline(d,_);E===L.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),E=n.dwg_dynapi_entity_data(t,"corner3"),h=n.dwg_dynapi_entity_data(t,"corner4"),g=n.dwg_dynapi_entity_data(t,"invis_flags");return{type:"3DFACE",...i,corner1:d,corner2:_,corner3:E,corner4:h,flag:g}}convert3dSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"version"),_=n.dwg_dynapi_entity_data(t,"acis_empty"),E=n.dwg_dynapi_entity_data(t,"acis_data"),h=n.dwg_dynapi_entity_data(t,"has_revision_guid"),g=n.dwg_dynapi_entity_data(t,"history_id"),A=n.dwg_ref_get_id(g),P={type:"3DSOLID",subclassMarker:"AcDb3dSolid",...i};if(d&&(P.version=d),P.satCache=_,E&&(P.data=E),h){const v=n.dwg_dynapi_entity_field_offset(t,"revision_guid");if(v>=0){const p=n.UTF8ToString(t+v,38);p&&(P.guid=p)}}return A&&(P.historyObjectSoftId=A),P}convertArc(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ARC",...i,thickness:E,center:d,radius:_,startAngle:g,endAngle:A,extrusionDirection:h}}convertArcAlignedText(t,i){const n=this.libredwg,d=(A,P=0)=>{const v=n.dwg_dynapi_entity_data(t,A);if(typeof v=="number"&&Number.isFinite(v))return v;if(typeof v=="string"&&v.trim()!==""){const p=Number(v);if(Number.isFinite(p))return p}return P},_=n.dwg_dynapi_entity_data(t,"center"),E=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"arc_handle"),g=d("xscale",1);return{type:"ARCALIGNEDTEXT",...i,text:n.dwg_dynapi_entity_data(t,"text_value")??"",textSize:d("text_size"),xScale:g>0?g:1,characterSpacing:d("char_spacing"),styleName:n.dwg_dynapi_entity_data(t,"style")??"",fontName:n.dwg_dynapi_entity_data(t,"font_name")??"",bigFontName:n.dwg_dynapi_entity_data(t,"bigfont_name")??"",offsetFromArc:d("offset_from_arc"),rightOffset:d("right_offset"),leftOffset:d("left_offset"),center:_??{x:0,y:0,z:0},radius:n.dwg_dynapi_entity_data(t,"radius")??0,startAngle:n.dwg_dynapi_entity_data(t,"start_angle")??0,endAngle:n.dwg_dynapi_entity_data(t,"end_angle")??0,extrusionDirection:E??{x:0,y:0,z:1},rawTextColor:n.dwg_dynapi_entity_data(t,"color")??256,characterSet:n.dwg_dynapi_entity_data(t,"character_set")??0,pitchAndFamily:n.dwg_dynapi_entity_data(t,"pitch_and_family")??0,isShx:(n.dwg_dynapi_entity_data(t,"is_shx")??0)!==0,isBold:(n.dwg_dynapi_entity_data(t,"is_bold")??0)!==0,isItalic:(n.dwg_dynapi_entity_data(t,"is_italic")??0)!==0,isUnderlined:(n.dwg_dynapi_entity_data(t,"is_underlined")??0)!==0,alignment:n.dwg_dynapi_entity_data(t,"alignment")??0,isReverse:(n.dwg_dynapi_entity_data(t,"is_reverse")??0)!==0,wizardFlag:n.dwg_dynapi_entity_data(t,"wizard_flag")??0,textPosition:n.dwg_dynapi_entity_data(t,"text_position")??1,textDirection:n.dwg_dynapi_entity_data(t,"text_direction")??1,arcHandle:h?n.dwg_ref_get_id(h)??"":""}}convertEmbeddedMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,i,"attachment"),_=n.dwg_dynapi_subclass_data(t,i,"ins_pt"),E=n.dwg_dynapi_subclass_data(t,i,"x_axis_dir"),h=n.dwg_dynapi_subclass_data(t,i,"rect_height"),g=n.dwg_dynapi_subclass_data(t,i,"rect_width"),A=n.dwg_dynapi_subclass_data(t,i,"extents_height"),P=n.dwg_dynapi_subclass_data(t,i,"extents_width");return{insertionPoint:_,rectHeight:h,rectWidth:g,extentsHeight:A,extentsWidth:P,attachmentPoint:d,direction:E}}convertAttdef(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"default_value"),_=this.convertTextBase(t);_.text=d;const E=n.dwg_dynapi_entity_data(t,"prompt"),h=n.dwg_dynapi_entity_data(t,"tag"),g=n.dwg_dynapi_entity_data(t,"flags"),A=n.dwg_dynapi_entity_data(t,"field_length"),P=n.dwg_dynapi_entity_data(t,"lock_position_flag"),v=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),p=n.dwg_dynapi_entity_data(t,"is_really_locked"),I=n.dwg_dynapi_entity_data(t,"mtext_type"),R=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTDEF",...i,text:this.convertTextBase(t),prompt:E,tag:h,flags:g,fieldLength:A,lockPositionFlag:P>0,duplicateRecordCloningFlag:v>0,mtextFlag:I,isReallyLocked:p>0,alignmentPoint:R,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertAttrib(t,i){const n=this.libredwg,d=this.convertTextBase(t),_=n.dwg_dynapi_entity_data(t,"tag"),E=n.dwg_dynapi_entity_data(t,"flags"),h=n.dwg_dynapi_entity_data(t,"field_length"),g=n.dwg_dynapi_entity_data(t,"lock_position_flag"),A=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),P=n.dwg_dynapi_entity_data(t,"mtext_type"),v=n.dwg_dynapi_entity_data(t,"is_really_locked"),p=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTRIB",...i,text:d,tag:_,flags:E,fieldLength:h,lockPositionFlag:!!g,duplicateRecordCloningFlag:!!A,mtextFlag:P,isReallyLocked:!!v,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...p,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertCircle(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"CIRCLE",...i,thickness:E,center:d,radius:_,extrusionDirection:h}}convertAlignedDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"clone_ins_pt"),E=n.dwg_dynapi_entity_data(t,"xline1_pt"),h=n.dwg_dynapi_entity_data(t,"xline2_pt"),g=n.dwg_dynapi_entity_data(t,"ins_rotation"),A=n.dwg_dynapi_entity_data(t,"oblique_angle");return{subclassMarker:"AcDbAlignedDimension",...i,...d,insertionPoint:_,subDefinitionPoint1:E,subDefinitionPoint2:h,rotationAngle:g??0,obliqueAngle:A}}convert3PointAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1_pt"),E=n.dwg_dynapi_entity_data(t,"xline2_pt"),h=n.dwg_dynapi_entity_data(t,"center_pt"),g=n.dwg_dynapi_entity_data(t,"xline2end_pt");return{subclassMarker:"AcDb3PointAngularDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:E,centerPoint:h,arcPoint:g}}convert2LineAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1start_pt"),E=n.dwg_dynapi_entity_data(t,"xline1end_pt"),h=n.dwg_dynapi_entity_data(t,"xline2start_pt"),g=n.dwg_dynapi_entity_data(t,"xline2end_pt"),A=n.dwg_dynapi_entity_data(t,"def_pt");return g&&(d.definitionPoint=g),{subclassMarker:"AcDb2LineAngularDimension",...i,...d,subDefinitionPoint1:_??E??A??g,subDefinitionPoint2:h??g??A??E,centerPoint:A??h??E??g,arcPoint:g??d.definitionPoint}}convertDiameterDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),E=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbDiametricDimension",...i,...d,centerPoint:_,leaderLength:E}}convertOrdinateDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"feature_location_pt"),E=n.dwg_dynapi_entity_data(t,"leader_endpt");return{subclassMarker:"AcDbOrdinateDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:E}}convertRadiusDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),E=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbRadialDimension",...i,...d,centerPoint:_,leaderLength:E}}convertEllise(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"sm_axis"),E=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"axis_ratio"),g=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ELLIPSE",...i,center:d,majorAxisEndPoint:_,extrusionDirection:E,axisRatio:h,startAngle:g,endAngle:A}}convertHatch(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"extrusion"),_=n.dwg_dynapi_entity_data(t,"name"),E=n.dwg_dynapi_entity_data(t,"is_solid_fill"),h=n.dwg_dynapi_entity_data(t,"is_associative"),g=n.dwg_dynapi_entity_data(t,"num_paths"),A=n.dwg_dynapi_entity_data(t,"paths"),P=n.dwg_ptr_to_hatch_path_array(A,g),v=n.dwg_dynapi_entity_data(t,"style"),p=n.dwg_dynapi_entity_data(t,"pattern_type"),I=n.dwg_dynapi_entity_data(t,"angle"),R=n.dwg_dynapi_entity_data(t,"scale_spacing"),w=n.dwg_dynapi_entity_data(t,"num_deflines"),m=n.dwg_dynapi_entity_data(t,"deflines"),S=n.dwg_ptr_to_hatch_defline_array(m,w),W=n.dwg_dynapi_entity_data(t,"pixel_size"),M=n.dwg_dynapi_entity_data(t,"num_seeds"),x=n.dwg_dynapi_entity_data(t,"seeds"),k=n.dwg_ptr_to_point2d_array(x,M),V={...i,extrusionDirection:d,patternName:_,solidFill:E?wn.SolidFill:wn.PatternFill,associativity:h?Cn.Associative:Cn.NonAssociative,numberOfBoundaryPaths:g,boundaryPaths:this.convertHatchBoundaryPaths(P),hatchStyle:v,patternType:p,patternAngle:I,patternScale:R,numberOfDefinitionLines:w,definitionLines:S.map($=>({angle:$.angle,base:$.pt0,offset:$.offset,numberOfDashLengths:$.dashes.length,dashLengths:$.dashes})),pixelSize:W,numberOfSeedPoints:M,seedPoints:k};if(n.dwg_dynapi_entity_data(t,"is_gradient_fill")>0){const $=n.dwg_dynapi_entity_data(t,"gradient_name"),Z=n.dwg_dynapi_entity_data(t,"gradient_angle"),nt=n.dwg_dynapi_entity_data(t,"gradient_shift"),it=n.dwg_dynapi_entity_data(t,"gradient_tint"),Y=n.dwg_dynapi_entity_data(t,"single_color_gradient"),U=n.dwg_dynapi_entity_data(t,"colors"),lt=n.dwg_ptr_to_hatch_gradient_color_array(U,Y==1?1:2);return{type:"HATCH",...V,gradientFlag:dr.Gradient,gradientColorFlag:Y==1?Dn.OneColor:Dn.TwoColor,gradientName:$,gradientRotation:Z,gradientDefinition:nt,colorTint:it,gradientColors:lt}}else return{type:"HATCH",...V}}convertHatchBoundaryPaths(t){return t.filter(n=>n.num_segs_or_paths>0).map(n=>{const d={boundaryPathTypeFlag:n.flag};if(n.flag&2)return{...d,hasBulge:n.bulges_present,isClosed:n.closed,numberOfVertices:n.num_segs_or_paths,vertices:n.polyline_paths.map(_=>({x:_.point.x,y:_.point.y,bulge:_.bulge}))};{const _=n.segs.map(E=>{if(E.curve_type==Ue.Line)return{type:Fe.Line,start:E.first_endpoint,end:E.second_endpoint};if(E.curve_type==Ue.CircularArc)return{type:Fe.Circular,center:E.center,radius:E.radius,startAngle:E.start_angle,endAngle:E.end_angle,isCCW:E.is_ccw};if(E.curve_type==Ue.EllipticArc)return{type:Fe.Elliptic,center:E.center,end:E.endpoint,lengthOfMinorAxis:E.minor_major_ratio,startAngle:E.start_angle,endAngle:E.end_angle,isCCW:E.is_ccw};if(E.curve_type==Ue.Spline)return{type:Fe.Spline,degree:E.degree,isRational:E.is_rational,isPeriodic:E.is_periodic,numberOfKnots:E.num_knots,numberOfControlPoints:E.num_control_points,knots:E.knots,controlPoints:E.control_points,numberOfFitData:E.num_fitpts,fitDatum:E.fitpts,startTangent:E.start_tangent,endTangent:E.end_tangent}});return{...d,numberOfEdges:n.num_segs_or_paths,edges:_}}})}convertImage(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),E=n.dwg_dynapi_entity_data(t,"uvec"),h=n.dwg_dynapi_entity_data(t,"vvec"),g=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),P=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=n.dwg_dynapi_entity_data(t,"fade"),R=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),W=n.dwg_ptr_to_point3d_array(S,m),M=n.dwg_dynapi_entity_data(t,"imagedef"),x=n.dwg_ref_get_id(M)??"",k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),V=n.dwg_ref_get_id(k)??"";return{type:"IMAGE",...i,version:d,position:_,uPixel:E,vPixel:h,imageSize:g,imageDefHandle:x,flags:A,clipping:P,brightness:v,contrast:p,fade:I,imageDefReactorHandle:V,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:W,clipMode:R}}convertInsert(t,i){const n=this.libredwg;let d="";const _=n.dwg_dynapi_entity_data(t,"block_header");if(_){const m=n.dwg_ref_get_object(_);if(m){const S=n.dwg_object_to_object_tio(m);S&&(d=n.dwg_entity_block_header_get_block(S).name)}}d||(d=n.dwg_dynapi_entity_data(t,"block_name"));const E=n.dwg_dynapi_entity_data(t,"ins_pt"),h=n.dwg_dynapi_entity_data(t,"scale"),g=n.dwg_dynapi_entity_data(t,"rotation"),A=n.dwg_dynapi_entity_data(t,"num_cols"),P=n.dwg_dynapi_entity_data(t,"num_rows"),v=n.dwg_dynapi_entity_data(t,"col_spacing"),p=n.dwg_dynapi_entity_data(t,"row_spacing"),I=n.dwg_dynapi_entity_data(t,"extrusion"),R=n.dwg_entity_insert_get_attribs(t),w=[];return R.forEach(m=>{const S=n.dwg_object_to_entity(m),W=n.dwg_object_to_entity_tio(m);if(S&&W){const M=this.getCommonAttrs(S);n.dwg_object_get_fixedtype(m)==L.DWG_TYPE_ATTRIB&&w.push(this.convertAttrib(W,M))}}),{type:"INSERT",...i,name:d,insertionPoint:E,xScale:h?h.x:1,yScale:h?h.y:1,zScale:h?h.z:1,rotation:g,columnCount:A,rowCount:P,columnSpacing:v,rowSpacing:p,extrusionDirection:I,attribs:w}}convertLeader(t,i){const n=this.libredwg,d=n.dwg_entity_mtext_get_style_name(t),_=n.dwg_dynapi_entity_data(t,"arrowhead_type"),E=n.dwg_dynapi_entity_data(t,"path_type"),h=n.dwg_dynapi_entity_data(t,"annot_type"),g=n.dwg_dynapi_entity_data(t,"hookline_dir"),A=n.dwg_dynapi_entity_data(t,"hookline_on"),P=n.dwg_dynapi_entity_data(t,"box_height"),v=n.dwg_dynapi_entity_data(t,"box_width"),p=n.dwg_dynapi_entity_data(t,"num_points"),I=n.dwg_dynapi_entity_data(t,"points"),R=p>0?n.dwg_ptr_to_point3d_array(I,p):[],w=n.dwg_dynapi_entity_data(t,"byblock_color"),m=n.dwg_dynapi_entity_data(t,"extrusion"),S=n.dwg_dynapi_entity_data(t,"x_direction"),W=n.dwg_dynapi_entity_data(t,"inspt_offset"),M=n.dwg_dynapi_entity_data(t,"endptproj");return{type:"LEADER",...i,styleName:d,isArrowheadEnabled:_>0,isSpline:E>0,leaderCreationFlag:h,isHooklineSameDirection:g>0,isHooklineExists:A>0,textHeight:P,textWidth:v,numberOfVertices:p,vertices:R,byBlockColor:w,normal:m,horizontalDirection:S,offsetFromBlock:W,offsetFromAnnotation:M}}convertLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"start"),_=n.dwg_dynapi_entity_data(t,"end"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"LINE",...i,thickness:E,startPoint:d,endPoint:_,extrusionDirection:h}}convertLWPolyline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"num_points"),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"const_width"),h=n.dwg_dynapi_entity_data(t,"elevation"),g=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion"),P=[],v=n.dwg_dynapi_entity_data(t,"num_points"),p=n.dwg_dynapi_entity_data(t,"points"),I=n.dwg_ptr_to_point2d_array(p,v),R=n.dwg_dynapi_entity_data(t,"num_bulges"),w=n.dwg_dynapi_entity_data(t,"bulges"),m=n.dwg_ptr_to_double_array(w,R),S=n.dwg_dynapi_entity_data(t,"num_widths")??0,W=n.dwg_dynapi_entity_data(t,"widths"),M=S>0&&W?n.dwg_ptr_to_double_array(W,S*2):[];return I.forEach((x,k)=>{const V={id:k,x:x.x,y:x.y,bulge:m.length>k?m[k]:0};k<S&&M.length>=(k+1)*2&&(V.startWidth=M[k*2],V.endWidth=M[k*2+1]),P.push(V)}),{type:"LWPOLYLINE",...i,numberOfVertices:d,flag:_,constantWidth:E,elevation:h,thickness:g,extrusionDirection:A,vertices:P}}convertMLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"scale"),_=n.dwg_dynapi_entity_data(t,"flags"),E=n.dwg_dynapi_entity_data(t,"justification"),h=n.dwg_dynapi_entity_data(t,"base_point"),g=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"num_lines"),P=n.dwg_dynapi_entity_data(t,"num_verts"),v=n.dwg_dynapi_entity_data(t,"verts"),p=n.dwg_ptr_to_mline_vertex_array(v,P),I=[];return p.forEach(R=>{I.push({vertex:R.vertex,vertexDirection:R.vertex_direction,miterDirection:R.miter_direction,numberOfLines:R.num_lines,lines:R.lines.map(w=>({numberOfSegmentParams:w.num_segparms,segmentParams:w.segparms,numberOfAreaFillParams:w.num_areafillparms,areaFillParams:w.areafillparms}))})}),{type:"MLINE",...i,scale:d,flags:_,justification:E,startPoint:h,extrusionDirection:g,numberOfLines:A,numberOfVertices:P,vertices:I,mlineStyle:""}}convertMultiLeader(t,i){const n=this.libredwg,d=F=>n.dwg_dynapi_entity_data(t,F),_=(F,j,Kt)=>n.dwg_dynapi_subclass_data(F,j,Kt),E=F=>n.dwg_ref_get_id(F),h=F=>F>0,g=F=>F!=null?cr(F):void 0,A=d("class_version"),P=E(d("mleaderstyle")),v=d("flags"),p=d("type"),I=g(d("line_color")),R=E(d("line_ltype")),w=d("line_linewt"),m=h(d("has_landing")),S=h(d("has_dogleg")),W=d("landing_dist"),M=E(d("arrow_handle")),x=d("arrow_size"),k=d("style_content"),V=E(d("text_style")),q=d("text_left"),$=d("text_right"),Z=d("text_angletype"),nt=d("text_alignment"),it=g(d("text_color")),Y=h(d("has_text_frame")),U=E(d("block_style")),lt=g(d("block_color")),st=d("block_scale"),Dt=d("block_rotation"),yt=d("style_attachment"),Nt=h(d("is_annotative")),pt=h(d("is_neg_textdir")),ft=d("ipe_alignment");let ht=d("justification");const Rt=d("attach_dir"),Ft=d("attach_bottom"),Ut=d("attach_top"),Zt=d("scale_factor"),qt=d("num_arrowheads"),Qt=d("arrowheads"),jt=n.dwg_dynapi_subclass_size("LEADER_ArrowHead"),Gt=[];for(let F=0;F<qt;F++){const j=Qt+F*jt;Gt.push({index:_(j,"LEADER_ArrowHead","is_default"),handle:E(_(j,"LEADER_ArrowHead","arrowhead"))??""})}const te=d("num_blocklabels"),ct=d("blocklabels"),Wt=n.dwg_dynapi_subclass_size("LEADER_BlockLabel"),$t=[];for(let F=0;F<te;F++){const j=ct+F*Wt;$t.push({id:E(_(j,"LEADER_BlockLabel","attdef")),index:_(j,"LEADER_BlockLabel","ui_index"),width:_(j,"LEADER_BlockLabel","width"),text:_(j,"LEADER_BlockLabel","label_text")})}const Q=t+n.dwg_dynapi_entity_field_offset(t,"ctx"),X=Q+n.dwg_dynapi_subclass_field_offset("MLEADER_AnnotContext","content"),ee=_(Q,"MLEADER_AnnotContext","scale_factor"),we=_(Q,"MLEADER_AnnotContext","content_base"),Ce=_(Q,"MLEADER_AnnotContext","landing_gap"),De=_(Q,"MLEADER_AnnotContext","attach_dir"),Re=_(Q,"MLEADER_AnnotContext","text_height"),Se=_(Q,"MLEADER_AnnotContext","arrow_size"),Le=_(Q,"MLEADER_AnnotContext","text_left"),Ye=_(Q,"MLEADER_AnnotContext","text_right"),ne=_(Q,"MLEADER_AnnotContext","text_angletype"),Ne=_(Q,"MLEADER_AnnotContext","text_alignment"),he=h(_(Q,"MLEADER_AnnotContext","has_content_txt")),ge=h(_(Q,"MLEADER_AnnotContext","has_content_blk")),Ge=_(Q,"MLEADER_AnnotContext","base"),Ae=_(Q,"MLEADER_AnnotContext","base_dir"),We=_(Q,"MLEADER_AnnotContext","base_vert"),Me=h(_(Q,"MLEADER_AnnotContext","is_normal_reversed"));let re,Te,Mt,vt,J,Pe,Ht,It,ae,mt,Vt,St,Xt,oe,ye,gt,pe,ie,B,He,Ve;if(he){const F=_(X,"MLEADER_Content_MText","alignment");F!=null&&F!==0&&(ht=F),Te=_(X,"MLEADER_Content_MText","normal"),Ht=_(X,"MLEADER_Content_MText","location"),Mt=_(X,"MLEADER_Content_MText","rotation"),It=_(X,"MLEADER_Content_MText","direction"),vt=_(X,"MLEADER_Content_MText","width"),J=_(X,"MLEADER_Content_MText","line_spacing_factor"),Pe=_(X,"MLEADER_Content_MText","line_spacing_style"),re=_(X,"MLEADER_Content_MText","flow"),ae=g(_(X,"MLEADER_Content_MText","bg_color")),mt=_(X,"MLEADER_Content_MText","bg_scale"),Vt=_(X,"MLEADER_Content_MText","bg_transparency"),Xt=h(_(X,"MLEADER_Content_MText","is_bg_fill")),St=h(_(X,"MLEADER_Content_MText","is_bg_mask_fill")),oe=_(X,"MLEADER_Content_MText","col_type"),ye=h(_(X,"MLEADER_Content_MText","is_height_auto")),gt=_(X,"MLEADER_Content_MText","col_width"),pe=_(X,"MLEADER_Content_MText","col_gutter"),ie=h(_(X,"MLEADER_Content_MText","is_col_flow_reversed"));const j=_(X,"MLEADER_Content_MText","num_col_sizes"),Kt=_(X,"MLEADER_Content_MText","col_sizes");j>0&&(B=n.dwg_ptr_to_double_array(Kt,j)[0]),He=h(_(X,"MLEADER_Content_MText","word_break")),Ve=_(X,"MLEADER_Content_MText","default_text")}let Xe;if(ge){const F=_(X,"MLEADER_Content_Block","transform");Xe={blockContentId:E(_(X,"MLEADER_Content_Block","block_table")),normal:_(X,"MLEADER_Content_Block","normal"),position:_(X,"MLEADER_Content_Block","location"),scale:_(X,"MLEADER_Content_Block","scale"),rotation:_(X,"MLEADER_Content_Block","rotation"),color:g(_(X,"MLEADER_Content_Block","color")),transformationMatrix:F?n.dwg_ptr_to_double_array(F,16):void 0}}const an=_(Q,"MLEADER_AnnotContext","num_leaders"),on=_(Q,"MLEADER_AnnotContext","leaders"),sn=n.dwg_dynapi_subclass_size("LEADER_Node"),xe=n.dwg_dynapi_subclass_size("LEADER_Line"),l=n.dwg_dynapi_subclass_size("LEADER_Break"),xt=[];for(let F=0;F<an;F++){const j=on+F*sn,Kt=h(_(j,"LEADER_Node","has_lastleaderlinepoint")),Ke=h(_(j,"LEADER_Node","has_dogleg")),_n=_(j,"LEADER_Node","num_breaks"),dn=_(j,"LEADER_Node","breaks"),be=[];for(let bt=0;bt<_n;bt++){const wt=dn+bt*l;be.push({start:_(wt,"LEADER_Break","start"),end:_(wt,"LEADER_Break","end")})}const ln=_(j,"LEADER_Node","num_lines"),cn=_(j,"LEADER_Node","lines"),se=[];for(let bt=0;bt<ln;bt++){const wt=cn+bt*xe,ot=_(wt,"LEADER_Line","num_points"),zt=_(wt,"LEADER_Line","points"),kt=ot>0?n.dwg_ptr_to_point3d_array(zt,ot):[],ve=_(wt,"LEADER_Line","num_breaks"),_e=_(wt,"LEADER_Line","breaks"),H=[];for(let Ie=0;Ie<ve;Ie++){const de=_e+Ie*l;H.push({start:_(de,"LEADER_Break","start"),end:_(de,"LEADER_Break","end")})}se.push({vertices:kt,leaderLineIndex:_(wt,"LEADER_Line","line_index"),breaks:H.length>0?H:void 0})}xt.push({lastLeaderLinePoint:Kt?_(j,"LEADER_Node","lastleaderlinepoint"):void 0,lastLeaderLinePointSet:Kt,doglegVector:Ke?_(j,"LEADER_Node","dogleg_vector"):void 0,doglegVectorSet:Ke,doglegLength:_(j,"LEADER_Node","dogleg_length"),breaks:be.length>0?be:void 0,leaderBranchIndex:_(j,"LEADER_Node","branch_index"),leaderLines:se})}return{type:"MULTILEADER",...i,subclassMarker:"AcDbMLeader",version:A,leaderStyleId:P,propertyOverrideFlag:v,leaderLineType:p,leaderLineColor:I,leaderLineTypeId:R,leaderLineWeight:w,landingEnabled:m,doglegEnabled:S,doglegLength:W,arrowheadId:M,arrowheadSize:x||Se,contentType:k,textStyleId:V,textLeftAttachmentType:q||Le,textRightAttachmentType:$||Ye,textAngleType:Z||ne,textAlignmentType:nt||Ne,textColor:it,textFrameEnabled:Y,landingGap:Ce,textAttachment:De,textFlowDirection:re,blockContentId:U,blockContentColor:lt,blockContentScale:st,blockContentRotation:Dt,blockContentConnectionType:yt,annotativeScaleEnabled:Nt,arrowheadOverrides:Gt.length>0?Gt:void 0,blockAttributes:$t.length>0?$t:void 0,textDirectionNegative:pt,textAlignInIPE:ft,textAttachmentPoint:ht,textAttachmentDirection:Rt,bottomTextAttachmentDirection:Ft,topTextAttachmentDirection:Ut,contentScale:Zt||ee,contentBasePosition:we,normal:Te,textHeight:Re,textRotation:Mt,textWidth:vt,textLineSpacingFactor:J,textLineSpacingStyle:Pe,textAnchor:Ht,textDirection:It,textBackgroundColor:ae,textBackgroundScaleFactor:mt,textBackgroundTransparency:Vt,textBackgroundColorOn:St,textFillOn:Xt,textColumnType:oe,textUseAutoHeight:ye,textColumnWidth:gt,textColumnGutterWidth:pe,textColumnFlowReversed:ie,textColumnHeight:B,textUseWordBreak:He,textContent:Ve,hasMText:he,hasBlock:ge,blockContent:Xe,planeOrigin:Ge,planeXAxisDirection:Ae,planeYAxisDirection:We,planeNormalReversed:Me,leaderSections:xt.length>0?xt:void 0}}convertOle2Frame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"oleversion"),_=n.dwg_dynapi_entity_data(t,"oleclient"),E=n.dwg_dynapi_entity_data(t,"data_size");let h=n.dwg_dynapi_entity_data(t,"pt1"),g=n.dwg_dynapi_entity_data(t,"pt2");const A=n.dwg_dynapi_entity_data(t,"lock_aspect"),P=n.dwg_dynapi_entity_data(t,"type"),v=n.dwg_dynapi_entity_data(t,"mode"),p=n.dwg_entity_ole2frame_get_data(t),I=p?$e(p):"";if(p){const R=So(p);R&&(h=R.upperLeft,g=R.lowerRight)}return{type:"OLE2FRAME",...i,oleVersion:d,oleClient:_,dataSize:E,leftUpPoint:h,rightDownPoint:g,lockAspect:A,oleObjectType:P,tileModeDescriptor:v,binaryData:I}}convertOleFrame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"flag"),_=n.dwg_dynapi_entity_data(t,"mode"),E=n.dwg_dynapi_entity_data(t,"data_size"),h=n.dwg_entity_oleframe_get_data(t),g=h?$e(h):"";return{type:"OLEFRAME",...i,flag:d,mode:_,dataSize:E,binaryData:g}}convertMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_height"),E=n.dwg_dynapi_entity_data(t,"rect_height"),h=n.dwg_dynapi_entity_data(t,"rect_width"),g=n.dwg_dynapi_entity_data(t,"extents_width"),A=n.dwg_dynapi_entity_data(t,"extents_height"),P=n.dwg_dynapi_entity_data(t,"attachment"),v=n.dwg_dynapi_entity_data(t,"flow_dir"),p=n.dwg_dynapi_entity_data(t,"text"),I=n.dwg_entity_mtext_get_style_name(t),R=n.dwg_dynapi_entity_data(t,"extrusion"),w=n.dwg_dynapi_entity_data(t,"x_axis_dir"),m=n.dwg_dynapi_entity_data(t,"linespace_style"),S=n.dwg_dynapi_entity_data(t,"linespace_factor"),W=n.dwg_dynapi_entity_data(t,"bg_fill_flag"),M=n.dwg_dynapi_entity_data(t,"bg_fill_scale"),x=n.dwg_dynapi_entity_data(t,"bg_fill_color"),k=n.dwg_dynapi_entity_data(t,"bg_fill_trans"),V=n.dwg_dynapi_entity_data(t,"column_type"),q=n.dwg_dynapi_entity_data(t,"flow_reversed"),$=n.dwg_dynapi_entity_data(t,"auto_height"),Z=n.dwg_dynapi_entity_data(t,"column_width"),nt=n.dwg_dynapi_entity_data(t,"gutter"),it=n.dwg_dynapi_entity_data(t,"num_column_heights"),Y=n.dwg_dynapi_entity_data(t,"column_heights"),U=n.dwg_ptr_to_double_array(Y,it);return{type:"MTEXT",...i,insertionPoint:d,textHeight:_,rectHeight:E,rectWidth:h,extentsHeight:A,extentsWidth:g,attachmentPoint:P,drawingDirection:v,text:p,styleName:I,extrusionDirection:R,direction:w,rotation:0,lineSpacingStyle:m,lineSpacing:S,backgroundFill:W,fillBoxScale:M,backgroundFillColor:x.rgb,backgroundFillTransparency:k,columnType:V,columnFlowReversed:q,columnAutoHeight:$,columnWidth:Z,columnGutter:nt,columnHeightCount:it,columnHeights:U}}convertPoint(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"x"),_=n.dwg_dynapi_entity_data(t,"y"),E=n.dwg_dynapi_entity_data(t,"z"),h=n.dwg_dynapi_entity_data(t,"thickness"),g=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"x_ang");return{type:"POINT",...i,position:{x:d,y:_,z:E},thickness:h,extrusionDirection:g,angle:A}}convertPolyline2d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),E=d.dwg_dynapi_entity_data(t,"curve_type"),h=d.dwg_dynapi_entity_data(t,"start_width"),g=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"elevation"),P=d.dwg_dynapi_entity_data(t,"thickness"),v=d.dwg_dynapi_entity_data(t,"extrusion"),p=d.dwg_entity_polyline_2d_get_vertices(n)??[];return{type:"POLYLINE2D",...i,flag:_,smoothType:E,startWidth:h,endWidth:g,elevation:A,thickness:P,extrusionDirection:v,vertices:p.map(I=>({x:I.point.x,y:I.point.y,z:I.point.z,startWidth:I.start_width,endWidth:I.end_width,bulge:I.bulge,flag:I.flag,tangentDirection:I.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),E=d.dwg_dynapi_entity_data(t,"curve_type"),h=d.dwg_dynapi_entity_data(t,"start_width"),g=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"extrusion"),P=d.dwg_entity_polyline_3d_get_vertices(n)??[];return{type:"POLYLINE3D",...i,flag:_,smoothType:E,startWidth:h,endWidth:g,extrusionDirection:A,vertices:P.map(v=>({x:v.point.x,y:v.point.y,z:v.point.z,flag:v.flag}))}}convertProxyEntity(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"proxy_id"),E=d.dwg_dynapi_entity_data(t,"class_id"),h=d.dwg_dynapi_entity_data(t,"data_numbits"),g=d.dwg_dynapi_entity_data(t,"version"),A=d.dwg_dynapi_entity_data(t,"from_dxf"),P=d.dwg_dynapi_entity_data(t,"num_objids"),v=d.dwg_entity_get_preview(n),p=(v==null?void 0:v.length)??0,I=d.dwg_entity_proxy_entity_get_entity_data(t),R=v?$e(v):void 0,w=I?$e(I):void 0;let m;if(P>0){const M=d.dwg_dynapi_entity_data(t,"objids");M&&(m=d.dwg_ptr_to_object_ref_array(M,P).map(k=>Tt(k.absolute_ref)))}const S=this.getOriginalDxfName(E),W={type:"ACAD_PROXY_ENTITY",subclassMarker:"AcDbProxyEntity",...i,proxyEntityClassId:_||498,applicationEntityClassId:E};return S&&(W.originalDxfName=S),p>0&&(W.graphicsDataSize=p),R&&(W.graphicsData=R),h>0&&(W.entityDataSize=h),w&&(W.entityData=w),m&&m.length>0&&(W.linkedObjectIds=m),g&&(W.objectDrawingFormat=g),(A===0||A===1)&&(W.originalDataFormat=A),W}getOriginalDxfName(t){if(this.classes.length===0||t<0)return;const i=t>=500?t-500:t;if(i>=0&&i<this.classes.length)return this.classes[i].dxfName}convertRay(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"RAY",...i,firstPoint:d,unitDirection:_}}convertSection(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"state"),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"name"),h=n.dwg_dynapi_entity_data(t,"vert_dir"),g=n.dwg_dynapi_entity_data(t,"top_height"),A=n.dwg_dynapi_entity_data(t,"bottom_height"),P=n.dwg_dynapi_entity_data(t,"indicator_alpha"),v=n.dwg_dynapi_entity_data(t,"indicator_color"),p=n.dwg_dynapi_entity_data(t,"num_verts"),I=n.dwg_dynapi_entity_data(t,"verts"),R=p>0?n.dwg_ptr_to_point3d_array(I,p):[],w=n.dwg_dynapi_entity_data(t,"num_blverts"),m=n.dwg_dynapi_entity_data(t,"blverts"),S=w>0?n.dwg_ptr_to_point3d_array(m,w):[],W=n.dwg_dynapi_entity_data(t,"geometrySettingHardId"),M=n.dwg_ref_get_handle_absolute_ref(W)??0n;return{type:"SECTION",...i,state:d,flags:_,name:E,verticalDirection:h,topHeight:g,bottomHeight:A,indicatorTransparency:P,indicatorColor:v.rgb,numberOfVertices:p,vertices:R,numberOfBackLineVertices:w,backLineVertices:S,geometrySettingHardId:M}}convertShape(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"scale"),E=n.dwg_dynapi_entity_data(t,"rotation"),h=n.dwg_dynapi_entity_data(t,"width_factor"),g=n.dwg_dynapi_entity_data(t,"oblique_angle"),A=n.dwg_dynapi_entity_data(t,"thickness"),P=n.dwg_dynapi_entity_data(t,"extrusion"),v=n.dwg_dynapi_entity_data(t,"style_id"),p=n.dwg_entity_text_get_style_name(t);return{type:"SHAPE",subclassMarker:"AcDbShape",...i,thickness:A,insertionPoint:d,size:_,shapeNumber:v,styleName:p,rotation:E,xScale:h,obliqueAngle:g,extrusionDirection:P}}convertSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),E=n.dwg_dynapi_entity_data(t,"corner3"),h=n.dwg_dynapi_entity_data(t,"corner4"),g=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"SOLID",...i,corner1:d,corner2:_,corner3:E,corner4:h,thickness:g,extrusionDirection:A}}convertSpline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"splineflags"),_=n.dwg_dynapi_entity_data(t,"degree"),E=n.dwg_dynapi_entity_data(t,"knot_tol"),h=n.dwg_dynapi_entity_data(t,"num_knots"),g=n.dwg_dynapi_entity_data(t,"knots"),A=n.dwg_ptr_to_double_array(g,h),P=n.dwg_dynapi_entity_data(t,"fit_tol"),v=n.dwg_dynapi_entity_data(t,"num_fit_pts"),p=n.dwg_dynapi_entity_data(t,"fit_pts"),I=n.dwg_ptr_to_point3d_array(p,v),R=n.dwg_dynapi_entity_data(t,"weighted"),w=n.dwg_dynapi_entity_data(t,"ctrl_tol"),m=n.dwg_dynapi_entity_data(t,"num_ctrl_pts"),S=n.dwg_dynapi_entity_data(t,"ctrl_pts"),W=n.dwg_ptr_to_point4d_array(S,m),M=n.dwg_dynapi_entity_data(t,"beg_tan_vec"),x=n.dwg_dynapi_entity_data(t,"end_tan_vec");return{type:"SPLINE",...i,flag:d,degree:_,numberOfKnots:h,numberOfControlPoints:m,numberOfFitPoints:v,knotTolerance:E,controlTolerance:w,fitTolerance:P,startTangent:M,endTangent:x,knots:A,weights:R?W.map(k=>k.w):void 0,controlPoints:W.map(k=>({x:k.x,y:k.y,z:k.z})),fitPoints:I}}convertTable(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,"ldata","name"),_=n.dwg_dynapi_entity_data(t,"ins_pt"),E=n.dwg_dynapi_entity_data(t,"horiz_direction"),h=n.dwg_dynapi_entity_data(t,"flag_for_table_value"),g=n.dwg_dynapi_entity_data(t,"num_rows"),A=n.dwg_dynapi_entity_data(t,"num_cols"),P=n.dwg_dynapi_entity_data(t,"row_heights"),v=n.dwg_ptr_to_double_array(P,g),p=n.dwg_dynapi_entity_data(t,"col_widths"),I=n.dwg_ptr_to_double_array(p,A),R=n.dwg_dynapi_entity_data(t,"tablestyle"),w=n.dwg_ref_get_id(R)??"",m=n.dwg_dynapi_entity_data(t,"block_header"),S=n.dwg_ref_get_id(m)??"",W=n.dwg_dynapi_entity_data(t,"table_flag_override"),M=n.dwg_dynapi_entity_data(t,"border_color_overrides_flag"),x=n.dwg_dynapi_entity_data(t,"border_lineweight_overrides_flag"),k=n.dwg_dynapi_entity_data(t,"border_visibility_overrides_flag"),V=n.dwg_dynapi_entity_data(t,"num_cells"),q=n.dwg_dynapi_entity_data(t,"cells"),$=n.dwg_ptr_to_table_cell_array(q,V);return{type:"ACAD_TABLE",...i,name:d,startPoint:_,directionVector:E,tableValue:h,rowCount:g,columnCount:A,overrideFlag:W,borderColorOverrideFlag:M,borderLineWeightOverrideFlag:x,borderVisibilityOverrideFlag:k,rowHeightArr:v,columnWidthArr:I,tableStyleId:w,blockRecordHandle:S,cells:this.convertTableCells($),bmpPreview:""}}convertTableCells(t){return t.map(i=>{var n,d;return{text:i.text_value,attachmentPoint:i.cell_alignment,textStyle:i.text_style?String(i.text_style):void 0,rotation:i.rotation,cellType:i.type,flagValue:i.flags,mergedValue:i.is_merged_value,autoFit:i.is_autofit_flag,topBorderVisibility:!!i.top_visibility,bottomBorderVisibility:!!i.bottom_visibility,leftBorderVisibility:!!i.left_visibility,rightBorderVisibility:!!i.right_visibility,overrideFlag:i.cell_flag_override,virtualEdgeFlag:i.virtual_edge_flag,blockTableRecordId:i.block_handle?String(i.block_handle.absolute_ref??""):void 0,blockScale:i.block_scale,blockAttrNum:((n=i.attr_defs)==null?void 0:n.length)??0,attrDefineId:(d=i.attr_defs)==null?void 0:d.map(_=>{var E;return String(((E=_.attdef)==null?void 0:E.absolute_ref)??"")}),textHeight:i.text_height??0,extendedCellFlags:i.additional_data_flag}})}convertTextBase(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"text_value"),d=i.dwg_dynapi_entity_data(t,"thickness"),_=i.dwg_dynapi_entity_data(t,"ins_pt"),E=i.dwg_dynapi_entity_data(t,"alignment_pt"),h=i.dwg_dynapi_entity_data(t,"rotation"),g=i.dwg_dynapi_entity_data(t,"height"),A=i.dwg_dynapi_entity_data(t,"width_factor"),P=i.dwg_dynapi_entity_data(t,"oblique_angle"),v=i.dwg_entity_text_get_style_name(t),p=i.dwg_dynapi_entity_data(t,"generation"),I=i.dwg_dynapi_entity_data(t,"horiz_alignment"),R=i.dwg_dynapi_entity_data(t,"vert_alignment"),w=i.dwg_dynapi_entity_data(t,"extrusion");return{text:n,thickness:d,startPoint:_,endPoint:E,textHeight:g,rotation:h,xScale:A,obliqueAngle:P,styleName:v,generationFlag:p,halign:I,valign:R,extrusionDirection:w}}convertText(t,i){return{type:"TEXT",...i,...this.convertTextBase(t)}}convertTolerance(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_value"),E=n.dwg_dynapi_entity_data(t,"x_direction"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_entity_get_dimstyle_name(t);return{type:"TOLERANCE",...i,styleName:g,insertionPoint:d,text:_,extrusionDirection:h,xAxisDirection:E}}convertViewport(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"width"),E=n.dwg_dynapi_entity_data(t,"height"),h=n.dwg_dynapi_entity_data(t,"on_off"),g=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"SNAPBASE"),P=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),v=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),p=n.dwg_dynapi_entity_data(t,"VIEWDIR"),I=n.dwg_dynapi_entity_data(t,"view_target"),R=n.dwg_dynapi_entity_data(t,"lens_length"),w=n.dwg_dynapi_entity_data(t,"front_clip_z"),m=n.dwg_dynapi_entity_data(t,"back_clip_z"),S=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),W=n.dwg_dynapi_entity_data(t,"SNAPANG"),M=n.dwg_dynapi_entity_data(t,"twist_angle"),x=n.dwg_dynapi_entity_data(t,"circle_zoom"),k=n.dwg_dynapi_entity_data(t,"status_flag"),V=n.dwg_dynapi_entity_data(t,"style_sheet"),q=n.dwg_dynapi_entity_data(t,"render_mode"),$=n.dwg_dynapi_entity_data(t,"UCSVP"),Z=n.dwg_dynapi_entity_data(t,"ucsorg"),nt=n.dwg_dynapi_entity_data(t,"ucsxdir"),it=n.dwg_dynapi_entity_data(t,"ucsydir"),Y=n.dwg_dynapi_entity_data(t,"named_ucs"),U=n.dwg_ref_get_id(Y),lt=n.dwg_dynapi_entity_data(t,"base_ucs"),st=n.dwg_ref_get_id(lt),Dt=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),yt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),Nt=n.dwg_dynapi_entity_data(t,"shadeplot_mode"),pt=n.dwg_dynapi_entity_data(t,"use_default_lights"),ft=n.dwg_dynapi_entity_data(t,"default_lighting_type"),ht=n.dwg_dynapi_entity_data(t,"brightness"),Rt=n.dwg_dynapi_entity_data(t,"contrast"),Ft=n.dwg_dynapi_entity_data(t,"grid_major"),Ut=n.dwg_dynapi_entity_data(t,"background"),Zt=n.dwg_ref_get_id(Ut),qt=n.dwg_dynapi_entity_data(t,"shadeplot"),Qt=n.dwg_ref_get_id(qt),jt=n.dwg_dynapi_entity_data(t,"visualstyle"),Gt=n.dwg_ref_get_id(jt),te=n.dwg_dynapi_entity_data(t,"sun"),ct=n.dwg_ref_get_id(te);return{type:"VIEWPORT",...i,viewportCenter:d,width:_,height:E,status:h,viewportId:0,displayCenter:g,snapBase:A,snapSpacing:P,gridSpacing:v,viewDirection:p,targetPoint:I,perspectiveLensLength:R,frontClipZ:w,backClipZ:m,viewHeight:S,snapAngle:W,viewTwistAngle:M,circleZoomPercent:x,statusBitFlags:k,sheetName:V,renderMode:q,ucsPerViewport:$,ucsOrigin:Z,ucsXAxis:nt,ucsYAxis:it,ucsId:U??"",ucsBaseId:st??"",orthographicType:Dt,elevation:yt,shadePlotMode:Nt,majorGridFrequency:Ft,backgroundId:Zt??"",shadePlotId:Qt??"",visualStyleId:Gt??"",isDefaultLighting:!!pt,defaultLightingType:ft,brightness:ht,contrast:Rt,sunId:ct??""}}convertWipeout(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),E=n.dwg_dynapi_entity_data(t,"uvec"),h=n.dwg_dynapi_entity_data(t,"vvec"),g=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),P=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=n.dwg_dynapi_entity_data(t,"fade"),R=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),W=n.dwg_ptr_to_point2d_array(S,m),M=n.dwg_dynapi_entity_data(t,"imagedef"),x=n.dwg_ref_get_absref(M)??0,k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),V=n.dwg_ref_get_absref(k)??0;return{type:"WIPEOUT",...i,version:d,position:_,uPixel:E,vPixel:h,imageSize:g,imageDefHandle:x,flags:A,clipping:P,brightness:v,contrast:p,fade:I,imageDefReactorHandle:V,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:W,clipMode:R}}convertXline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"XLINE",...i,firstPoint:d,unitDirection:_}}getDimensionCommonAttrs(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"class_version"),d=i.dwg_entity_get_block_name(t,"block"),_=i.dwg_dynapi_entity_data(t,"def_pt"),E=i.dwg_dynapi_entity_data(t,"text_midpt"),h=i.dwg_dynapi_entity_data(t,"attachmentPoint"),g=i.dwg_dynapi_entity_data(t,"flag"),A=i.dwg_dynapi_entity_data(t,"lspace_factor"),P=i.dwg_dynapi_entity_data(t,"lspace_factor"),v=i.dwg_dynapi_entity_data(t,"act_measurement"),p=i.dwg_dynapi_entity_data(t,"user_text"),I=i.dwg_dynapi_entity_data(t,"text_rotation"),R=i.dwg_dynapi_entity_data(t,"ins_rotation"),w=i.dwg_dynapi_entity_data(t,"extrusion"),m=i.dwg_entity_get_dimstyle_name(t);return{type:"DIMENSION",version:n,name:d,definitionPoint:_,textPoint:E,dimensionType:g,attachmentPoint:h,textLineSpacingStyle:A,textLineSpacingFactor:P||1,measurement:v,text:p,textRotation:I,ocsRotation:R,extrusionDirection:w,styleName:m}}getCommonAttrs(t){const i=this.libredwg,n=i.dwg_object_entity_get_color_object(t),d=n.method,_=n.index;let E;(d==194||(n.rgb>>>24&255)===194)&&(E=n.rgb&16777215);const h=this.getLayerName(t),g=i.dwg_object_entity_get_handle_object(t),A=i.dwg_object_entity_get_ownerhandle_object(t),P=i.dwg_object_entity_get_xdicobjhandle_object(t),v=this.getLtypeName(t),p=i.dwg_object_entity_get_line_weight(t),I=i.dwg_object_entity_get_ltype_scale(t),R=!i.dwg_object_entity_get_invisible(t),w=i.dwg_object_entity_get_xdata(t);return{handle:Tt(g.value),ownerDictionaryHardId:Tt(P.absolute_ref),ownerBlockRecordSoftId:Tt(A.absolute_ref),layer:h,color:E,colorIndex:_,colorName:n.name,lineType:v,lineweight:p,lineTypeScale:I,isVisible:R,transparency:n.alpha,transparencyType:n.alpha_type,xdata:w}}getLayerName(t){const n=this.libredwg.dwg_object_entity_get_layer_object_ref(t);return this.layers.get(Tt(n.handleref.value))??"0"}getLtypeName(t){const n=this.libredwg.dwg_object_entity_get_ltype_object_ref(t);return this.ltypes.get(Tt(n.handleref.value))??""}}class sr{constructor(t){et(this,"libredwg"),et(this,"entityConverter"),et(this,"orphanEntitiesByBlock",null),et(this,"ownerlessOrphanIndices",null),et(this,"orphanIndexDataPtr",null),this.libredwg=t,this.entityConverter=new Lo(t)}convert(t){var i;this.entityConverter.clear(),this.orphanEntitiesByBlock=null,this.ownerlessOrphanIndices=null,this.orphanIndexDataPtr=t;const n={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],IMAGEDEF:[],LAYER_FILTER:[],LAYER_INDEX:[],LAYOUT:[],MLEADERSTYLE:[],SPATIAL_FILTER:[],XRECORD:[]},header:{},entities:[],classes:[]},d=this.libredwg;this.convertHeader(t,n.header),this.convertClasses(t,n.classes),this.entityConverter.setClasses(n.classes);const _=d.dwg_get_num_objects(t);for(let g=0;g<_;g++){const A=d.dwg_get_object(t,g);if(A){const P=this.safeObjectTio(A);if(P)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_LAYER:{const p=this.convertLayer(P,A);n.tables.LAYER.entries.push(p),this.entityConverter.layers.set(p.handle,p.name)}break;case L.DWG_TYPE_LTYPE:{const p=this.convertLineType(P,A);n.tables.LTYPE.entries.push(p),this.entityConverter.ltypes.set(p.handle,p.name)}break}}}for(let g=0;g<_;g++){const A=d.dwg_get_object(t,g);if(A){const P=this.safeObjectTio(A);if(P)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_APPID:n.tables.APPID.entries.push(this.convertAppId(P));break;case L.DWG_TYPE_BLOCK_HEADER:{const p=this.convertBlockRecord(P,A);n.tables.BLOCK_RECORD.entries.push(p),(Ln(p.name)||Ro(p.name))&&p.entities.forEach(I=>{n.entities.push(I),I.type==="INSERT"&&I.attribs.forEach(R=>{n.entities.push(R)})})}break;case L.DWG_TYPE_DIMSTYLE:n.tables.DIMSTYLE.entries.push(this.convertDimStyle(P,A));break;case L.DWG_TYPE_STYLE:n.tables.STYLE.entries.push(this.convertStyle(P,A));break;case L.DWG_TYPE_VPORT:n.tables.VPORT.entries.push(this.convertViewport(P,A));break;case L.DWG_TYPE_DICTIONARY:n.objects.DICTIONARY.push(this.convertDictionary(P,A));break;case L.DWG_TYPE_IMAGEDEF:n.objects.IMAGEDEF.push(this.convertImageDef(P,A));break;case L.DWG_TYPE_LAYERFILTER:n.objects.LAYER_FILTER.push(this.convertLayerFilter(P,A));break;case L.DWG_TYPE_LAYER_INDEX:n.objects.LAYER_INDEX.push(this.convertLayerIndex(P,A));break;case L.DWG_TYPE_LAYOUT:n.objects.LAYOUT.push(this.convertLayout(P,A));break;case L.DWG_TYPE_MLEADERSTYLE:n.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(P,A));break;case L.DWG_TYPE_SPATIAL_FILTER:n.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(P,A));break;case L.DWG_TYPE_XRECORD:n.objects.XRECORD.push(this.convertXRecord(P,A));break}}}const E=n.entities.filter(g=>g.type==="VIEWPORT");E.sort((g,A)=>{const P=parseInt(g.handle,16),v=parseInt(A.handle,16);return P-v}),E.forEach((g,A)=>{g.viewportId=A+1});const h=d.dwg_bmp(t);return(i=h==null?void 0:h.data)!=null&&i.length&&(n.thumbnailImage=h.data),n}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}safeObjectTio(t){const i=this.libredwg;try{if(i.dwg_object_get_supertype(t)!=Sn.DWG_SUPERTYPE_OBJECT)return null;const n=i.dwg_object_to_object_tio(t);return n||null}catch{return null}}convertHeader(t,i){const n=this.libredwg;vo.forEach(d=>{let _=d;(d=="DIMBLK"||d=="DIMBLK1"||d=="DIMBLK2")&&(_=_+"_T");let E=n.dwg_dynapi_header_data(t,_);d=="CELTYPE"||d=="CLAYER"||d=="CLAYER"||d=="DIMSTYLE"||d=="DIMTXSTY"||d=="TEXTSTYLE"?E=E?n.dwg_ref_get_object_name(E):"":d=="DRAGVS"&&(E=E?n.dwg_ref_get_absref(E)??2:2),i[d]=E})}convertClasses(t,i){const n=this.libredwg,d=n.dwg_get_num_classes(t);for(let _=0;_<d;_++){const E=n.dwg_get_class(t,_);i.push({dxfName:E.dxfname,cppName:E.cppname,appName:E.appname,capabilitiesFlag:E.proxyflag,instanceCount:E.num_instances,wasAProxyFlag:E.s_zombie,isAnEntityFlag:E.item_class_id===498})}}convertAppId(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"name"),d=i.dwg_dynapi_entity_data(t,"flag");return{name:n,standardFlag:d}}convertBlockRecord(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_entity_block_header_get_block(t);_.name&&(d.name=_.name);const E=n.dwg_dynapi_entity_data(t,"num_owned"),h=n.dwg_dynapi_entity_data(t,"flag"),g=n.dwg_dynapi_entity_data(t,"description"),A=n.dwg_dynapi_entity_data(t,"base_pt"),P=n.dwg_dynapi_entity_data(t,"insert_units"),v=n.dwg_dynapi_entity_data(t,"explodable"),p=n.dwg_dynapi_entity_data(t,"block_scaling"),I=n.dwg_dynapi_entity_data(t,"layout"),R=n.dwg_ref_get_id(I)??"";let w;const m=n.dwg_entity_block_header_get_preview(t);m&&m.length>0&&(w=$e(m));let S=this.convertEntities(i,d.handle);if(!S||S.length==0){S=[];const W=n.dwg_dynapi_entity_data(t,"entities");if(W){const M=n.dwg_ptr_to_object_ref_ptr_array(W,E),x=this.entityConverter;for(let k=0;k<E;k++){const V=n.dwg_ref_get_object(M[k]),q=x.convert(V);q&&(q.ownerBlockRecordSoftId=d.handle,S.push(q))}}}if(this.orphanIndexDataPtr!=null){const W=this.convertOrphanOwnedEntities(this.orphanIndexDataPtr,i,d.handle,Ln(d.name)===!0);if(W.length)if(S.length===0)S=W;else{const M=new Set(S.map(x=>x.handle));for(const x of W)M.has(x.handle)||S.push(x)}}return{...d,flags:h,description:g,basePoint:A,layout:R,insertionUnits:P,explodability:v,scalability:p,bmpPreview:w,entities:S}}convertEntities(t,i){const n=this.libredwg,d=this.entityConverter,_=[];let E=n.get_first_owned_entity(t);for(;E;){const h=d.convert(E);h&&(h.ownerBlockRecordSoftId=i,_.push(h)),E=n.get_next_owned_entity(t,E)}return _}convertOrphanOwnedEntities(t,i,n,d){this.ensureOrphanEntityIndex(t);const E=(this.orphanEntitiesByBlock??new Map).get(i)??[],h=d&&this.ownerlessOrphanIndices?this.ownerlessOrphanIndices:[],g=E.length&&h.length?E.concat(h):E.length?E:h;if(g.length===0)return[];const A=this.libredwg,P=this.entityConverter,v=[];for(const p of g){const I=A.dwg_get_object(t,p),R=P.convert(I);R&&(R.ownerBlockRecordSoftId=n,v.push(R))}return v}ensureOrphanEntityIndex(t){if(this.orphanEntitiesByBlock)return;const i=this.libredwg,n=i.dwg_get_num_objects(t),d=new Map,_=[],E=[],h=new Map;for(let v=0;v<n;v++){const p=i.dwg_get_object(t,v);if(p){if(i.dwg_object_get_supertype(p)===Sn.DWG_SUPERTYPE_ENTITY)_.push(v),d.set(p,v);else if(i.dwg_object_get_fixedtype(p)===L.DWG_TYPE_BLOCK_HEADER){E.push(p);const I=i.dwg_object_to_object_tio(p);I&&h.set(I,p)}}}const g=new Set;for(const v of E){let p=i.get_first_owned_entity(v),I=0;for(;p&&I++<=_.length;){const R=d.get(p);if(R===void 0||g.has(R))break;g.add(R),p=i.get_next_owned_entity(v,p)}}const A=new Map,P=[];for(const v of _){if(g.has(v))continue;const p=i.dwg_get_object(t,v),I=p?i.dwg_object_to_entity_tio(p):0,R=I?i.dwg_entity_owner(I):0,w=R?h.get(R)??0:0;if(w){const m=A.get(w);m?m.push(v):A.set(w,[v])}else P.push(v)}this.orphanEntitiesByBlock=A,this.ownerlessOrphanIndices=P}convertDimStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"DIMTOL"),E=n.dwg_dynapi_entity_data(t,"DIMLIM"),h=n.dwg_dynapi_entity_data(t,"DIMTIH"),g=n.dwg_dynapi_entity_data(t,"DIMTOH"),A=n.dwg_dynapi_entity_data(t,"DIMSE1"),P=n.dwg_dynapi_entity_data(t,"DIMSE2"),v=n.dwg_dynapi_entity_data(t,"DIMALT"),p=n.dwg_dynapi_entity_data(t,"DIMTOFL"),I=n.dwg_dynapi_entity_data(t,"DIMSAH"),R=n.dwg_dynapi_entity_data(t,"DIMTIX"),w=n.dwg_dynapi_entity_data(t,"DIMSOXD"),m=n.dwg_dynapi_entity_data(t,"DIMALTD"),S=n.dwg_dynapi_entity_data(t,"DIMZIN"),W=n.dwg_dynapi_entity_data(t,"DIMSD1"),M=n.dwg_dynapi_entity_data(t,"DIMSD2"),x=n.dwg_dynapi_entity_data(t,"DIMTOLJ"),k=n.dwg_dynapi_entity_data(t,"DIMJUST"),V=n.dwg_dynapi_entity_data(t,"DIMFIT"),q=n.dwg_dynapi_entity_data(t,"DIMUPT"),$=n.dwg_dynapi_entity_data(t,"DIMTZIN"),Z=n.dwg_dynapi_entity_data(t,"DIMALTZ"),nt=n.dwg_dynapi_entity_data(t,"DIMALTTZ"),it=n.dwg_dynapi_entity_data(t,"DIMTAD"),Y=n.dwg_dynapi_entity_data(t,"DIMUNIT"),U=n.dwg_dynapi_entity_data(t,"DIMAUNIT"),lt=n.dwg_dynapi_entity_data(t,"DIMDEC"),st=n.dwg_dynapi_entity_data(t,"DIMTDEC"),Dt=n.dwg_dynapi_entity_data(t,"DIMALTU"),yt=n.dwg_dynapi_entity_data(t,"DIMALTTD"),Nt=n.dwg_dynapi_entity_data(t,"DIMSCALE"),pt=n.dwg_dynapi_entity_data(t,"DIMASZ"),ft=n.dwg_dynapi_entity_data(t,"DIMEXO"),ht=n.dwg_dynapi_entity_data(t,"DIMDLI"),Rt=n.dwg_dynapi_entity_data(t,"DIMEXE"),Ft=n.dwg_dynapi_entity_data(t,"DIMRND"),Ut=n.dwg_dynapi_entity_data(t,"DIMDLE"),Zt=n.dwg_dynapi_entity_data(t,"DIMTP"),qt=n.dwg_dynapi_entity_data(t,"DIMTM"),Qt=n.dwg_dynapi_entity_data(t,"DIMFXL"),jt=n.dwg_dynapi_entity_data(t,"DIMJOGANG"),Gt=n.dwg_dynapi_entity_data(t,"DIMTFILL"),te=n.dwg_dynapi_entity_data(t,"DIMTFILLCLR"),ct=n.dwg_dynapi_entity_data(t,"DIMAZIN"),Wt=n.dwg_dynapi_entity_data(t,"DIMARCSYM"),$t=n.dwg_dynapi_entity_data(t,"DIMTXT"),Q=n.dwg_dynapi_entity_data(t,"DIMCEN"),X=n.dwg_dynapi_entity_data(t,"DIMTSZ"),ee=n.dwg_dynapi_entity_data(t,"DIMALTF"),we=n.dwg_dynapi_entity_data(t,"DIMLFAC"),Ce=n.dwg_dynapi_entity_data(t,"DIMTVP"),De=n.dwg_dynapi_entity_data(t,"DIMTFAC"),Re=n.dwg_dynapi_entity_data(t,"DIMGAP"),Se=n.dwg_dynapi_entity_data(t,"DIMPOST"),Le=n.dwg_dynapi_entity_data(t,"DIMAPOST"),Ye=n.dwg_dynapi_entity_data(t,"DIMBLK_T"),ne=n.dwg_dynapi_entity_data(t,"DIMBLK1_T"),Ne=n.dwg_dynapi_entity_data(t,"DIMBLK2_T"),he=n.dwg_dynapi_entity_data(t,"DIMALTRND"),ge=n.dwg_dynapi_entity_data(t,"DIMCLRD_N"),Ge=n.dwg_dynapi_entity_data(t,"DIMCLRE_N"),Ae=n.dwg_dynapi_entity_data(t,"DIMCLRT_N"),We=n.dwg_dynapi_entity_data(t,"DIMCLRD"),Me=n.dwg_dynapi_entity_data(t,"DIMCLRE"),re=n.dwg_dynapi_entity_data(t,"DIMCLRT"),Te=n.dwg_dynapi_entity_data(t,"DIMADEC"),Mt=n.dwg_dynapi_entity_data(t,"DIMFRAC"),vt=n.dwg_dynapi_entity_data(t,"DIMLUNIT"),J=n.dwg_dynapi_entity_data(t,"DIMDSEP"),Pe=n.dwg_dynapi_entity_data(t,"DIMTMOVE"),Ht=n.dwg_dynapi_entity_data(t,"DIMATFIT"),It=n.dwg_dynapi_entity_data(t,"DIMFXLON"),ae=n.dwg_dynapi_entity_data(t,"DIMTXTDIRECTION"),mt=n.dwg_dynapi_entity_data(t,"DIMALTMZF"),Vt=n.dwg_dynapi_entity_data(t,"DIMALTMZS"),St=n.dwg_dynapi_entity_data(t,"DIMMZF"),Xt=n.dwg_dynapi_entity_data(t,"DIMMZS"),oe=n.dwg_dynapi_entity_data(t,"DIMLWD"),ye=n.dwg_dynapi_entity_data(t,"DIMLWE"),gt=n.dwg_dynapi_entity_data(t,"DIMTXSTY"),pe=n.dwg_ref_get_absref(gt)??void 0,ie=n.dwg_dynapi_entity_data(t,"DIMLDRBLK"),B=n.dwg_ref_get_absref(ie)??void 0;return{...d,DIMPOST:Se,DIMAPOST:Le,DIMBLK:Ye,DIMBLK1:ne,DIMBLK2:Ne,DIMSCALE:Nt,DIMASZ:pt,DIMEXO:ft,DIMDLI:ht,DIMEXE:Rt,DIMRND:Ft,DIMDLE:Ut,DIMTP:Zt,DIMTM:qt,DIMTXT:$t,DIMCEN:Q,DIMTSZ:X,DIMALTF:ee,DIMLFAC:we,DIMTVP:Ce,DIMTFAC:De,DIMGAP:Re,DIMALTRND:he,DIMTOL:_,DIMLIM:E,DIMTIH:h,DIMTOH:g,DIMSE1:A,DIMSE2:P,DIMTAD:it,DIMZIN:S,DIMAZIN:ct,DIMALT:v,DIMALTD:m,DIMTOFL:p,DIMSAH:I,DIMTIX:R,DIMSOXD:w,DIMCLRD:We,DIMCLRE:Me,DIMCLRT:re,DIMADEC:Te,DIMUNIT:Y,DIMDEC:lt,DIMTDEC:st,DIMALTU:Dt,DIMALTTD:yt,DIMAUNIT:U,DIMFRAC:Mt,DIMLUNIT:vt,DIMDSEP:String.fromCharCode(J),DIMTMOVE:Pe,DIMJUST:k,DIMSD1:W,DIMSD2:M,DIMTOLJ:x,DIMTZIN:$,DIMALTZ:Z,DIMALTTZ:nt,DIMFIT:V,DIMUPT:q,DIMATFIT:Ht,DIMTXSTY:pe,DIMLDRBLK:B,DIMLWD:oe,DIMLWE:ye,DIMFXL:Qt,DIMJOGANG:jt,DIMTFILL:Gt,DIMTFILLCLR:te,DIMARCSYM:Wt,DIMCLRD_N:ge,DIMCLRE_N:Ge,DIMCLRT_N:Ae,DIMFXLON:It,DIMTXTDIRECTION:ae,DIMALTMZF:mt,DIMALTMZS:Vt,DIMMZF:St,DIMMZS:Xt}}convertLayer(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"frozen"),h=n.dwg_dynapi_entity_data(t,"off"),g=n.dwg_dynapi_entity_data(t,"frozen_in_new"),A=n.dwg_dynapi_entity_data(t,"plotflockedlag"),P=n.dwg_dynapi_entity_data(t,"plotflag"),v=n.dwg_dynapi_entity_data(t,"linewt"),p=n.dwg_dynapi_entity_data(t,"color"),I=n.dwg_dynapi_entity_data(t,"ltype");let R="Continuous";if(I)try{R=n.dwg_ref_get_object_name(I)}catch{}const w=p.method;let m=256,S=16777215;return w===195||(p.rgb>>>24&255)===195?m=p.rgb&255:w==194||(p.rgb>>>24&255)===194?S=p.rgb&16777215:p.index>=1&&p.index<=255&&(m=p.index),{...d,standardFlag:_,colorIndex:m,color:S,colorName:p.name,transparency:p.alpha,lineType:R,frozen:E!=0,off:h!=0,frozenInNew:g!=0,locked:A!=0,plotFlag:P,lineweight:v,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"description"),h=n.dwg_dynapi_entity_data(t,"numdashes"),g=n.dwg_dynapi_entity_data(t,"pattern_len"),A=n.dwg_dynapi_entity_data(t,"dashes"),P=A?n.dwg_ptr_to_ltype_dash_array(A,h):[];return{...d,description:E,standardFlag:_,numberOfLineTypes:h,totalPatternLength:g,pattern:this.convertLineTypePattern(P)}}convertLineTypePattern(t){const i=[];return t.forEach(n=>{i.push({elementLength:n.length||0,elementTypeFlag:n.shape_flag||0,shapeNumber:n.complex_shapecode,scale:n.scale,rotation:n.rotation,offsetX:n.x_offset,offsetY:n.y_offset,text:n.text})}),i}convertStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"width_factor"),h=n.dwg_dynapi_entity_data(t,"oblique_angle"),g=n.dwg_dynapi_entity_data(t,"generation"),A=n.dwg_dynapi_entity_data(t,"last_height"),P=n.dwg_dynapi_entity_data(t,"font_file"),v=n.dwg_dynapi_entity_data(t,"bigfont_file");return{...d,standardFlag:_,fixedTextHeight:0,widthFactor:E,obliqueAngle:h,textGenerationFlag:g,lastHeight:A,font:P,bigFont:v}}convertViewport(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),h=n.dwg_dynapi_entity_data(t,"aspect_ratio"),g=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"view_target"),P=n.dwg_dynapi_entity_data(t,"VIEWDIR"),v=n.dwg_dynapi_entity_data(t,"view_twist"),p=n.dwg_dynapi_entity_data(t,"lens_length"),I=n.dwg_dynapi_entity_data(t,"front_clip_z"),R=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"VIEWMODE"),m=n.dwg_dynapi_entity_data(t,"render_mode"),S=n.dwg_dynapi_entity_data(t,"use_default_lights")!=0,W=n.dwg_dynapi_entity_data(t,"default_lightning_type"),M=n.dwg_dynapi_entity_data(t,"brightness"),x=n.dwg_dynapi_entity_data(t,"contrast"),k=n.dwg_dynapi_entity_data(t,"ambient_color"),V=n.dwg_dynapi_entity_data(t,"lower_left"),q=n.dwg_dynapi_entity_data(t,"upper_right"),$=n.dwg_dynapi_entity_data(t,"circle_zoom"),Z=n.dwg_dynapi_entity_data(t,"UCSICON"),nt=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),it=n.dwg_dynapi_entity_data(t,"SNAPANG"),Y=n.dwg_dynapi_entity_data(t,"SNAPBASE"),U=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),lt=n.dwg_dynapi_entity_data(t,"ucsorg"),st=n.dwg_dynapi_entity_data(t,"ucsxdir"),Dt=n.dwg_dynapi_entity_data(t,"ucsydir"),yt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),Nt=n.dwg_dynapi_entity_data(t,"grid_major"),pt=n.dwg_dynapi_entity_data(t,"background"),ft=pt?n.dwg_ref_get_id(pt)??"":void 0,ht=n.dwg_dynapi_entity_data(t,"visualstyle"),Rt=ht?n.dwg_ref_get_id(ht)??"":void 0;return{...d,standardFlag:_,lowerLeftCorner:V,upperRightCorner:q,center:g,snapBasePoint:Y,snapSpacing:U,gridSpacing:nt,viewDirectionFromTarget:P,viewTarget:A,lensLength:p,frontClippingPlane:I,backClippingPlane:R,viewHeight:E,aspectRatio:h,snapRotationAngle:it,viewTwistAngle:v,circleSides:$,frozenLayers:[],styleSheet:"",renderMode:m,viewMode:w,ucsIconSetting:Z,ucsOrigin:lt,ucsXAxis:st,ucsYAxis:Dt,orthographicType:0,elevation:yt,shadePlotSetting:0,majorGridLines:Nt,backgroundObjectId:ft,visualStyleObjectId:Rt,isDefaultLightingOn:S,defaultLightingType:W,brightness:M,contrast:x,ambientColor:k.index}}getCommonTableEntryAttrs(t,i){const n=this.libredwg,d=n.dwg_object_get_tio(i),_=n.dwg_object_object_get_ownerhandle_object(d),E=n.dwg_object_get_handle_object(i);return{handle:Tt(E.value),ownerHandle:Tt(_.absolute_ref),name:n.dwg_dynapi_entity_data(t,"name")}}convertDictionary(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"is_hardowner"),E=n.dwg_dynapi_entity_data(t,"cloning"),h=n.dwg_dynapi_entity_data(t,"numitems"),g=n.dwg_dynapi_entity_data(t,"itemhandles"),A=n.dwg_ptr_to_object_ref_array(g,h),P=n.dwg_object_dictionary_get_texts(i),v={};return A.forEach((p,I)=>v[P[I]]=Tt(p.absolute_ref)),{...d,isHardOwner:!!_,cloningFlag:E,entries:v}}convertImageDef(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"image_size"),E=n.dwg_dynapi_entity_data(t,"file_path"),h=n.dwg_dynapi_entity_data(t,"is_loaded"),g=n.dwg_dynapi_entity_data(t,"pixel_size"),A=n.dwg_dynapi_entity_data(t,"resunits");return{...d,fileName:E,size:_,sizeOfOnePixel:g,isLoaded:h,resolutionUnits:A}}convertLayerFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"num_names")??0,E=n.dwg_dynapi_entity_data(t,"names"),h=E&&_>0?n.dwg_ptr_to_wchar_string_array(E,_).filter(g=>g!=null&&g!==""):[];return{...d,...h.length?{layerNames:h}:{}}}convertLayerIndex(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"last_updated"),E=n.dwg_dynapi_entity_data(t,"num_entries")??0,h=n.dwg_dynapi_entity_data(t,"entries"),g=n.dwg_dynapi_subclass_size("LAYER_entry"),A=[],P=[],v=[];if(h&&g>0)for(let p=0;p<E;p++){const I=h+p*g,R=n.dwg_dynapi_subclass_data(I,"LAYER_entry","name");A.push(R??"");const w=n.dwg_dynapi_subclass_data(I,"LAYER_entry","handle");P.push(w?n.dwg_ref_get_id(w)??"":""),v.push(n.dwg_dynapi_subclass_data(I,"LAYER_entry","numlayers")??0)}return{...d,..._!=null?{timeStamp:_}:{},...A.length?{layerNames:A}:{},...P.length?{idBufferIds:P}:{},...v.length?{idBufferEntryCounts:v}:{}}}convertLayout(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"layout_name"),E=n.dwg_dynapi_entity_data(t,"tab_order"),h=n.dwg_dynapi_entity_data(t,"layout_flags"),g=n.dwg_dynapi_entity_data(t,"INSBASE"),A=n.dwg_dynapi_entity_data(t,"LIMMIN"),P=n.dwg_dynapi_entity_data(t,"LIMMAX"),v=n.dwg_dynapi_entity_data(t,"UCSORG"),p=n.dwg_dynapi_entity_data(t,"UCSXDIR"),I=n.dwg_dynapi_entity_data(t,"UCSYDIR"),R=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),w=n.dwg_dynapi_entity_data(t,"EXTMIN"),m=n.dwg_dynapi_entity_data(t,"EXTMAX"),S=n.dwg_dynapi_entity_data(t,"ucs_elevation"),W=n.dwg_dynapi_entity_data(t,"block_header"),M=n.dwg_ref_get_id(W)??"",x=n.dwg_dynapi_entity_data(t,"active_viewport"),k=n.dwg_ref_get_id(x)??"",V=n.dwg_dynapi_entity_data(t,"named_ucs"),q=V?n.dwg_ref_get_id(V)??"":void 0;return{...d,layoutName:_,controlFlag:h,tabOrder:E,minLimit:A,maxLimit:P,insertionPoint:g,minExtent:w,maxExtent:m,elevation:S,ucsOrigin:v,ucsXAxis:p,ucsYAxis:I,orthographicType:R,paperSpaceTableId:M,viewportId:k,namedUcsId:q,shadePlotId:""}}convertMLeaderStyle(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=A=>n.dwg_dynapi_entity_data(t,A),E=A=>n.dwg_ref_get_id(A),h=A=>A>0,g=A=>A!=null?cr(A):void 0;return{...d,subclassMarker:"AcDbMLeaderStyle",unknown1:_("class_version"),contentType:_("content_type"),drawMLeaderOrderType:_("mleader_order"),drawLeaderOrderType:_("leader_order"),maxLeaderSegmentPoints:_("max_points"),firstSegmentAngleConstraint:_("first_seg_angle"),secondSegmentAngleConstraint:_("second_seg_angle"),leaderLineType:_("type"),leaderLineColor:g(_("line_color")),leaderLineTypeId:E(_("line_type")),leaderLineWeight:_("linewt"),landingEnabled:h(_("has_landing")),landingGap:_("landing_gap"),doglegEnabled:h(_("has_dogleg")),doglegLength:_("landing_dist"),description:_("description"),arrowheadId:E(_("arrow_head")),arrowheadSize:_("arrow_head_size"),defaultMTextContents:_("text_default"),textStyleId:E(_("text_style")),textLeftAttachmentType:_("attach_left"),textAngleType:_("text_angle_type"),textAlignmentType:_("text_align_type"),textRightAttachmentType:_("attach_right"),textColor:g(_("text_color")),textHeight:_("text_height"),textFrameEnabled:h(_("has_text_frame")),textAlignAlwaysLeft:h(_("text_always_left")),alignSpace:_("align_space"),blockContentId:E(_("block")),blockContentColor:g(_("block_color")),blockContentScale:_("block_scale"),blockContentScaleEnabled:h(_("use_block_scale")),blockContentRotation:_("block_rotation"),blockContentRotationEnabled:h(_("use_block_rotation")),blockContentConnectionType:_("block_connection"),scale:_("scale"),overwritePropertyValue:h(_("is_changed")),annotative:h(_("is_annotative")),breakGapSize:_("break_size"),textAttachmentDirection:_("attach_dir"),bottomTextAttachmentDirection:_("attach_bottom"),topTextAttachmentDirection:_("attach_top"),unknown2:h(_("text_extended"))}}convertSpatialFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"origin"),E=n.dwg_dynapi_entity_data(t,"num_clip_verts"),h=n.dwg_dynapi_entity_data(t,"clip_verts"),g=n.dwg_ptr_to_point2d_array(h,E),A=n.dwg_dynapi_entity_data(t,"extrusion"),P=n.dwg_dynapi_entity_data(t,"display_boundary_on"),v=n.dwg_dynapi_entity_data(t,"front_clip_on"),p=n.dwg_dynapi_entity_data(t,"front_clip_z"),I=n.dwg_dynapi_entity_data(t,"back_clip_on"),R=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"transform"),m=n.dwg_ptr_to_double_array(w,12),S=n.dwg_dynapi_entity_data(t,"inverse_transform"),W=n.dwg_ptr_to_double_array(S,12);return{...d,origin:_,numberOfPointsOnClipBoundary:E,vertices:g,extrusionDirection:A,clipBoundaryVisible:!!P,frontClippingPlaneFlag:!!v,frontClippingPlaneDistance:p,backClippingPlaneFlag:!!I,backClippingPlaneDistance:R,matrix:m,invertBlockMatrix:W}}convertXRecord(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"cloning"),E=n.dwg_object_xrecord_get_xdata(t)??[],h=n.dwg_object_get_tio(i),g=h?n.dwg_object_object_get_xdicobjhandle_object(h):null,A=g&&g.absolute_ref?Tt(g.absolute_ref):void 0;return{...d,..._!=null?{cloning:_}:{},...A?{extensionDictionary:A}:{},data:E}}getCommonObjectAttrs(t){const i=this.libredwg,n=i.dwg_object_get_tio(t),d=i.dwg_object_object_get_ownerhandle_object(n),_=i.dwg_object_get_handle_object(t);return{handle:Tt(_.value),ownerHandle:Tt(d.absolute_ref)}}}class At{constructor(){et(this,"min"),et(this,"max"),et(this,"valid"),this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(t){return this.min.x=Math.min(this.min.x,t.x),this.min.y=Math.min(this.min.y,t.y),this.max.x=Math.max(this.max.x,t.x),this.max.y=Math.max(this.max.y,t.y),this.valid=!0,this}transform(t,i){const n=this.getCorners().map(d=>({x:d.x*t.x+i.x,y:d.y*t.y+i.y}));this.reset();for(const d of n)this.expandByPoint(d);return this}rotate(t,i){const n=Math.cos(t),d=Math.sin(t),_=this.getCorners().map(E=>{const h=E.x-i.x,g=E.y-i.y;return{x:i.x+h*n-g*d,y:i.y+h*d+g*n}});this.reset();for(const E of _)this.expandByPoint(E);return this}clone(){const t=new At;return t.min={x:this.min.x,y:this.min.y},t.max={x:this.max.x,y:this.max.y},t.valid=this.valid,t}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 Yo(a,t,i,n,d){const _=i.length;if(_===0)throw new Error("points must not be empty");const E=i[0].length;if(a<0||a>1)throw new Error(`t out of bounds [0,1]: ${a}`);if(t<1)throw new Error("degree must be at least 1 (linear)");if(t>_-1)throw new Error("degree must be less than or equal to point count - 1");const h=d??new Array(_).fill(1),g=n??(()=>{const w=[];for(let m=0;m<_+t+1;m++)w.push(m);return w})();if(g.length!==_+t+1)throw new Error("bad knot vector length");const A=[t,g.length-1-t],P=g[A[0]],v=g[A[1]];a=a*(v-P)+P,a=Math.max(a,P),a=Math.min(a,v);let p=A[0];for(;p<A[1]&&!(a>=g[p]&&a<=g[p+1]);p++);const I=new Array(_);for(let w=0;w<_;w++){I[w]=new Array(E+1);for(let m=0;m<E;m++)I[w][m]=i[w][m]*h[w];I[w][E]=h[w]}for(let w=1;w<=t+1;w++)for(let m=p;m>p-t-1+w;m--){const S=g[m+t+1-w]-g[m],W=S===0?0:(a-g[m])/S;for(let M=0;M<E+1;M++)I[m][M]=(1-W)*I[m-1][M]+W*I[m][M]}const R=new Array(E);for(let w=0;w<E;w++)R[w]=No(I[p][w]/I[p][E],-9);return R}function No(a,t){if(isNaN(a)||!Number.isInteger(t))return NaN;const[i,n="0"]=a.toString().split("e"),d=Math.round(+`${i}e${+n-t}`),[_,E="0"]=d.toString().split("e");return+`${_}e${+E+t}`}const rn={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},mn=[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 Be(a,t,i){return Math.max(t,Math.min(i,a))}const Er=class ur{constructor(){et(this,"_colorIndex"),et(this,"_color"),et(this,"_colorName"),this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Be(t,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 t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}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(t){t==null?this._colorIndex=null:(this._colorIndex=Be(t,0,256),this._color=mn[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const i=rn[t.toLowerCase()];i!==void 0&&(this._colorName=t,this._color=i,this._colorIndex=this.getColorIndexByValue(this._color))}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(t){return this.setRGB(t,t,t),this}setRGB(t,i,n){const d=Math.round(Be(t,0,255)),_=Math.round(Be(i,0,255)),E=Math.round(Be(n,0,255));return this.color=(d<<16)+(_<<8)+E,this}setColorName(t){const i=rn[t.toLowerCase()];return i!==void 0&&(this.color=i),this}clone(){const t=new ur;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[i,n]of Object.entries(rn))if(n===t)return i;return null}getColorIndexByValue(t){const i=mn.length-1;for(let n=1;n<i;++n)if(mn[n]===t)return n;return null}};et(Er,"NAMES",rn);let Go=Er;class Pt{constructor(t,i){et(this,"x"),et(this,"y"),this.x=t,this.y=i}add(t){return new Pt(this.x+t.x,this.y+t.y)}sub(t){return new Pt(this.x-t.x,this.y-t.y)}multiply(t){return new Pt(this.x*t,this.y*t)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const t=this.length();return t===0?new Pt(0,0):new Pt(this.x/t,this.y/t)}}function Wo(a,t,i,n=5){let d,_,E;i<0?(d=Math.atan(-i)*4,_=new Pt(a.x,a.y),E=new Pt(t.x,t.y)):(d=Math.atan(i)*4,_=new Pt(t.x,t.y),E=new Pt(a.x,a.y));const h=E.sub(_),g=h.length(),A=_.add(h.multiply(.5)),P=Math.abs(g/2/Math.tan(d/2)),v=h.norm(),p=new Pt(v.x*Math.cos(Math.PI/2)-v.y*Math.sin(Math.PI/2),v.y*Math.cos(Math.PI/2)+v.x*Math.sin(Math.PI/2)),I=d<Math.PI?A.add(p.multiply(-P)):A.add(p.multiply(P)),R=Math.atan2(E.y-I.y,E.x-I.x)/Math.PI*180;let w=Math.atan2(_.y-I.y,_.x-I.x)/Math.PI*180;w<R&&(w+=360);const m=E.sub(I).length(),S=Math.floor(R/n)*n+n,W=Math.ceil(w/n)*n-n,M=[];for(let x=S;x<=W;x+=n){const k=x/180*Math.PI,V=I.add(new Pt(Math.cos(k)*m,Math.sin(k)*m));M.push(V)}return i<0&&M.reverse(),M}function Mo(a,t=!1){let i=[];const n=a.vertices.map(d=>({x:d.x,y:d.y,bulge:d.bulge}));t&&n.push(n[0]);for(let d=0,_=n.length;d<_-1;++d){const E=n[d],h=n[d+1];i.push(E),n[d].bulge&&(i=i.concat(Wo(E,h,a.vertices[d].bulge))),d===_-2&&i.push(h)}return i}class xo{constructor(){et(this,"blockMap",new Map)}rotate(t,i){const n=Math.cos(i),d=Math.sin(i);return{x:t.x*n-t.y*d,y:t.x*d+t.y*n}}interpolateBSpline(t,i,n,d=25,_){const E=[],h=t.map(P=>[P.x,P.y]),g=[n[i]],A=[n[i],n[n.length-1-i]];for(let P=i+1;P<n.length-i;++P)g[g.length-1]!==n[P]&&g.push(n[P]);for(let P=1;P<g.length;++P){const v=g[P-1],p=g[P];for(let I=0;I<=d;++I){let w=(I/d*(p-v)+v-A[0])/(A[1]-A[0]);w=Math.max(0,Math.min(1,w));const m=Yo(w,i,h,n,_);E.push({x:m[0],y:m[1]})}}return E}addFlipXIfApplicable(t,{bbox:i,element:n}){return"extrusionDirection"in t&&t.extrusionDirection.z===-1?{bbox:new At().expandByPoint({x:-i.min.x,y:i.min.y}).expandByPoint({x:-i.max.x,y:i.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${n}</g>`}:{bbox:i,element:n}}line(t){const i=new At().expandByPoint({x:t.startPoint.x,y:t.startPoint.y}).expandByPoint({x:t.endPoint.x,y:t.endPoint.y}),n=`<line x1="${t.startPoint.x}" y1="${t.startPoint.y}" x2="${t.endPoint.x}" y2="${t.endPoint.y}" />`;return{bbox:i,element:n}}ray(t){const n=t.firstPoint,d={x:n.x+t.unitDirection.x*1e4,y:n.y+t.unitDirection.y*1e4},_=new At().expandByPoint(n).expandByPoint(d),E=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:E}}xline(t){const n={x:t.firstPoint.x-t.unitDirection.x*1e4,y:t.firstPoint.y-t.unitDirection.y*1e4},d={x:t.firstPoint.x+t.unitDirection.x*1e4,y:t.firstPoint.y+t.unitDirection.y*1e4},_=new At().expandByPoint(n).expandByPoint(d),E=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:E}}extractMTextLines(t){return t.replace(/\\U\+([0-9A-Fa-f]{4})/g,(i,n)=>String.fromCharCode(parseInt(n,16))).replace(/\\P/g,`
17
+ `,y.push(u);var O=Hn(Function,y)(...C),G=`methodCaller<(${s.map(b=>b.name).join(", ")}) => ${c.name}>`;return ua(me(G,O))}function Aa(e){e>>>=0,e>9&&(Ot[e+1]+=1)}function Ta(){return Et.toHandle([])}function Pa(e){return e>>>=0,Et.toHandle(Xn(e))}function ya(){return Et.toHandle({})}function pa(e){e>>>=0;var r=Et.toValue(e);hn(r),An(e)}function va(e,r,o){e>>>=0,r>>>=0,o>>>=0,e=Et.toValue(e),r=Et.toValue(r),o=Et.toValue(o),e[r]=o}function Ia(e,r){e>>>=0,r>>>=0,e=Tn(e,"_emval_take_value");var o=e.readValueFromPointer(r);return Et.toHandle(o)}function ma(e,r){e=re(e),r>>>=0;var o=new Date(e*1e3);Y[r>>>2>>>0]=o.getUTCSeconds(),Y[r+4>>>2>>>0]=o.getUTCMinutes(),Y[r+8>>>2>>>0]=o.getUTCHours(),Y[r+12>>>2>>>0]=o.getUTCDate(),Y[r+16>>>2>>>0]=o.getUTCMonth(),Y[r+20>>>2>>>0]=o.getUTCFullYear()-1900,Y[r+24>>>2>>>0]=o.getUTCDay();var s=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-s)/(1e3*60*60*24)|0;Y[r+28>>>2>>>0]=c}var wa=e=>e%4===0&&(e%100!==0||e%400===0),Ca=[0,31,60,91,121,152,182,213,244,274,305,335],Da=[0,31,59,90,120,151,181,212,243,273,304,334],Ra=e=>{var r=wa(e.getFullYear()),o=r?Ca:Da,s=o[e.getMonth()]+e.getDate()-1;return s},Sa=function(e){e>>>=0;var r=(()=>{var o=new Date(Y[e+20>>>2>>>0]+1900,Y[e+16>>>2>>>0],Y[e+12>>>2>>>0],Y[e+8>>>2>>>0],Y[e+4>>>2>>>0],Y[e>>>2>>>0],0),s=Y[e+32>>>2>>>0],c=o.getTimezoneOffset(),u=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),T=u.getTimezoneOffset(),y=Math.min(T,f);if(s<0)Y[e+32>>>2>>>0]=+(f!=T&&y==c);else if(s>0!=(y==c)){var C=Math.max(T,f),D=s>0?y:C;o.setTime(o.getTime()+(D-c)*6e4)}Y[e+24>>>2>>>0]=o.getDay();var N=Ra(o)|0;Y[e+28>>>2>>>0]=N,Y[e>>>2>>>0]=o.getSeconds(),Y[e+4>>>2>>>0]=o.getMinutes(),Y[e+8>>>2>>>0]=o.getHours(),Y[e+12>>>2>>>0]=o.getDate(),Y[e+16>>>2>>>0]=o.getMonth(),Y[e+20>>>2>>>0]=o.getYear();var O=o.getTime();return isNaN(O)?-1:O/1e3})();return BigInt(r)},La=function(e,r,o,s){e>>>=0,r>>>=0,o>>>=0,s>>>=0;var c=new Date().getFullYear(),u=new Date(c,0,1),f=new Date(c,6,1),T=u.getTimezoneOffset(),y=f.getTimezoneOffset(),C=Math.max(T,y);U[e>>>2>>>0]=C*60,Y[r>>>2>>>0]=+(T!=y);var D=G=>{var b=G>=0?"-":"+",z=Math.abs(G),_t=String(Math.floor(z/60)).padStart(2,"0"),rt=String(z%60).padStart(2,"0");return`UTC${b}${_t}${rt}`},N=D(T),O=D(y);y<T?(ce(N,o,17),ce(O,s,17)):(ce(N,s,17),ce(O,o,17))},Kn=()=>performance.now(),zn=()=>Date.now(),Ya=e=>e>=0&&e<=3;function Na(e,r,o){if(o>>>=0,!Ya(e))return 28;var s;e===0?s=zn():s=Kn();var c=Math.round(s*1e3*1e3);return st[o>>>3]=BigInt(c),0}function Ga(e){return e>>>=0,x(xt(e))}var Wa=()=>4294901760,Ma=e=>{var r=V.buffer,o=(e-r.byteLength+65535)/65536|0;try{return V.grow(o),ht(),1}catch{}};function xa(e){e>>>=0;var r=Z.length,o=Wa();if(e>o)return!1;for(var s=1;s<=4;s*=2){var c=r*(1+.2/s);c=Math.min(c,e+100663296);var u=Math.min(o,pe(Math.max(e,c),65536)),f=Ma(u);if(f)return!0}return!1}var nn={},ba=()=>p||"./this.program",Oe=()=>{if(!Oe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:ba()};for(var o in nn)nn[o]===void 0?delete r[o]:r[o]=nn[o];var s=[];for(var o in r)s.push(`${o}=${r[o]}`);Oe.strings=s}return Oe.strings},ka=(e,r)=>{for(var o=0;o<e.length;++o)$[r++>>>0]=e.charCodeAt(o);$[r>>>0]=0},Oa=function(e,r){e>>>=0,r>>>=0;var o=0;return Oe().forEach((s,c)=>{var u=r+o;U[e+c*4>>>2>>>0]=u,ka(s,u),o+=s.length+1}),0},Ba=function(e,r){e>>>=0,r>>>=0;var o=Oe();U[e>>>2>>>0]=o.length;var s=0;return o.forEach(c=>s+=c.length+1),U[r>>>2>>>0]=s,0};function Fa(e){try{var r=F.getStreamFromFD(e);return l.close(r),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var Ua=(e,r,o,s)=>{for(var c=0,u=0;u<o;u++){var f=U[r>>>2>>>0],T=U[r+4>>>2>>>0];r+=8;var y=l.read(e,$,f,T,s);if(y<0)return-1;if(c+=y,y<T)break}return c};function $a(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=F.getStreamFromFD(e),u=Ua(c,r,o);return U[s>>>2>>>0]=u,0}catch(f){if(typeof l>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function Ha(e,r,o,s){r=re(r),s>>>=0;try{if(isNaN(r))return 61;var c=F.getStreamFromFD(e);return l.llseek(c,r,o),st[s>>>3]=BigInt(c.position),c.getdents&&r===0&&o===0&&(c.getdents=null),0}catch(u){if(typeof l>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Va=(e,r,o,s)=>{for(var c=0,u=0;u<o;u++){var f=U[r>>>2>>>0],T=U[r+4>>>2>>>0];r+=8;var y=l.write(e,$,f,T,s);if(y<0)return-1;if(c+=y,y<T)break}return c};function Xa(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=F.getStreamFromFD(e),u=Va(c,r,o);return U[s>>>2>>>0]=u,0}catch(f){if(typeof l>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function Ka(e,r){e>>>=0,r>>>=0;try{return Ht(Z.subarray(e>>>0,e+r>>>0)),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var Jn=e=>{var r=n["_"+e];return r},za=(e,r)=>{$.set(e,r>>>0)},Zn=e=>to(e),Ja=e=>{var r=St(e)+1,o=Zn(r);return ce(e,o,r),o},qn=(e,r,o,s,c)=>{var u={string:b=>{var z=0;return b!=null&&b!==0&&(z=Ja(b)),z},array:b=>{var z=Zn(b.length);return za(b,z),z}};function f(b){return r==="string"?xt(b):r==="boolean"?!!b:b}var T=Jn(e),y=[],C=0;if(s)for(var D=0;D<s.length;D++){var N=u[o[D]];N?(C===0&&(C=ge()),y[D]=N(s[D])):y[D]=s[D]}var O=T(...y);function G(b){return C!==0&&he(C),f(b)}return O=G(O),O},Za=(e,r,o,s)=>{var c=!o||o.every(f=>f==="number"||f==="boolean"),u=r!=="string";return u&&c&&!s?Jn(e):(...f)=>qn(e,r,o,f)},qa=e=>{var r=St(e)+1,o=yn(r);return o&&ce(e,o,r),o};l.createPreloadedFile=on,l.staticInit(),B.doesNotExistError=new l.ErrnoError(44),B.doesNotExistError.stack="<generic error, no stack>",bt(),_e=n.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Ie=n.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},wr(),Wr(),Bn=n.UnboundTypeError=br(Error,"UnboundTypeError"),Fr();var Qn={__cxa_throw:Te,__syscall_fcntl64:j,__syscall_fstat64:Kt,__syscall_ioctl:Ke,__syscall_lstat64:_n,__syscall_newfstatat:dn,__syscall_openat:be,__syscall_stat64:ln,_abort_js:cn,_embind_register_bigint:Ar,_embind_register_bool:Tr,_embind_register_class:kr,_embind_register_class_property:Or,_embind_register_emval:$r,_embind_register_enum:Vr,_embind_register_enum_value:Xr,_embind_register_float:zr,_embind_register_function:jr,_embind_register_integer:ta,_embind_register_memory_view:ea,_embind_register_std_string:na,_embind_register_std_wstring:da,_embind_register_void:la,_emval_call_method:Ea,_emval_decref:An,_emval_get_method_caller:ga,_emval_incref:Aa,_emval_new_array:Ta,_emval_new_cstring:Pa,_emval_new_object:ya,_emval_run_destructors:pa,_emval_set_property:va,_emval_take_value:Ia,_gmtime_js:ma,_mktime_js:Sa,_tzset_js:La,clock_time_get:Na,emscripten_date_now:zn,emscripten_err:Ga,emscripten_get_now:Kn,emscripten_resize_heap:xa,environ_get:Oa,environ_sizes_get:Ba,fd_close:Fa,fd_read:$a,fd_seek:Ha,fd_write:Xa,random_get:Ka},K=await Ye();K.__wasm_call_ctors,n.__ZdlPvm=K._ZdlPvm;var yn=K.malloc,Jt=K.free;K.calloc,K.realloc;var Qa=K.__getTypeName;n._strndup=K.strndup,n.__ZdaPv=K._ZdaPv,n.__ZdaPvm=K._ZdaPvm,n.__ZdlPv=K._ZdlPv,n._emscripten_builtin_malloc=K.emscripten_builtin_malloc,n.__Znaj=K._Znaj,n.__ZnajSt11align_val_t=K._ZnajSt11align_val_t,n.__Znwj=K._Znwj,n.__ZnwjSt11align_val_t=K._ZnwjSt11align_val_t,n.___libc_calloc=K.__libc_calloc,n.___libc_free=K.__libc_free,n.___libc_malloc=K.__libc_malloc,n.___libc_realloc=K.__libc_realloc,n._emscripten_builtin_calloc=K.emscripten_builtin_calloc,n._emscripten_builtin_free=K.emscripten_builtin_free,n._emscripten_builtin_realloc=K.emscripten_builtin_realloc,n._malloc_size=K.malloc_size,n._malloc_usable_size=K.malloc_usable_size,n._reallocf=K.reallocf;var ja=K._emscripten_stack_restore,to=K._emscripten_stack_alloc,eo=K.emscripten_stack_get_current;function no(e){e=Object.assign({},e);var r=c=>u=>c(u)>>>0,o=c=>(u,f)=>c(u,f)>>>0,s=c=>()=>c()>>>0;return e.malloc=r(e.malloc),e.calloc=o(e.calloc),e.__getTypeName=r(e.__getTypeName),e.emscripten_builtin_malloc=r(e.emscripten_builtin_malloc),e.emscripten_builtin_calloc=o(e.emscripten_builtin_calloc),e._emscripten_stack_alloc=r(e._emscripten_stack_alloc),e.emscripten_stack_get_current=s(e.emscripten_stack_get_current),e}n.ENV=nn,n.ccall=qn,n.cwrap=Za,n.setValue=Ne,n.UTF8ToString=xt,n.stringToNewUTF8=qa,n.FS=l;function pn(){if(ct>0){Wt=pn;return}if(Zt(),ct>0){Wt=pn;return}function e(){var r;n.calledRun=!0,!q&&(qt(),d(n),(r=n.onRuntimeInitialized)==null||r.call(n),Qt())}n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e()}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return pn(),i=E,i})})(),Po=Object.defineProperty,yo=(a,t,i)=>t in a?Po(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,et=(a,t,i)=>yo(a,typeof t!="symbol"?t+"":t,i);const po=["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","euc-kr","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"],nr=a=>po[a];var ue=(a=>(a[a.TopLeft=1]="TopLeft",a[a.TopCenter=2]="TopCenter",a[a.TopRight=3]="TopRight",a[a.MiddleLeft=4]="MiddleLeft",a[a.MiddleCenter=5]="MiddleCenter",a[a.MiddleRight=6]="MiddleRight",a[a.BottomLeft=7]="BottomLeft",a[a.BottomCenter=8]="BottomCenter",a[a.BottomRight=9]="BottomRight",a))(ue||{}),wn=(a=>(a[a.PatternFill=0]="PatternFill",a[a.SolidFill=1]="SolidFill",a))(wn||{}),Cn=(a=>(a[a.NonAssociative=0]="NonAssociative",a[a.Associative=1]="Associative",a))(Cn||{}),dr=(a=>(a[a.Solid=0]="Solid",a[a.Gradient=1]="Gradient",a))(dr||{}),Dn=(a=>(a[a.TwoColor=0]="TwoColor",a[a.OneColor=1]="OneColor",a))(Dn||{}),Fe=(a=>(a[a.Line=1]="Line",a[a.Circular=2]="Circular",a[a.Elliptic=3]="Elliptic",a[a.Spline=4]="Spline",a))(Fe||{}),Rn=(a=>(a[a.LEFT=0]="LEFT",a[a.CENTER=1]="CENTER",a[a.RIGHT=2]="RIGHT",a[a.ALIGNED=3]="ALIGNED",a[a.MIDDLE=4]="MIDDLE",a[a.FIT=5]="FIT",a))(Rn||{});const vo=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"]),Io=/\\U\+([0-9A-Fa-f]{4})/g;function rr(a){return!a||!a.includes("\\U+")?a:a.replace(Io,(t,i)=>String.fromCharCode(parseInt(i,16)))}const mo=[{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}];var Sn=(a=>(a[a.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",a[a.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT",a))(Sn||{}),lr=(a=>(a[a.WRONGCRC=1]="WRONGCRC",a[a.NOTYETSUPPORTED=2]="NOTYETSUPPORTED",a[a.UNHANDLEDCLASS=4]="UNHANDLEDCLASS",a[a.INVALIDTYPE=8]="INVALIDTYPE",a[a.INVALIDHANDLE=16]="INVALIDHANDLE",a[a.INVALIDEED=32]="INVALIDEED",a[a.VALUEOUTOFBOUNDS=64]="VALUEOUTOFBOUNDS",a[a.CLASSESNOTFOUND=128]="CLASSESNOTFOUND",a[a.SECTIONNOTFOUND=256]="SECTIONNOTFOUND",a[a.PAGENOTFOUND=512]="PAGENOTFOUND",a[a.INTERNALERROR=1024]="INTERNALERROR",a[a.INVALIDDWG=2048]="INVALIDDWG",a[a.IOERROR=4096]="IOERROR",a[a.OUTOFMEM=8192]="OUTOFMEM",a))(lr||{}),L=(a=>(a[a.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",a[a.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",a[a.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",a[a.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",a[a.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",a[a.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",a[a.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",a[a.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",a[a.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",a[a.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",a[a.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",a[a.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",a[a.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",a[a.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",a[a.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",a[a.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",a[a.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",a[a.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",a[a.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",a[a.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",a[a.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",a[a.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",a[a.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",a[a.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",a[a.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",a[a.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",a[a.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",a[a.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",a[a.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",a[a.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",a[a.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",a[a.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",a[a.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",a[a.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",a[a.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",a[a.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",a[a.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",a[a.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",a[a.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",a[a.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",a[a.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",a[a.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",a[a.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",a[a.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",a[a.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",a[a.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",a[a.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",a[a.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",a[a.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",a[a.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",a[a.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",a[a.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",a[a.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",a[a.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",a[a.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",a[a.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",a[a.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",a[a.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",a[a.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",a[a.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",a[a.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",a[a.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",a[a.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",a[a.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",a[a.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",a[a.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",a[a.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",a[a.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",a[a.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",a[a.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",a[a.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",a[a.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",a[a.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",a[a.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",a[a.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",a[a.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",a[a.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",a[a.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",a[a.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",a[a.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",a[a.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",a[a.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",a[a.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",a[a.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",a[a.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",a[a.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",a[a.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",a[a.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",a[a.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",a[a.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",a[a.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",a[a.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",a[a.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",a[a.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",a[a.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",a[a.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",a[a.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",a[a.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",a[a.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",a[a.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",a[a.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",a[a.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",a[a.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",a[a.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",a[a.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",a[a.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",a[a.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",a[a.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",a[a.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",a[a.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",a[a.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",a[a.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",a[a.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",a[a.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",a[a.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",a[a.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",a[a.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",a[a.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",a[a.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",a[a.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",a[a.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",a[a.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",a[a.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",a[a.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",a[a.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",a[a.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",a[a.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",a[a.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",a[a.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",a[a.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",a[a.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",a[a.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",a[a.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",a[a.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",a[a.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",a[a.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",a[a.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",a[a.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",a[a.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",a[a.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",a[a.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",a[a.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",a[a.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",a[a.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",a[a.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",a[a.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",a[a.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",a[a.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",a[a.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",a[a.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",a[a.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",a[a.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",a[a.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",a[a.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",a[a.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",a[a.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",a[a.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",a[a.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",a[a.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",a[a.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",a[a.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",a[a.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",a[a.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",a[a.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",a[a.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",a[a.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",a[a.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",a[a.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",a[a.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",a[a.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",a[a.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",a[a.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",a[a.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",a[a.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",a[a.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",a[a.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",a[a.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",a[a.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",a[a.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",a[a.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",a[a.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",a[a.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",a[a.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",a[a.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",a[a.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",a[a.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",a[a.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",a[a.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",a[a.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",a[a.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",a[a.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",a[a.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",a[a.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",a[a.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",a[a.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",a[a.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",a[a.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",a[a.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",a[a.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",a[a.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",a[a.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",a[a.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",a[a.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",a[a.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",a[a.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",a[a.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",a[a.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",a[a.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",a[a.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",a[a.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",a[a.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",a[a.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",a[a.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",a[a.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",a[a.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",a[a.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",a[a.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",a[a.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",a[a.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",a[a.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",a[a.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",a[a.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",a[a.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",a[a.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",a[a.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",a[a.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",a[a.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",a[a.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",a[a.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",a[a.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",a[a.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",a[a.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",a[a.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",a[a.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",a[a.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",a[a.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",a[a.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",a[a.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",a[a.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",a[a.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",a[a.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",a[a.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",a[a.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",a[a.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",a[a.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",a[a.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",a[a.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",a[a.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",a[a.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",a[a.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",a[a.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",a[a.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",a[a.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",a[a.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",a[a.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",a[a.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",a[a.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",a[a.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",a[a.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",a[a.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",a[a.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",a[a.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",a[a.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",a[a.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",a[a.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",a[a.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",a[a.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",a[a.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",a[a.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",a[a.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",a[a.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",a[a.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",a[a.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",a[a.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",a[a.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",a[a.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",a[a.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",a[a.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",a[a.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",a[a.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",a[a.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",a[a.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",a[a.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",a[a.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",a[a.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",a[a.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",a[a.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",a[a.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",a[a.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ",a))(L||{});Object.fromEntries(Object.entries(L).map(([a,t])=>[t,a]));var Yn=(a=>(a[a.DWG=0]="DWG",a[a.DXF=1]="DXF",a))(Yn||{}),Ue=(a=>(a[a.Line=1]="Line",a[a.CircularArc=2]="CircularArc",a[a.EllipticArc=3]="EllipticArc",a[a.Spline=4]="Spline",a))(Ue||{}),fe=(a=>(a[a.ByLayer=192]="ByLayer",a[a.ByBlock=193]="ByBlock",a[a.Entities=194]="Entities",a[a.TrueColor=195]="TrueColor",a[a.ForegroundColor=197]="ForegroundColor",a[a.None=200]="None",a))(fe||{});const ar=192,or=193,wo=194,In=195,ir=200;function cr(a){if(a==null)return;const t=a.method,i=a.method!=null&&t!==0?t:a.rgb>>>24&255,n=a.index;if(a.rgb!=null&&i>=ar&&i<=ir&&(a.rgb>>>24&255)===i)return a.rgb>>0;if(i===fe.ByLayer||n===256)return ar<<24>>0;if(i===fe.ByBlock||n===0)return or<<24>>0;if(i===fe.None)return ir<<24>>0;if(i===fe.TrueColor){const d=a.rgb!=null?a.rgb&16777215:void 0;if(d!=null)return(wo<<24|d)>>0}return i===fe.ForegroundColor?(In<<24|7)>>0:i===fe.Entities&&n>0&&n<256||n>0&&n<256?(In<<24|n&255)>>0:or<<24>>0}const Co="*MODEL_SPACE",Do="*PAPER_SPACE",Ln=a=>a&&a.toUpperCase()==Co,Ro=a=>a&&a.toUpperCase().startsWith(Do),Tt=a=>a.toString(16).toUpperCase(),$e=a=>{const t=new Array(a.length);for(let i=0;i<a.length;i++)t[i]=a[i].toString(16).toUpperCase().padStart(2,"0");return t.join("")},So=a=>{if(!a||a.length<98)return null;const t=new DataView(a.buffer,a.byteOffset,a.byteLength),i=_=>({x:t.getFloat64(_,!0),y:t.getFloat64(_+8,!0),z:t.getFloat64(_+16,!0)}),n=i(2),d=i(50);return[n.x,n.y,n.z,d.x,d.y,d.z].every(Number.isFinite)?{upperLeft:n,lowerRight:d}:null};class Lo{constructor(t){et(this,"libredwg"),et(this,"layers",new Map),et(this,"ltypes",new Map),et(this,"classes",[]),et(this,"unknownEntityCount"),this.libredwg=t,this.unknownEntityCount=0}prepare(t,i=!1){(i||this.layers.size==0)&&(this.layers.clear(),t.tables.LAYER.entries.forEach(n=>{this.layers.set(n.handle,n.name)})),(i||this.ltypes.size==0)&&(this.ltypes.clear(),t.tables.LTYPE.entries.forEach(n=>{this.ltypes.set(n.handle,n.name)})),this.classes=t.classes,this.unknownEntityCount=0}setClasses(t){this.classes=t}clear(){this.layers.clear(),this.ltypes.clear(),this.classes=[],this.unknownEntityCount=0}convert(t){const i=this.libredwg,n=i.dwg_object_to_entity(t),d=i.dwg_object_to_entity_tio(t);if(n&&d){const _=this.getCommonAttrs(n),E=i.dwg_object_get_fixedtype(t);if(E==L.DWG_TYPE_3DFACE)return this.convert3dFace(d,_);if(E==L.DWG_TYPE_3DSOLID)return this.convert3dSolid(d,_);if(E==L.DWG_TYPE_ARC)return this.convertArc(d,_);if(E==L.DWG_TYPE_ARCALIGNEDTEXT)return this.convertArcAlignedText(d,_);if(E==L.DWG_TYPE_ATTDEF)return this.convertAttdef(d,_);if(E==L.DWG_TYPE_CIRCLE)return this.convertCircle(d,_);if(E==L.DWG_TYPE_DIMENSION_ALIGNED||E==L.DWG_TYPE_DIMENSION_LINEAR)return this.convertAlignedDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ANG2LN)return this.convert2LineAngularDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(d,_);if(E==L.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(d,_);if(E==L.DWG_TYPE_ELLIPSE)return this.convertEllise(d,_);if(E==L.DWG_TYPE_HATCH)return this.convertHatch(d,_);if(E==L.DWG_TYPE_IMAGE)return this.convertImage(d,_);if(E==L.DWG_TYPE_INSERT)return this.convertInsert(d,_);if(E==L.DWG_TYPE_LEADER)return this.convertLeader(d,_);if(E==L.DWG_TYPE_LINE)return this.convertLine(d,_);if(E==L.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(d,_);if(E==L.DWG_TYPE_MLINE)return this.convertMLine(d,_);if(E==L.DWG_TYPE_MULTILEADER)return this.convertMultiLeader(d,_);if(E==L.DWG_TYPE_MTEXT)return this.convertMText(d,_);if(E==L.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(d,_);if(E==L.DWG_TYPE_OLEFRAME)return this.convertOleFrame(d,_);if(E==L.DWG_TYPE_POINT)return this.convertPoint(d,_);if(E==L.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(d,_,t);if(E==L.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(d,_,t);if(E==L.DWG_TYPE_PROXY_ENTITY)return this.convertProxyEntity(d,_,t);if(E==L.DWG_TYPE_RAY)return this.convertRay(d,_);if(E==L.DWG_TYPE_SECTIONOBJECT)return this.convertSection(d,_);if(E==L.DWG_TYPE_SHAPE)return this.convertShape(d,_);if(E==L.DWG_TYPE_SOLID)return this.convertSolid(d,_);if(E==L.DWG_TYPE_TRACE)return this.convertTrace(d,_);if(E==L.DWG_TYPE_SPLINE)return this.convertSpline(d,_);if(E==L.DWG_TYPE_TABLE)return this.convertTable(d,_);if(E==L.DWG_TYPE_TEXT)return this.convertText(d,_);if(E==L.DWG_TYPE_TOLERANCE)return this.convertTolerance(d,_);if(E==L.DWG_TYPE_VIEWPORT)return this.convertViewport(d,_);if(E==L.DWG_TYPE_WIPEOUT)return this.convertWipeout(d,_);if(E==L.DWG_TYPE_XLINE)return this.convertXline(d,_);E===L.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),E=n.dwg_dynapi_entity_data(t,"corner3"),h=n.dwg_dynapi_entity_data(t,"corner4"),g=n.dwg_dynapi_entity_data(t,"invis_flags");return{type:"3DFACE",...i,corner1:d,corner2:_,corner3:E,corner4:h,flag:g}}convert3dSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"version"),_=n.dwg_dynapi_entity_data(t,"acis_empty"),E=n.dwg_dynapi_entity_data(t,"acis_data"),h=n.dwg_dynapi_entity_data(t,"has_revision_guid"),g=n.dwg_dynapi_entity_data(t,"history_id"),A=n.dwg_ref_get_id(g),P={type:"3DSOLID",subclassMarker:"AcDb3dSolid",...i};if(d&&(P.version=d),P.satCache=_,E&&(P.data=E),h){const v=n.dwg_dynapi_entity_field_offset(t,"revision_guid");if(v>=0){const p=n.UTF8ToString(t+v,38);p&&(P.guid=p)}}return A&&(P.historyObjectSoftId=A),P}convertArc(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ARC",...i,thickness:E,center:d,radius:_,startAngle:g,endAngle:A,extrusionDirection:h}}convertArcAlignedText(t,i){const n=this.libredwg,d=(A,P=0)=>{const v=n.dwg_dynapi_entity_data(t,A);if(typeof v=="number"&&Number.isFinite(v))return v;if(typeof v=="string"&&v.trim()!==""){const p=Number(v);if(Number.isFinite(p))return p}return P},_=n.dwg_dynapi_entity_data(t,"center"),E=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"arc_handle"),g=d("xscale",1);return{type:"ARCALIGNEDTEXT",...i,text:n.dwg_dynapi_entity_data(t,"text_value")??"",textSize:d("text_size"),xScale:g>0?g:1,characterSpacing:d("char_spacing"),styleName:n.dwg_dynapi_entity_data(t,"style")??"",fontName:n.dwg_dynapi_entity_data(t,"font_name")??"",bigFontName:n.dwg_dynapi_entity_data(t,"bigfont_name")??"",offsetFromArc:d("offset_from_arc"),rightOffset:d("right_offset"),leftOffset:d("left_offset"),center:_??{x:0,y:0,z:0},radius:n.dwg_dynapi_entity_data(t,"radius")??0,startAngle:n.dwg_dynapi_entity_data(t,"start_angle")??0,endAngle:n.dwg_dynapi_entity_data(t,"end_angle")??0,extrusionDirection:E??{x:0,y:0,z:1},rawTextColor:n.dwg_dynapi_entity_data(t,"color")??256,characterSet:n.dwg_dynapi_entity_data(t,"character_set")??0,pitchAndFamily:n.dwg_dynapi_entity_data(t,"pitch_and_family")??0,isShx:(n.dwg_dynapi_entity_data(t,"is_shx")??0)!==0,isBold:(n.dwg_dynapi_entity_data(t,"is_bold")??0)!==0,isItalic:(n.dwg_dynapi_entity_data(t,"is_italic")??0)!==0,isUnderlined:(n.dwg_dynapi_entity_data(t,"is_underlined")??0)!==0,alignment:n.dwg_dynapi_entity_data(t,"alignment")??0,isReverse:(n.dwg_dynapi_entity_data(t,"is_reverse")??0)!==0,wizardFlag:n.dwg_dynapi_entity_data(t,"wizard_flag")??0,textPosition:n.dwg_dynapi_entity_data(t,"text_position")??1,textDirection:n.dwg_dynapi_entity_data(t,"text_direction")??1,arcHandle:h?n.dwg_ref_get_id(h)??"":""}}convertEmbeddedMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,i,"attachment"),_=n.dwg_dynapi_subclass_data(t,i,"ins_pt"),E=n.dwg_dynapi_subclass_data(t,i,"x_axis_dir"),h=n.dwg_dynapi_subclass_data(t,i,"rect_height"),g=n.dwg_dynapi_subclass_data(t,i,"rect_width"),A=n.dwg_dynapi_subclass_data(t,i,"extents_height"),P=n.dwg_dynapi_subclass_data(t,i,"extents_width");return{insertionPoint:_,rectHeight:h,rectWidth:g,extentsHeight:A,extentsWidth:P,attachmentPoint:d,direction:E}}convertAttdef(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"default_value"),_=this.convertTextBase(t);_.text=d;const E=n.dwg_dynapi_entity_data(t,"prompt"),h=n.dwg_dynapi_entity_data(t,"tag"),g=n.dwg_dynapi_entity_data(t,"flags"),A=n.dwg_dynapi_entity_data(t,"field_length"),P=n.dwg_dynapi_entity_data(t,"lock_position_flag"),v=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),p=n.dwg_dynapi_entity_data(t,"is_really_locked"),I=n.dwg_dynapi_entity_data(t,"mtext_type"),R=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTDEF",...i,text:this.convertTextBase(t),prompt:E,tag:h,flags:g,fieldLength:A,lockPositionFlag:P>0,duplicateRecordCloningFlag:v>0,mtextFlag:I,isReallyLocked:p>0,alignmentPoint:R,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertAttrib(t,i){const n=this.libredwg,d=this.convertTextBase(t),_=n.dwg_dynapi_entity_data(t,"tag"),E=n.dwg_dynapi_entity_data(t,"flags"),h=n.dwg_dynapi_entity_data(t,"field_length"),g=n.dwg_dynapi_entity_data(t,"lock_position_flag"),A=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),P=n.dwg_dynapi_entity_data(t,"mtext_type"),v=n.dwg_dynapi_entity_data(t,"is_really_locked"),p=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTRIB",...i,text:d,tag:_,flags:E,fieldLength:h,lockPositionFlag:!!g,duplicateRecordCloningFlag:!!A,mtextFlag:P,isReallyLocked:!!v,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...p,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertCircle(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"CIRCLE",...i,thickness:E,center:d,radius:_,extrusionDirection:h}}convertAlignedDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"clone_ins_pt"),E=n.dwg_dynapi_entity_data(t,"xline1_pt"),h=n.dwg_dynapi_entity_data(t,"xline2_pt"),g=n.dwg_dynapi_entity_data(t,"ins_rotation"),A=n.dwg_dynapi_entity_data(t,"oblique_angle");return{subclassMarker:"AcDbAlignedDimension",...i,...d,insertionPoint:_,subDefinitionPoint1:E,subDefinitionPoint2:h,rotationAngle:g??0,obliqueAngle:A}}convert3PointAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1_pt"),E=n.dwg_dynapi_entity_data(t,"xline2_pt"),h=n.dwg_dynapi_entity_data(t,"center_pt"),g=n.dwg_dynapi_entity_data(t,"xline2end_pt");return{subclassMarker:"AcDb3PointAngularDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:E,centerPoint:h,arcPoint:g}}convert2LineAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1start_pt"),E=n.dwg_dynapi_entity_data(t,"xline1end_pt"),h=n.dwg_dynapi_entity_data(t,"xline2start_pt"),g=n.dwg_dynapi_entity_data(t,"xline2end_pt"),A=n.dwg_dynapi_entity_data(t,"def_pt");return g&&(d.definitionPoint=g),{subclassMarker:"AcDb2LineAngularDimension",...i,...d,subDefinitionPoint1:_??E??A??g,subDefinitionPoint2:h??g??A??E,centerPoint:A??h??E??g,arcPoint:g??d.definitionPoint}}convertDiameterDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),E=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbDiametricDimension",...i,...d,centerPoint:_,leaderLength:E}}convertOrdinateDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"feature_location_pt"),E=n.dwg_dynapi_entity_data(t,"leader_endpt");return{subclassMarker:"AcDbOrdinateDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:E}}convertRadiusDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),E=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbRadialDimension",...i,...d,centerPoint:_,leaderLength:E}}convertEllise(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"sm_axis"),E=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"axis_ratio"),g=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ELLIPSE",...i,center:d,majorAxisEndPoint:_,extrusionDirection:E,axisRatio:h,startAngle:g,endAngle:A}}convertHatch(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"extrusion"),_=n.dwg_dynapi_entity_data(t,"name"),E=n.dwg_dynapi_entity_data(t,"is_solid_fill"),h=n.dwg_dynapi_entity_data(t,"is_associative"),g=n.dwg_dynapi_entity_data(t,"num_paths"),A=n.dwg_dynapi_entity_data(t,"paths"),P=n.dwg_ptr_to_hatch_path_array(A,g),v=n.dwg_dynapi_entity_data(t,"style"),p=n.dwg_dynapi_entity_data(t,"pattern_type"),I=n.dwg_dynapi_entity_data(t,"angle"),R=n.dwg_dynapi_entity_data(t,"scale_spacing"),w=n.dwg_dynapi_entity_data(t,"num_deflines"),m=n.dwg_dynapi_entity_data(t,"deflines"),S=n.dwg_ptr_to_hatch_defline_array(m,w),W=n.dwg_dynapi_entity_data(t,"pixel_size"),M=n.dwg_dynapi_entity_data(t,"num_seeds"),x=n.dwg_dynapi_entity_data(t,"seeds"),k=n.dwg_ptr_to_point2d_array(x,M),V={...i,extrusionDirection:d,patternName:_,solidFill:E?wn.SolidFill:wn.PatternFill,associativity:h?Cn.Associative:Cn.NonAssociative,numberOfBoundaryPaths:g,boundaryPaths:this.convertHatchBoundaryPaths(P),hatchStyle:v,patternType:p,patternAngle:I,patternScale:R,numberOfDefinitionLines:w,definitionLines:S.map($=>({angle:$.angle,base:$.pt0,offset:$.offset,numberOfDashLengths:$.dashes.length,dashLengths:$.dashes})),pixelSize:W,numberOfSeedPoints:M,seedPoints:k};if(n.dwg_dynapi_entity_data(t,"is_gradient_fill")>0){const $=n.dwg_dynapi_entity_data(t,"gradient_name"),Z=n.dwg_dynapi_entity_data(t,"gradient_angle"),nt=n.dwg_dynapi_entity_data(t,"gradient_shift"),it=n.dwg_dynapi_entity_data(t,"gradient_tint"),Y=n.dwg_dynapi_entity_data(t,"single_color_gradient"),U=n.dwg_dynapi_entity_data(t,"colors"),lt=n.dwg_ptr_to_hatch_gradient_color_array(U,Y==1?1:2);return{type:"HATCH",...V,gradientFlag:dr.Gradient,gradientColorFlag:Y==1?Dn.OneColor:Dn.TwoColor,gradientName:$,gradientRotation:Z,gradientDefinition:nt,colorTint:it,gradientColors:lt}}else return{type:"HATCH",...V}}convertHatchBoundaryPaths(t){return t.filter(n=>n.num_segs_or_paths>0).map(n=>{const d={boundaryPathTypeFlag:n.flag};if(n.flag&2)return{...d,hasBulge:n.bulges_present,isClosed:n.closed,numberOfVertices:n.num_segs_or_paths,vertices:n.polyline_paths.map(_=>({x:_.point.x,y:_.point.y,bulge:_.bulge}))};{const _=n.segs.map(E=>{if(E.curve_type==Ue.Line)return{type:Fe.Line,start:E.first_endpoint,end:E.second_endpoint};if(E.curve_type==Ue.CircularArc)return{type:Fe.Circular,center:E.center,radius:E.radius,startAngle:E.start_angle,endAngle:E.end_angle,isCCW:E.is_ccw};if(E.curve_type==Ue.EllipticArc)return{type:Fe.Elliptic,center:E.center,end:E.endpoint,lengthOfMinorAxis:E.minor_major_ratio,startAngle:E.start_angle,endAngle:E.end_angle,isCCW:E.is_ccw};if(E.curve_type==Ue.Spline)return{type:Fe.Spline,degree:E.degree,isRational:E.is_rational,isPeriodic:E.is_periodic,numberOfKnots:E.num_knots,numberOfControlPoints:E.num_control_points,knots:E.knots,controlPoints:E.control_points,numberOfFitData:E.num_fitpts,fitDatum:E.fitpts,startTangent:E.start_tangent,endTangent:E.end_tangent}});return{...d,numberOfEdges:n.num_segs_or_paths,edges:_}}})}convertImage(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),E=n.dwg_dynapi_entity_data(t,"uvec"),h=n.dwg_dynapi_entity_data(t,"vvec"),g=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),P=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=n.dwg_dynapi_entity_data(t,"fade"),R=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),W=n.dwg_ptr_to_point3d_array(S,m),M=n.dwg_dynapi_entity_data(t,"imagedef"),x=n.dwg_ref_get_id(M)??"",k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),V=n.dwg_ref_get_id(k)??"";return{type:"IMAGE",...i,version:d,position:_,uPixel:E,vPixel:h,imageSize:g,imageDefHandle:x,flags:A,clipping:P,brightness:v,contrast:p,fade:I,imageDefReactorHandle:V,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:W,clipMode:R}}convertInsert(t,i){const n=this.libredwg;let d="";const _=n.dwg_dynapi_entity_data(t,"block_header");if(_){const m=n.dwg_ref_get_object(_);if(m){const S=n.dwg_object_to_object_tio(m);S&&(d=n.dwg_entity_block_header_get_block(S).name)}}d||(d=n.dwg_dynapi_entity_data(t,"block_name"));const E=n.dwg_dynapi_entity_data(t,"ins_pt"),h=n.dwg_dynapi_entity_data(t,"scale"),g=n.dwg_dynapi_entity_data(t,"rotation"),A=n.dwg_dynapi_entity_data(t,"num_cols"),P=n.dwg_dynapi_entity_data(t,"num_rows"),v=n.dwg_dynapi_entity_data(t,"col_spacing"),p=n.dwg_dynapi_entity_data(t,"row_spacing"),I=n.dwg_dynapi_entity_data(t,"extrusion"),R=n.dwg_entity_insert_get_attribs(t),w=[];return R.forEach(m=>{const S=n.dwg_object_to_entity(m),W=n.dwg_object_to_entity_tio(m);if(S&&W){const M=this.getCommonAttrs(S);n.dwg_object_get_fixedtype(m)==L.DWG_TYPE_ATTRIB&&w.push(this.convertAttrib(W,M))}}),{type:"INSERT",...i,name:d,insertionPoint:E,xScale:h?h.x:1,yScale:h?h.y:1,zScale:h?h.z:1,rotation:g,columnCount:A,rowCount:P,columnSpacing:v,rowSpacing:p,extrusionDirection:I,attribs:w}}convertLeader(t,i){const n=this.libredwg,d=n.dwg_entity_mtext_get_style_name(t),_=n.dwg_dynapi_entity_data(t,"arrowhead_type"),E=n.dwg_dynapi_entity_data(t,"path_type"),h=n.dwg_dynapi_entity_data(t,"annot_type"),g=n.dwg_dynapi_entity_data(t,"hookline_dir"),A=n.dwg_dynapi_entity_data(t,"hookline_on"),P=n.dwg_dynapi_entity_data(t,"box_height"),v=n.dwg_dynapi_entity_data(t,"box_width"),p=n.dwg_dynapi_entity_data(t,"num_points"),I=n.dwg_dynapi_entity_data(t,"points"),R=p>0?n.dwg_ptr_to_point3d_array(I,p):[],w=n.dwg_dynapi_entity_data(t,"byblock_color"),m=n.dwg_dynapi_entity_data(t,"extrusion"),S=n.dwg_dynapi_entity_data(t,"x_direction"),W=n.dwg_dynapi_entity_data(t,"inspt_offset"),M=n.dwg_dynapi_entity_data(t,"endptproj");return{type:"LEADER",...i,styleName:d,isArrowheadEnabled:_>0,isSpline:E>0,leaderCreationFlag:h,isHooklineSameDirection:g>0,isHooklineExists:A>0,textHeight:P,textWidth:v,numberOfVertices:p,vertices:R,byBlockColor:w,normal:m,horizontalDirection:S,offsetFromBlock:W,offsetFromAnnotation:M}}convertLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"start"),_=n.dwg_dynapi_entity_data(t,"end"),E=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"LINE",...i,thickness:E,startPoint:d,endPoint:_,extrusionDirection:h}}convertLWPolyline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"num_points"),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"const_width"),h=n.dwg_dynapi_entity_data(t,"elevation"),g=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion"),P=[],v=n.dwg_dynapi_entity_data(t,"num_points"),p=n.dwg_dynapi_entity_data(t,"points"),I=n.dwg_ptr_to_point2d_array(p,v),R=n.dwg_dynapi_entity_data(t,"num_bulges"),w=n.dwg_dynapi_entity_data(t,"bulges"),m=n.dwg_ptr_to_double_array(w,R),S=n.dwg_dynapi_entity_data(t,"num_widths")??0,W=n.dwg_dynapi_entity_data(t,"widths"),M=S>0&&W?n.dwg_ptr_to_double_array(W,S*2):[];return I.forEach((x,k)=>{const V={id:k,x:x.x,y:x.y,bulge:m.length>k?m[k]:0};k<S&&M.length>=(k+1)*2&&(V.startWidth=M[k*2],V.endWidth=M[k*2+1]),P.push(V)}),{type:"LWPOLYLINE",...i,numberOfVertices:d,flag:_,constantWidth:E,elevation:h,thickness:g,extrusionDirection:A,vertices:P}}convertMLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"scale"),_=n.dwg_dynapi_entity_data(t,"flags"),E=n.dwg_dynapi_entity_data(t,"justification"),h=n.dwg_dynapi_entity_data(t,"base_point"),g=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"num_lines"),P=n.dwg_dynapi_entity_data(t,"num_verts"),v=n.dwg_dynapi_entity_data(t,"verts"),p=n.dwg_ptr_to_mline_vertex_array(v,P),I=[];return p.forEach(R=>{I.push({vertex:R.vertex,vertexDirection:R.vertex_direction,miterDirection:R.miter_direction,numberOfLines:R.num_lines,lines:R.lines.map(w=>({numberOfSegmentParams:w.num_segparms,segmentParams:w.segparms,numberOfAreaFillParams:w.num_areafillparms,areaFillParams:w.areafillparms}))})}),{type:"MLINE",...i,scale:d,flags:_,justification:E,startPoint:h,extrusionDirection:g,numberOfLines:A,numberOfVertices:P,vertices:I,mlineStyle:""}}convertMultiLeader(t,i){const n=this.libredwg,d=F=>n.dwg_dynapi_entity_data(t,F),_=(F,j,Kt)=>n.dwg_dynapi_subclass_data(F,j,Kt),E=F=>n.dwg_ref_get_id(F),h=F=>F>0,g=F=>F!=null?cr(F):void 0,A=d("class_version"),P=E(d("mleaderstyle")),v=d("flags"),p=d("type"),I=g(d("line_color")),R=E(d("line_ltype")),w=d("line_linewt"),m=h(d("has_landing")),S=h(d("has_dogleg")),W=d("landing_dist"),M=E(d("arrow_handle")),x=d("arrow_size"),k=d("style_content"),V=E(d("text_style")),q=d("text_left"),$=d("text_right"),Z=d("text_angletype"),nt=d("text_alignment"),it=g(d("text_color")),Y=h(d("has_text_frame")),U=E(d("block_style")),lt=g(d("block_color")),st=d("block_scale"),Dt=d("block_rotation"),yt=d("style_attachment"),Nt=h(d("is_annotative")),pt=h(d("is_neg_textdir")),ft=d("ipe_alignment");let ht=d("justification");const Rt=d("attach_dir"),Ft=d("attach_bottom"),Ut=d("attach_top"),Zt=d("scale_factor"),qt=d("num_arrowheads"),Qt=d("arrowheads"),jt=n.dwg_dynapi_subclass_size("LEADER_ArrowHead"),Gt=[];for(let F=0;F<qt;F++){const j=Qt+F*jt;Gt.push({index:_(j,"LEADER_ArrowHead","is_default"),handle:E(_(j,"LEADER_ArrowHead","arrowhead"))??""})}const te=d("num_blocklabels"),ct=d("blocklabels"),Wt=n.dwg_dynapi_subclass_size("LEADER_BlockLabel"),$t=[];for(let F=0;F<te;F++){const j=ct+F*Wt;$t.push({id:E(_(j,"LEADER_BlockLabel","attdef")),index:_(j,"LEADER_BlockLabel","ui_index"),width:_(j,"LEADER_BlockLabel","width"),text:_(j,"LEADER_BlockLabel","label_text")})}const Q=t+n.dwg_dynapi_entity_field_offset(t,"ctx"),X=Q+n.dwg_dynapi_subclass_field_offset("MLEADER_AnnotContext","content"),ee=_(Q,"MLEADER_AnnotContext","scale_factor"),we=_(Q,"MLEADER_AnnotContext","content_base"),Ce=_(Q,"MLEADER_AnnotContext","landing_gap"),De=_(Q,"MLEADER_AnnotContext","attach_dir"),Re=_(Q,"MLEADER_AnnotContext","text_height"),Se=_(Q,"MLEADER_AnnotContext","arrow_size"),Le=_(Q,"MLEADER_AnnotContext","text_left"),Ye=_(Q,"MLEADER_AnnotContext","text_right"),ne=_(Q,"MLEADER_AnnotContext","text_angletype"),Ne=_(Q,"MLEADER_AnnotContext","text_alignment"),he=h(_(Q,"MLEADER_AnnotContext","has_content_txt")),ge=h(_(Q,"MLEADER_AnnotContext","has_content_blk")),Ge=_(Q,"MLEADER_AnnotContext","base"),Ae=_(Q,"MLEADER_AnnotContext","base_dir"),We=_(Q,"MLEADER_AnnotContext","base_vert"),Me=h(_(Q,"MLEADER_AnnotContext","is_normal_reversed"));let re,Te,Mt,vt,J,Pe,Ht,It,ae,mt,Vt,St,Xt,oe,ye,gt,pe,ie,B,He,Ve;if(he){const F=_(X,"MLEADER_Content_MText","alignment");F!=null&&F!==0&&(ht=F),Te=_(X,"MLEADER_Content_MText","normal"),Ht=_(X,"MLEADER_Content_MText","location"),Mt=_(X,"MLEADER_Content_MText","rotation"),It=_(X,"MLEADER_Content_MText","direction"),vt=_(X,"MLEADER_Content_MText","width"),J=_(X,"MLEADER_Content_MText","line_spacing_factor"),Pe=_(X,"MLEADER_Content_MText","line_spacing_style"),re=_(X,"MLEADER_Content_MText","flow"),ae=g(_(X,"MLEADER_Content_MText","bg_color")),mt=_(X,"MLEADER_Content_MText","bg_scale"),Vt=_(X,"MLEADER_Content_MText","bg_transparency"),Xt=h(_(X,"MLEADER_Content_MText","is_bg_fill")),St=h(_(X,"MLEADER_Content_MText","is_bg_mask_fill")),oe=_(X,"MLEADER_Content_MText","col_type"),ye=h(_(X,"MLEADER_Content_MText","is_height_auto")),gt=_(X,"MLEADER_Content_MText","col_width"),pe=_(X,"MLEADER_Content_MText","col_gutter"),ie=h(_(X,"MLEADER_Content_MText","is_col_flow_reversed"));const j=_(X,"MLEADER_Content_MText","num_col_sizes"),Kt=_(X,"MLEADER_Content_MText","col_sizes");j>0&&(B=n.dwg_ptr_to_double_array(Kt,j)[0]),He=h(_(X,"MLEADER_Content_MText","word_break")),Ve=_(X,"MLEADER_Content_MText","default_text")}let Xe;if(ge){const F=_(X,"MLEADER_Content_Block","transform");Xe={blockContentId:E(_(X,"MLEADER_Content_Block","block_table")),normal:_(X,"MLEADER_Content_Block","normal"),position:_(X,"MLEADER_Content_Block","location"),scale:_(X,"MLEADER_Content_Block","scale"),rotation:_(X,"MLEADER_Content_Block","rotation"),color:g(_(X,"MLEADER_Content_Block","color")),transformationMatrix:F?n.dwg_ptr_to_double_array(F,16):void 0}}const an=_(Q,"MLEADER_AnnotContext","num_leaders"),on=_(Q,"MLEADER_AnnotContext","leaders"),sn=n.dwg_dynapi_subclass_size("LEADER_Node"),xe=n.dwg_dynapi_subclass_size("LEADER_Line"),l=n.dwg_dynapi_subclass_size("LEADER_Break"),xt=[];for(let F=0;F<an;F++){const j=on+F*sn,Kt=h(_(j,"LEADER_Node","has_lastleaderlinepoint")),Ke=h(_(j,"LEADER_Node","has_dogleg")),_n=_(j,"LEADER_Node","num_breaks"),dn=_(j,"LEADER_Node","breaks"),be=[];for(let bt=0;bt<_n;bt++){const wt=dn+bt*l;be.push({start:_(wt,"LEADER_Break","start"),end:_(wt,"LEADER_Break","end")})}const ln=_(j,"LEADER_Node","num_lines"),cn=_(j,"LEADER_Node","lines"),se=[];for(let bt=0;bt<ln;bt++){const wt=cn+bt*xe,ot=_(wt,"LEADER_Line","num_points"),zt=_(wt,"LEADER_Line","points"),kt=ot>0?n.dwg_ptr_to_point3d_array(zt,ot):[],ve=_(wt,"LEADER_Line","num_breaks"),_e=_(wt,"LEADER_Line","breaks"),H=[];for(let Ie=0;Ie<ve;Ie++){const de=_e+Ie*l;H.push({start:_(de,"LEADER_Break","start"),end:_(de,"LEADER_Break","end")})}se.push({vertices:kt,leaderLineIndex:_(wt,"LEADER_Line","line_index"),breaks:H.length>0?H:void 0})}xt.push({lastLeaderLinePoint:Kt?_(j,"LEADER_Node","lastleaderlinepoint"):void 0,lastLeaderLinePointSet:Kt,doglegVector:Ke?_(j,"LEADER_Node","dogleg_vector"):void 0,doglegVectorSet:Ke,doglegLength:_(j,"LEADER_Node","dogleg_length"),breaks:be.length>0?be:void 0,leaderBranchIndex:_(j,"LEADER_Node","branch_index"),leaderLines:se})}return{type:"MULTILEADER",...i,subclassMarker:"AcDbMLeader",version:A,leaderStyleId:P,propertyOverrideFlag:v,leaderLineType:p,leaderLineColor:I,leaderLineTypeId:R,leaderLineWeight:w,landingEnabled:m,doglegEnabled:S,doglegLength:W,arrowheadId:M,arrowheadSize:x||Se,contentType:k,textStyleId:V,textLeftAttachmentType:q||Le,textRightAttachmentType:$||Ye,textAngleType:Z||ne,textAlignmentType:nt||Ne,textColor:it,textFrameEnabled:Y,landingGap:Ce,textAttachment:De,textFlowDirection:re,blockContentId:U,blockContentColor:lt,blockContentScale:st,blockContentRotation:Dt,blockContentConnectionType:yt,annotativeScaleEnabled:Nt,arrowheadOverrides:Gt.length>0?Gt:void 0,blockAttributes:$t.length>0?$t:void 0,textDirectionNegative:pt,textAlignInIPE:ft,textAttachmentPoint:ht,textAttachmentDirection:Rt,bottomTextAttachmentDirection:Ft,topTextAttachmentDirection:Ut,contentScale:Zt||ee,contentBasePosition:we,normal:Te,textHeight:Re,textRotation:Mt,textWidth:vt,textLineSpacingFactor:J,textLineSpacingStyle:Pe,textAnchor:Ht,textDirection:It,textBackgroundColor:ae,textBackgroundScaleFactor:mt,textBackgroundTransparency:Vt,textBackgroundColorOn:St,textFillOn:Xt,textColumnType:oe,textUseAutoHeight:ye,textColumnWidth:gt,textColumnGutterWidth:pe,textColumnFlowReversed:ie,textColumnHeight:B,textUseWordBreak:He,textContent:Ve,hasMText:he,hasBlock:ge,blockContent:Xe,planeOrigin:Ge,planeXAxisDirection:Ae,planeYAxisDirection:We,planeNormalReversed:Me,leaderSections:xt.length>0?xt:void 0}}convertOle2Frame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"oleversion"),_=n.dwg_dynapi_entity_data(t,"oleclient"),E=n.dwg_dynapi_entity_data(t,"data_size");let h=n.dwg_dynapi_entity_data(t,"pt1"),g=n.dwg_dynapi_entity_data(t,"pt2");const A=n.dwg_dynapi_entity_data(t,"lock_aspect"),P=n.dwg_dynapi_entity_data(t,"type"),v=n.dwg_dynapi_entity_data(t,"mode"),p=n.dwg_entity_ole2frame_get_data(t),I=p?$e(p):"";if(p){const R=So(p);R&&(h=R.upperLeft,g=R.lowerRight)}return{type:"OLE2FRAME",...i,oleVersion:d,oleClient:_,dataSize:E,leftUpPoint:h,rightDownPoint:g,lockAspect:A,oleObjectType:P,tileModeDescriptor:v,binaryData:I}}convertOleFrame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"flag"),_=n.dwg_dynapi_entity_data(t,"mode"),E=n.dwg_dynapi_entity_data(t,"data_size"),h=n.dwg_entity_oleframe_get_data(t),g=h?$e(h):"";return{type:"OLEFRAME",...i,flag:d,mode:_,dataSize:E,binaryData:g}}convertMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_height"),E=n.dwg_dynapi_entity_data(t,"rect_height"),h=n.dwg_dynapi_entity_data(t,"rect_width"),g=n.dwg_dynapi_entity_data(t,"extents_width"),A=n.dwg_dynapi_entity_data(t,"extents_height"),P=n.dwg_dynapi_entity_data(t,"attachment"),v=n.dwg_dynapi_entity_data(t,"flow_dir"),p=n.dwg_dynapi_entity_data(t,"text"),I=n.dwg_entity_mtext_get_style_name(t),R=n.dwg_dynapi_entity_data(t,"extrusion"),w=n.dwg_dynapi_entity_data(t,"x_axis_dir"),m=n.dwg_dynapi_entity_data(t,"linespace_style"),S=n.dwg_dynapi_entity_data(t,"linespace_factor"),W=n.dwg_dynapi_entity_data(t,"bg_fill_flag"),M=n.dwg_dynapi_entity_data(t,"bg_fill_scale"),x=n.dwg_dynapi_entity_data(t,"bg_fill_color"),k=n.dwg_dynapi_entity_data(t,"bg_fill_trans"),V=n.dwg_dynapi_entity_data(t,"column_type"),q=n.dwg_dynapi_entity_data(t,"flow_reversed"),$=n.dwg_dynapi_entity_data(t,"auto_height"),Z=n.dwg_dynapi_entity_data(t,"column_width"),nt=n.dwg_dynapi_entity_data(t,"gutter"),it=n.dwg_dynapi_entity_data(t,"num_column_heights"),Y=n.dwg_dynapi_entity_data(t,"column_heights"),U=n.dwg_ptr_to_double_array(Y,it);return{type:"MTEXT",...i,insertionPoint:d,textHeight:_,rectHeight:E,rectWidth:h,extentsHeight:A,extentsWidth:g,attachmentPoint:P,drawingDirection:v,text:p,styleName:I,extrusionDirection:R,direction:w,rotation:0,lineSpacingStyle:m,lineSpacing:S,backgroundFill:W,fillBoxScale:M,backgroundFillColor:x.rgb,backgroundFillTransparency:k,columnType:V,columnFlowReversed:q,columnAutoHeight:$,columnWidth:Z,columnGutter:nt,columnHeightCount:it,columnHeights:U}}convertPoint(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"x"),_=n.dwg_dynapi_entity_data(t,"y"),E=n.dwg_dynapi_entity_data(t,"z"),h=n.dwg_dynapi_entity_data(t,"thickness"),g=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"x_ang");return{type:"POINT",...i,position:{x:d,y:_,z:E},thickness:h,extrusionDirection:g,angle:A}}convertPolyline2d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),E=d.dwg_dynapi_entity_data(t,"curve_type"),h=d.dwg_dynapi_entity_data(t,"start_width"),g=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"elevation"),P=d.dwg_dynapi_entity_data(t,"thickness"),v=d.dwg_dynapi_entity_data(t,"extrusion"),p=d.dwg_entity_polyline_2d_get_vertices(n)??[];return{type:"POLYLINE2D",...i,flag:_,smoothType:E,startWidth:h,endWidth:g,elevation:A,thickness:P,extrusionDirection:v,vertices:p.map(I=>({x:I.point.x,y:I.point.y,z:I.point.z,startWidth:I.start_width,endWidth:I.end_width,bulge:I.bulge,flag:I.flag,tangentDirection:I.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),E=d.dwg_dynapi_entity_data(t,"curve_type"),h=d.dwg_dynapi_entity_data(t,"start_width"),g=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"extrusion"),P=d.dwg_entity_polyline_3d_get_vertices(n)??[];return{type:"POLYLINE3D",...i,flag:_,smoothType:E,startWidth:h,endWidth:g,extrusionDirection:A,vertices:P.map(v=>({x:v.point.x,y:v.point.y,z:v.point.z,flag:v.flag}))}}convertProxyEntity(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"proxy_id"),E=d.dwg_dynapi_entity_data(t,"class_id"),h=d.dwg_dynapi_entity_data(t,"data_numbits"),g=d.dwg_dynapi_entity_data(t,"version"),A=d.dwg_dynapi_entity_data(t,"from_dxf"),P=d.dwg_dynapi_entity_data(t,"num_objids"),v=d.dwg_entity_get_preview(n),p=(v==null?void 0:v.length)??0,I=d.dwg_entity_proxy_entity_get_entity_data(t),R=v?$e(v):void 0,w=I?$e(I):void 0;let m;if(P>0){const M=d.dwg_dynapi_entity_data(t,"objids");M&&(m=d.dwg_ptr_to_object_ref_array(M,P).map(k=>Tt(k.absolute_ref)))}const S=this.getOriginalDxfName(E),W={type:"ACAD_PROXY_ENTITY",subclassMarker:"AcDbProxyEntity",...i,proxyEntityClassId:_||498,applicationEntityClassId:E};return S&&(W.originalDxfName=S),p>0&&(W.graphicsDataSize=p),R&&(W.graphicsData=R),h>0&&(W.entityDataSize=h),w&&(W.entityData=w),m&&m.length>0&&(W.linkedObjectIds=m),g&&(W.objectDrawingFormat=g),(A===0||A===1)&&(W.originalDataFormat=A),W}getOriginalDxfName(t){if(this.classes.length===0||t<0)return;const i=t>=500?t-500:t;if(i>=0&&i<this.classes.length)return this.classes[i].dxfName}convertRay(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"RAY",...i,firstPoint:d,unitDirection:_}}convertSection(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"state"),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"name"),h=n.dwg_dynapi_entity_data(t,"vert_dir"),g=n.dwg_dynapi_entity_data(t,"top_height"),A=n.dwg_dynapi_entity_data(t,"bottom_height"),P=n.dwg_dynapi_entity_data(t,"indicator_alpha"),v=n.dwg_dynapi_entity_data(t,"indicator_color"),p=n.dwg_dynapi_entity_data(t,"num_verts"),I=n.dwg_dynapi_entity_data(t,"verts"),R=p>0?n.dwg_ptr_to_point3d_array(I,p):[],w=n.dwg_dynapi_entity_data(t,"num_blverts"),m=n.dwg_dynapi_entity_data(t,"blverts"),S=w>0?n.dwg_ptr_to_point3d_array(m,w):[],W=n.dwg_dynapi_entity_data(t,"geometrySettingHardId"),M=n.dwg_ref_get_handle_absolute_ref(W)??0n;return{type:"SECTION",...i,state:d,flags:_,name:E,verticalDirection:h,topHeight:g,bottomHeight:A,indicatorTransparency:P,indicatorColor:v.rgb,numberOfVertices:p,vertices:R,numberOfBackLineVertices:w,backLineVertices:S,geometrySettingHardId:M}}convertShape(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"scale"),E=n.dwg_dynapi_entity_data(t,"rotation"),h=n.dwg_dynapi_entity_data(t,"width_factor"),g=n.dwg_dynapi_entity_data(t,"oblique_angle"),A=n.dwg_dynapi_entity_data(t,"thickness"),P=n.dwg_dynapi_entity_data(t,"extrusion"),v=n.dwg_dynapi_entity_data(t,"style_id"),p=n.dwg_entity_text_get_style_name(t);return{type:"SHAPE",subclassMarker:"AcDbShape",...i,thickness:A,insertionPoint:d,size:_,shapeNumber:v,styleName:p,rotation:E,xScale:h,obliqueAngle:g,extrusionDirection:P}}convertSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),E=n.dwg_dynapi_entity_data(t,"corner3"),h=n.dwg_dynapi_entity_data(t,"corner4"),g=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"SOLID",...i,corner1:d,corner2:_,corner3:E,corner4:h,thickness:g,extrusionDirection:A}}convertTrace(t,i){return{...this.convertSolid(t,i),type:"TRACE"}}convertSpline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"splineflags"),_=n.dwg_dynapi_entity_data(t,"degree"),E=n.dwg_dynapi_entity_data(t,"knot_tol"),h=n.dwg_dynapi_entity_data(t,"num_knots"),g=n.dwg_dynapi_entity_data(t,"knots"),A=n.dwg_ptr_to_double_array(g,h),P=n.dwg_dynapi_entity_data(t,"fit_tol"),v=n.dwg_dynapi_entity_data(t,"num_fit_pts"),p=n.dwg_dynapi_entity_data(t,"fit_pts"),I=n.dwg_ptr_to_point3d_array(p,v),R=n.dwg_dynapi_entity_data(t,"weighted"),w=n.dwg_dynapi_entity_data(t,"ctrl_tol"),m=n.dwg_dynapi_entity_data(t,"num_ctrl_pts"),S=n.dwg_dynapi_entity_data(t,"ctrl_pts"),W=n.dwg_ptr_to_point4d_array(S,m),M=n.dwg_dynapi_entity_data(t,"beg_tan_vec"),x=n.dwg_dynapi_entity_data(t,"end_tan_vec");return{type:"SPLINE",...i,flag:d,degree:_,numberOfKnots:h,numberOfControlPoints:m,numberOfFitPoints:v,knotTolerance:E,controlTolerance:w,fitTolerance:P,startTangent:M,endTangent:x,knots:A,weights:R?W.map(k=>k.w):void 0,controlPoints:W.map(k=>({x:k.x,y:k.y,z:k.z})),fitPoints:I}}convertTable(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,"ldata","name"),_=n.dwg_dynapi_entity_data(t,"ins_pt"),E=n.dwg_dynapi_entity_data(t,"horiz_direction"),h=n.dwg_dynapi_entity_data(t,"flag_for_table_value"),g=n.dwg_dynapi_entity_data(t,"num_rows"),A=n.dwg_dynapi_entity_data(t,"num_cols"),P=n.dwg_dynapi_entity_data(t,"row_heights"),v=n.dwg_ptr_to_double_array(P,g),p=n.dwg_dynapi_entity_data(t,"col_widths"),I=n.dwg_ptr_to_double_array(p,A),R=n.dwg_dynapi_entity_data(t,"tablestyle"),w=n.dwg_ref_get_id(R)??"",m=n.dwg_dynapi_entity_data(t,"block_header"),S=n.dwg_ref_get_id(m)??"",W=n.dwg_dynapi_entity_data(t,"table_flag_override"),M=n.dwg_dynapi_entity_data(t,"border_color_overrides_flag"),x=n.dwg_dynapi_entity_data(t,"border_lineweight_overrides_flag"),k=n.dwg_dynapi_entity_data(t,"border_visibility_overrides_flag"),V=n.dwg_dynapi_entity_data(t,"num_cells"),q=n.dwg_dynapi_entity_data(t,"cells"),$=n.dwg_ptr_to_table_cell_array(q,V);return{type:"ACAD_TABLE",...i,name:d,startPoint:_,directionVector:E,tableValue:h,rowCount:g,columnCount:A,overrideFlag:W,borderColorOverrideFlag:M,borderLineWeightOverrideFlag:x,borderVisibilityOverrideFlag:k,rowHeightArr:v,columnWidthArr:I,tableStyleId:w,blockRecordHandle:S,cells:this.convertTableCells($),bmpPreview:""}}convertTableCells(t){return t.map(i=>{var n,d;return{text:i.text_value,attachmentPoint:i.cell_alignment,textStyle:i.text_style?String(i.text_style):void 0,rotation:i.rotation,cellType:i.type,flagValue:i.flags,mergedValue:i.is_merged_value,autoFit:i.is_autofit_flag,topBorderVisibility:!!i.top_visibility,bottomBorderVisibility:!!i.bottom_visibility,leftBorderVisibility:!!i.left_visibility,rightBorderVisibility:!!i.right_visibility,overrideFlag:i.cell_flag_override,virtualEdgeFlag:i.virtual_edge_flag,blockTableRecordId:i.block_handle?String(i.block_handle.absolute_ref??""):void 0,blockScale:i.block_scale,blockAttrNum:((n=i.attr_defs)==null?void 0:n.length)??0,attrDefineId:(d=i.attr_defs)==null?void 0:d.map(_=>{var E;return String(((E=_.attdef)==null?void 0:E.absolute_ref)??"")}),textHeight:i.text_height??0,extendedCellFlags:i.additional_data_flag}})}convertTextBase(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"text_value"),d=i.dwg_dynapi_entity_data(t,"thickness"),_=i.dwg_dynapi_entity_data(t,"ins_pt"),E=i.dwg_dynapi_entity_data(t,"alignment_pt"),h=i.dwg_dynapi_entity_data(t,"rotation"),g=i.dwg_dynapi_entity_data(t,"height"),A=i.dwg_dynapi_entity_data(t,"width_factor"),P=i.dwg_dynapi_entity_data(t,"oblique_angle"),v=i.dwg_entity_text_get_style_name(t),p=i.dwg_dynapi_entity_data(t,"generation"),I=i.dwg_dynapi_entity_data(t,"horiz_alignment"),R=i.dwg_dynapi_entity_data(t,"vert_alignment"),w=i.dwg_dynapi_entity_data(t,"extrusion");return{text:n,thickness:d,startPoint:_,endPoint:E,textHeight:g,rotation:h,xScale:A,obliqueAngle:P,styleName:v,generationFlag:p,halign:I,valign:R,extrusionDirection:w}}convertText(t,i){return{type:"TEXT",...i,...this.convertTextBase(t)}}convertTolerance(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_value"),E=n.dwg_dynapi_entity_data(t,"x_direction"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_entity_get_dimstyle_name(t);return{type:"TOLERANCE",...i,styleName:g,insertionPoint:d,text:_,extrusionDirection:h,xAxisDirection:E}}convertViewport(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"width"),E=n.dwg_dynapi_entity_data(t,"height"),h=n.dwg_dynapi_entity_data(t,"on_off"),g=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"SNAPBASE"),P=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),v=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),p=n.dwg_dynapi_entity_data(t,"VIEWDIR"),I=n.dwg_dynapi_entity_data(t,"view_target"),R=n.dwg_dynapi_entity_data(t,"lens_length"),w=n.dwg_dynapi_entity_data(t,"front_clip_z"),m=n.dwg_dynapi_entity_data(t,"back_clip_z"),S=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),W=n.dwg_dynapi_entity_data(t,"SNAPANG"),M=n.dwg_dynapi_entity_data(t,"twist_angle"),x=n.dwg_dynapi_entity_data(t,"circle_zoom"),k=n.dwg_dynapi_entity_data(t,"status_flag"),V=n.dwg_dynapi_entity_data(t,"style_sheet"),q=n.dwg_dynapi_entity_data(t,"render_mode"),$=n.dwg_dynapi_entity_data(t,"UCSVP"),Z=n.dwg_dynapi_entity_data(t,"ucsorg"),nt=n.dwg_dynapi_entity_data(t,"ucsxdir"),it=n.dwg_dynapi_entity_data(t,"ucsydir"),Y=n.dwg_dynapi_entity_data(t,"named_ucs"),U=n.dwg_ref_get_id(Y),lt=n.dwg_dynapi_entity_data(t,"base_ucs"),st=n.dwg_ref_get_id(lt),Dt=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),yt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),Nt=n.dwg_dynapi_entity_data(t,"shadeplot_mode"),pt=n.dwg_dynapi_entity_data(t,"use_default_lights"),ft=n.dwg_dynapi_entity_data(t,"default_lighting_type"),ht=n.dwg_dynapi_entity_data(t,"brightness"),Rt=n.dwg_dynapi_entity_data(t,"contrast"),Ft=n.dwg_dynapi_entity_data(t,"grid_major"),Ut=n.dwg_dynapi_entity_data(t,"background"),Zt=n.dwg_ref_get_id(Ut),qt=n.dwg_dynapi_entity_data(t,"shadeplot"),Qt=n.dwg_ref_get_id(qt),jt=n.dwg_dynapi_entity_data(t,"visualstyle"),Gt=n.dwg_ref_get_id(jt),te=n.dwg_dynapi_entity_data(t,"sun"),ct=n.dwg_ref_get_id(te);return{type:"VIEWPORT",...i,viewportCenter:d,width:_,height:E,status:h,viewportId:0,displayCenter:g,snapBase:A,snapSpacing:P,gridSpacing:v,viewDirection:p,targetPoint:I,perspectiveLensLength:R,frontClipZ:w,backClipZ:m,viewHeight:S,snapAngle:W,viewTwistAngle:M,circleZoomPercent:x,statusBitFlags:k,sheetName:V,renderMode:q,ucsPerViewport:$,ucsOrigin:Z,ucsXAxis:nt,ucsYAxis:it,ucsId:U??"",ucsBaseId:st??"",orthographicType:Dt,elevation:yt,shadePlotMode:Nt,majorGridFrequency:Ft,backgroundId:Zt??"",shadePlotId:Qt??"",visualStyleId:Gt??"",isDefaultLighting:!!pt,defaultLightingType:ft,brightness:ht,contrast:Rt,sunId:ct??""}}convertWipeout(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),E=n.dwg_dynapi_entity_data(t,"uvec"),h=n.dwg_dynapi_entity_data(t,"vvec"),g=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),P=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=n.dwg_dynapi_entity_data(t,"fade"),R=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),W=n.dwg_ptr_to_point2d_array(S,m),M=n.dwg_dynapi_entity_data(t,"imagedef"),x=n.dwg_ref_get_absref(M)??0,k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),V=n.dwg_ref_get_absref(k)??0;return{type:"WIPEOUT",...i,version:d,position:_,uPixel:E,vPixel:h,imageSize:g,imageDefHandle:x,flags:A,clipping:P,brightness:v,contrast:p,fade:I,imageDefReactorHandle:V,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:W,clipMode:R}}convertXline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"XLINE",...i,firstPoint:d,unitDirection:_}}getDimensionCommonAttrs(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"class_version"),d=i.dwg_entity_get_block_name(t,"block"),_=i.dwg_dynapi_entity_data(t,"def_pt"),E=i.dwg_dynapi_entity_data(t,"text_midpt"),h=i.dwg_dynapi_entity_data(t,"attachmentPoint"),g=i.dwg_dynapi_entity_data(t,"flag"),A=i.dwg_dynapi_entity_data(t,"lspace_factor"),P=i.dwg_dynapi_entity_data(t,"lspace_factor"),v=i.dwg_dynapi_entity_data(t,"act_measurement"),p=i.dwg_dynapi_entity_data(t,"user_text"),I=i.dwg_dynapi_entity_data(t,"text_rotation"),R=i.dwg_dynapi_entity_data(t,"ins_rotation"),w=i.dwg_dynapi_entity_data(t,"extrusion"),m=i.dwg_entity_get_dimstyle_name(t);return{type:"DIMENSION",version:n,name:d,definitionPoint:_,textPoint:E,dimensionType:g,attachmentPoint:h,textLineSpacingStyle:A,textLineSpacingFactor:P||1,measurement:v,text:p,textRotation:I,ocsRotation:R,extrusionDirection:w,styleName:m}}getCommonAttrs(t){const i=this.libredwg,n=i.dwg_object_entity_get_color_object(t),d=n.method,_=n.index;let E;(d==194||(n.rgb>>>24&255)===194)&&(E=n.rgb&16777215);const h=this.getLayerName(t),g=i.dwg_object_entity_get_handle_object(t),A=i.dwg_object_entity_get_ownerhandle_object(t),P=i.dwg_object_entity_get_xdicobjhandle_object(t),v=this.getLtypeName(t),p=i.dwg_object_entity_get_line_weight(t),I=i.dwg_object_entity_get_ltype_scale(t),R=!i.dwg_object_entity_get_invisible(t),w=i.dwg_object_entity_get_xdata(t);return{handle:Tt(g.value),ownerDictionaryHardId:Tt(P.absolute_ref),ownerBlockRecordSoftId:Tt(A.absolute_ref),layer:h,color:E,colorIndex:_,colorName:n.name,lineType:v,lineweight:p,lineTypeScale:I,isVisible:R,transparency:n.alpha,transparencyType:n.alpha_type,xdata:w}}getLayerName(t){const n=this.libredwg.dwg_object_entity_get_layer_object_ref(t);return this.layers.get(Tt(n.handleref.value))??"0"}getLtypeName(t){const n=this.libredwg.dwg_object_entity_get_ltype_object_ref(t);return this.ltypes.get(Tt(n.handleref.value))??""}}class sr{constructor(t){et(this,"libredwg"),et(this,"entityConverter"),et(this,"orphanEntitiesByBlock",null),et(this,"ownerlessOrphanIndices",null),et(this,"orphanIndexDataPtr",null),this.libredwg=t,this.entityConverter=new Lo(t)}convert(t){var i;this.entityConverter.clear(),this.orphanEntitiesByBlock=null,this.ownerlessOrphanIndices=null,this.orphanIndexDataPtr=t;const n={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],IMAGEDEF:[],LAYER_FILTER:[],LAYER_INDEX:[],LAYOUT:[],MLEADERSTYLE:[],SPATIAL_FILTER:[],XRECORD:[]},header:{},entities:[],classes:[]},d=this.libredwg;this.convertHeader(t,n.header),this.convertClasses(t,n.classes),this.entityConverter.setClasses(n.classes);const _=d.dwg_get_num_objects(t);for(let g=0;g<_;g++){const A=d.dwg_get_object(t,g);if(A){const P=this.safeObjectTio(A);if(P)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_LAYER:{const p=this.convertLayer(P,A);n.tables.LAYER.entries.push(p),this.entityConverter.layers.set(p.handle,p.name)}break;case L.DWG_TYPE_LTYPE:{const p=this.convertLineType(P,A);n.tables.LTYPE.entries.push(p),this.entityConverter.ltypes.set(p.handle,p.name)}break}}}for(let g=0;g<_;g++){const A=d.dwg_get_object(t,g);if(A){const P=this.safeObjectTio(A);if(P)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_APPID:n.tables.APPID.entries.push(this.convertAppId(P));break;case L.DWG_TYPE_BLOCK_HEADER:{const p=this.convertBlockRecord(P,A);n.tables.BLOCK_RECORD.entries.push(p),(Ln(p.name)||Ro(p.name))&&p.entities.forEach(I=>{n.entities.push(I),I.type==="INSERT"&&I.attribs.forEach(R=>{n.entities.push(R)})})}break;case L.DWG_TYPE_DIMSTYLE:n.tables.DIMSTYLE.entries.push(this.convertDimStyle(P,A));break;case L.DWG_TYPE_STYLE:n.tables.STYLE.entries.push(this.convertStyle(P,A));break;case L.DWG_TYPE_VPORT:n.tables.VPORT.entries.push(this.convertViewport(P,A));break;case L.DWG_TYPE_DICTIONARY:n.objects.DICTIONARY.push(this.convertDictionary(P,A));break;case L.DWG_TYPE_IMAGEDEF:n.objects.IMAGEDEF.push(this.convertImageDef(P,A));break;case L.DWG_TYPE_LAYERFILTER:n.objects.LAYER_FILTER.push(this.convertLayerFilter(P,A));break;case L.DWG_TYPE_LAYER_INDEX:n.objects.LAYER_INDEX.push(this.convertLayerIndex(P,A));break;case L.DWG_TYPE_LAYOUT:n.objects.LAYOUT.push(this.convertLayout(P,A));break;case L.DWG_TYPE_MLEADERSTYLE:n.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(P,A));break;case L.DWG_TYPE_SPATIAL_FILTER:n.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(P,A));break;case L.DWG_TYPE_XRECORD:n.objects.XRECORD.push(this.convertXRecord(P,A));break}}}const E=n.entities.filter(g=>g.type==="VIEWPORT");E.sort((g,A)=>{const P=parseInt(g.handle,16),v=parseInt(A.handle,16);return P-v}),E.forEach((g,A)=>{g.viewportId=A+1});const h=d.dwg_bmp(t);return(i=h==null?void 0:h.data)!=null&&i.length&&(n.thumbnailImage=h.data),n}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}safeObjectTio(t){const i=this.libredwg;try{if(i.dwg_object_get_supertype(t)!=Sn.DWG_SUPERTYPE_OBJECT)return null;const n=i.dwg_object_to_object_tio(t);return n||null}catch{return null}}convertHeader(t,i){const n=this.libredwg;vo.forEach(d=>{let _=d;(d=="DIMBLK"||d=="DIMBLK1"||d=="DIMBLK2")&&(_=_+"_T");let E=n.dwg_dynapi_header_data(t,_);d=="CELTYPE"||d=="CLAYER"||d=="CLAYER"||d=="DIMSTYLE"||d=="DIMTXSTY"||d=="TEXTSTYLE"?E=E?n.dwg_ref_get_object_name(E):"":d=="DRAGVS"&&(E=E?n.dwg_ref_get_absref(E)??2:2),i[d]=E})}convertClasses(t,i){const n=this.libredwg,d=n.dwg_get_num_classes(t);for(let _=0;_<d;_++){const E=n.dwg_get_class(t,_);i.push({dxfName:E.dxfname,cppName:E.cppname,appName:E.appname,capabilitiesFlag:E.proxyflag,instanceCount:E.num_instances,wasAProxyFlag:E.s_zombie,isAnEntityFlag:E.item_class_id===498})}}convertAppId(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"name"),d=i.dwg_dynapi_entity_data(t,"flag");return{name:n,standardFlag:d}}convertBlockRecord(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_entity_block_header_get_block(t);_.name&&(d.name=_.name);const E=n.dwg_dynapi_entity_data(t,"num_owned"),h=n.dwg_dynapi_entity_data(t,"flag"),g=n.dwg_dynapi_entity_data(t,"description"),A=n.dwg_dynapi_entity_data(t,"base_pt"),P=n.dwg_dynapi_entity_data(t,"insert_units"),v=n.dwg_dynapi_entity_data(t,"explodable"),p=n.dwg_dynapi_entity_data(t,"block_scaling"),I=n.dwg_dynapi_entity_data(t,"layout"),R=n.dwg_ref_get_id(I)??"";let w;const m=n.dwg_entity_block_header_get_preview(t);m&&m.length>0&&(w=$e(m));let S=this.convertEntities(i,d.handle);if(!S||S.length==0){S=[];const W=n.dwg_dynapi_entity_data(t,"entities");if(W){const M=n.dwg_ptr_to_object_ref_ptr_array(W,E),x=this.entityConverter;for(let k=0;k<E;k++){const V=n.dwg_ref_get_object(M[k]),q=x.convert(V);q&&(q.ownerBlockRecordSoftId=d.handle,S.push(q))}}}if(this.orphanIndexDataPtr!=null){const W=this.convertOrphanOwnedEntities(this.orphanIndexDataPtr,i,d.handle,Ln(d.name)===!0);if(W.length)if(S.length===0)S=W;else{const M=new Set(S.map(x=>x.handle));for(const x of W)M.has(x.handle)||S.push(x)}}return{...d,flags:h,description:g,basePoint:A,layout:R,insertionUnits:P,explodability:v,scalability:p,bmpPreview:w,entities:S}}convertEntities(t,i){const n=this.libredwg,d=this.entityConverter,_=[];let E=n.get_first_owned_entity(t);for(;E;){const h=d.convert(E);h&&(h.ownerBlockRecordSoftId=i,_.push(h)),E=n.get_next_owned_entity(t,E)}return _}convertOrphanOwnedEntities(t,i,n,d){this.ensureOrphanEntityIndex(t);const E=(this.orphanEntitiesByBlock??new Map).get(i)??[],h=d&&this.ownerlessOrphanIndices?this.ownerlessOrphanIndices:[],g=E.length&&h.length?E.concat(h):E.length?E:h;if(g.length===0)return[];const A=this.libredwg,P=this.entityConverter,v=[];for(const p of g){const I=A.dwg_get_object(t,p),R=P.convert(I);R&&(R.ownerBlockRecordSoftId=n,v.push(R))}return v}ensureOrphanEntityIndex(t){if(this.orphanEntitiesByBlock)return;const i=this.libredwg,n=i.dwg_get_num_objects(t),d=new Map,_=[],E=[],h=new Map;for(let v=0;v<n;v++){const p=i.dwg_get_object(t,v);if(p){if(i.dwg_object_get_supertype(p)===Sn.DWG_SUPERTYPE_ENTITY)_.push(v),d.set(p,v);else if(i.dwg_object_get_fixedtype(p)===L.DWG_TYPE_BLOCK_HEADER){E.push(p);const I=i.dwg_object_to_object_tio(p);I&&h.set(I,p)}}}const g=new Set;for(const v of E){let p=i.get_first_owned_entity(v),I=0;for(;p&&I++<=_.length;){const R=d.get(p);if(R===void 0||g.has(R))break;g.add(R),p=i.get_next_owned_entity(v,p)}}const A=new Map,P=[];for(const v of _){if(g.has(v))continue;const p=i.dwg_get_object(t,v),I=p?i.dwg_object_to_entity_tio(p):0,R=I?i.dwg_entity_owner(I):0,w=R?h.get(R)??0:0;if(w){const m=A.get(w);m?m.push(v):A.set(w,[v])}else P.push(v)}this.orphanEntitiesByBlock=A,this.ownerlessOrphanIndices=P}convertDimStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"DIMTOL"),E=n.dwg_dynapi_entity_data(t,"DIMLIM"),h=n.dwg_dynapi_entity_data(t,"DIMTIH"),g=n.dwg_dynapi_entity_data(t,"DIMTOH"),A=n.dwg_dynapi_entity_data(t,"DIMSE1"),P=n.dwg_dynapi_entity_data(t,"DIMSE2"),v=n.dwg_dynapi_entity_data(t,"DIMALT"),p=n.dwg_dynapi_entity_data(t,"DIMTOFL"),I=n.dwg_dynapi_entity_data(t,"DIMSAH"),R=n.dwg_dynapi_entity_data(t,"DIMTIX"),w=n.dwg_dynapi_entity_data(t,"DIMSOXD"),m=n.dwg_dynapi_entity_data(t,"DIMALTD"),S=n.dwg_dynapi_entity_data(t,"DIMZIN"),W=n.dwg_dynapi_entity_data(t,"DIMSD1"),M=n.dwg_dynapi_entity_data(t,"DIMSD2"),x=n.dwg_dynapi_entity_data(t,"DIMTOLJ"),k=n.dwg_dynapi_entity_data(t,"DIMJUST"),V=n.dwg_dynapi_entity_data(t,"DIMFIT"),q=n.dwg_dynapi_entity_data(t,"DIMUPT"),$=n.dwg_dynapi_entity_data(t,"DIMTZIN"),Z=n.dwg_dynapi_entity_data(t,"DIMALTZ"),nt=n.dwg_dynapi_entity_data(t,"DIMALTTZ"),it=n.dwg_dynapi_entity_data(t,"DIMTAD"),Y=n.dwg_dynapi_entity_data(t,"DIMUNIT"),U=n.dwg_dynapi_entity_data(t,"DIMAUNIT"),lt=n.dwg_dynapi_entity_data(t,"DIMDEC"),st=n.dwg_dynapi_entity_data(t,"DIMTDEC"),Dt=n.dwg_dynapi_entity_data(t,"DIMALTU"),yt=n.dwg_dynapi_entity_data(t,"DIMALTTD"),Nt=n.dwg_dynapi_entity_data(t,"DIMSCALE"),pt=n.dwg_dynapi_entity_data(t,"DIMASZ"),ft=n.dwg_dynapi_entity_data(t,"DIMEXO"),ht=n.dwg_dynapi_entity_data(t,"DIMDLI"),Rt=n.dwg_dynapi_entity_data(t,"DIMEXE"),Ft=n.dwg_dynapi_entity_data(t,"DIMRND"),Ut=n.dwg_dynapi_entity_data(t,"DIMDLE"),Zt=n.dwg_dynapi_entity_data(t,"DIMTP"),qt=n.dwg_dynapi_entity_data(t,"DIMTM"),Qt=n.dwg_dynapi_entity_data(t,"DIMFXL"),jt=n.dwg_dynapi_entity_data(t,"DIMJOGANG"),Gt=n.dwg_dynapi_entity_data(t,"DIMTFILL"),te=n.dwg_dynapi_entity_data(t,"DIMTFILLCLR"),ct=n.dwg_dynapi_entity_data(t,"DIMAZIN"),Wt=n.dwg_dynapi_entity_data(t,"DIMARCSYM"),$t=n.dwg_dynapi_entity_data(t,"DIMTXT"),Q=n.dwg_dynapi_entity_data(t,"DIMCEN"),X=n.dwg_dynapi_entity_data(t,"DIMTSZ"),ee=n.dwg_dynapi_entity_data(t,"DIMALTF"),we=n.dwg_dynapi_entity_data(t,"DIMLFAC"),Ce=n.dwg_dynapi_entity_data(t,"DIMTVP"),De=n.dwg_dynapi_entity_data(t,"DIMTFAC"),Re=n.dwg_dynapi_entity_data(t,"DIMGAP"),Se=n.dwg_dynapi_entity_data(t,"DIMPOST"),Le=n.dwg_dynapi_entity_data(t,"DIMAPOST"),Ye=n.dwg_dynapi_entity_data(t,"DIMBLK_T"),ne=n.dwg_dynapi_entity_data(t,"DIMBLK1_T"),Ne=n.dwg_dynapi_entity_data(t,"DIMBLK2_T"),he=n.dwg_dynapi_entity_data(t,"DIMALTRND"),ge=n.dwg_dynapi_entity_data(t,"DIMCLRD_N"),Ge=n.dwg_dynapi_entity_data(t,"DIMCLRE_N"),Ae=n.dwg_dynapi_entity_data(t,"DIMCLRT_N"),We=n.dwg_dynapi_entity_data(t,"DIMCLRD"),Me=n.dwg_dynapi_entity_data(t,"DIMCLRE"),re=n.dwg_dynapi_entity_data(t,"DIMCLRT"),Te=n.dwg_dynapi_entity_data(t,"DIMADEC"),Mt=n.dwg_dynapi_entity_data(t,"DIMFRAC"),vt=n.dwg_dynapi_entity_data(t,"DIMLUNIT"),J=n.dwg_dynapi_entity_data(t,"DIMDSEP"),Pe=n.dwg_dynapi_entity_data(t,"DIMTMOVE"),Ht=n.dwg_dynapi_entity_data(t,"DIMATFIT"),It=n.dwg_dynapi_entity_data(t,"DIMFXLON"),ae=n.dwg_dynapi_entity_data(t,"DIMTXTDIRECTION"),mt=n.dwg_dynapi_entity_data(t,"DIMALTMZF"),Vt=n.dwg_dynapi_entity_data(t,"DIMALTMZS"),St=n.dwg_dynapi_entity_data(t,"DIMMZF"),Xt=n.dwg_dynapi_entity_data(t,"DIMMZS"),oe=n.dwg_dynapi_entity_data(t,"DIMLWD"),ye=n.dwg_dynapi_entity_data(t,"DIMLWE"),gt=n.dwg_dynapi_entity_data(t,"DIMTXSTY"),pe=n.dwg_ref_get_absref(gt)??void 0,ie=n.dwg_dynapi_entity_data(t,"DIMLDRBLK"),B=n.dwg_ref_get_absref(ie)??void 0;return{...d,DIMPOST:Se,DIMAPOST:Le,DIMBLK:Ye,DIMBLK1:ne,DIMBLK2:Ne,DIMSCALE:Nt,DIMASZ:pt,DIMEXO:ft,DIMDLI:ht,DIMEXE:Rt,DIMRND:Ft,DIMDLE:Ut,DIMTP:Zt,DIMTM:qt,DIMTXT:$t,DIMCEN:Q,DIMTSZ:X,DIMALTF:ee,DIMLFAC:we,DIMTVP:Ce,DIMTFAC:De,DIMGAP:Re,DIMALTRND:he,DIMTOL:_,DIMLIM:E,DIMTIH:h,DIMTOH:g,DIMSE1:A,DIMSE2:P,DIMTAD:it,DIMZIN:S,DIMAZIN:ct,DIMALT:v,DIMALTD:m,DIMTOFL:p,DIMSAH:I,DIMTIX:R,DIMSOXD:w,DIMCLRD:We,DIMCLRE:Me,DIMCLRT:re,DIMADEC:Te,DIMUNIT:Y,DIMDEC:lt,DIMTDEC:st,DIMALTU:Dt,DIMALTTD:yt,DIMAUNIT:U,DIMFRAC:Mt,DIMLUNIT:vt,DIMDSEP:String.fromCharCode(J),DIMTMOVE:Pe,DIMJUST:k,DIMSD1:W,DIMSD2:M,DIMTOLJ:x,DIMTZIN:$,DIMALTZ:Z,DIMALTTZ:nt,DIMFIT:V,DIMUPT:q,DIMATFIT:Ht,DIMTXSTY:pe,DIMLDRBLK:B,DIMLWD:oe,DIMLWE:ye,DIMFXL:Qt,DIMJOGANG:jt,DIMTFILL:Gt,DIMTFILLCLR:te,DIMARCSYM:Wt,DIMCLRD_N:ge,DIMCLRE_N:Ge,DIMCLRT_N:Ae,DIMFXLON:It,DIMTXTDIRECTION:ae,DIMALTMZF:mt,DIMALTMZS:Vt,DIMMZF:St,DIMMZS:Xt}}convertLayer(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"frozen"),h=n.dwg_dynapi_entity_data(t,"off"),g=n.dwg_dynapi_entity_data(t,"frozen_in_new"),A=n.dwg_dynapi_entity_data(t,"plotflockedlag"),P=n.dwg_dynapi_entity_data(t,"plotflag"),v=n.dwg_dynapi_entity_data(t,"linewt"),p=n.dwg_dynapi_entity_data(t,"color"),I=n.dwg_dynapi_entity_data(t,"ltype");let R="Continuous";if(I)try{R=n.dwg_ref_get_object_name(I)}catch{}const w=p.method;let m=256,S=16777215;return w===195||(p.rgb>>>24&255)===195?m=p.rgb&255:w==194||(p.rgb>>>24&255)===194?S=p.rgb&16777215:p.index>=1&&p.index<=255&&(m=p.index),{...d,standardFlag:_,colorIndex:m,color:S,colorName:p.name,transparency:p.alpha,lineType:R,frozen:E!=0,off:h!=0,frozenInNew:g!=0,locked:A!=0,plotFlag:P,lineweight:v,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"description"),h=n.dwg_dynapi_entity_data(t,"numdashes"),g=n.dwg_dynapi_entity_data(t,"pattern_len"),A=n.dwg_dynapi_entity_data(t,"dashes"),P=A?n.dwg_ptr_to_ltype_dash_array(A,h):[];return{...d,description:E,standardFlag:_,numberOfLineTypes:h,totalPatternLength:g,pattern:this.convertLineTypePattern(P)}}convertLineTypePattern(t){const i=[];return t.forEach(n=>{i.push({elementLength:n.length||0,elementTypeFlag:n.shape_flag||0,shapeNumber:n.complex_shapecode,scale:n.scale,rotation:n.rotation,offsetX:n.x_offset,offsetY:n.y_offset,text:n.text})}),i}convertStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"width_factor"),h=n.dwg_dynapi_entity_data(t,"oblique_angle"),g=n.dwg_dynapi_entity_data(t,"generation"),A=n.dwg_dynapi_entity_data(t,"last_height"),P=n.dwg_dynapi_entity_data(t,"font_file"),v=n.dwg_dynapi_entity_data(t,"bigfont_file");return{...d,standardFlag:_,fixedTextHeight:0,widthFactor:E,obliqueAngle:h,textGenerationFlag:g,lastHeight:A,font:P,bigFont:v}}convertViewport(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),E=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),h=n.dwg_dynapi_entity_data(t,"aspect_ratio"),g=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"view_target"),P=n.dwg_dynapi_entity_data(t,"VIEWDIR"),v=n.dwg_dynapi_entity_data(t,"view_twist"),p=n.dwg_dynapi_entity_data(t,"lens_length"),I=n.dwg_dynapi_entity_data(t,"front_clip_z"),R=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"VIEWMODE"),m=n.dwg_dynapi_entity_data(t,"render_mode"),S=n.dwg_dynapi_entity_data(t,"use_default_lights")!=0,W=n.dwg_dynapi_entity_data(t,"default_lightning_type"),M=n.dwg_dynapi_entity_data(t,"brightness"),x=n.dwg_dynapi_entity_data(t,"contrast"),k=n.dwg_dynapi_entity_data(t,"ambient_color"),V=n.dwg_dynapi_entity_data(t,"lower_left"),q=n.dwg_dynapi_entity_data(t,"upper_right"),$=n.dwg_dynapi_entity_data(t,"circle_zoom"),Z=n.dwg_dynapi_entity_data(t,"UCSICON"),nt=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),it=n.dwg_dynapi_entity_data(t,"SNAPANG"),Y=n.dwg_dynapi_entity_data(t,"SNAPBASE"),U=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),lt=n.dwg_dynapi_entity_data(t,"ucsorg"),st=n.dwg_dynapi_entity_data(t,"ucsxdir"),Dt=n.dwg_dynapi_entity_data(t,"ucsydir"),yt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),Nt=n.dwg_dynapi_entity_data(t,"grid_major"),pt=n.dwg_dynapi_entity_data(t,"background"),ft=pt?n.dwg_ref_get_id(pt)??"":void 0,ht=n.dwg_dynapi_entity_data(t,"visualstyle"),Rt=ht?n.dwg_ref_get_id(ht)??"":void 0;return{...d,standardFlag:_,lowerLeftCorner:V,upperRightCorner:q,center:g,snapBasePoint:Y,snapSpacing:U,gridSpacing:nt,viewDirectionFromTarget:P,viewTarget:A,lensLength:p,frontClippingPlane:I,backClippingPlane:R,viewHeight:E,aspectRatio:h,snapRotationAngle:it,viewTwistAngle:v,circleSides:$,frozenLayers:[],styleSheet:"",renderMode:m,viewMode:w,ucsIconSetting:Z,ucsOrigin:lt,ucsXAxis:st,ucsYAxis:Dt,orthographicType:0,elevation:yt,shadePlotSetting:0,majorGridLines:Nt,backgroundObjectId:ft,visualStyleObjectId:Rt,isDefaultLightingOn:S,defaultLightingType:W,brightness:M,contrast:x,ambientColor:k.index}}getCommonTableEntryAttrs(t,i){const n=this.libredwg,d=n.dwg_object_get_tio(i),_=n.dwg_object_object_get_ownerhandle_object(d),E=n.dwg_object_get_handle_object(i);return{handle:Tt(E.value),ownerHandle:Tt(_.absolute_ref),name:n.dwg_dynapi_entity_data(t,"name")}}convertDictionary(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"is_hardowner"),E=n.dwg_dynapi_entity_data(t,"cloning"),h=n.dwg_dynapi_entity_data(t,"numitems"),g=n.dwg_dynapi_entity_data(t,"itemhandles"),A=n.dwg_ptr_to_object_ref_array(g,h),P=n.dwg_object_dictionary_get_texts(i),v={};return A.forEach((p,I)=>v[P[I]]=Tt(p.absolute_ref)),{...d,isHardOwner:!!_,cloningFlag:E,entries:v}}convertImageDef(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"image_size"),E=n.dwg_dynapi_entity_data(t,"file_path"),h=n.dwg_dynapi_entity_data(t,"is_loaded"),g=n.dwg_dynapi_entity_data(t,"pixel_size"),A=n.dwg_dynapi_entity_data(t,"resunits");return{...d,fileName:E,size:_,sizeOfOnePixel:g,isLoaded:h,resolutionUnits:A}}convertLayerFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"num_names")??0,E=n.dwg_dynapi_entity_data(t,"names"),h=E&&_>0?n.dwg_ptr_to_wchar_string_array(E,_).filter(g=>g!=null&&g!==""):[];return{...d,...h.length?{layerNames:h}:{}}}convertLayerIndex(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"last_updated"),E=n.dwg_dynapi_entity_data(t,"num_entries")??0,h=n.dwg_dynapi_entity_data(t,"entries"),g=n.dwg_dynapi_subclass_size("LAYER_entry"),A=[],P=[],v=[];if(h&&g>0)for(let p=0;p<E;p++){const I=h+p*g,R=n.dwg_dynapi_subclass_data(I,"LAYER_entry","name");A.push(R??"");const w=n.dwg_dynapi_subclass_data(I,"LAYER_entry","handle");P.push(w?n.dwg_ref_get_id(w)??"":""),v.push(n.dwg_dynapi_subclass_data(I,"LAYER_entry","numlayers")??0)}return{...d,..._!=null?{timeStamp:_}:{},...A.length?{layerNames:A}:{},...P.length?{idBufferIds:P}:{},...v.length?{idBufferEntryCounts:v}:{}}}convertLayout(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"layout_name"),E=n.dwg_dynapi_entity_data(t,"tab_order"),h=n.dwg_dynapi_entity_data(t,"layout_flags"),g=n.dwg_dynapi_entity_data(t,"INSBASE"),A=n.dwg_dynapi_entity_data(t,"LIMMIN"),P=n.dwg_dynapi_entity_data(t,"LIMMAX"),v=n.dwg_dynapi_entity_data(t,"UCSORG"),p=n.dwg_dynapi_entity_data(t,"UCSXDIR"),I=n.dwg_dynapi_entity_data(t,"UCSYDIR"),R=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),w=n.dwg_dynapi_entity_data(t,"EXTMIN"),m=n.dwg_dynapi_entity_data(t,"EXTMAX"),S=n.dwg_dynapi_entity_data(t,"ucs_elevation"),W=n.dwg_dynapi_entity_data(t,"block_header"),M=n.dwg_ref_get_id(W)??"",x=n.dwg_dynapi_entity_data(t,"active_viewport"),k=n.dwg_ref_get_id(x)??"",V=n.dwg_dynapi_entity_data(t,"named_ucs"),q=V?n.dwg_ref_get_id(V)??"":void 0;return{...d,layoutName:_,controlFlag:h,tabOrder:E,minLimit:A,maxLimit:P,insertionPoint:g,minExtent:w,maxExtent:m,elevation:S,ucsOrigin:v,ucsXAxis:p,ucsYAxis:I,orthographicType:R,paperSpaceTableId:M,viewportId:k,namedUcsId:q,shadePlotId:""}}convertMLeaderStyle(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=A=>n.dwg_dynapi_entity_data(t,A),E=A=>n.dwg_ref_get_id(A),h=A=>A>0,g=A=>A!=null?cr(A):void 0;return{...d,subclassMarker:"AcDbMLeaderStyle",unknown1:_("class_version"),contentType:_("content_type"),drawMLeaderOrderType:_("mleader_order"),drawLeaderOrderType:_("leader_order"),maxLeaderSegmentPoints:_("max_points"),firstSegmentAngleConstraint:_("first_seg_angle"),secondSegmentAngleConstraint:_("second_seg_angle"),leaderLineType:_("type"),leaderLineColor:g(_("line_color")),leaderLineTypeId:E(_("line_type")),leaderLineWeight:_("linewt"),landingEnabled:h(_("has_landing")),landingGap:_("landing_gap"),doglegEnabled:h(_("has_dogleg")),doglegLength:_("landing_dist"),description:_("description"),arrowheadId:E(_("arrow_head")),arrowheadSize:_("arrow_head_size"),defaultMTextContents:_("text_default"),textStyleId:E(_("text_style")),textLeftAttachmentType:_("attach_left"),textAngleType:_("text_angle_type"),textAlignmentType:_("text_align_type"),textRightAttachmentType:_("attach_right"),textColor:g(_("text_color")),textHeight:_("text_height"),textFrameEnabled:h(_("has_text_frame")),textAlignAlwaysLeft:h(_("text_always_left")),alignSpace:_("align_space"),blockContentId:E(_("block")),blockContentColor:g(_("block_color")),blockContentScale:_("block_scale"),blockContentScaleEnabled:h(_("use_block_scale")),blockContentRotation:_("block_rotation"),blockContentRotationEnabled:h(_("use_block_rotation")),blockContentConnectionType:_("block_connection"),scale:_("scale"),overwritePropertyValue:h(_("is_changed")),annotative:h(_("is_annotative")),breakGapSize:_("break_size"),textAttachmentDirection:_("attach_dir"),bottomTextAttachmentDirection:_("attach_bottom"),topTextAttachmentDirection:_("attach_top"),unknown2:h(_("text_extended"))}}convertSpatialFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"origin"),E=n.dwg_dynapi_entity_data(t,"num_clip_verts"),h=n.dwg_dynapi_entity_data(t,"clip_verts"),g=n.dwg_ptr_to_point2d_array(h,E),A=n.dwg_dynapi_entity_data(t,"extrusion"),P=n.dwg_dynapi_entity_data(t,"display_boundary_on"),v=n.dwg_dynapi_entity_data(t,"front_clip_on"),p=n.dwg_dynapi_entity_data(t,"front_clip_z"),I=n.dwg_dynapi_entity_data(t,"back_clip_on"),R=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"transform"),m=n.dwg_ptr_to_double_array(w,12),S=n.dwg_dynapi_entity_data(t,"inverse_transform"),W=n.dwg_ptr_to_double_array(S,12);return{...d,origin:_,numberOfPointsOnClipBoundary:E,vertices:g,extrusionDirection:A,clipBoundaryVisible:!!P,frontClippingPlaneFlag:!!v,frontClippingPlaneDistance:p,backClippingPlaneFlag:!!I,backClippingPlaneDistance:R,matrix:m,invertBlockMatrix:W}}convertXRecord(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"cloning"),E=n.dwg_object_xrecord_get_xdata(t)??[],h=n.dwg_object_get_tio(i),g=h?n.dwg_object_object_get_xdicobjhandle_object(h):null,A=g&&g.absolute_ref?Tt(g.absolute_ref):void 0;return{...d,..._!=null?{cloning:_}:{},...A?{extensionDictionary:A}:{},data:E}}getCommonObjectAttrs(t){const i=this.libredwg,n=i.dwg_object_get_tio(t),d=i.dwg_object_object_get_ownerhandle_object(n),_=i.dwg_object_get_handle_object(t);return{handle:Tt(_.value),ownerHandle:Tt(d.absolute_ref)}}}class At{constructor(){et(this,"min"),et(this,"max"),et(this,"valid"),this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(t){return this.min.x=Math.min(this.min.x,t.x),this.min.y=Math.min(this.min.y,t.y),this.max.x=Math.max(this.max.x,t.x),this.max.y=Math.max(this.max.y,t.y),this.valid=!0,this}transform(t,i){const n=this.getCorners().map(d=>({x:d.x*t.x+i.x,y:d.y*t.y+i.y}));this.reset();for(const d of n)this.expandByPoint(d);return this}rotate(t,i){const n=Math.cos(t),d=Math.sin(t),_=this.getCorners().map(E=>{const h=E.x-i.x,g=E.y-i.y;return{x:i.x+h*n-g*d,y:i.y+h*d+g*n}});this.reset();for(const E of _)this.expandByPoint(E);return this}clone(){const t=new At;return t.min={x:this.min.x,y:this.min.y},t.max={x:this.max.x,y:this.max.y},t.valid=this.valid,t}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 Yo(a,t,i,n,d){const _=i.length;if(_===0)throw new Error("points must not be empty");const E=i[0].length;if(a<0||a>1)throw new Error(`t out of bounds [0,1]: ${a}`);if(t<1)throw new Error("degree must be at least 1 (linear)");if(t>_-1)throw new Error("degree must be less than or equal to point count - 1");const h=d??new Array(_).fill(1),g=n??(()=>{const w=[];for(let m=0;m<_+t+1;m++)w.push(m);return w})();if(g.length!==_+t+1)throw new Error("bad knot vector length");const A=[t,g.length-1-t],P=g[A[0]],v=g[A[1]];a=a*(v-P)+P,a=Math.max(a,P),a=Math.min(a,v);let p=A[0];for(;p<A[1]&&!(a>=g[p]&&a<=g[p+1]);p++);const I=new Array(_);for(let w=0;w<_;w++){I[w]=new Array(E+1);for(let m=0;m<E;m++)I[w][m]=i[w][m]*h[w];I[w][E]=h[w]}for(let w=1;w<=t+1;w++)for(let m=p;m>p-t-1+w;m--){const S=g[m+t+1-w]-g[m],W=S===0?0:(a-g[m])/S;for(let M=0;M<E+1;M++)I[m][M]=(1-W)*I[m-1][M]+W*I[m][M]}const R=new Array(E);for(let w=0;w<E;w++)R[w]=No(I[p][w]/I[p][E],-9);return R}function No(a,t){if(isNaN(a)||!Number.isInteger(t))return NaN;const[i,n="0"]=a.toString().split("e"),d=Math.round(+`${i}e${+n-t}`),[_,E="0"]=d.toString().split("e");return+`${_}e${+E+t}`}const rn={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},mn=[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 Be(a,t,i){return Math.max(t,Math.min(i,a))}const Er=class ur{constructor(){et(this,"_colorIndex"),et(this,"_color"),et(this,"_colorName"),this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Be(t,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 t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}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(t){t==null?this._colorIndex=null:(this._colorIndex=Be(t,0,256),this._color=mn[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const i=rn[t.toLowerCase()];i!==void 0&&(this._colorName=t,this._color=i,this._colorIndex=this.getColorIndexByValue(this._color))}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(t){return this.setRGB(t,t,t),this}setRGB(t,i,n){const d=Math.round(Be(t,0,255)),_=Math.round(Be(i,0,255)),E=Math.round(Be(n,0,255));return this.color=(d<<16)+(_<<8)+E,this}setColorName(t){const i=rn[t.toLowerCase()];return i!==void 0&&(this.color=i),this}clone(){const t=new ur;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[i,n]of Object.entries(rn))if(n===t)return i;return null}getColorIndexByValue(t){const i=mn.length-1;for(let n=1;n<i;++n)if(mn[n]===t)return n;return null}};et(Er,"NAMES",rn);let Go=Er;class Pt{constructor(t,i){et(this,"x"),et(this,"y"),this.x=t,this.y=i}add(t){return new Pt(this.x+t.x,this.y+t.y)}sub(t){return new Pt(this.x-t.x,this.y-t.y)}multiply(t){return new Pt(this.x*t,this.y*t)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const t=this.length();return t===0?new Pt(0,0):new Pt(this.x/t,this.y/t)}}function Wo(a,t,i,n=5){let d,_,E;i<0?(d=Math.atan(-i)*4,_=new Pt(a.x,a.y),E=new Pt(t.x,t.y)):(d=Math.atan(i)*4,_=new Pt(t.x,t.y),E=new Pt(a.x,a.y));const h=E.sub(_),g=h.length(),A=_.add(h.multiply(.5)),P=Math.abs(g/2/Math.tan(d/2)),v=h.norm(),p=new Pt(v.x*Math.cos(Math.PI/2)-v.y*Math.sin(Math.PI/2),v.y*Math.cos(Math.PI/2)+v.x*Math.sin(Math.PI/2)),I=d<Math.PI?A.add(p.multiply(-P)):A.add(p.multiply(P)),R=Math.atan2(E.y-I.y,E.x-I.x)/Math.PI*180;let w=Math.atan2(_.y-I.y,_.x-I.x)/Math.PI*180;w<R&&(w+=360);const m=E.sub(I).length(),S=Math.floor(R/n)*n+n,W=Math.ceil(w/n)*n-n,M=[];for(let x=S;x<=W;x+=n){const k=x/180*Math.PI,V=I.add(new Pt(Math.cos(k)*m,Math.sin(k)*m));M.push(V)}return i<0&&M.reverse(),M}function Mo(a,t=!1){let i=[];const n=a.vertices.map(d=>({x:d.x,y:d.y,bulge:d.bulge}));t&&n.push(n[0]);for(let d=0,_=n.length;d<_-1;++d){const E=n[d],h=n[d+1];i.push(E),n[d].bulge&&(i=i.concat(Wo(E,h,a.vertices[d].bulge))),d===_-2&&i.push(h)}return i}class xo{constructor(){et(this,"blockMap",new Map)}rotate(t,i){const n=Math.cos(i),d=Math.sin(i);return{x:t.x*n-t.y*d,y:t.x*d+t.y*n}}interpolateBSpline(t,i,n,d=25,_){const E=[],h=t.map(P=>[P.x,P.y]),g=[n[i]],A=[n[i],n[n.length-1-i]];for(let P=i+1;P<n.length-i;++P)g[g.length-1]!==n[P]&&g.push(n[P]);for(let P=1;P<g.length;++P){const v=g[P-1],p=g[P];for(let I=0;I<=d;++I){let w=(I/d*(p-v)+v-A[0])/(A[1]-A[0]);w=Math.max(0,Math.min(1,w));const m=Yo(w,i,h,n,_);E.push({x:m[0],y:m[1]})}}return E}addFlipXIfApplicable(t,{bbox:i,element:n}){return"extrusionDirection"in t&&t.extrusionDirection.z===-1?{bbox:new At().expandByPoint({x:-i.min.x,y:i.min.y}).expandByPoint({x:-i.max.x,y:i.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${n}</g>`}:{bbox:i,element:n}}line(t){const i=new At().expandByPoint({x:t.startPoint.x,y:t.startPoint.y}).expandByPoint({x:t.endPoint.x,y:t.endPoint.y}),n=`<line x1="${t.startPoint.x}" y1="${t.startPoint.y}" x2="${t.endPoint.x}" y2="${t.endPoint.y}" />`;return{bbox:i,element:n}}ray(t){const n=t.firstPoint,d={x:n.x+t.unitDirection.x*1e4,y:n.y+t.unitDirection.y*1e4},_=new At().expandByPoint(n).expandByPoint(d),E=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:E}}xline(t){const n={x:t.firstPoint.x-t.unitDirection.x*1e4,y:t.firstPoint.y-t.unitDirection.y*1e4},d={x:t.firstPoint.x+t.unitDirection.x*1e4,y:t.firstPoint.y+t.unitDirection.y*1e4},_=new At().expandByPoint(n).expandByPoint(d),E=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:E}}extractMTextLines(t){return t.replace(/\\U\+([0-9A-Fa-f]{4})/g,(i,n)=>String.fromCharCode(parseInt(n,16))).replace(/\\P/g,`
18
18
  `).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(`
19
19
  `).map(i=>i.trim()).filter(i=>i.length>0)}lines(t,i,n,d,_="start"){const E=new At().expandByPoint({x:n.x,y:n.y}).expandByPoint({x:n.x+d,y:n.y-t.length*i*1.5}),h=t.map((g,A)=>{const P=n.x,v=n.y-A*i*1.5,p=`translate(${P},${v}) scale(1,-1) translate(${-P},${-v})`;return`<text x="${P}" y="${v}" font-size="${i}" text-anchor="${_}" transform="${p}">${g}</text>`});return{bbox:E,element:h.join(`
20
20
  `)}}mtext(t){const i=t.textHeight,n=t.insertionPoint,d=this.extractMTextLines(t.text),_=t.attachmentPoint;let E="start";return _==ue.BottomCenter||_==ue.MiddleCenter||_==ue.TopCenter?E="middle":(_==ue.BottomRight||_==ue.MiddleRight||_==ue.TopRight)&&(E="end"),this.lines(d,i,n,t.extentsWidth,E)}table(t){const{rowCount:i,columnCount:n,rowHeightArr:d,columnWidthArr:_,startPoint:E,cells:h}=t,g=E.x,A=E.y,P=[];for(let m=0,S=A;m<i;m++){const W=d[m];let M=g;for(let x=0;x<n;x++){const k=m*n+x,V=h[k],q=_[x];P.push({x:M,y:S,width:q,height:W,cell:V,row:m,col:x}),M+=q}S+=W}const v=P.map(({x:m,y:S,width:W,height:M,cell:x})=>{const k=[];x.topBorderVisibility&&k.push(`<line x1="${m}" y1="${S}" x2="${m+W}" y2="${S}" stroke="black" />`),x.bottomBorderVisibility&&k.push(`<line x1="${m}" y1="${S+M}" x2="${m+W}" y2="${S+M}" stroke="black" />`),x.leftBorderVisibility&&k.push(`<line x1="${m}" y1="${S}" x2="${m}" y2="${S+M}" stroke="black" />`),x.rightBorderVisibility&&k.push(`<line x1="${m+W}" y1="${S}" x2="${m+W}" y2="${S+M}" stroke="black" />`);const V=m+W/2,q=S+M/2+x.textHeight/3,$=`<text x="${V}" y="${q}" font-size="${x.textHeight}" text-anchor="middle" dominant-baseline="middle">${x.text}</text>`;return[...k,$].join(`