@mlightcad/dxf-json-converter 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/dxf-json-converter.umd.cjs +1 -0
- package/dist/dxf-parser-worker.js +1887 -0
- package/lib/AcDbDxfConverter.d.ts +276 -0
- package/lib/AcDbDxfConverter.d.ts.map +1 -0
- package/lib/AcDbDxfConverter.js +1062 -0
- package/lib/AcDbDxfConverter.js.map +1 -0
- package/lib/AcDbDxfParser.d.ts +23 -0
- package/lib/AcDbDxfParser.d.ts.map +1 -0
- package/lib/AcDbDxfParser.js +82 -0
- package/lib/AcDbDxfParser.js.map +1 -0
- package/lib/AcDbDxfParserWorker.d.ts +2 -0
- package/lib/AcDbDxfParserWorker.d.ts.map +1 -0
- package/lib/AcDbDxfParserWorker.js +76 -0
- package/lib/AcDbDxfParserWorker.js.map +1 -0
- package/lib/AcDbEntitiyConverter.d.ts +156 -0
- package/lib/AcDbEntitiyConverter.d.ts.map +1 -0
- package/lib/AcDbEntitiyConverter.js +1424 -0
- package/lib/AcDbEntitiyConverter.js.map +1 -0
- package/lib/AcDbObjectConverter.d.ts +68 -0
- package/lib/AcDbObjectConverter.d.ts.map +1 -0
- package/lib/AcDbObjectConverter.js +374 -0
- package/lib/AcDbObjectConverter.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mlightcad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @mlightcad/dxf-json-converter
|
|
2
|
+
|
|
3
|
+
The `dxf-json-converter` package provides a DXF file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DXF files into the AutoCAD-like drawing database structure. It is based on [@mlightcad/dxf-json](https://www.npmjs.com/package/@mlightcad/dxf-json).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package implements a DXF file converter compatible with the RealDWG-Web data model. It allows you to register DXF file support in your application and convert DXF files into the in-memory drawing database.
|
|
8
|
+
|
|
9
|
+
DXF parsing is provided through a dedicated Web Worker bundle (`dxf-parser-worker.js`). **This converter is intended for Web Worker use only.** That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. `@mlightcad/dxf-json` is GPL-3.0, and loading it in a separate worker bundle helps keep copyleft parser code apart from the main MIT-licensed application so license obligations are easier to manage.
|
|
10
|
+
|
|
11
|
+
## Key Features
|
|
12
|
+
|
|
13
|
+
- **DXF File Support**: Read and convert DXF files to the drawing database
|
|
14
|
+
- **Worker-based Parsing**: Required by design for GPL license isolation
|
|
15
|
+
- **Integration**: Designed to work with the RealDWG-Web data model and converter manager
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @mlightcad/dxf-json-converter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> **Peer dependencies:**
|
|
24
|
+
> - `@mlightcad/data-model`
|
|
25
|
+
|
|
26
|
+
## Usage Example
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
|
|
30
|
+
import { AcDbDxfConverter } from '@mlightcad/dxf-json-converter';
|
|
31
|
+
|
|
32
|
+
const dxfConverter = new AcDbDxfConverter({
|
|
33
|
+
useWorker: true,
|
|
34
|
+
parserWorkerUrl: './assets/dxf-parser-worker.js'
|
|
35
|
+
});
|
|
36
|
+
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DXF, dxfConverter);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Deploy `dxf-parser-worker.js` from this package's `dist/` folder to a public URL accessible by your application.
|
|
40
|
+
|
|
41
|
+
## API
|
|
42
|
+
|
|
43
|
+
- **AcDbDxfConverter**: Main converter class for DXF files (extends `AcDbDatabaseConverter`)
|
|
44
|
+
|
|
45
|
+
## Dependencies
|
|
46
|
+
|
|
47
|
+
- **@mlightcad/data-model**: Drawing database and entity definitions
|
|
48
|
+
- **@mlightcad/dxf-json**: DXF file parser (GPL-3.0), loaded in the worker bundle by design for license isolation
|
|
49
|
+
|
|
50
|
+
## API Documentation
|
|
51
|
+
|
|
52
|
+
For detailed API documentation, visit the [RealDWG-Web documentation](https://mlight-lee.github.io/realdwg-web/).
|
|
53
|
+
|
|
54
|
+
## Contributing
|
|
55
|
+
|
|
56
|
+
This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(oe,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@mlightcad/data-model")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/data-model"],i):(oe=typeof globalThis<"u"?globalThis:oe||self,i(oe["dxf-json-converter"]={},oe.dataModel))})(this,function(oe,i){"use strict";var S,Ce,h,L,Pe,v,ie,G,m,H,k,re,ae,se,O,W,me,be,ce,le,Ne,Oe,Re,R,Y,D,de,xe,d,b,ye,N,we,z,f,X,Me,ue,B,_e,j,K,Ve,Fe,$,Ae,fe,ve,Ie,Z,De,C,q,x,Te,y,J,P,Q,w,ge,ke,pe,M,ee,_,te,Ue,he,V;(S={})[S.None=0]="None",S[S.Anonymous=1]="Anonymous",S[S.NonConstant=2]="NonConstant",S[S.Xref=4]="Xref",S[S.XrefOverlay=8]="XrefOverlay",S[S.ExternallyDependent=16]="ExternallyDependent",S[S.ResolvedOrDependent=32]="ResolvedOrDependent",S[S.ReferencedXref=64]="ReferencedXref",(Ce={})[Ce.BYBLOCK=0]="BYBLOCK",Ce[Ce.BYLAYER=256]="BYLAYER",(h={})[h.Rotated=0]="Rotated",h[h.Aligned=1]="Aligned",h[h.Angular=2]="Angular",h[h.Diameter=3]="Diameter",h[h.Radius=4]="Radius",h[h.Angular3Point=5]="Angular3Point",h[h.Ordinate=6]="Ordinate",h[h.ReferenceIsExclusive=32]="ReferenceIsExclusive",h[h.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",h[h.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(L={})[L.TopLeft=1]="TopLeft",L[L.TopCenter=2]="TopCenter",L[L.TopRight=3]="TopRight",L[L.MiddleLeft=4]="MiddleLeft",L[L.MiddleCenter=5]="MiddleCenter",L[L.MiddleRight=6]="MiddleRight",L[L.BottomLeft=7]="BottomLeft",L[L.BottomCenter=8]="BottomCenter",L[L.BottomRight=9]="BottomRight",(Pe={})[Pe.AtLeast=1]="AtLeast",Pe[Pe.Exact=2]="Exact";var Ge=((v={})[v.Center=0]="Center",v[v.Above=1]="Above",v[v.Outside=2]="Outside",v[v.JIS=3]="JIS",v[v.Below=4]="Below",v);(ie={})[ie.WithDimension=0]="WithDimension",ie[ie.AddLeader=1]="AddLeader",ie[ie.Independent=2]="Independent",(G={})[G.BothOutside=0]="BothOutside",G[G.ArrowFirst=1]="ArrowFirst",G[G.TextFirst=2]="TextFirst",G[G.Auto=3]="Auto";var Le=((m={})[m.Feet=0]="Feet",m[m.None=1]="None",m[m.Inch=2]="Inch",m[m.FeetAndInch=3]="FeetAndInch",m[m.Leading=4]="Leading",m[m.Trailing=8]="Trailing",m[m.LeadingAndTrailing=12]="LeadingAndTrailing",m),Ye=((H={})[H.None=0]="None",H[H.Leading=1]="Leading",H[H.Trailing=2]="Trailing",H[H.LeadingAndTrailing=3]="LeadingAndTrailing",H),ze=((k={})[k.Center=0]="Center",k[k.First=1]="First",k[k.Second=2]="Second",k[k.OverFirst=3]="OverFirst",k[k.OverSecond=4]="OverSecond",k),Xe=((re={})[re.Bottom=0]="Bottom",re[re.Center=1]="Center",re[re.Top=2]="Top",re);(ae={})[ae.None=0]="None",ae[ae.UseDrawingBackground=1]="UseDrawingBackground",ae[ae.Custom=2]="Custom",(se={})[se.Horizontal=0]="Horizontal",se[se.Diagonal=1]="Diagonal",se[se.NotStacked=2]="NotStacked",(O={})[O.Scientific=1]="Scientific",O[O.Decimal=2]="Decimal",O[O.Engineering=3]="Engineering",O[O.Architectural=4]="Architectural",O[O.Fractional=5]="Fractional",O[O.WindowDesktop=6]="WindowDesktop",(W={})[W.Decimal=0]="Decimal",W[W.DegreesMinutesSecond=1]="DegreesMinutesSecond",W[W.Gradian=2]="Gradian",W[W.Radian=3]="Radian";var je=((me={})[me.PatternFill=0]="PatternFill",me[me.SolidFill=1]="SolidFill",me);(be={})[be.NonAssociative=0]="NonAssociative",be[be.Associative=1]="Associative",(ce={})[ce.Normal=0]="Normal",ce[ce.Outer=1]="Outer",ce[ce.Ignore=2]="Ignore",(le={})[le.UserDefined=0]="UserDefined",le[le.Predefined=1]="Predefined",le[le.Custom=2]="Custom",(Ne={})[Ne.NotAnnotated=0]="NotAnnotated",Ne[Ne.Annotated=1]="Annotated",(Oe={})[Oe.Solid=0]="Solid",Oe[Oe.Gradient=1]="Gradient",(Re={})[Re.TwoColor=0]="TwoColor",Re[Re.OneColor=1]="OneColor",(R={})[R.Default=0]="Default",R[R.External=1]="External",R[R.Polyline=2]="Polyline",R[R.Derived=4]="Derived",R[R.Textbox=8]="Textbox",R[R.Outermost=16]="Outermost",(Y={})[Y.Line=1]="Line",Y[Y.Circular=2]="Circular",Y[Y.Elliptic=3]="Elliptic",Y[Y.Spline=4]="Spline";var Ke=((D={})[D.Off=0]="Off",D[D.Solid=1]="Solid",D[D.Dashed=2]="Dashed",D[D.Dotted=3]="Dotted",D[D.ShotDash=4]="ShotDash",D[D.MediumDash=5]="MediumDash",D[D.LongDash=6]="LongDash",D[D.DoubleShortDash=7]="DoubleShortDash",D[D.DoubleMediumDash=8]="DoubleMediumDash",D[D.DoubleLongDash=9]="DoubleLongDash",D[D.DoubleMediumLongDash=10]="DoubleMediumLongDash",D[D.SparseDot=11]="SparseDot",D);Ke.Off,(de={})[de.Standard=-3]="Standard",de[de.ByLayer=-2]="ByLayer",de[de.ByBlock=-1]="ByBlock",(xe={})[xe.English=0]="English",xe[xe.Metric=1]="Metric",(d={})[d.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",d[d.FRONT_CLIPPING=2]="FRONT_CLIPPING",d[d.BACK_CLIPPING=4]="BACK_CLIPPING",d[d.UCS_FOLLOW=8]="UCS_FOLLOW",d[d.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",d[d.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",d[d.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",d[d.FAST_ZOOM=128]="FAST_ZOOM",d[d.SNAP_MODE=256]="SNAP_MODE",d[d.GRID_MODE=512]="GRID_MODE",d[d.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",d[d.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",d[d.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",d[d.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",d[d.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",d[d.UNUSED=32768]="UNUSED",d[d.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",d[d.VIEWPORT_OFF=131072]="VIEWPORT_OFF",d[d.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",d[d.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",d[d.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",d[d.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(b={})[b.OPTIMIZED_2D=0]="OPTIMIZED_2D",b[b.WIREFRAME=1]="WIREFRAME",b[b.HIDDEN_LINE=2]="HIDDEN_LINE",b[b.FLAT_SHADED=3]="FLAT_SHADED",b[b.GOURAUD_SHADED=4]="GOURAUD_SHADED",b[b.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",b[b.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(ye={})[ye.UCS_UNCHANGED=0]="UCS_UNCHANGED",ye[ye.HAS_OWN_UCS=1]="HAS_OWN_UCS",(N={})[N.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",N[N.TOP=1]="TOP",N[N.BOTTOM=2]="BOTTOM",N[N.FRONT=3]="FRONT",N[N.BACK=4]="BACK",N[N.LEFT=5]="LEFT",N[N.RIGHT=6]="RIGHT",(we={})[we.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",we[we.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",(z={})[z.ByLayer=0]="ByLayer",z[z.ByBlock=1]="ByBlock",z[z.ByDictionaryDefault=2]="ByDictionaryDefault",z[z.ByObject=3]="ByObject",(f={})[f.NotAllowed=0]="NotAllowed",f[f.AllowErase=1]="AllowErase",f[f.AllowTransform=2]="AllowTransform",f[f.AllowChangeColor=4]="AllowChangeColor",f[f.AllowChangeLayer=8]="AllowChangeLayer",f[f.AllowChangeLinetype=16]="AllowChangeLinetype",f[f.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",f[f.AllowChangeVisibility=64]="AllowChangeVisibility",f[f.AllowClone=128]="AllowClone",f[f.AllowChangeLineweight=256]="AllowChangeLineweight",f[f.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",f[f.AllowAllExceptClone=895]="AllowAllExceptClone",f[f.AllowAll=1023]="AllowAll",f[f.DisableProxyWarning=1024]="DisableProxyWarning",f[f.R13FormatProxy=32768]="R13FormatProxy",(X={})[X.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",X[X.CAST=1]="CAST",X[X.RECEIVE=2]="RECEIVE",X[X.IGNORE=3]="IGNORE",(Me={})[Me.RayTrace=0]="RayTrace",Me[Me.ShadowMap=1]="ShadowMap",(ue={})[ue.BeforeText=0]="BeforeText",ue[ue.AboveText=1]="AboveText",ue[ue.None=2]="None",(B={})[B.NONE=0]="NONE",B[B.INVISIBLE=1]="INVISIBLE",B[B.CONSTANT=2]="CONSTANT",B[B.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",B[B.PRESET=8]="PRESET",(_e={})[_e.MULTILINE=2]="MULTILINE",_e[_e.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(j={})[j.First=1]="First",j[j.Second=2]="Second",j[j.Third=4]="Third",j[j.Fourth=8]="Fourth",(K={})[K.ShowImage=1]="ShowImage",K[K.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",K[K.UseClippingBoundary=4]="UseClippingBoundary",K[K.TransparencyIsOn=8]="TransparencyIsOn",(Ve={})[Ve.Rectangular=1]="Rectangular",Ve[Ve.Polygonal=2]="Polygonal",(Fe={})[Fe.Outside=0]="Outside",Fe[Fe.Inside=1]="Inside",($={})[$.TextAnnotation=0]="TextAnnotation",$[$.ToleranceAnnotation=1]="ToleranceAnnotation",$[$.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",$[$.NoAnnotation=3]="NoAnnotation",(Ae={})[Ae.Distant=1]="Distant",Ae[Ae.Point=2]="Point",Ae[Ae.Spot=3]="Spot",(fe={})[fe.None=0]="None",fe[fe.InverseLinear=1]="InverseLinear",fe[fe.InverseSquare=2]="InverseSquare",(ve={})[ve.IS_CLOSED=1]="IS_CLOSED",ve[ve.PLINE_GEN=128]="PLINE_GEN",(Ie={})[Ie.Top=0]="Top",Ie[Ie.Zero=1]="Zero",Ie[Ie.Bottom=2]="Bottom",(Z={})[Z.HasVertex=1]="HasVertex",Z[Z.Closed=2]="Closed",Z[Z.SuppressStartCaps=4]="SuppressStartCaps",Z[Z.SuppressEndCaps=8]="SuppressEndCaps",(De={})[De.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",De[De.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",De[De.BY_STYLE=5]="BY_STYLE",(C={})[C.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",C[C.CURVE_FIT=2]="CURVE_FIT",C[C.SPLINE_FIT=4]="SPLINE_FIT",C[C.POLYLINE_3D=8]="POLYLINE_3D",C[C.POLYGON_3D=16]="POLYGON_3D",C[C.CLOSED_POLYGON=32]="CLOSED_POLYGON",C[C.POLYFACE=64]="POLYFACE",C[C.CONTINUOUS=128]="CONTINUOUS";var Be=((q={})[q.NONE=0]="NONE",q[q.QUADRATIC=5]="QUADRATIC",q[q.CUBIC=6]="CUBIC",q[q.BEZIER=8]="BEZIER",q);(x={})[x.NONE=0]="NONE",x[x.CLOSED=1]="CLOSED",x[x.PERIODIC=2]="PERIODIC",x[x.RATIONAL=4]="RATIONAL",x[x.PLANAR=8]="PLANAR",x[x.LINEAR=16]="LINEAR",(Te={})[Te.NONE=0]="NONE",Te[Te.MIRRORED_X=2]="MIRRORED_X",Te[Te.MIRRORED_Y=4]="MIRRORED_Y",(y={})[y.LEFT=0]="LEFT",y[y.CENTER=1]="CENTER",y[y.RIGHT=2]="RIGHT",y[y.ALIGNED=3]="ALIGNED",y[y.MIDDLE=4]="MIDDLE",y[y.FIT=5]="FIT",(J={})[J.BASELINE=0]="BASELINE",J[J.BOTTOM=1]="BOTTOM",J[J.MIDDLE=2]="MIDDLE",J[J.TOP=3]="TOP";var $e=((P={})[P.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",P[P.TANGENT_DEFINED=2]="TANGENT_DEFINED",P[P.NOT_USED=4]="NOT_USED",P[P.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",P[P.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",P[P.FOR_POLYLINE=32]="FOR_POLYLINE",P[P.FOR_POLYGON=64]="FOR_POLYGON",P[P.POLYFACE=128]="POLYFACE",P);(Q={})[Q.ShowImage=1]="ShowImage",Q[Q.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Q[Q.UseClippingBoundary=4]="UseClippingBoundary",Q[Q.Transparency=8]="Transparency",(w={})[w.NOT_APPLICABLE=0]="NOT_APPLICABLE",w[w.KEEP_EXISTING=1]="KEEP_EXISTING",w[w.USE_CLONE=2]="USE_CLONE",w[w.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",w[w.VALUE_NAME=4]="VALUE_NAME",w[w.UNMANGLE_NAME=5]="UNMANGLE_NAME",(ge={})[ge.NOUNIT=0]="NOUNIT",ge[ge.CENTIMETERS=2]="CENTIMETERS",ge[ge.INCH=5]="INCH",(ke={})[ke.PSLTSCALE=1]="PSLTSCALE",ke[ke.LIMCHECK=2]="LIMCHECK",(pe={})[pe.INCHES=0]="INCHES",pe[pe.MILLIMETERS=1]="MILLIMETERS",pe[pe.PIXELS=2]="PIXELS",(M={})[M.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",M[M.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",M[M.DRAWING_LIMITS=2]="DRAWING_LIMITS",M[M.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",M[M.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",M[M.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION",(ee={})[ee.AS_DISPLAYED=0]="AS_DISPLAYED",ee[ee.WIREFRAME=1]="WIREFRAME",ee[ee.HIDDEN=2]="HIDDEN",ee[ee.RENDERED=3]="RENDERED",(_={})[_.DRAFT=0]="DRAFT",_[_.PREVIEW=1]="PREVIEW",_[_.NORMAL=2]="NORMAL",_[_.PRESENTATION=3]="PRESENTATION",_[_.MAXIMUM=4]="MAXIMUM",_[_.CUSTOM=5]="CUSTOM",Ge.Above,Ge.Center,Le.Trailing,Le.Feet,Ye.None,ze.Center,Xe.Center,Le.Trailing,Le.Feet,Le.Trailing,Le.Trailing,(te={})[te.NONE=0]="NONE",te[te.AbsoluteRotation=1]="AbsoluteRotation",te[te.TextEmbedded=2]="TextEmbedded",te[te.ShapeEmbedded=4]="ShapeEmbedded",(Ue={})[Ue.PaperSpace=1]="PaperSpace",(he={})[he.XrefDependent=16]="XrefDependent",he[he.XrefResolved=32]="XrefResolved",he[he.Referenced=64]="Referenced",(V={})[V.Off=0]="Off",V[V.Perspective=1]="Perspective",V[V.ClipFront=2]="ClipFront",V[V.ClipBack=4]="ClipBack",V[V.UcsFollow=8]="UcsFollow",V[V.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class He{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="ATTDEF"?this.convertAttributeDefinition(e):e.type=="ATTRIB"?this.convertAttribute(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="MLINE"?this.convertMLine(e):e.type=="MULTILEADER"||e.type=="MLEADER"?this.convertMLeader(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SHAPE"?this.convertShape(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new i.AcDbFace;return e.vertices.forEach((n,r)=>t.setVertexAt(r,n)),t}convertArc(e){const t=e.extrusionDirection??i.AcGeVector3d.Z_AXIS;return new i.AcDbArc(i.transformOcsPointToWcs(e.center,t),e.radius,i.AcGeMathUtil.degToRad(e.startAngle),i.AcGeMathUtil.degToRad(e.endAngle),t)}convertAttributeCommon(e,t){t.textString=e.text,t.height=e.textHeight,t.position.copy(e.startPoint);const n=e.alignmentPoint,r=!n||n.x===0&&n.y===0&&(n.z??0)===0;n&&!r?t.alignmentPoint.copy(n):t.alignmentPoint.copy(e.startPoint),t.rotation=e.rotation,t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.tag=e.tag,t.fieldLength=0,t.isInvisible=(e.attributeFlag&i.AcDbAttributeFlags.Invisible)!==0,t.isConst=(e.attributeFlag&i.AcDbAttributeFlags.Const)!==0,t.isVerifiable=(e.attributeFlag&i.AcDbAttributeFlags.Verifiable)!==0,t.isPreset=(e.attributeFlag&i.AcDbAttributeFlags.Preset)!==0,t.isReallyLocked=!!e.isReallyLocked,t.isMTextAttribute=(e.mtextFlag&i.AcDbAttributeMTextFlag.MultiLine)!==0,t.isConstMTextAttribute=(e.mtextFlag&i.AcDbAttributeMTextFlag.ConstMultiLine)!==0}convertAttribute(e){const t=new i.AcDbAttribute;return this.convertAttributeCommon(e,t),t.styleName=e.textStyle,t.horizontalMode=e.horizontalJustification,t.verticalMode=e.verticalJustification,t.widthFactor=e.scale??1,t.lockPositionInBlock=e.lockPositionFlag,t}convertAttributeDefinition(e){const t=new i.AcDbAttributeDefinition;return this.convertAttributeCommon(e,t),t.styleName=e.styleName,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t.prompt=e.prompt,t}convertCirle(e){const t=e.extrusionDirection??i.AcGeVector3d.Z_AXIS;return new i.AcDbCircle(i.transformOcsPointToWcs(e.center,t),e.radius,t)}convertEllipse(e){const t=new i.AcGeVector3d(e.majorAxisEndPoint),n=t.length();return new i.AcDbEllipse(e.center,e.extrusionDirection??i.AcGeVector3d.Z_AXIS,t,n,n*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,n=e.endPoint;return new i.AcDbLine(new i.AcGePoint3d(t.x,t.y,t.z||0),new i.AcGePoint3d(n.x,n.y,n.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new i.AcDbSpline(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0)return new i.AcDbSpline(e.fitPoints,"Uniform",e.degree,!!(e.flag&1))}catch{}return null}convertPoint(e){const t=new i.AcDbPoint;return t.position=e.position,t}convertShape(e){const t=new i.AcDbShape;return t.position.copy(e.insertionPoint),t.size=e.size,t.name=e.shapeName,t.rotation=i.AcGeMathUtil.degToRad(e.rotation||0),t.widthFactor=e.xScale??1,t.oblique=i.AcGeMathUtil.degToRad(e.obliqueAngle||0),t.thickness=e.thickness??0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}convertSolid(e){const t=new i.AcDbTrace;return e.points.forEach((n,r)=>t.setPointAt(r,n)),t.thickness=e.thickness,t}convertPolyline(e){var u;const t=!!(e.flag&1),n=!!(e.flag&8),r=!!(e.flag&16),a=!!(e.flag&64),o=!!(e.flag&32),s=[],l=[],A=[];if((u=e.vertices)==null||u.map(c=>{c.flag&$e.SPLINE_CONTROL_POINT||(a&&c.flag&128?c.flag&64?(s.push({x:c.x,y:c.y,z:c.z}),l.push(c.bulge??0)):c.faces&&c.faces.length>=3&&A.push([...c.faces]):(s.push({x:c.x,y:c.y,z:c.z}),l.push(c.bulge??0)))}),r){const c=e.meshMVertexCount,p=e.meshNVertexCount;return new i.AcDbPolygonMesh(c,p,s,t,o)}else{if(a)return new i.AcDbPolyFaceMesh(s,A);if(n){let c=i.AcDbPoly3dType.SimplePoly;return e.flag&4&&(e.smoothType==Be.CUBIC?c=i.AcDbPoly3dType.CubicSplinePoly:e.smoothType==Be.QUADRATIC&&(c=i.AcDbPoly3dType.QuadSplinePoly)),new i.AcDb3dPolyline(c,s,t)}else{let c=i.AcDbPoly2dType.SimplePoly;return e.flag&2?c=i.AcDbPoly2dType.FitCurvePoly:e.flag&4&&(e.smoothType==Be.CUBIC?c=i.AcDbPoly2dType.CubicSplinePoly:e.smoothType==Be.QUADRATIC&&(c=i.AcDbPoly2dType.QuadSplinePoly)),new i.AcDb2dPolyline(c,s,0,t,e.startWidth,e.endWidth,l)}}}convertLWPolyline(e){var r;const t=new i.AcDbPolyline;t.closed=!!(e.flag&1);const n=e.constantWidth??-1;return(r=e.vertices)==null||r.forEach((a,o)=>{t.addVertexAt(o,new i.AcGePoint2d(a.x,a.y),a.bulge,a.startWidth??n,a.endWidth??n)}),t}convertHatch(e){var r;const t=new i.AcDbHatch;if((r=e.definitionLines)==null||r.forEach(a=>{t.definitionLines.push({angle:i.AcGeMathUtil.degToRad(a.angle||0),base:a.base,offset:a.offset,dashLengths:a.numberOfDashLengths>0?a.dashLengths:[]})}),t.isSolidFill=e.solidFill==je.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:i.AcGeMathUtil.degToRad(e.patternAngle),t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(a=>{if(a.boundaryPathTypeFlag&2){const s=a,l=new i.AcGePolyline2d;l.closed=s.isClosed,s.vertices.forEach((A,u)=>{l.addVertexAt(u,{x:A.x,y:A.y,bulge:A.bulge})}),t.add(l)}else{const s=a,l=[];s.edges.forEach(u=>{if(u.type==1){const c=u;l.push(new i.AcGeLine2d(c.start,c.end))}else if(u.type==2){const c=u;l.push(new i.AcGeCircArc2d(c.center,c.radius,i.AcGeMathUtil.degToRad(c.startAngle||0),i.AcGeMathUtil.degToRad(c.endAngle||0),!c.isCCW))}else if(u.type==3){const c=u;new i.AcGeVector2d().subVectors(c.end,c.center);const g=Math.sqrt(Math.pow(c.end.x,2)+Math.pow(c.end.y,2)),I=g*c.lengthOfMinorAxis;let T=i.AcGeMathUtil.degToRad(c.startAngle||0),F=i.AcGeMathUtil.degToRad(c.endAngle||0);const ne=Math.atan2(c.end.y,c.end.x);c.isCCW||(T=Math.PI*2-T,F=Math.PI*2-F),l.push(new i.AcGeEllipseArc2d({...c.center,z:0},g,I,T,F,!c.isCCW,ne))}else if(u.type==4){const c=u;if(c.numberOfControlPoints>0&&c.numberOfKnots>0){const p=c.controlPoints.map(T=>({x:T.x,y:T.y,z:0}));let g=!0;const I=c.controlPoints.map(T=>(T.weight==null&&(g=!1),T.weight||1));l.push(new i.AcGeSpline3d(p,c.knots,g?I:void 0))}else if(c.numberOfFitData>0){const p=c.fitDatum.map(g=>({x:g.x,y:g.y,z:0}));l.push(new i.AcGeSpline3d(p,"Uniform"))}}});const A=i.AcGeLoop2d.buildFromEdges(l);A.length==0&&l.length>0?t.add(new i.AcGeLoop2d(l)):A.forEach(u=>t.add(u))}}),e.gradientFlag){const a=e;if(t.hatchObjectType=i.AcDbHatchObjectType.GradientObject,t.gradientName=a.gradientName,t.gradientAngle=a.gradientRotation??0,t.gradientShift=a.gradientDefinition??0,t.gradientOneColorMode=a.gradientColorFlag==1,t.shadeTintValue=a.colorTint??0,a.gradientColors){const o=a.gradientColors.length;o>1?(t.gradientStartColor=a.gradientColors[0].rgb,t.gradientEndColor=a.gradientColors[1].rgb):o>0&&(t.gradientStartColor=a.gradientColors[0].rgb)}}return t}convertTable(e){const t=new i.AcDbTable(e.name,e.rowCount,e.columnCount);return t.tableDataVersion=e.version,t.tableStyleId=e.tableStyleId,t.owningBlockRecordId=e.blockRecordHandle,e.directionVector&&(t.horizontalDirection=new i.AcGeVector3d(e.directionVector)),t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),t.tableValueFlag=e.tableValue,t.tableOverrideFlag=e.overrideFlag,t.borderColorOverrideFlag=e.borderColorOverrideFlag,t.borderLineweightOverrideFlag=e.borderLineWeightOverrideFlag,t.borderVisibilityOverrideFlag=e.borderVisibilityOverrideFlag,e.columnWidthArr.forEach((n,r)=>t.setColumnWidth(r,n)),e.rowHeightArr.forEach((n,r)=>t.setRowHeight(r,n)),e.cells.forEach((n,r)=>{t.setCell(r,n)}),t}convertText(e){const t=new i.AcDbText;t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint);const n=e.endPoint,r=!n||n.x===0&&n.y===0&&(n.z??0)===0;return n&&!r?t.alignmentPoint.copy(n):t.alignmentPoint.copy(e.startPoint),t.rotation=i.AcGeMathUtil.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new i.AcDbMText;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=i.AcGeMathUtil.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new i.AcGeVector3d(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){var n;const t=new i.AcDbLeader;return(n=e.vertices)==null||n.forEach(r=>{t.appendVertex(r)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isHookLineSameDirection=e.isHooklineSameDirection,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName??"",t.annoType=e.leaderCreationFlag,t.textHeight=e.textHeight??0,t.textWidth=e.textWidth??0,t.byBlockColor=e.byBlockColor,t.associatedAnnotation=e.associatedAnnotation??"",e.normal&&(t.normal=e.normal),e.horizontalDirection&&(t.horizontalDirection=e.horizontalDirection),e.offsetFromBlock&&(t.offsetFromBlock=e.offsetFromBlock),e.offsetFromAnnotation&&(t.offsetFromAnnotation=e.offsetFromAnnotation),t}convertMLine(e){const t=new i.AcDbMLine;return t.styleName=e.name||"STANDARD",t.styleObjectHandle=e.styleObjectHandle,t.scale=e.scale,t.justification=e.justification,t.flags=e.flags,t.styleCount=e.styleCount,t.startPosition=e.startPosition,t.normal=e.extrusionDirection??i.AcGeVector3d.Z_AXIS,t.segments=(e.segments??[]).map(n=>{var r;return{position:n.position,direction:n.direction,miterDirection:n.miterDirection,elements:((r=n.elements)==null?void 0:r.map(a=>({parameterCount:a.parameterCount,parameters:a.parameters??[],fillCount:a.fillCount,fillParameters:a.fillParameters??[]})))??[]}}),t}convertMLeader(e){var Ee,Se;const t=new i.AcDbMLeader,n=e;t.version=e.version,t.leaderStyleId=e.leaderStyleId,e.leaderStyleId&&(t.mleaderStyleId=e.leaderStyleId),t.propertyOverrideFlag=e.propertyOverrideFlag,t.leaderLineType=e.leaderLineType??i.AcDbMLeaderLineType.StraightLeader,t.leaderLineColor=e.leaderLineColor,t.leaderLineTypeId=e.leaderLineTypeId,t.leaderLineWeight=e.leaderLineWeight,t.landingEnabled=e.landingEnabled,t.doglegEnabled=e.doglegEnabled??!1,t.doglegLength=e.doglegLength??0,t.arrowheadId=e.arrowheadId,t.arrowheadSize=e.arrowheadSize,t.textStyleId=e.textStyleId,t.textLeftAttachmentType=e.textLeftAttachmentType,t.textRightAttachmentType=e.textRightAttachmentType,t.textAngleType=e.textAngleType,t.textAlignmentType=e.textAlignmentType,t.textColor=e.textColor,t.textFrameEnabled=e.textFrameEnabled,t.landingGap=e.landingGap,t.textAttachment=e.textAttachment,t.textFlowDirection=e.textFlowDirection,t.blockContentId=e.blockContentId,t.blockContentColor=e.blockContentColor,t.blockContentRotation=e.blockContentRotation,t.blockContentConnectionType=e.blockContentConnectionType,t.annotativeScaleEnabled=e.annotativeScaleEnabled,t.arrowheadOverrides=e.arrowheadOverrides?e.arrowheadOverrides.map(E=>({...E})):[],t.blockAttributes=e.blockAttributes?e.blockAttributes.map(E=>({...E})):[],t.textDirectionNegative=e.textDirectionNegative,t.textAlignInIPE=e.textAlignInIPE,t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection,t.topTextAttachmentDirection=e.topTextAttachmentDirection,t.contentScale=e.contentScale,t.textLineSpacingStyle=e.textLineSpacingStyle,t.textBackgroundColor=e.textBackgroundColor,t.textBackgroundScaleFactor=e.textBackgroundScaleFactor,t.textBackgroundTransparency=e.textBackgroundTransparency,t.textBackgroundColorOn=e.textBackgroundColorOn,t.textFillOn=e.textFillOn,t.textColumnType=e.textColumnType,t.textUseAutoHeight=e.textUseAutoHeight,t.textColumnWidth=e.textColumnWidth,t.textColumnGutterWidth=e.textColumnGutterWidth,t.textColumnFlowReversed=e.textColumnFlowReversed,t.textColumnHeight=e.textColumnHeight,t.textUseWordBreak=e.textUseWordBreak,t.hasMText=e.hasMText,t.hasBlock=e.hasBlock,t.planeNormalReversed=e.planeNormalReversed,e.blockContentScale&&(t.blockContentScale=new i.AcGeVector3d(e.blockContentScale)),e.contentBasePosition&&(t.contentBasePosition=new i.AcGePoint3d().copy(e.contentBasePosition)),e.textAnchor&&(t.textAnchor=new i.AcGePoint3d().copy(e.textAnchor)),e.planeOrigin&&(t.planeOrigin=new i.AcGePoint3d().copy(e.planeOrigin)),e.planeXAxisDirection&&(t.planeXAxisDirection=new i.AcGeVector3d(e.planeXAxisDirection)),e.planeYAxisDirection&&(t.planeYAxisDirection=new i.AcGeVector3d(e.planeYAxisDirection));const r=n.textContent,a=r&&typeof r=="object"?r:void 0,o=typeof r=="string"&&r.length>0||this.readString(a??{},["text","contents"])!=null||this.readString(n,["text","contents","mtext"])!=null,s=e.contentType??(o?i.AcDbMLeaderContentType.MTextContent:e.blockContent?i.AcDbMLeaderContentType.BlockContent:i.AcDbMLeaderContentType.NoneContent);t.contentType=s;const l=this.readPoint(n,["normal","extrusionDirection"]);l&&(t.normal=l);const A=this.readString(a??{},["styleName","textStyleName","textStyle"])??this.readString(n,["textStyleName","textStyle","styleName","textStyleId"]);A&&(t.textStyleName=A);const u=this.readPositiveNumber(a??{},["textHeight","height"])??this.readPositiveNumber(n,["textHeight","mtextHeight","textContentHeight"])??this.readPositiveNumber(n,["arrowheadSize","contentScale"]);u!=null&&(t.textHeight=u);const c=this.readPositiveNumber(a??{},["textWidth","width"])??this.readPositiveNumber(n,["textWidth","mtextWidth","textContentWidth"]);c!=null&&(t.textWidth=c),t.textLineSpacingFactor=this.readNumber(a??{},["lineSpacingFactor","textLineSpacingFactor"])??this.readNumber(n,["textLineSpacingFactor"])??t.textLineSpacingFactor;const p=this.readNumber(a??{},["textRotation","rotation"])??this.readNumber(n,["textRotation","mtextRotation","textContentRotation"]);p!=null&&(t.textRotation=i.AcGeMathUtil.degToRad(p));const g=this.readPoint(n,["textDirection","mtextDirection","textDirectionVector"]);g&&(t.textDirection=g);const I=this.readNumber(n,["textAttachmentPoint","attachmentPoint"]);I!=null&&(t.textAttachmentPoint=I);const T=e.textAttachmentDirection;T!=null&&(t.textAttachmentDirection=T);const F=this.readNumber(n,["textDrawingDirection","drawingDirection"]);F!=null&&(t.textDrawingDirection=F);const ne=typeof r=="string"?r:this.readString(a??{},["text","contents"])??this.readString(n,["text","contents","mtext"]),U=this.readPoint(a??{},["anchorPoint","textAnchor","textLocation","textPosition","textAnchorPoint"])??this.readPoint(n,["textAnchor","textLocation","textPosition","textAnchorPoint","contentBasePosition"]);if(ne!=null&&U&&(t.mtextContent={text:ne,anchorPoint:U}),e.blockContent){const E=e.blockContent;t.blockContent={blockContentId:e.blockContent.blockContentId,normal:this.readPoint(E,["normal"]),position:e.blockContent.position,scale:this.readPoint(E,["scale"]),rotation:this.readNumber(E,["rotation"]),color:this.readNumber(E,["color"]),transformationMatrix:Array.isArray(e.blockContent.transformationMatrix)?e.blockContent.transformationMatrix:[]}}else e.blockContentId&&(t.blockContent={blockContentId:e.blockContentId,scale:e.blockContentScale,rotation:e.blockContentRotation,color:e.blockContentColor,transformationMatrix:[]});return(Ee=this.readMLeaderLeaders(n))==null||Ee.forEach(E=>{t.addLeader({lastLeaderLinePoint:E.lastLeaderLinePoint,lastLeaderLinePointSet:E.lastLeaderLinePointSet,doglegVector:E.doglegVector,doglegVectorSet:E.doglegVectorSet,doglegLength:E.doglegLength??e.doglegLength,breaks:E.breaks,leaderBranchIndex:E.leaderBranchIndex,leaderLines:E.leaderLines})}),t.numberOfLeaders===0&&((Se=this.readLeaderLineArray(n))==null||Se.forEach(E=>{t.addLeader({doglegLength:e.doglegLength}),t.addLeaderLine(t.numberOfLeaders-1,E)})),t.numberOfLeaders===0&&e.contentBasePosition&&t.addLeader({lastLeaderLinePoint:e.contentBasePosition,lastLeaderLinePointSet:!0,doglegLength:e.doglegLength}),t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"){const t=e,n=new i.AcDbAlignedDimension(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(n.dimBlockPosition={...t.insertionPoint,z:0}),n.rotation=i.AcGeMathUtil.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbRotatedDimension"){const t=e,n=new i.AcDbRotatedDimension(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(n.dimBlockPosition={...t.insertionPoint,z:0}),n.rotation=i.AcGeMathUtil.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,n=new i.AcDb3PointAngularDimension(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,n=new i.AcDbOrdinateDimension(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,n=new i.AcDbRadialDimension(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,n=new i.AcDbDiametricDimension(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,n),n}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(n=>{t.clipBoundary.push(new i.AcGePoint2d(n))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new i.AcDbRasterImage;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(n=>{t.clipBoundary.push(new i.AcGePoint2d(n))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new i.AcDbWipeout;return this.processWipeout(e,t),t}convertViewport(e){const t=new i.AcDbViewport;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new i.AcDbRay;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new i.AcDbXline;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new i.AcDbBlockReference(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?i.AcGeMathUtil.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){if(t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle.toString()),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null||e.colorIndex!=null||e.colorName){const n=new i.AcCmColor;e.color!=null&&n.setRGBValue(e.color),e.colorIndex!=null&&(n.colorIndex=e.colorIndex),e.colorName&&(n.colorName=e.colorName),t.color=n}e.isVisible!=null&&(t.visibility=!e.isVisible),e.transparency!=null&&(t.transparency=i.AcCmTransparency.deserialize(e.transparency))}readNumber(e,t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}readPositiveNumber(e,t){const n=this.readNumber(e,t);return n!=null&&n>0?n:void 0}readString(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}readBoolean(e,t){for(const n of t){const r=e[n];if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0}}readPoint(e,t){for(const n of t){const r=e[n];if(this.isPointLike(r))return r;if(Array.isArray(r)&&typeof r[0]=="number"&&typeof r[1]=="number")return{x:r[0],y:r[1],z:r[2]??0}}}readLeaderLineArray(e){const t=e.leaderLines;if(Array.isArray(t))return t.map(r=>{if(!r||typeof r!="object")return;const a=r.vertices;return Array.isArray(a)?a.filter(o=>this.isPointLike(o)):void 0}).filter(r=>!!r&&r.length>0);const n=e.vertices;if(Array.isArray(n)){const r=n.filter(a=>this.isPointLike(a));return r.length>0?[r]:void 0}}readMLeaderLeaders(e){const t=e.leaderSections;if(!Array.isArray(t))return;const n=[];return t.forEach(r=>{if(!r||typeof r!="object")return;const a=r,o=a.leaderLines,s=Array.isArray(o)?o.reduce((I,T)=>{const F=this.readMLeaderLine(T);return F&&I.push(F),I},[]):void 0,l={},A=this.readPoint(a,["lastLeaderLinePoint"]),u=this.readPoint(a,["doglegVector"]),c=this.readNumber(a,["doglegLength"]),p=this.readMLeaderBreaks(a.breaks),g=this.readNumber(a,["leaderBranchIndex"]);A&&(l.lastLeaderLinePoint=A),a.lastLeaderLinePointSet!=null&&(l.lastLeaderLinePointSet=this.readBoolean(a,["lastLeaderLinePointSet"])),u&&(l.doglegVector=u),a.doglegVectorSet!=null&&(l.doglegVectorSet=this.readBoolean(a,["doglegVectorSet"])),c!=null&&(l.doglegLength=c),p&&(l.breaks=p),g!=null&&(l.leaderBranchIndex=g),s&&(l.leaderLines=s),n.push(l)}),n}readMLeaderLine(e){if(!e||typeof e!="object")return;const t=e,n=t.vertices,r=Array.isArray(n)?n.filter(l=>this.isPointLike(l)):[],a=this.readMLeaderBreaks(t.breaks),o=Array.isArray(t.breakPointIndexes)?t.breakPointIndexes.filter(l=>typeof l=="number"):void 0,s=this.readNumber(t,["leaderLineIndex"]);return r.length>0||a&&a.length>0?{vertices:r,breakPointIndexes:o,leaderLineIndex:s,breaks:a}:void 0}readMLeaderBreaks(e){if(!Array.isArray(e))return;const t=e.map(n=>{if(!n||typeof n!="object")return;const r=n,a=this.readPoint(r,["start"]),o=this.readPoint(r,["end"]),s=this.readNumber(r,["index"]);if(!a||!o)return;const l={start:a,end:o};return s!=null&&(l.index=s),l}).filter(n=>!!n);return t.length>0?t:void 0}isPointLike(e){return!!e&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"}}class Ze{convertLayout(e,t){var a,o;const n=new i.AcDbLayout;n.layoutName=e.layoutName,n.tabOrder=e.tabOrder,n.plotSettingsName=e.pageSetupName,n.plotCfgName=e.configName,n.canonicalMediaName=e.paperSize,n.plotViewName=e.plotViewName,n.currentStyleSheet=e.currentStyleSheet,n.plotPaperMargins={left:e.marginLeft,right:e.marginRight,top:e.marginTop,bottom:e.marginBottom},n.plotPaperSize.copy({x:e.paperWidth,y:e.paperHeight}),n.plotOrigin.copy({x:e.plotOriginX,y:e.plotOriginY}),n.plotWindowArea.min.copy({x:e.windowAreaXMin,y:e.windowAreaYMin}),n.plotWindowArea.max.copy({x:e.windowAreaXMax,y:e.windowAreaYMax}),n.customPrintScale={numerator:e.printScaleNumerator,denominator:e.printScaleDenominator},n.plotPaperUnits=e.plotPaperUnit,n.plotRotation=e.plotRotation,n.plotType=e.plotType,n.stdScaleType=e.standardScaleType,n.shadePlot=(()=>{switch(e.shadePlotMode){case 1:return i.AcDbPlotShadePlotType.kWireframe;case 2:return i.AcDbPlotShadePlotType.kHidden;case 3:return i.AcDbPlotShadePlotType.kRendered;default:return i.AcDbPlotShadePlotType.kAsDisplayed}})(),n.shadePlotResLevel=(()=>{switch(e.shadePlotResolution){case 1:return i.AcDbPlotShadePlotResLevel.kPreview;case 2:return i.AcDbPlotShadePlotResLevel.kNormal;case 3:return i.AcDbPlotShadePlotResLevel.kPresentation;case 4:return i.AcDbPlotShadePlotResLevel.kMaximum;case 5:return i.AcDbPlotShadePlotResLevel.kCustom;default:return i.AcDbPlotShadePlotResLevel.kDraft}})(),e.shadePlotCustomDPI!=null&&(n.shadePlotCustomDPI=e.shadePlotCustomDPI),e.shadePlotId&&(n.shadePlotId=e.shadePlotId);const r=e.layoutFlag??0;if(n.plotViewportBorders=(r&1)!==0,n.showPlotStyles=(r&2)!==0,n.plotCentered=(r&4)!==0,n.plotHidden=(r&8)!==0,n.useStandardScale=(r&16)!==0,n.plotPlotStyles=(r&32)!==0,n.scaleLineweights=(r&64)!==0,n.printLineweights=(r&128)!==0,n.drawViewportsFirst=(r&512)!==0,n.modelType=(r&1024)!==0,e.viewportId&&n.viewportArray.push(e.viewportId),e.layoutName==="Model"){const s=i.AcDbBlockTableRecord.MODEL_SPACE_NAME.toUpperCase();(a=t.tables.BLOCK_RECORD)==null||a.entries.some(l=>l.name.toUpperCase()===s?(n.blockTableRecordId=l.handle,!0):!1)}else(o=t.tables.BLOCK_RECORD)==null||o.entries.some(s=>s.layoutObjects===e.handle?(n.blockTableRecordId=s.handle,!0):!1),n.blockTableRecordId||(n.blockTableRecordId=e.paperSpaceTableId);return e.minLimit&&n.limits.min.copy(e.minLimit),e.maxLimit&&n.limits.max.copy(e.maxLimit),e.minExtent&&n.extents.min.copy(e.minExtent),e.maxExtent&&n.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,n),n}convertImageDef(e){const t=new i.AcDbRasterImageDef;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}convertMLeaderStyle(e){const t=new i.AcDbMLeaderStyle;return t.unknown1=e.unknown1,e.contentType!=null&&(t.contentType=e.contentType),e.drawMLeaderOrderType!=null&&(t.drawMLeaderOrderType=e.drawMLeaderOrderType),e.drawLeaderOrderType!=null&&(t.drawLeaderOrderType=e.drawLeaderOrderType),e.maxLeaderSegmentPoints!=null&&(t.maxLeaderSegmentPoints=e.maxLeaderSegmentPoints),e.firstSegmentAngleConstraint!=null&&(t.firstSegmentAngleConstraint=e.firstSegmentAngleConstraint),e.secondSegmentAngleConstraint!=null&&(t.secondSegmentAngleConstraint=e.secondSegmentAngleConstraint),e.leaderLineType!=null&&(t.leaderLineType=e.leaderLineType),e.leaderLineColor!=null&&(t.leaderLineColor=i.decodeMLeaderStyleRawColor(e.leaderLineColor)),t.leaderLineTypeId=e.leaderLineTypeId,e.leaderLineWeight!=null&&(t.leaderLineWeight=e.leaderLineWeight),e.landingEnabled!=null&&(t.landingEnabled=e.landingEnabled),e.landingGap!=null&&(t.landingGap=e.landingGap),e.doglegEnabled!=null&&(t.doglegEnabled=e.doglegEnabled),e.doglegLength!=null&&(t.doglegLength=e.doglegLength),e.description!=null&&(t.description=e.description),t.arrowheadId=e.arrowheadId,e.arrowheadSize!=null&&(t.arrowheadSize=e.arrowheadSize),e.defaultMTextContents!=null&&(t.defaultMTextContents=e.defaultMTextContents),t.textStyleId=e.textStyleId,e.textLeftAttachmentType!=null&&(t.textLeftAttachmentType=e.textLeftAttachmentType),e.textAngleType!=null&&(t.textAngleType=e.textAngleType),e.textAlignmentType!=null&&(t.textAlignmentType=e.textAlignmentType),e.textRightAttachmentType!=null&&(t.textRightAttachmentType=e.textRightAttachmentType),e.textColor!=null&&(t.textColor=i.decodeMLeaderStyleRawColor(e.textColor)),e.textHeight!=null&&(t.textHeight=e.textHeight),e.textFrameEnabled!=null&&(t.textFrameEnabled=e.textFrameEnabled),e.textAlignAlwaysLeft!=null&&(t.textAlignAlwaysLeft=e.textAlignAlwaysLeft),e.alignSpace!=null&&(t.alignSpace=e.alignSpace),t.blockContentId=e.blockContentId,e.blockContentColor!=null&&(t.blockContentColor=i.decodeMLeaderStyleRawColor(e.blockContentColor)),e.blockContentScale&&(t.blockContentScale={x:e.blockContentScale.x,y:e.blockContentScale.y,z:e.blockContentScale.z??1}),e.blockContentScaleEnabled!=null&&(t.blockContentScaleEnabled=e.blockContentScaleEnabled),e.blockContentRotation!=null&&(t.blockContentRotation=e.blockContentRotation),e.blockContentRotationEnabled!=null&&(t.blockContentRotationEnabled=e.blockContentRotationEnabled),e.blockContentConnectionType!=null&&(t.blockContentConnectionType=e.blockContentConnectionType),e.scale!=null&&(t.scale=e.scale),e.overwritePropertyValue!=null&&(t.overwritePropertyValue=e.overwritePropertyValue),e.annotative!=null&&(t.annotative=e.annotative),e.breakGapSize!=null&&(t.breakGapSize=e.breakGapSize),e.textAttachmentDirection!=null&&(t.textAttachmentDirection=e.textAttachmentDirection),e.bottomTextAttachmentDirection!=null&&(t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection),e.topTextAttachmentDirection!=null&&(t.topTextAttachmentDirection=e.topTextAttachmentDirection),t.unknown2=e.unknown2,this.processCommonAttrs(e,t),t}convertMLineStyle(e){var r;const t=new i.AcDbMlineStyle;if(e.styleName!=null&&(t.styleName=e.styleName),e.flags!=null&&(t.flags=e.flags),e.description!=null&&(t.description=e.description),e.fillColor!=null)t.fillColor=new i.AcCmColor().setRGBValue(e.fillColor);else if(e.fillColorIndex!=null){const a=new i.AcCmColor;a.colorIndex=e.fillColorIndex,t.fillColor=a}e.startAngle!=null&&(t.startAngle=e.startAngle),e.endAngle!=null&&(t.endAngle=e.endAngle);const n=Math.max(e.elementCount??0,((r=e.elements)==null?void 0:r.length)??0);return n>0&&(t.elements=Array.from({length:n},(a,o)=>{var s,l,A,u;return{offset:((l=(s=e.elements)==null?void 0:s[o])==null?void 0:l.offset)??0,color:(()=>{var p,g,I,T;const c=new i.AcCmColor;return((g=(p=e.elements)==null?void 0:p[o])==null?void 0:g.color)!=null?c.setRGBValue(e.elements[o].color):c.colorIndex=((T=(I=e.elements)==null?void 0:I[o])==null?void 0:T.colorIndex)??256,c})(),lineType:((u=(A=e.elements)==null?void 0:A[o])==null?void 0:u.lineType)??"BYLAYER"}})),this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}}class qe extends i.AcDbDatabaseConverter{constructor(e={}){super(e),this.config.parserWorkerUrl||(this.config.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e,t){const n=this.config,r=this.getParserWorkerTimeout(e,t);if(n.useWorker&&n.parserWorkerUrl){const a=i.createWorkerApi({workerUrl:n.parserWorkerUrl,timeout:r,maxConcurrentWorkers:1}),o=await a.execute(e);if(a.destroy(),o.success)return{model:o.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${o.error}'`)}else throw new Error("dxf converter can run in web worker only!")}getFonts(e){var a;const t=new Map,n=o=>{if(o){const s=o.lastIndexOf(".");return s>=0?o.substring(0,s).toLowerCase():o.toLowerCase()}};(a=e.tables.STYLE)==null||a.entries.forEach(o=>{const s=[];if(o.font){const l=n(o.font);l&&s.push(l)}if(o.bigFont){const l=n(o.bigFont);l&&s.push(l)}if(o.extendedFont){const l=n(o.extendedFont);l&&s.push(l)}t.set(o.name,s)});const r=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,r),Array.from(r)}getFontsInBlock(e,t,n,r){const a=/\\f(.*?)\|/g;e.forEach(o=>{if(o.type=="MTEXT"){const s=o;[...s.text.matchAll(a)].forEach(u=>{r.add(u[1].toLowerCase())});const A=n.get(s.styleName);A==null||A.forEach(u=>r.add(u))}else if(o.type=="TEXT"){const s=o,l=n.get(s.styleName);l==null||l.forEach(A=>r.add(A))}else if(o.type=="MULTILEADER"||o.type=="MLEADER"){const s=o;[...(typeof s.textContent=="string"?s.textContent:"").matchAll(a)].forEach(c=>{r.add(c[1].toLowerCase())});const A=typeof s.textStyleName=="string"?s.textStyleName:typeof s.styleName=="string"?s.styleName:void 0,u=A?n.get(A):void 0;u==null||u.forEach(c=>r.add(c))}else if(o.type=="INSERT"){const l=t[o.name];l&&l.entities&&this.getFontsInBlock(l.entities,t,n,r)}})}async processEntities(e,t,n,r,a){const o=new He;let s=e.entities;const l=s.length,A=new i.AcDbBatchProcessing(l,100-r.value,n);this.config.convertByEntityType&&(s=this.groupAndFlattenByType(s));const u=new Map;for(let p=0;p<l;p++){const g=s[p];if(g.type==="ATTRIB"){const I=o.convert(g);if(I&&I.ownerId&&I.ownerId!=="0"){let T=u.get(I==null?void 0:I.ownerId);T==null&&(T=[],u.set(I.ownerId,T)),T.push(I)}}}const c=t.tables.blockTable.modelSpace;await A.processChunk(async(p,g)=>{let I=[],T=p<g?s[p].type:"";for(let ne=p;ne<g;ne++){const U=s[ne];if(!(U.ownerBlockRecordSoftId&&U.ownerBlockRecordSoftId!==c.objectId)&&U.type!=="ATTRIB"){const Ee=o.convert(U);if(Ee){if(this.config.convertByEntityType&&U.type!==T&&(c.appendEntity(I),I=[],T=U.type),U.type==="INSERT"){const Se=u.get(Ee.objectId);Se&&Se.length>0&&Se.forEach(E=>{Ee.appendAttributes(E)})}I.push(Ee)}}}c.appendEntity(I);let F=r.value+g/l*(100-r.value);F>100&&(F=100),a&&await a(F,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(e,t,n=!1){const r=new He,a=e.length,o=[],s=t.objectId,l=[];for(let A=0;A<a;A++){const u=e[A],c=r.convert(u);c&&(u.type==="ATTRIB"?l.push(c):(!n||u.ownerBlockRecordSoftId===s)&&o.push(c))}t.appendEntity(o),l.forEach(A=>{const u=t.getIdAt(A.ownerId);u&&u.appendAttributes(A)})}processBlocks(e,t){const n=e.blocks;for(const[r,a]of Object.entries(n)){let o=t.tables.blockTable.getAt(a.name);o||(o=new i.AcDbBlockTableRecord,a.handle!=null&&(o.objectId=String(a.handle)),o.name=r,o.origin.copy(a.position),t.tables.blockTable.add(o)),a.entities?this.processEntitiesInBlock(a.entities,o):o.isPaperSapce&&this.processEntitiesInBlock(e.entities,o,!0)}}processHeader(e,t){const n=e.header;n.$ACADVER&&(t.version=n.$ACADVER),t.cecolor.colorIndex=n.$CECOLOR||256,t.angbase=n.$ANGBASE||0,t.angdir=n.$ANGDIR||0,n.$AUNITS!=null&&(t.aunits=n.$AUNITS),n.$AUPREC!=null&&(t.auprec=n.$AUPREC),n.$LUNITS!=null&&(t.lunits=n.$LUNITS),n.$LUPREC!=null&&(t.luprec=n.$LUPREC),n.$UNITMODE!=null&&(t.unitmode=n.$UNITMODE),n.$MEASUREMENT!=null&&(t.measurement=n.$MEASUREMENT),t.celtype=n.$CELTYPE||i.ByLayer,i.AcDbSysVarManager.instance().setVar(i.AcDbSystemVariables.CETRANSPARENCY,n.$CETRANSPARENCY||"ByLayer",t),t.celtscale=n.$CELTSCALE||1;const r=this.normalizeHeaderStringValue(n.$CMLSTYLE)||this.normalizeHeaderStringValue(n.CMLSTYLE)||i.DEFAULT_MLINE_STYLE;t.cmlstyle=r;const a=n.$CMLSCALE??n.CMLSCALE;typeof a=="number"&&Number.isFinite(a)&&(t.cmlscale=a);const o=this.normalizeHeaderStringValue(n.$CMLEADERSTYLE)||this.normalizeHeaderStringValue(n.CMLEADERSTYLE)||i.DEFAULT_MLEADER_STYLE;t.cmleaderstyle=o,t.hplayer=this.normalizeHeaderStringValue(n.$HPLAYER)||this.normalizeHeaderStringValue(n.HPLAYER)||".",t.ltscale=n.$LTSCALE||1,n.$EXTMAX&&(t.extmax=n.$EXTMAX),n.$EXTMIN&&(t.extmin=n.$EXTMIN),n.$INSUNITS!=null&&(t.insunits=n.$INSUNITS),t.osmode=n.$OSMODE||0,t.orthomode=n.$ORTHOMODE||0,t.pdmode=n.$PDMODE||0,t.pdsize=n.$PDSIZE||0,t.textstyle=n.$TEXTSTYLE||i.DEFAULT_TEXT_STYLE}processBlockTables(e,t){var r;const n=(r=e.tables.BLOCK_RECORD)==null?void 0:r.entries;n&&n.length>0&&(t.tables.blockTable.removeAll(),n.forEach(a=>{const o=new i.AcDbBlockTableRecord;o.objectId=a.handle,o.name=a.name,o.layoutId=a.layoutObjects,o.blockInsertUnits=a.insertionUnits,o.explodability=a.explodability,o.blockScaling=a.scalability,a.bmpPreview&&(o.bmpPreview=a.bmpPreview),t.tables.blockTable.add(o)}))}processObjects(e,t){const n=e.objects.byName,r=new Ze;if("LAYOUT"in n){const a=t.objects.layout;n.LAYOUT.forEach(o=>{const s=r.convertLayout(o,e);a.setAt(s.layoutName,s)})}if("IMAGEDEF"in n){const a=t.objects.imageDefinition;n.IMAGEDEF.forEach(o=>{const s=r.convertImageDef(o);a.setAt(s.objectId,s)})}if("MLEADERSTYLE"in n){const a=t.objects.mleaderStyle;n.MLEADERSTYLE.forEach(o=>{const s=r.convertMLeaderStyle(o);a.setAt(s.objectId,s)})}if("MLINESTYLE"in n){const a=t.objects.mlineStyle;n.MLINESTYLE.forEach(o=>{const s=r.convertMLineStyle(o);a.setAt(s.styleName||s.objectId,s)})}}processViewports(e,t){var r;const n=(r=e.tables)==null?void 0:r.VPORT;if(n){this.processCommonTableAttrs(n,t.tables.viewportTable);const a=n.entries;a&&a.length>0&&a.forEach(o=>{const s=new i.AcDbViewportTableRecord;this.processCommonTableEntryAttrs(o,s),o.circleSides&&(s.circleSides=o.circleSides),s.standardFlag=o.standardFlag,s.center.copy(o.center??i.VPORT_FALLBACK_CENTER_2D),s.lowerLeftCorner.copy(o.lowerLeftCorner??i.VPORT_FALLBACK_LLC),s.upperRightCorner.copy(o.upperRightCorner??i.VPORT_FALLBACK_URC),o.snapBasePoint&&s.snapBase.copy(o.snapBasePoint),o.snapRotationAngle&&(s.snapAngle=o.snapRotationAngle),o.snapSpacing&&s.snapIncrements.copy(o.snapSpacing),o.majorGridLines&&(s.gridMajor=o.majorGridLines),o.gridSpacing&&s.gridIncrements.copy(o.gridSpacing),o.backgroundObjectId&&(s.backgroundObjectId=o.backgroundObjectId),s.gsView.center.copy(o.center??i.VPORT_FALLBACK_CENTER_2D),s.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget??i.VPORT_FALLBACK_VIEW_DIR),s.gsView.viewTarget.copy(o.viewTarget??i.VPORT_FALLBACK_VIEW_TARGET),o.lensLength&&(s.gsView.lensLength=o.lensLength),o.frontClippingPlane&&(s.gsView.frontClippingPlane=o.frontClippingPlane),o.backClippingPlane&&(s.gsView.backClippingPlane=o.backClippingPlane),o.viewHeight&&(s.gsView.viewHeight=o.viewHeight),o.aspectRatio!=null&&Number.isFinite(o.aspectRatio)&&o.aspectRatio>0&&(s.gsView.aspectRatio=o.aspectRatio),o.viewTwistAngle&&(s.gsView.viewTwistAngle=o.viewTwistAngle),o.frozenLayers&&(s.gsView.frozenLayers=o.frozenLayers),o.styleSheet&&(s.gsView.styleSheet=o.styleSheet),o.renderMode&&(s.gsView.renderMode=o.renderMode),o.viewMode&&(s.gsView.viewMode=o.viewMode),o.ucsIconSetting&&(s.gsView.ucsIconSetting=o.ucsIconSetting),o.ucsOrigin&&s.gsView.ucsOrigin.copy(o.ucsOrigin),o.ucsXAxis&&s.gsView.ucsXAxis.copy(o.ucsXAxis),o.ucsYAxis&&s.gsView.ucsYAxis.copy(o.ucsYAxis),o.orthographicType&&(s.gsView.orthographicType=o.orthographicType),o.shadePlotSetting&&(s.gsView.shadePlotSetting=o.shadePlotSetting),o.shadePlotObjectId&&(s.gsView.shadePlotObjectId=o.shadePlotObjectId),o.visualStyleObjectId&&(s.gsView.visualStyleObjectId=o.visualStyleObjectId),o.isDefaultLightingOn&&(s.gsView.isDefaultLightingOn=o.isDefaultLightingOn),o.defaultLightingType&&(s.gsView.defaultLightingType=o.defaultLightingType),o.brightness&&(s.gsView.brightness=o.brightness),o.contrast&&(s.gsView.contrast=o.contrast),o.ambientColor&&(s.gsView.ambientColor=o.ambientColor),t.tables.viewportTable.add(s)})}}processLayers(e,t){var r;const n=(r=e.tables)==null?void 0:r.LAYER;if(n){this.processCommonTableAttrs(n,t.tables.layerTable);const a=n.entries;a&&a.length>0&&a.forEach(o=>{const s=new i.AcCmColor;s.colorIndex=o.colorIndex;const l=new i.AcDbLayerTableRecord({name:o.name,standardFlags:o.standardFlag,linetype:o.lineType,lineWeight:o.lineweight,isOff:o.colorIndex<0,color:s,isPlottable:o.isPlotting});this.processCommonTableEntryAttrs(o,l),t.tables.layerTable.add(l)})}}processLineTypes(e,t){var r;const n=(r=e.tables)==null?void 0:r.LTYPE;if(n){this.processCommonTableAttrs(n,t.tables.linetypeTable);const a=n.entries;a&&a.length>0&&a.forEach(o=>{const s=new i.AcDbLinetypeTableRecord(o);this.processCommonTableEntryAttrs(o,s),s.name=o.name,t.tables.linetypeTable.add(s)})}}processTextStyles(e,t){var r;const n=(r=e.tables)==null?void 0:r.STYLE;if(n){this.processCommonTableAttrs(n,t.tables.textStyleTable);const a=n.entries;a&&a.length>0&&a.forEach(o=>{const s=new i.AcDbTextStyleTableRecord(o);this.processCommonTableEntryAttrs(o,s),t.tables.textStyleTable.add(s)})}t.ensureTextStyleDefaults()}processDimStyles(e,t){var r;const n=(r=e.tables)==null?void 0:r.DIMSTYLE;if(n){this.processCommonTableAttrs(n,t.tables.dimStyleTable);const a=n.entries;a&&a.length>0&&a.forEach(o=>{const s={name:o.name,ownerId:o.ownerObjectId,dimpost:o.DIMPOST||"",dimapost:o.DIMAPOST||"",dimscale:o.DIMSCALE,dimasz:o.DIMASZ,dimexo:o.DIMEXO,dimdli:o.DIMDLI,dimexe:o.DIMEXE,dimrnd:o.DIMRND,dimdle:o.DIMDLE,dimtp:o.DIMTP,dimtm:o.DIMTM,dimtxt:o.DIMTXT,dimcen:o.DIMCEN,dimtsz:o.DIMTSZ,dimaltf:o.DIMALTF,dimlfac:o.DIMLFAC,dimtvp:o.DIMTVP,dimtfac:o.DIMTFAC,dimgap:o.DIMGAP,dimaltrnd:o.DIMALTRND,dimtol:o.DIMTOL==null||o.DIMTOL==0?0:1,dimlim:o.DIMLIM==null||o.DIMLIM==0?0:1,dimtih:o.DIMTIH==null||o.DIMTIH==0?0:1,dimtoh:o.DIMTOH==null||o.DIMTOH==0?0:1,dimse1:o.DIMSE1==null||o.DIMSE1==0?0:1,dimse2:o.DIMSE2==null||o.DIMSE2==0?0:1,dimtad:o.DIMTAD,dimzin:o.DIMZIN,dimazin:o.DIMAZIN,dimalt:o.DIMALT,dimaltd:o.DIMALTD,dimtofl:o.DIMTOFL,dimsah:o.DIMSAH,dimtix:o.DIMTIX,dimsoxd:o.DIMSOXD,dimclrd:o.DIMCLRD,dimclre:o.DIMCLRE,dimclrt:o.DIMCLRT,dimadec:o.DIMADEC||0,dimunit:o.DIMUNIT||2,dimdec:o.DIMDEC,dimtdec:o.DIMTDEC,dimaltu:o.DIMALTU,dimalttd:o.DIMALTTD,dimaunit:o.DIMAUNIT,dimfrac:o.DIMFRAC,dimlunit:o.DIMLUNIT,dimdsep:o.DIMDSEP?o.DIMDSEP.toString():".",dimtmove:o.DIMTMOVE||0,dimjust:o.DIMJUST,dimsd1:o.DIMSD1,dimsd2:o.DIMSD2,dimtolj:o.DIMTOLJ,dimtzin:o.DIMTZIN,dimaltz:o.DIMALTZ,dimalttz:o.DIMALTTZ,dimfit:o.DIMFIT||0,dimupt:o.DIMUPT,dimatfit:o.DIMATFIT,dimtxsty:o.DIMTXSTY||i.DEFAULT_TEXT_STYLE,dimldrblk:o.DIMLDRBLK||"",dimblk:o.DIMBLK||"",dimblk1:o.DIMBLK1||"",dimblk2:o.DIMBLK2||"",dimlwd:o.DIMLWD,dimlwe:o.DIMLWE},l=new i.AcDbDimStyleTableRecord(s);this.processCommonTableEntryAttrs(o,l),t.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(e,t){e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}processCommonTableEntryAttrs(e,t){t.name="name"in e?e.name:"",e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}groupAndFlattenByType(e){const t={},n=[];for(const r of e)t[r.type]||(t[r.type]=[],n.push(r.type)),t[r.type].push(r);return n.flatMap(r=>t[r])}normalizeHeaderStringValue(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}}oe.AcDbDxfConverter=qe,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|