@node-projects/acad-ts 1.0.0 → 1.1.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/dist/index-min.js CHANGED
@@ -1,15 +1,15 @@
1
- var uh=Object.defineProperty;var Oc=Object.getOwnPropertyDescriptor;var jc=Object.getOwnPropertyNames;var Nc=Object.prototype.hasOwnProperty;var er=(r,e)=>()=>(r&&(e=r(r=0)),e);var Vc=(r,e)=>{for(var t in e)uh(r,t,{get:e[t],enumerable:!0})},Ic=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of jc(e))!Nc.call(r,s)&&s!==t&&uh(r,s,{get:()=>e[s],enumerable:!(i=Oc(e,s))||i.enumerable});return r};var Mc=r=>Ic(uh({},"__esModule",{value:!0}),r);var d,D=er(()=>{d=class{static BeginSection="SECTION";static BlkRefObjectContextData="ACDB_BLKREFOBJECTCONTEXTDATA_CLASS";static BlkRefToken="{BLKREFS";static Block="BLOCK";static BlocksSection="BLOCKS";static ClassEntry="CLASS";static ClassesSection="CLASSES";static CustomData="CUSTOMDATA";static DictionaryToken="{ACAD_XDICTIONARY";static EndBlock="ENDBLK";static EndOfFile="EOF";static EndSection="ENDSEC";static EndSequence="SEQEND";static EndTable="ENDTAB";static EntitiesSection="ENTITIES";static Entity3DFace="3DFACE";static Entity3DSolid="3DSOLID";static EntityAecWall="AEC_WALL";static EntityArc="ARC";static EntityAttribute="ATTRIB";static EntityAttributeDefinition="ATTDEF";static EntityBody="BODY";static EntityCircle="CIRCLE";static EntityCoordinationModel="COORDINATION MODEL";static EntityDimension="DIMENSION";static EntityEllipse="ELLIPSE";static EntityHatch="HATCH";static EntityHelix="HELIX";static EntityImage="IMAGE";static EntityInsert="INSERT";static EntityLeader="LEADER";static EntityLight="LIGHT";static EntityLine="LINE";static EntityLwPolyline="LWPOLYLINE";static EntityMesh="MESH";static EntityMLine="MLINE";static EntityMText="MTEXT";static EntityMultiLeader="MULTILEADER";static EntityOle2Frame="OLE2FRAME";static EntityOleFrame="OLEFRAME";static EntityPdfUnderlay="PDFUNDERLAY";static EntityPoint="POINT";static EntityPolyFaceMesh="PFACE";static EntityPolyline="POLYLINE";static EntityProxyEntity="ACAD_PROXY_ENTITY";static EntityRay="RAY";static EntityRegion="REGION";static EntitySection="SECTION";static EntitySeqend="SEQEND";static EntityShape="SHAPE";static EntitySolid="SOLID";static EntitySpline="SPLINE";static EntitySun="SUN";static EntitySurface="SURFACE";static EntityTable="ACAD_TABLE";static EntityText="TEXT";static EntityTolerance="TOLERANCE";static EntityTrace="TRACE";static EntityUnderlay="UNDERLAY";static EntityVertex="VERTEX";static EntityViewport="VIEWPORT";static EntityWipeout="WIPEOUT";static EntityXline="XLINE";static FormattedTableDataColumn_BEGIN="FORMATTEDTABLEDATACOLUMN_BEGIN";static FormattedTableDataColumn_END="FORMATTEDTABLEDATACOLUMN_END";static FormattedTableDataRow_BEGIN="FORMATTEDTABLEDATAROW_BEGIN";static FormattedTableDataRow_END="FORMATTEDTABLEDATAROW_END";static HeaderSection="HEADER";static LinkedTableDataCell_BEGIN="LINKEDTABLEDATACELL_BEGIN";static LinkedTableDataCell_END="LINKEDTABLEDATACELL_END";static LinkedTableDataColumn_BEGIN="LINKEDTABLEDATACOLUMN_BEGIN";static LinkedTableDataColumn_END="LINKEDTABLEDATACOLUMN_END";static LinkedTableDataRow_BEGIN="LINKEDTABLEDATAROW_BEGIN";static LinkedTableDataRow_END="LINKEDTABLEDATAROW_END";static MTextAttributeObjectContextData="ACDB_MTEXTATTRIBUTEOBJECTCONTEXTDATA_CLASS";static ObjectAecCleanupGroupDef="AEC_CLEANUP_GROUP_DEF";static ObjectAecWallStyle="AEC_WALL_STYLE";static ObjectBinRecord="BINRECORD";static ObjectBlockBasePointParameter="BLOCKBASEPOINTPARAMETER";static ObjectBlockFlipAction="BLOCKFLIPACTION";static ObjectBlockFlipParameter="BLOCKFLIPPARAMETER";static ObjectBlockGripLocationComponent="BLOCKGRIPLOCATIONCOMPONENT";static ObjectBlockLinearParameter="BLOCKLINEARPARAMETER";static ObjectBlockPointParameter="BLOCKPOINTPARAMETER";static ObjectBlockRepresentationData="ACDB_BLOCKREPRESENTATION_DATA";static ObjectBlockRotateAction="BLOCKROTATEACTION";static ObjectBlockRotationGrip="BLOCKROTATIONGRIP";static ObjectBlockRotationParameter="BLOCKROTATIONPARAMETER";static ObjectBlockVisibilityGrip="BLOCKVISIBILITYGRIP";static ObjectBlockVisibilityParameter="BLOCKVISIBILITYPARAMETER";static ObjectCell="CELL";static ObjectCellStyleMap="CELLSTYLEMAP";static ObjectDBColor="DBCOLOR";static ObjectDictionary="DICTIONARY";static ObjectDictionaryVar="DICTIONARYVAR";static ObjectDictionaryWithDefault="ACDBDICTIONARYWDFLT";static ObjectDimensionAssociation="DIMASSOC";static ObjectEvalGraph="ACAD_EVALUATION_GRAPH";static ObjectField="FIELD";static ObjectFieldList="FIELDLIST";static ObjectGeoData="GEODATA";static ObjectGroup="GROUP";static ObjectImageDefinition="IMAGEDEF";static ObjectImageDefinitionReactor="IMAGEDEF_REACTOR";static ObjectLayout="LAYOUT";static ObjectMaterial="MATERIAL";static ObjectMLeaderContextData="ACDB_MLEADEROBJECTCONTEXTDATA_CLASS";static ObjectMLeaderStyle="MLEADERSTYLE";static ObjectMLineStyle="MLINESTYLE";static ObjectPdfDefinition="PDFDEFINITION";static ObjectPlaceholder="ACDBPLACEHOLDER";static ObjectPlotSettings="PLOTSETTINGS";static ObjectProxyObject="ACAD_PROXY_OBJECT";static ObjectRasterVariables="RASTERVARIABLES";static ObjectScale="SCALE";static ObjectSortEntsTable="SORTENTSTABLE";static ObjectSpatialFilter="SPATIAL_FILTER";static ObjectsSection="OBJECTS";static ObjectTableColumn="COLUMN";static ObjectTableColumnBegin="TABLECOLUMN_BEGIN";static ObjectTableColumnEnd="TABLECOLUMN_END";static ObjectTableContent="TABLECONTENT";static ObjectTableRow="ROW";static ObjectTableRowBegin="TABLEROW_BEGIN";static ObjectTableRowEnd="TABLEOW_END";static ObjectTableStyle="TABLESTYLE";static ObjectVisualStyle="VISUALSTYLE";static ObjectXRecord="XRECORD";static ReactorsToken="{ACAD_REACTORS";static TableAppId="APPID";static TableBlockRecord="BLOCK_RECORD";static TableDimstyle="DIMSTYLE";static TableEntry="TABLE";static TableGroup="GROUP";static TableLayer="LAYER";static TableLinetype="LTYPE";static TablesSection="TABLES";static TableStyle="STYLE";static TableUcs="UCS";static TableView="VIEW";static TableVport="VPORT"}});var l,x=er(()=>{l=class{static AecWall="AecDbWall";static AecDbWallStyle="AecDbWallStyle";static AecDbCleanupGroupDef="AecDbCleanupGroupDef";static BinRecord="BinRecord";static ApplicationId="AcDbRegAppTableRecord";static AcDbPlaceHolder="AcDbPlaceHolder";static AlignedDimension="AcDbAlignedDimension";static Angular2LineDimension="AcDb2LineAngularDimension";static Angular3PointDimension="AcDb3PointAngularDimension";static AnnotScaleObjectContextData="AcDbAnnotScaleObjectContextData";static Arc="AcDbArc";static Attribute="AcDbAttribute";static AttributeDefinition="AcDbAttributeDefinition";static BlkRefObjectContextData="AcDbBlkRefObjectContextData";static Block1PtParameter="AcDbBlock1PtParameter";static Block2PtParameter="AcDbBlock2PtParameter";static BlockAction="AcDbBlockAction";static BlockActionBasePt="AcDbBlockActionWithBasePt";static BlockBasePointParameter="AcDbBlockBasePointParameter";static BlockBegin="AcDbBlockBegin";static BlockElement="AcDbBlockElement";static BlockEnd="AcDbBlockEnd";static BlockFlipAction="AcDbBlockFlipAction";static BlockFlipGrip="AcDbBlockFlipGrip";static BlockFlipParameter="AcDbBlockFlipParameter";static BlockGrip="AcDbBlockGrip";static BlockGripExpression="AcDbBlockGripExpr";static BlockLinearParameter="AcDbBlockLinearParameter";static BlockParameter="AcDbBlockParameter";static BlockRecord="AcDbBlockTableRecord";static BlockRepresentationData="AcDbBlockRepresentationData";static BlockRotationAction="AcDbBlockRotationAction";static BlockRotationGrip="AcDbBlockRotationGrip";static BlockRotationParameter="AcDbBlockRotationParameter";static BlockVisibilityGrip="AcDbBlockVisibilityGrip";static BlockVisibilityParameter="AcDbBlockVisibilityParameter";static CellStyleMap="AcDbCellStyleMap";static Circle="AcDbCircle";static DbColor="AcDbColor";static DiametricDimension="AcDbDiametricDimension";static Dictionary="AcDbDictionary";static DictionaryVar="AcDbDictionaryVar";static DictionaryVariables="DictionaryVariables";static DictionaryWithDefault="AcDbDictionaryWithDefault";static Dimension="AcDbDimension";static DimensionStyle="AcDbDimStyleTableRecord";static DimensionStyleTable="AcDbDimStyleTable";static DimensionAssociation="AcDbDimAssoc";static Ellipse="AcDbEllipse";static Entity="AcDbEntity";static EvalGraph="AcDbEvalGraph";static EvalGraphExpr="AcDbEvalExpr";static Face3d="AcDbFace";static Field="AcDbField";static FieldList="AcDbFieldList";static Filter="AcDbFilter";static FormattedTableData="AcDbFormattedTableData";static GeoData="AcDbGeoData";static Group="AcDbGroup";static Hatch="AcDbHatch";static Helix="AcDbHelix";static IdSet="AcDbIdSet";static Insert="AcDbBlockReference";static Layer="AcDbLayerTableRecord";static Layout="AcDbLayout";static Leader="AcDbLeader";static Line="AcDbLine";static LinearDimension="AcDbRotatedDimension";static Linetype="AcDbLinetypeTableRecord";static LinkedData="AcDbLinkedData";static LinkedTableData="AcDbLinkedTableData";static LwPolyline="AcDbPolyline";static Material="AcDbMaterial";static Mesh="AcDbSubDMesh";static MInsert="AcDbMInsertBlock";static MLeaderStyle="AcDbMLeaderStyle";static MLine="AcDbMline";static MLineStyle="AcDbMlineStyle";static ModelerGeometry="AcDbModelerGeometry";static MText="AcDbMText";static MTextAttributeObjectContextData="AcDbMTextAttributeObjectContextData";static MultiLeader="AcDbMLeader";static MultiLeaderObjectContextData="AcDbMLeaderObjectContextData";static ObjectContextData="AcDbObjectContextData";static Ole2Frame="AcDbOle2Frame";static OrdinateDimension="AcDbOrdinateDimension";static PdfDefinition="AcDbPdfDefinition";static PdfReference="AcDbPdfReference";static PlotSettings="AcDbPlotSettings";static Point="AcDbPoint";static PolyfaceMesh="AcDbPolyFaceMesh";static PolyfaceMeshFace="AcDbFaceRecord";static PolyfaceMeshVertex="AcDbPolyFaceMeshVertex";static PolygonMesh="AcDbPolygonMesh";static PolygonMeshVertex="AcDbPolygonMeshVertex";static Polyline="AcDb2dPolyline";static Polyline3d="AcDb3dPolyline";static Polyline3dVertex="AcDb3dPolylineVertex";static PolylineVertex="AcDb2dVertex";static ProxyEntity="AcDbProxyEntity";static ProxyObject="AcDbProxyObject";static RadialDimension="AcDbRadialDimension";static RasterImage="AcDbRasterImage";static RasterImageDef="AcDbRasterImageDef";static RasterImageDefReactor="AcDbRasterImageDefReactor";static RasterVariables="AcDbRasterVariables";static Ray="AcDbRay";static Scale="AcDbScale";static Shape="AcDbShape";static Solid="AcDbTrace";static Solid3D="AcDb3dSolid";static SortentsTable="AcDbSortentsTable";static SpatialFilter="AcDbSpatialFilter";static Spline="AcDbSpline";static Table="AcDbSymbolTable";static TableContent="AcDbTableContent";static TableEntity="AcDbTable";static TableRecord="AcDbSymbolTableRecord";static TableStyle="AcDbTableStyle";static Text="AcDbText";static TextStyle="AcDbTextStyleTableRecord";static Tolerance="AcDbFcf";static Trace="AcDbTrace";static Ucs="AcDbUCSTableRecord";static Underlay="AcDbUnderlayReference";static UnderlayDefinition="AcDbUnderlayDefinition";static Vertex="AcDbVertex";static View="AcDbViewTableRecord";static Viewport="AcDbViewport";static VisualStyle="AcDbVisualStyle";static VPort="AcDbViewportTableRecord";static Wipeout="AcDbWipeout";static XLine="AcDbXline";static XRecord="AcDbXrecord"}});var u,R=er(()=>{(function(r){r[r.UNLISTED=-999]="UNLISTED",r[r.INVALID=-1]="INVALID",r[r.UNDEFINED=0]="UNDEFINED",r[r.TEXT=1]="TEXT",r[r.ATTRIB=2]="ATTRIB",r[r.ATTDEF=3]="ATTDEF",r[r.BLOCK=4]="BLOCK",r[r.ENDBLK=5]="ENDBLK",r[r.SEQEND=6]="SEQEND",r[r.INSERT=7]="INSERT",r[r.MINSERT=8]="MINSERT",r[r.UNKNOW_9=9]="UNKNOW_9",r[r.VERTEX_2D=10]="VERTEX_2D",r[r.VERTEX_3D=11]="VERTEX_3D",r[r.VERTEX_MESH=12]="VERTEX_MESH",r[r.VERTEX_PFACE=13]="VERTEX_PFACE",r[r.VERTEX_PFACE_FACE=14]="VERTEX_PFACE_FACE",r[r.POLYLINE_2D=15]="POLYLINE_2D",r[r.POLYLINE_3D=16]="POLYLINE_3D",r[r.ARC=17]="ARC",r[r.CIRCLE=18]="CIRCLE",r[r.LINE=19]="LINE",r[r.DIMENSION_ORDINATE=20]="DIMENSION_ORDINATE",r[r.DIMENSION_LINEAR=21]="DIMENSION_LINEAR",r[r.DIMENSION_ALIGNED=22]="DIMENSION_ALIGNED",r[r.DIMENSION_ANG_3_Pt=23]="DIMENSION_ANG_3_Pt",r[r.DIMENSION_ANG_2_Ln=24]="DIMENSION_ANG_2_Ln",r[r.DIMENSION_RADIUS=25]="DIMENSION_RADIUS",r[r.DIMENSION_DIAMETER=26]="DIMENSION_DIAMETER",r[r.POINT=27]="POINT",r[r.FACE3D=28]="FACE3D",r[r.POLYLINE_PFACE=29]="POLYLINE_PFACE",r[r.POLYLINE_MESH=30]="POLYLINE_MESH",r[r.SOLID=31]="SOLID",r[r.TRACE=32]="TRACE",r[r.SHAPE=33]="SHAPE",r[r.VIEWPORT=34]="VIEWPORT",r[r.ELLIPSE=35]="ELLIPSE",r[r.SPLINE=36]="SPLINE",r[r.REGION=37]="REGION",r[r.SOLID3D=38]="SOLID3D",r[r.BODY=39]="BODY",r[r.RAY=40]="RAY",r[r.XLINE=41]="XLINE",r[r.DICTIONARY=42]="DICTIONARY",r[r.OLEFRAME=43]="OLEFRAME",r[r.MTEXT=44]="MTEXT",r[r.LEADER=45]="LEADER",r[r.TOLERANCE=46]="TOLERANCE",r[r.MLINE=47]="MLINE",r[r.BLOCK_CONTROL_OBJ=48]="BLOCK_CONTROL_OBJ",r[r.BLOCK_HEADER=49]="BLOCK_HEADER",r[r.LAYER_CONTROL_OBJ=50]="LAYER_CONTROL_OBJ",r[r.LAYER=51]="LAYER",r[r.STYLE_CONTROL_OBJ=52]="STYLE_CONTROL_OBJ",r[r.STYLE=53]="STYLE",r[r.UNKNOW_36=54]="UNKNOW_36",r[r.UNKNOW_37=55]="UNKNOW_37",r[r.LTYPE_CONTROL_OBJ=56]="LTYPE_CONTROL_OBJ",r[r.LTYPE=57]="LTYPE",r[r.UNKNOW_3A=58]="UNKNOW_3A",r[r.UNKNOW_3B=59]="UNKNOW_3B",r[r.VIEW_CONTROL_OBJ=60]="VIEW_CONTROL_OBJ",r[r.VIEW=61]="VIEW",r[r.UCS_CONTROL_OBJ=62]="UCS_CONTROL_OBJ",r[r.UCS=63]="UCS",r[r.VPORT_CONTROL_OBJ=64]="VPORT_CONTROL_OBJ",r[r.VPORT=65]="VPORT",r[r.APPID_CONTROL_OBJ=66]="APPID_CONTROL_OBJ",r[r.APPID=67]="APPID",r[r.DIMSTYLE_CONTROL_OBJ=68]="DIMSTYLE_CONTROL_OBJ",r[r.DIMSTYLE=69]="DIMSTYLE",r[r.VP_ENT_HDR_CTRL_OBJ=70]="VP_ENT_HDR_CTRL_OBJ",r[r.VP_ENT_HDR=71]="VP_ENT_HDR",r[r.GROUP=72]="GROUP",r[r.MLINESTYLE=73]="MLINESTYLE",r[r.OLE2FRAME=74]="OLE2FRAME",r[r.DUMMY=75]="DUMMY",r[r.LONG_TRANSACTION=76]="LONG_TRANSACTION",r[r.LWPOLYLINE=77]="LWPOLYLINE",r[r.HATCH=78]="HATCH",r[r.XRECORD=79]="XRECORD",r[r.ACDBPLACEHOLDER=80]="ACDBPLACEHOLDER",r[r.VBA_PROJECT=81]="VBA_PROJECT",r[r.LAYOUT=82]="LAYOUT",r[r.ACAD_PROXY_ENTITY=498]="ACAD_PROXY_ENTITY",r[r.ACAD_PROXY_OBJECT=499]="ACAD_PROXY_OBJECT"})(u||(u={}))});var p,q=er(()=>{(function(r){r[r.Invalid=-9999]="Invalid",r[r.XDictionary=-6]="XDictionary",r[r.PReactors=-5]="PReactors",r[r.Operator=-4]="Operator",r[r.XDataStart=-3]="XDataStart",r[r.HeaderId=-2]="HeaderId",r[r.FirstEntityId=-2]="FirstEntityId",r[r.End=-1]="End",r[r.Start=0]="Start",r[r.Text=1]="Text",r[r.XRefPath=1]="XRefPath",r[r.ShapeName=2]="ShapeName",r[r.BlockName=2]="BlockName",r[r.AttributeTag=2]="AttributeTag",r[r.SymbolTableName=2]="SymbolTableName",r[r.MlineStyleName=2]="MlineStyleName",r[r.SymbolTableRecordName=2]="SymbolTableRecordName",r[r.AttributePrompt=3]="AttributePrompt",r[r.DimStyleName=3]="DimStyleName",r[r.LinetypeProse=3]="LinetypeProse",r[r.TextFontFile=3]="TextFontFile",r[r.Description=3]="Description",r[r.DimPostString=3]="DimPostString",r[r.TextBigFontFile=4]="TextBigFontFile",r[r.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",r[r.CLShapeName=4]="CLShapeName",r[r.SymbolTableRecordComments=4]="SymbolTableRecordComments",r[r.Handle=5]="Handle",r[r.DimensionBlock=5]="DimensionBlock",r[r.DimBlk1=6]="DimBlk1",r[r.LinetypeName=6]="LinetypeName",r[r.DimBlk2=7]="DimBlk2",r[r.TextStyleName=7]="TextStyleName",r[r.LayerName=8]="LayerName",r[r.CLShapeText=9]="CLShapeText",r[r.XCoordinate=10]="XCoordinate",r[r.YCoordinate=20]="YCoordinate",r[r.ZCoordinate=30]="ZCoordinate",r[r.Elevation=38]="Elevation",r[r.Thickness=39]="Thickness",r[r.Real=40]="Real",r[r.ViewportHeight=40]="ViewportHeight",r[r.TxtSize=40]="TxtSize",r[r.TxtStyleXScale=41]="TxtStyleXScale",r[r.ViewWidth=41]="ViewWidth",r[r.ViewportAspect=41]="ViewportAspect",r[r.TxtStylePSize=42]="TxtStylePSize",r[r.ViewLensLength=42]="ViewLensLength",r[r.ViewFrontClip=43]="ViewFrontClip",r[r.ViewBackClip=44]="ViewBackClip",r[r.ShapeXOffset=44]="ShapeXOffset",r[r.ShapeYOffset=45]="ShapeYOffset",r[r.ViewHeight=45]="ViewHeight",r[r.ShapeScale=46]="ShapeScale",r[r.PixelScale=47]="PixelScale",r[r.LinetypeScale=48]="LinetypeScale",r[r.DashLength=49]="DashLength",r[r.MlineOffset=49]="MlineOffset",r[r.LinetypeElement=49]="LinetypeElement",r[r.Angle=50]="Angle",r[r.ViewportSnapAngle=50]="ViewportSnapAngle",r[r.ViewportTwist=51]="ViewportTwist",r[r.Visibility=60]="Visibility",r[r.LayerLinetype=61]="LayerLinetype",r[r.Color=62]="Color",r[r.HasSubentities=66]="HasSubentities",r[r.ViewportVisibility=67]="ViewportVisibility",r[r.ViewportActive=68]="ViewportActive",r[r.ViewportNumber=69]="ViewportNumber",r[r.Int16=70]="Int16",r[r.ViewMode=71]="ViewMode",r[r.CircleSides=72]="CircleSides",r[r.ViewportZoom=73]="ViewportZoom",r[r.ViewportIcon=74]="ViewportIcon",r[r.ViewportSnap=75]="ViewportSnap",r[r.ViewportGrid=76]="ViewportGrid",r[r.ViewportSnapStyle=77]="ViewportSnapStyle",r[r.ViewportSnapPair=78]="ViewportSnapPair",r[r.RegAppFlags=71]="RegAppFlags",r[r.TxtStyleFlags=71]="TxtStyleFlags",r[r.LinetypeAlign=72]="LinetypeAlign",r[r.LinetypePdc=73]="LinetypePdc",r[r.Int32=90]="Int32",r[r.Subclass=100]="Subclass",r[r.EmbeddedObjectStart=101]="EmbeddedObjectStart",r[r.ControlString=102]="ControlString",r[r.DimVarHandle=105]="DimVarHandle",r[r.UcsOrg=110]="UcsOrg",r[r.UcsOrientationX=111]="UcsOrientationX",r[r.UcsOrientationY=112]="UcsOrientationY",r[r.XReal=140]="XReal",r[r.ViewBrightness=141]="ViewBrightness",r[r.ViewContrast=142]="ViewContrast",r[r.Int64=160]="Int64",r[r.XInt16=170]="XInt16",r[r.NormalX=210]="NormalX",r[r.NormalY=220]="NormalY",r[r.NormalZ=230]="NormalZ",r[r.XXInt16=270]="XXInt16",r[r.Int8=280]="Int8",r[r.RenderMode=281]="RenderMode",r[r.Bool=290]="Bool",r[r.XTextString=300]="XTextString",r[r.BinaryChunk=310]="BinaryChunk",r[r.ArbitraryHandle=320]="ArbitraryHandle",r[r.SoftPointerId=330]="SoftPointerId",r[r.HardPointerId=340]="HardPointerId",r[r.SoftOwnershipId=350]="SoftOwnershipId",r[r.HardOwnershipId=360]="HardOwnershipId",r[r.LineWeight=370]="LineWeight",r[r.PlotStyleNameType=380]="PlotStyleNameType",r[r.PlotStyleNameId=390]="PlotStyleNameId",r[r.ExtendedInt16=400]="ExtendedInt16",r[r.LayoutName=410]="LayoutName",r[r.ColorRgb=420]="ColorRgb",r[r.ColorName=430]="ColorName",r[r.Alpha=440]="Alpha",r[r.GradientObjType=450]="GradientObjType",r[r.GradientPatType=451]="GradientPatType",r[r.GradientTintType=452]="GradientTintType",r[r.GradientColCount=453]="GradientColCount",r[r.GradientAngle=460]="GradientAngle",r[r.GradientShift=461]="GradientShift",r[r.GradientTintVal=462]="GradientTintVal",r[r.GradientColVal=463]="GradientColVal",r[r.GradientName=470]="GradientName",r[r.Comment=999]="Comment",r[r.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",r[r.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",r[r.ExtendedDataControlString=1002]="ExtendedDataControlString",r[r.ExtendedDataLayerName=1003]="ExtendedDataLayerName",r[r.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",r[r.ExtendedDataHandle=1005]="ExtendedDataHandle",r[r.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",r[r.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",r[r.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",r[r.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",r[r.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",r[r.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",r[r.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",r[r.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",r[r.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",r[r.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",r[r.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",r[r.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",r[r.ExtendedDataReal=1040]="ExtendedDataReal",r[r.ExtendedDataDist=1041]="ExtendedDataDist",r[r.ExtendedDataScale=1042]="ExtendedDataScale",r[r.ExtendedDataInteger16=1070]="ExtendedDataInteger16",r[r.ExtendedDataInteger32=1071]="ExtendedDataInteger32"})(p||(p={}))});var io,ae,bt=er(()=>{io=class{get code(){return this._code}get rawValue(){return this._value}_code;_value;constructor(e,t){this._code=e,this._value=t}toString(){return`${this.code}:${this._value}`}static create(e,t){throw new Error("ExtendedDataRecord factory not initialized")}},ae=class extends io{get value(){return this._value}set value(e){this._value=e}constructor(e,t){super(e,t)}}});var Pe,wn=er(()=>{q();bt();Pe=class r extends io{static get open(){return new r(!1)}static get close(){return new r(!0)}isClosing;get value(){return this.isClosing?"}":"{"}constructor(e){super(p.ExtendedDataControlString,e?"}":"{"),this.isClosing=e}}});var so,mh=er(()=>{wn();so=class{records=[];constructor(e){e&&this.records.push(...e)}addControlStrings(){if(this.records.length===0){this.records.push(Pe.open),this.records.push(Pe.close);return}let e=this.records[0];e instanceof Pe?e.isClosing&&this.records.unshift(Pe.open):this.records.unshift(Pe.open);let t=this.records[this.records.length-1];t instanceof Pe?t.isClosing||this.records.push(Pe.close):this.records.push(Pe.close)}}});var no,fh=er(()=>{mh();no=class{get document(){return this.owner?.document??null}owner;_data=new Map;constructor(e){this.owner=e}addByAppId(e,t){t===void 0&&(t=new so),this.document!=null?this._data.set(e,t):this._data.set(e,t)}addByName(e,t){this.addByAppId({name:e},t)}addWithRecords(e,t){this._data.set(e,new so(t))}clear(){this._data.clear()}containsKey(e){return this._data.has(e)}containsKeyName(e){for(let t of this._data.keys())if(t.name===e)return!0;return!1}getByName(e){let i=this.getExtendedDataByName().get(e.toUpperCase());if(!i)throw new Error(`AppId '${e}' not found`);return i}get(e){let t=this._data.get(e);if(!t)throw new Error("AppId not found");return t}get size(){return this._data.size}entries(){return this._data.entries()}add(e,t){this._data.set(e,t)}set(e,t){this._data.set(e,t)}[Symbol.iterator](){return this._data.entries()}getExtendedDataByName(){let e=new Map;for(let[t,i]of this._data)e.set(t.name.toUpperCase(),i);return e}tryAdd(e,t){let i=this.tryGetByName(e);return i.found?i.value:(this.addByName(e,t),t)}tryGet(e){let t=this._data.get(e);return t?{value:t,found:!0}:{value:null,found:!1}}tryGetByName(e){let i=this.getExtendedDataByName().get(e.toUpperCase());return i?{value:i,found:!0}:{value:null,found:!1}}}});var O,J=er(()=>{Te();R();O=class extends I{onNameChanged=null;get name(){return this._name}set name(e){this.onNameChanged?.call(this,this,{oldName:this._name,newName:e}),this._name=e}get objectType(){return u.UNLISTED}_name="";constructor(e){super(),e&&(this.name=e)}clone(){let e=super.clone();return e.onNameChanged=null,e}toString(){return this._name?`${this.objectName}:${this._name}:${this.handle}`:`${this.objectName}:${this.handle}`}}});var tr,rl=er(()=>{tr=class{item;constructor(e){this.item=e}}});var bs,il=er(()=>{(function(r){r[r.NotApplicable=0]="NotApplicable",r[r.KeepExisting=1]="KeepExisting",r[r.UseClone=2]="UseClone",r[r.XrefName=3]="XrefName",r[r.Name=4]="Name",r[r.UnmangleName=5]="UnmangleName"})(bs||(bs={}))});var Tc={};Vc(Tc,{CadDictionary:()=>xe,DictionaryCloningFlags:()=>bs});var xe,kr=er(()=>{J();rl();D();x();R();il();il();xe=class r extends O{onAdd=null;onRemove=null;clonningFlags=bs.NotApplicable;get entryHandles(){return[...this._entries.values()].map(e=>e.handle)}get entryNames(){return[...this._entries.keys()]}hardOwnerFlag=!1;get objectName(){return d.ObjectDictionary}get objectType(){return u.DICTIONARY}get subclassMarker(){return l.Dictionary}static AcadColor="ACAD_COLOR";static AcadFieldList="ACAD_FIELDLIST";static AcadGroup="ACAD_GROUP";static AcadImageDict="ACAD_IMAGE_DICT";static AcadLayout="ACAD_LAYOUT";static AcadMaterial="ACAD_MATERIAL";static AcadMLeaderStyle="ACAD_MLEADERSTYLE";static AcadMLineStyle="ACAD_MLINESTYLE";static AcadPdfDefinitions="ACAD_PDFDEFINITIONS";static AcadPlotSettings="ACAD_PLOTSETTINGS";static AcadPlotStyleName="ACAD_PLOTSTYLENAME";static AcadScaleList="ACAD_SCALELIST";static AcadSortEnts="ACAD_SORTENTS";static AcadTableStyle="ACAD_TABLESTYLE";static AcadVisualStyle="ACAD_VISUALSTYLE";static GeographicData="ACAD_GEOGRAPHICDATA";static Root="ROOT";static VariableDictionary="AcDbVariableDictionary";_entries=new Map;constructor(e){super(e)}static createDefaultEntries(e){e.tryAdd(new r(r.AcadColor)),e.tryAdd(new r(r.AcadGroup)),e.tryAdd(new r(r.AcadLayout)),e.tryAdd(new r(r.AcadMaterial)),e.tryAdd(new r(r.AcadSortEnts)),e.tryAdd(new r(r.AcadMLeaderStyle)),e.tryAdd(new r(r.AcadMLineStyle)),e.tryAdd(new r(r.AcadTableStyle)),e.tryAdd(new r(r.AcadPlotSettings)),e.tryAdd(new r(r.VariableDictionary)),e.tryAdd(new r(r.AcadScaleList)),e.tryAdd(new r(r.AcadVisualStyle)),e.tryAdd(new r(r.AcadFieldList)),e.tryAdd(new r(r.AcadImageDict))}static createRoot(){let e=new r(r.Root);return r.createDefaultEntries(e),e}addByKey(e,t){if(!e)throw new Error("NonGraphicalObject must have a name");this._entries.set(e.toLowerCase(),t),t.owner=this,this.onAdd?.call(this,this,new tr(t))}add(e){this.addByKey(e.name,e)}clear(){for(let[e]of this._entries)this.remove(e)}clone(){let e=super.clone();e.onAdd=null,e.onRemove=null,e._entries=new Map;for(let t of this._entries.values())e.add(t.clone());return e}containsKey(e){return this._entries.has(e.toLowerCase())}getEntry(e){return this._entries.get(e.toLowerCase())??null}remove(e){let t=this._entries.get(e.toLowerCase());return t?(this._entries.delete(e.toLowerCase()),t.owner=null,this.onRemove?.call(this,this,new tr(t)),!0):!1}tryAdd(e){return this._entries.has(e.name.toLowerCase())?!1:(this.add(e),!0)}get(e){return this._entries.get(e.toLowerCase())}[Symbol.iterator](){return this._entries.values()}}});var I,Te=er(()=>{fh();I=class r{document=null;extendedData;handle=0;get hasDynamicSubclass(){return!1}get objectName(){return""}owner=null;get reactors(){return this._reactors}get xDictionary(){return this._xdictionary}set xDictionary(e){e!=null&&(this._xdictionary=e,this._xdictionary.owner=this,this.document!=null&&this.document.registerCollection(this._xdictionary))}_reactors=[];_xdictionary=null;constructor(){this.extendedData=new no(this)}addReactor(e){this._reactors.push(e)}cleanReactors(){let e=[...this._reactors];for(let t of e)if(t.document!==this.document){let i=this._reactors.indexOf(t);i>=0&&this._reactors.splice(i,1)}}clone(){let e=Object.create(Object.getPrototypeOf(this));return Object.assign(e,this),e.handle=0,e.document=null,e.owner=null,e._reactors=[],e.extendedData=new no(e),e.xDictionary=this._xdictionary?.clone()??null,e}createExtendedDictionary(){if(this._xdictionary==null){let{CadDictionary:e}=(kr(),Mc(Tc));this.xDictionary=new e}return this._xdictionary}removeReactor(e){let t=this._reactors.indexOf(e);return t>=0?(this._reactors.splice(t,1),!0):!1}toString(){return`${this.objectName}:${this.handle}`}assignDocument(e){if(this.document=e,this.xDictionary!=null&&e.registerCollection(this.xDictionary),this.extendedData.size>0){let t=[...this.extendedData.entries()];this.extendedData.clear();for(let[i,s]of t)this.extendedData.add(i,s)}}unassignDocument(){if(this.xDictionary!=null&&this.document?.unregisterCollection(this.xDictionary),this.handle=0,this.document=null,this.extendedData.size>0){let e=[...this.extendedData.entries()];this.extendedData.clear();for(let[t,i]of e)this.extendedData.add(t,i)}this._reactors=[]}static updateCollection(e,t){return t==null||e==null?e:t.tryAdd(e)}static updateCollectionStatic(e,t){return r.updateCollection(e,t)}updateCollection(e,t){return r.updateCollection(e,t)}}});var m;(function(r){r[r.Unknown=-1]="Unknown",r[r.MC0_0=0]="MC0_0",r[r.AC1_2=1]="AC1_2",r[r.AC1_4=2]="AC1_4",r[r.AC1_50=3]="AC1_50",r[r.AC2_10=4]="AC2_10",r[r.AC1002=5]="AC1002",r[r.AC1003=6]="AC1003",r[r.AC1004=7]="AC1004",r[r.AC1006=8]="AC1006",r[r.AC1009=9]="AC1009",r[r.AC1012=19]="AC1012",r[r.AC1014=21]="AC1014",r[r.AC1015=23]="AC1015",r[r.AC1018=25]="AC1018",r[r.AC1021=27]="AC1021",r[r.AC1024=29]="AC1024",r[r.AC1027=31]="AC1027",r[r.AC1032=33]="AC1032"})(m||(m={}));D();x();R();var ne;(function(r){r[r.None=0]="None",r[r.Anonymous=1]="Anonymous",r[r.NonConstantAttributeDefinitions=2]="NonConstantAttributeDefinitions",r[r.XRef=4]="XRef",r[r.XRefOverlay=8]="XRefOverlay",r[r.XRefDependent=16]="XRefDependent",r[r.XRefResolved=32]="XRefResolved",r[r.Referenced=64]="Referenced"})(ne||(ne={}));Te();var B=class r{static get Black(){return new r(250)}static get Blue(){return new r(5)}static get ByBlock(){return r.fromIndex(0)}static get ByEntity(){return r.fromIndex(257)}static get ByLayer(){return r.fromIndex(256)}static get Cyan(){return new r(4)}static get DarkGray(){return new r(8)}static get Default(){return new r(7)}static get Green(){return new r(3)}static get LightGray(){return new r(9)}static get Magenta(){return new r(6)}static get Red(){return new r(1)}static get Yellow(){return new r(2)}get b(){return this.getRgb()[2]}get g(){return this.getRgb()[1]}get r(){return this.getRgb()[0]}get index(){return this.isTrueColor?-1:this._color}get isByBlock(){return this.index===0}get isByLayer(){return this.index===256}get isTrueColor(){return this._color>257||this._color<0}get trueColor(){return this.isTrueColor?this._color^1<<30:-1}static _maxTrueColor=16777216;static _trueColorFlag=1073741824;static _indexRgb=[[0,0,0],[255,0,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[255,0,255],[255,255,255],[128,128,128],[192,192,192],[255,0,0],[255,127,127],[165,0,0],[165,82,82],[127,0,0],[127,63,63],[76,0,0],[76,38,38],[38,0,0],[38,19,19],[255,63,0],[255,159,127],[165,41,0],[165,103,82],[127,31,0],[127,79,63],[76,19,0],[76,47,38],[38,9,0],[38,28,19],[255,127,0],[255,191,127],[165,82,0],[165,124,82],[127,63,0],[127,95,63],[76,38,0],[76,57,38],[38,19,0],[38,28,19],[255,191,0],[255,223,127],[165,124,0],[165,145,82],[127,95,0],[127,111,63],[76,57,0],[76,66,38],[38,28,0],[38,33,19],[255,255,0],[255,255,127],[165,165,0],[165,165,82],[127,127,0],[127,127,63],[76,76,0],[76,76,38],[38,38,0],[38,38,19],[191,255,0],[223,255,127],[124,165,0],[145,165,82],[95,127,0],[111,127,63],[57,76,0],[66,76,38],[28,38,0],[33,38,19],[127,255,0],[191,255,127],[82,165,0],[124,165,82],[63,127,0],[95,127,63],[38,76,0],[57,76,38],[19,38,0],[28,38,19],[63,255,0],[159,255,127],[41,165,0],[103,165,82],[31,127,0],[79,127,63],[19,76,0],[47,76,38],[9,38,0],[23,38,19],[0,255,0],[125,255,127],[0,165,0],[82,165,82],[0,127,0],[63,127,63],[0,76,0],[38,76,38],[0,38,0],[19,38,19],[0,255,63],[127,255,159],[0,165,41],[82,165,103],[0,127,31],[63,127,79],[0,76,19],[38,76,47],[0,38,9],[19,88,23],[0,255,127],[127,255,191],[0,165,82],[82,165,124],[0,127,63],[63,127,95],[0,76,38],[38,76,57],[0,38,19],[19,88,28],[0,255,191],[127,255,223],[0,165,124],[82,165,145],[0,127,95],[63,127,111],[0,76,57],[38,76,66],[0,38,28],[19,88,88],[0,255,255],[127,255,255],[0,165,165],[82,165,165],[0,127,127],[63,127,127],[0,76,76],[38,76,76],[0,38,38],[19,88,88],[0,191,255],[127,223,255],[0,124,165],[82,145,165],[0,95,127],[63,111,217],[0,57,76],[38,66,126],[0,28,38],[19,88,88],[0,127,255],[127,191,255],[0,82,165],[82,124,165],[0,63,127],[63,95,127],[0,38,76],[38,57,126],[0,19,38],[19,28,88],[0,63,255],[127,159,255],[0,41,165],[82,103,165],[0,31,127],[63,79,127],[0,19,76],[38,47,126],[0,9,38],[19,23,88],[0,0,255],[127,127,255],[0,0,165],[82,82,165],[0,0,127],[63,63,127],[0,0,76],[38,38,126],[0,0,38],[19,19,88],[63,0,255],[159,127,255],[41,0,165],[103,82,165],[31,0,127],[79,63,127],[19,0,76],[47,38,126],[9,0,38],[23,19,88],[127,0,255],[191,127,255],[165,0,82],[124,82,165],[63,0,127],[95,63,127],[38,0,76],[57,38,126],[19,0,38],[28,19,88],[191,0,255],[223,127,255],[124,0,165],[142,82,165],[95,0,127],[111,63,127],[57,0,76],[66,38,76],[28,0,38],[88,19,88],[255,0,255],[255,127,255],[165,0,165],[165,82,165],[127,0,127],[127,63,127],[76,0,76],[76,38,76],[38,0,38],[88,19,88],[255,0,191],[255,127,223],[165,0,124],[165,82,145],[127,0,95],[127,63,111],[76,0,57],[76,38,66],[38,0,28],[88,19,88],[255,0,127],[255,127,191],[165,0,82],[165,82,124],[127,0,63],[127,63,95],[76,0,38],[76,38,57],[38,0,19],[88,19,28],[255,0,63],[255,127,159],[165,0,41],[165,82,103],[127,0,31],[127,63,79],[76,0,19],[76,38,47],[38,0,9],[88,19,23],[0,0,0],[101,101,101],[102,102,102],[153,153,153],[204,204,204],[255,255,255]];_color;constructor(e,t,i){if(t!==void 0&&i!==void 0){let s=r._getInt24([e,t,i]);this._color=(s|r._trueColorFlag)>>>0}else{let s=e;s<0||s>257?this._color=256:this._color=s}}static fromIndex(e){let t=new r(0);return t._color=e,t}static fromTrueColor(e){let t=new r(0);return t._color=(e|r._trueColorFlag)>>>0,t}static getIndexRGB(e){return r._indexRgb[e]}static approxIndex(e,t,i){let s=-1;for(let n=0;n<r._indexRgb.length;n++){let a=e-r._indexRgb[n][0]+(t-r._indexRgb[n][1])+(i-r._indexRgb[n][2]);if(a===0)return n;if(a<s)return s=a,n}return 0}equals(e){return this._color===e._color}getApproxIndex(){return this.isTrueColor?r.approxIndex(this.r,this.g,this.b):this.index}getRgb(){return this.isTrueColor?this.getTrueColorRgb():r.getIndexRGB(this._color)}getTrueColorRgb(){return this.isTrueColor?r._getRGBfromTrueColor(this._color):[0,0,0]}toString(){if(this._color===0)return"ByBlock";if(this._color===256)return"ByLayer";if(this.isTrueColor){let e=this.getTrueColorRgb();return`True Color RGB:${e[0]},${e[1]},${e[2]}`}return`Indexed Color:${this.index}`}static _getInt24(e){return e[0]|e[1]<<8|e[2]<<16}static _getRGBfromTrueColor(e){return[e&255,e>>8&255,e>>16&255]}};D();x();R();var M;(function(r){r[r.ByDIPs=-4]="ByDIPs",r[r.Default=-3]="Default",r[r.ByBlock=-2]="ByBlock",r[r.ByLayer=-1]="ByLayer",r[r.W0=0]="W0",r[r.W5=5]="W5",r[r.W9=9]="W9",r[r.W13=13]="W13",r[r.W15=15]="W15",r[r.W18=18]="W18",r[r.W20=20]="W20",r[r.W25=25]="W25",r[r.W30=30]="W30",r[r.W35=35]="W35",r[r.W40=40]="W40",r[r.W50=50]="W50",r[r.W53=53]="W53",r[r.W60=60]="W60",r[r.W70=70]="W70",r[r.W80=80]="W80",r[r.W90=90]="W90",r[r.W100=100]="W100",r[r.W106=106]="W106",r[r.W120=120]="W120",r[r.W140=140]="W140",r[r.W158=158]="W158",r[r.W200=200]="W200",r[r.W211=211]="W211"})(M||(M={}));Te();Te();x();var Vt;(function(r){r[r.None=0]="None",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Vt||(Vt={}));var sl=class{oldName;newName;constructor(e,t){this.oldName=e,this.newName=t}};var De=class extends I{onNameChanged=null;flags=Vt.None;get name(){return this._name}set name(e){if(!e||!e.trim())throw new Error(`Table entry [${this.constructor.name}] must have a name`);this.onNameChanged&&this.onNameChanged(this,new sl(this._name,e)),this._name=e}get subclassMarker(){return l.TableRecord}_name="";constructor(e){if(super(),e!==void 0){if(!e)throw new Error(`${this.constructor.name} must have a name.`);this.name=e}}clone(){let e=super.clone();return e.onNameChanged=null,e}toString(){return`${this.objectName}:${this.name}`}};D();x();R();var Ze;(function(r){r[r.None=0]="None",r[r.RotationIsAbsolute=1]="RotationIsAbsolute",r[r.Text=2]="Text",r[r.Shape=4]="Shape"})(Ze||(Ze={}));var nl=class r{length=0;shapeFlags=Ze.None;shapeNumber=0;offset={x:0,y:0};rotation=0;scale=0;text="";style=null;owner=null;get isShape(){return(this.shapeFlags&Ze.Shape)!==0}clone(){let e=new r;return e.length=this.length,e.shapeFlags=this.shapeFlags,e.shapeNumber=this.shapeNumber,e.offset={...this.offset},e.rotation=this.rotation,e.scale=this.scale,e.text=this.text,e.style=this.style,e.owner=null,e}},H=class r extends De{static get ByBlock(){return new r("ByBlock")}static get ByLayer(){return new r("ByLayer")}static get Continuous(){return new r("Continuous")}alignment="A";description=null;get hasShapes(){return this._segments.some(e=>e.isShape)}get isComplex(){return this._segments.length>0}get objectName(){return d.TableLinetype}get objectType(){return u.LTYPE}get patternLength(){return this._segments.reduce((e,t)=>e+Math.abs(t.length),0)}get segments(){return this._segments}get subclassMarker(){return l.Linetype}static ByBlockName="ByBlock";static ByLayerName="ByLayer";static ContinuousName="Continuous";_segments=[];constructor(e){super(e)}addSegment(e){if(e.owner!=null)throw new Error(`Segment already assigned to a LineType: ${e.owner.name}`);e.owner=this,this._segments.push(e)}clone(){let e=super.clone();e._segments=[];for(let t of this._segments)e.addSegment(t.clone());return e}};var ze;(function(r){r[r.None=0]="None",r[r.Frozen=1]="Frozen",r[r.FrozenNewViewports=2]="FrozenNewViewports",r[r.Locked=4]="Locked",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(ze||(ze={}));var Se=class r extends De{static get Default(){return new r(r.DefaultName)}static get Defpoints(){let e=new r(r.DefpointsName);return e.plotFlag=!1,e}get color(){return this._color}set color(e){if(e.isByLayer||e.isByBlock)throw new Error("The layer color cannot be ByLayer or ByBlock");this._color=e}get layerFlags(){return this.flags}set layerFlags(e){this.flags=e}isOn=!0;lineType=null;lineWeight=M.Default;material=null;get objectName(){return d.TableLayer}get objectType(){return u.LAYER}get plotFlag(){return this._name.toLowerCase()===r.DefpointsName.toLowerCase()?!1:this._plotFlag}set plotFlag(e){this._plotFlag=e}plotStyleName=0;get subclassMarker(){return l.Layer}static DefaultName="0";static DefpointsName="defpoints";_color=new B(7);_plotFlag=!0;constructor(e){super(e)}clone(){return super.clone()}assignDocument(e){super.assignDocument(e),this.lineType=I.updateCollection(this.lineType??H.Continuous,e.lineTypes)}unassignDocument(){super.unassignDocument(),this.lineType=this.lineType?.clone?.()??H.Continuous}};var Ke=class r{static get ByLayer(){return new r(-1)}static get ByBlock(){return new r(100)}static get Opaque(){return new r(0)}get isByLayer(){return this._value===-1}get isByBlock(){return this._value===100}get value(){return this._value}set value(e){if(e===-1){this._value=e;return}if(e===100){this._value=e;return}if(e<0||e>90)throw new RangeError("Transparency must be in range from 0 to 90.");this._value=e}_value;constructor(e){this._value=-1,this.value=e}static toAlphaValue(e){let t=Math.round(255*(100-e.value)/100);return e.isByBlock?16777216:2<<24|t}static fromAlphaValue(e){let t=e&255,i=Math.round(100-t/255*100);return i===-1?r.ByLayer:i===100?r.ByBlock:i<0?new r(0):i>90?new r(90):new r(i)}};x();var C=class r{x;y;get dimension(){return 2}get 0(){return this.x}set 0(e){this.x=e}get 1(){return this.y}set 1(e){this.y=e}get X(){return this.x}set X(e){this.x=e}get Y(){return this.y}set Y(e){this.y=e}constructor(e=0,t=0){this.x=e,this.y=t}static Zero=new r(0,0);static AxisX=new r(1,0);static AxisY=new r(0,1);getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){let e=this.getLength();return e===0?new r:new r(this.x/e,this.y/e)}getAngle(){return Math.atan2(this.y,this.x)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}static Cross(e,t){return e.x*t.y-e.y*t.x}static Polar(e,t,i){return new r(e.x+i*Math.cos(t),e.y+i*Math.sin(t))}static Rotate(e,t){let i=Math.cos(t),s=Math.sin(t);return new r(e.x*i-e.y*s,e.x*s+e.y*i)}equals(e){return this.x===e.x&&this.y===e.y}};function ph(r){return r!=null&&typeof r=="object"&&"blockEntity"in r}var A=class extends I{bookColor=null;color=B.ByLayer;isInvisible=!1;get layer(){return this._layer}set layer(e){if(e==null)throw new Error("value cannot be null");this._layer=I.updateCollection(e,this.document?.layers??null)}get lineType(){return this._lineType}set lineType(e){if(e==null)throw new Error("value cannot be null");this._lineType=I.updateCollection(e,this.document?.lineTypes??null)}lineTypeScale=1;lineWeight=M.ByLayer;material=null;get subclassMarker(){return l.Entity}transparency=Ke.ByLayer;_bookColor=null;_layer=Se.Default;_lineType=H.ByLayer;constructor(){super()}applyRotation(e,t){}applyScaling(e,t){}applyTranslation(e){}clone(){let e=super.clone();return e._layer=this.layer.clone(),e._lineType=this.lineType.clone(),e.material=this.material?.clone?.()??null,e}getActiveColor(){let e;return this.color.isByLayer?e=this.layer.color:this.color.isByBlock&&ph(this.owner)?e=this.owner.blockEntity.color:e=this.color,e}getActiveLineType(){return this.lineType.name.toUpperCase()===H.ByLayerName.toUpperCase()?this.layer.lineType:this.lineType.name.toUpperCase()===H.ByBlockName.toUpperCase()&&ph(this.owner)?this.owner.blockEntity.lineType:this.lineType}getActiveLineWeightType(){switch(this.lineWeight){case M.ByLayer:return this.layer.lineWeight;case M.ByBlock:return ph(this.owner)?this.owner.blockEntity.getActiveLineWeightType():this.lineWeight;default:return this.lineWeight}}matchProperties(e){if(e==null)throw new Error("entity cannot be null");e.handle===0||this.document!==e.document?(this.layer=e.layer.clone(),this.lineType=e.lineType.clone(),this.material=e.material?.clone?.()??null):(this.layer=e.layer,this.lineType=e.lineType,this.material=e.material),this.color=e.color,this.lineWeight=e.lineWeight,this.lineTypeScale=e.lineTypeScale,this.isInvisible=e.isInvisible,this.transparency=e.transparency}assignDocument(e){super.assignDocument(e),this._layer=I.updateCollection(this.layer,e.layers),this._lineType=I.updateCollection(this.lineType,e.lineTypes),e.layers.onRemove=this._tableOnRemove.bind(this),e.lineTypes.onRemove=this._tableOnRemove.bind(this)}unassignDocument(){super.unassignDocument(),this._layer=this.layer.clone(),this._lineType=this.lineType.clone()}applyRotationToPoints(e,t){if(e==null)throw new Error("points cannot be null");if(Math.abs(t)<1e-12)return[...e];let i=Math.sin(t),s=Math.cos(t),n=[];for(let a of e)n.push(new C(a.x*s-a.y*i,a.x*i+a.y*s));return n}applyWorldMatrix(e,t,i,s){return e}getWorldMatrix(e,t,i){return{matrix:null,transOW:null,transWO:null}}_tableOnRemove(e,t){t.item===this.layer&&(this.layer=this.document.layers.get(Se.DefaultName)),t.item===this.lineType&&(this.lineType=this.document.lineTypes.get(H.ByLayerName))}transformNormal(e,t){return t}};var c=class r{x;y;z;get dimension(){return 3}get 0(){return this.x}set 0(e){this.x=e}get 1(){return this.y}set 1(e){this.y=e}get 2(){return this.z}set 2(e){this.z=e}get X(){return this.x}set X(e){this.x=e}get Y(){return this.y}set Y(e){this.y=e}get Z(){return this.z}set Z(e){this.z=e}constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}static Zero=new r(0,0,0);static AxisX=new r(1,0,0);static AxisY=new r(0,1,0);static AxisZ=new r(0,0,1);static NaN=new r(Number.NaN,Number.NaN,Number.NaN);getLength(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){let e=this.getLength();return e===0?new r:new r(this.x/e,this.y/e,this.z/e)}getAngle(){return Math.atan2(this.y,this.x)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new r(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}static Cross(e,t){return new r(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)}static equals(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}};var Ac=new c(0,0,0),Pr=class extends A{basePoint=Ac;get blockOwner(){return this.owner}comments=null;flags=ne.None;isUnloaded=!1;get name(){return this.blockOwner?.name??""}set name(e){this.blockOwner&&(this.blockOwner.name=e)}get objectName(){return d.Block}get objectType(){return u.BLOCK}get subclassMarker(){return l.BlockBegin}xRefPath=null;constructor(e){super(),e&&(this.owner=e)}clone(){return super.clone()}applyTransform(e){}getBoundingBox(){return null}};D();x();R();var gs=class extends A{get objectName(){return d.EndBlock}get objectType(){return u.ENDBLK}get subclassMarker(){return l.BlockEnd}constructor(e){super(),e&&(this.owner=e)}clone(){return super.clone()}applyTransform(e){}getBoundingBox(){return null}};Te();var Or=class{title="";subject="";author="";keywords="";comments="";lastSavedBy="";revisionNumber="";hyperlinkBase="";createdDate=new Date;modifiedDate=new Date;properties=new Map};var y;(function(r){r[r.Unknown=0]="Unknown",r[r.Usascii=20127]="Usascii",r[r.Iso88591=28591]="Iso88591",r[r.Iso88592=28592]="Iso88592",r[r.Iso88593=28593]="Iso88593",r[r.Iso88594=28594]="Iso88594",r[r.Iso88595=28595]="Iso88595",r[r.Iso88596=28596]="Iso88596",r[r.Iso88597=28597]="Iso88597",r[r.Iso88598=28598]="Iso88598",r[r.Iso88599=28599]="Iso88599",r[r.Iso885910=28600]="Iso885910",r[r.Iso885913=28603]="Iso885913",r[r.Iso885915=28605]="Iso885915",r[r.Ibm437=437]="Ibm437",r[r.Ibm737=737]="Ibm737",r[r.Ibm775=775]="Ibm775",r[r.Ibm850=850]="Ibm850",r[r.Ibm852=852]="Ibm852",r[r.Ibm855=855]="Ibm855",r[r.Ibm857=857]="Ibm857",r[r.Ibm860=860]="Ibm860",r[r.Ibm861=861]="Ibm861",r[r.Ibm863=863]="Ibm863",r[r.Ibm864=864]="Ibm864",r[r.Ibm865=865]="Ibm865",r[r.Ibm869=869]="Ibm869",r[r.Dos720=720]="Dos720",r[r.Cp866=866]="Cp866",r[r.Shift_jis=932]="Shift_jis",r[r.Gb2312=936]="Gb2312",r[r.Ksc5601=949]="Ksc5601",r[r.big5=950]="big5",r[r.Johab=1361]="Johab",r[r.Macintosh=1e4]="Macintosh",r[r.Xmacromanian=10010]="Xmacromanian",r[r.Windows874=874]="Windows874",r[r.Windows1250=1250]="Windows1250",r[r.Windows1251=1251]="Windows1251",r[r.Windows1252=1252]="Windows1252",r[r.Windows1253=1253]="Windows1253",r[r.Windows1254=1254]="Windows1254",r[r.Windows1255=1255]="Windows1255",r[r.Windows1256=1256]="Windows1256",r[r.Windows1257=1257]="Windows1257",r[r.Windows1258=1258]="Windows1258",r[r.Utf16=1200]="Utf16"})(y||(y={}));var Z=class r{static _dxfEncodingMap=new Map([["gb2312",y.Gb2312],["kcs5601",y.Ksc5601],["ascii",y.Usascii],["big5",y.big5],["johab",y.Johab],["mac-roman",y.Xmacromanian],["dos437",y.Ibm437],["dos850",y.Ibm850],["dos852",y.Ibm852],["dos737",y.Ibm737],["dos866",y.Cp866],["dos855",y.Ibm855],["dos857",y.Ibm857],["dos860",y.Ibm860],["dos861",y.Ibm861],["dos863",y.Ibm863],["dos864",y.Ibm864],["dos865",y.Ibm865],["dos869",y.Ibm869],["dos720",y.Dos720],["dos775",y.Ibm775],["dos932",y.Shift_jis],["dos950",y.big5],["ansi_874",y.Windows874],["ansi_932",y.Shift_jis],["ansi_936",y.Gb2312],["ansi_950",y.big5],["ansi_1250",y.Windows1250],["ansi1250",y.Windows1250],["ansi_1251",y.Windows1251],["ansi1251",y.Windows1251],["ansi_1252",y.Windows1252],["ansi1252",y.Windows1252],["ansi_1253",y.Windows1253],["ansi1253",y.Windows1253],["ansi_1254",y.Windows1254],["ansi1254",y.Windows1254],["ansi_1255",y.Windows1255],["ansi1255",y.Windows1255],["ansi_1256",y.Windows1256],["ansi1256",y.Windows1256],["ansi_1257",y.Windows1257],["ansi1257",y.Windows1257],["iso8859-1",y.Iso88591],["iso88591",y.Iso88591],["iso8859-2",y.Iso88592],["iso88592",y.Iso88592],["iso8859-3",y.Iso88593],["iso88593",y.Iso88593],["iso8859-4",y.Iso88594],["iso88594",y.Iso88594],["iso8859-5",y.Iso88595],["iso88595",y.Iso88595],["iso8859-6",y.Iso88596],["iso88596",y.Iso88596],["iso8859-7",y.Iso88597],["iso88597",y.Iso88597],["iso8859-8",y.Iso88598],["iso88598",y.Iso88598],["iso8859-9",y.Iso88599],["iso88599",y.Iso88599],["iso8859-10",y.Iso885910],["iso885910",y.Iso885910],["iso8859-13",y.Iso885913],["iso885913",y.Iso885913],["iso885915",y.Iso885915],["iso8859-15",y.Iso885915]]);static _indexedValue=[M.W0,M.W5,M.W9,M.W13,M.W15,M.W18,M.W20,M.W25,M.W30,M.W35,M.W40,M.W50,M.W53,M.W60,M.W70,M.W80,M.W90,M.W100,M.W106,M.W120,M.W140,M.W158,M.W200,M.W211];static _pageCodes=[y.Unknown,y.Usascii,y.Iso88591,y.Iso88592,y.Iso88593,y.Iso88594,y.Iso88595,y.Iso88596,y.Iso88597,y.Iso88598,y.Iso88599,y.Ibm437,y.Ibm850,y.Ibm852,y.Ibm855,y.Ibm857,y.Ibm860,y.Ibm861,y.Ibm863,y.Ibm864,y.Ibm865,y.Ibm869,y.Shift_jis,y.Macintosh,y.big5,y.Ksc5601,y.Johab,y.Cp866,y.Windows1250,y.Windows1251,y.Windows1252,y.Gb2312,y.Windows1253,y.Windows1254,y.Windows1255,y.Windows1256,y.Windows1257,y.Windows874,y.Shift_jis,y.Gb2312,y.Ksc5601,y.big5,y.Johab,y.Utf16,y.Windows1258];static toValue(e){switch(e){case 28:case 29:return M.ByLayer;case 30:return M.ByBlock;case 31:return M.Default;default:return e<0||e>=r._indexedValue.length?M.Default:r._indexedValue[e]}}static toIndex(e){let t=0;switch(e){case M.Default:t=31;break;case M.ByBlock:t=30;break;case M.ByLayer:t=29;break;default:t=r._indexedValue.indexOf(e),t<0&&(t=31);break}return t}static getCodePage(e){return typeof e=="string"?r._dxfEncodingMap.get(e.toLowerCase())??y.Unknown:r._pageCodes[e]??y.Unknown}static getCodePageName(e){for(let[t,i]of r._dxfEncodingMap)if(i===e)return t}static getCodeIndex(e){return r._pageCodes.indexOf(e)}static getVersionFromName(e){let t=e.replace(/\./g,"_").toUpperCase(),i=m[t];return i!==void 0?i:m.Unknown}static getNameFromVersion(e){return m[e]?.replace(/_/g,".")??"Unknown"}static toJulianCalendar(e){let t=e.getFullYear(),i=e.getMonth()+1,s=e.getDate(),n=e.getHours(),a=e.getMinutes(),o=e.getSeconds(),h=e.getMilliseconds(),f=s+n/24+a/1440+(o+h/1e3)/86400;i<3&&(t-=1,i+=12);let b=Math.floor(t/100),S=2-b+Math.floor(b/4),N;t<0?N=Math.floor(365.25*t-.75):N=Math.floor(365.25*t);let L=Math.floor(30.6001*(i+1));return S+N+L+1720995+f}static fromJulianCalendar(e){if(e<1721426||e>5373484)throw new RangeError("The valid values range from 1721426 and 5373484.");let t=Math.floor(e),i=e-t,s=Math.floor((t-186721625e-2)/36524.25),a=t+1+s-Math.floor(s/4)+1524,o=Math.floor((a-122.1)/365.25),h=Math.floor(365.25*o),f=Math.floor((a-h)/30.6001),b=f<14?f-1:f-13,S=b>2?o-4716:o-4715,N=a-h-Math.floor(30.6001*f),L=Math.floor(i*24);i-=L/24;let j=Math.floor(i*1440);i-=j/1440;let we=i*86400,z=Math.floor(we),X=Math.floor((we-z)*1e3);return new Date(S,b-1,N,L,j,z,X)}static editingTime(e){let t=Math.floor(e),i=e-t,s=Math.floor(i*24);i-=s/24;let n=Math.floor(i*1440);i-=n/1440;let a=i*86400,o=Math.floor(a),h=Math.floor((a-o)*1e3);return{days:t,hours:s,minutes:n,seconds:o,milliseconds:h}}static dateToJulian(e){let t=new Date(1,0,1,12,0,0);if(e<t)return{jdate:0,milliseconds:0};let i=new Date(e.getTime()-12*36e5),s=i.getMonth()+1,n=Math.floor((14-s)/12),a=i.getFullYear()+4800-n,o=i.getDate()+Math.floor((153*(s+12*n-3)+2)/5)+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)-32045,h=i.getMilliseconds()+i.getSeconds()*1e3+i.getMinutes()*6e4+i.getHours()*36e5;return{jdate:o,milliseconds:h}}};var al;(function(r){r[r.CounterClockWise=0]="CounterClockWise",r[r.ClockWise=1]="ClockWise"})(al||(al={}));var _n;(function(r){r[r.DecimalDegrees=0]="DecimalDegrees",r[r.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",r[r.Gradians=2]="Gradians",r[r.Radians=3]="Radians",r[r.SurveyorsUnits=4]="SurveyorsUnits"})(_n||(_n={}));var Js;(function(r){r[r.None=0]="None",r[r.Scientific=1]="Scientific",r[r.Decimal=2]="Decimal",r[r.Engineering=3]="Engineering",r[r.Architectural=4]="Architectural",r[r.Fractional=5]="Fractional",r[r.WindowsDesktop=6]="WindowsDesktop"})(Js||(Js={}));var ie;(function(r){r[r.Unitless=0]="Unitless",r[r.Inches=1]="Inches",r[r.Feet=2]="Feet",r[r.Miles=3]="Miles",r[r.Millimeters=4]="Millimeters",r[r.Centimeters=5]="Centimeters",r[r.Meters=6]="Meters",r[r.Kilometers=7]="Kilometers",r[r.Microinches=8]="Microinches",r[r.Mils=9]="Mils",r[r.Yards=10]="Yards",r[r.Angstroms=11]="Angstroms",r[r.Nanometers=12]="Nanometers",r[r.Microns=13]="Microns",r[r.Decimeters=14]="Decimeters",r[r.Decameters=15]="Decameters",r[r.Hectometers=16]="Hectometers",r[r.Gigameters=17]="Gigameters",r[r.AstronomicalUnits=18]="AstronomicalUnits",r[r.LightYears=19]="LightYears",r[r.Parsecs=20]="Parsecs",r[r.USSurveyFeet=21]="USSurveyFeet",r[r.USSurveyInches=22]="USSurveyInches",r[r.USSurveyYards=23]="USSurveyYards"})(ie||(ie={}));D();x();R();var oe;(function(r){r[r.SuppressZeroFeetAndInches=0]="SuppressZeroFeetAndInches",r[r.ShowZeroFeetAndInches=1]="ShowZeroFeetAndInches",r[r.ShowZeroFeetSuppressZeroInches=2]="ShowZeroFeetSuppressZeroInches",r[r.SuppressZeroFeetShowZeroInches=3]="SuppressZeroFeetShowZeroInches",r[r.SuppressDecimalLeadingZeroes=4]="SuppressDecimalLeadingZeroes",r[r.SuppressDecimalTrailingZeroes=8]="SuppressDecimalTrailingZeroes",r[r.SuppressDecimalLeadingAndTrailingZeroes=12]="SuppressDecimalLeadingAndTrailingZeroes"})(oe||(oe={}));var jr;(function(r){r[r.DisplayAll=0]="DisplayAll",r[r.SuppressLeadingZeroes=1]="SuppressLeadingZeroes",r[r.SupressTrailingZeroes=2]="SupressTrailingZeroes",r[r.SupressAll=3]="SupressAll"})(jr||(jr={}));var It;(function(r){r[r.Horizontal=0]="Horizontal",r[r.Diagonal=1]="Diagonal",r[r.None=2]="None"})(It||(It={}));var ao=class r{get angularDecimalPlaces(){return this._angularDecimalPlaces}set angularDecimalPlaces(e){if(e<0)throw new RangeError("The number of decimal places must be equals or greater than zero.");this._angularDecimalPlaces=e}angularZeroHandling=jr.DisplayAll;decimalSeparator;degreesSymbol;feetInchesSeparator;feetSymbol;get fractionHeightScale(){return this._fractionHeightScale}set fractionHeightScale(e){if(e<=0)throw new RangeError("The fraction height scale must be greater than zero.");this._fractionHeightScale=e}fractionType;gradiansSymbol;inchesSymbol;get linearDecimalPlaces(){return this._linearDecimalPlaces}set linearDecimalPlaces(e){if(e<0)throw new RangeError("The number of decimal places must be equals or greater than zero.");this._linearDecimalPlaces=e}linearZeroHandling=oe.SuppressDecimalTrailingZeroes;minutesSymbol;radiansSymbol;secondsSymbol;get suppressAngularLeadingZeros(){return this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressAngularTrailingZeros(){return this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressLinearLeadingZeros(){return this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressLinearTrailingZeros(){return this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressZeroFeet(){return this.linearZeroHandling===oe.SuppressZeroFeetAndInches||this.linearZeroHandling===oe.SuppressZeroFeetShowZeroInches}get suppressZeroInches(){return this.linearZeroHandling===oe.SuppressZeroFeetAndInches||this.linearZeroHandling===oe.ShowZeroFeetSuppressZeroInches}_angularDecimalPlaces;_fractionHeightScale;_linearDecimalPlaces;constructor(){this._linearDecimalPlaces=2,this._angularDecimalPlaces=0,this.decimalSeparator=".",this.feetInchesSeparator="-",this.degreesSymbol="\xB0",this.minutesSymbol="'",this.secondsSymbol='"',this.radiansSymbol="r",this.gradiansSymbol="g",this.feetSymbol="'",this.inchesSymbol='"',this._fractionHeightScale=1,this.fractionType=It.Horizontal}getZeroHandlingFormat(e=!1){let t,i,s;e?(t=this.angularDecimalPlaces,i=this.angularZeroHandling===jr.SuppressLeadingZeroes||this.angularZeroHandling===jr.SupressAll?"#":"0",s=this.angularZeroHandling===jr.SupressTrailingZeroes||this.angularZeroHandling===jr.SupressAll?"#":"0"):(t=this.linearDecimalPlaces,i=this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes?"#":"0",s=this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes?"#":"0");let n=i+".";for(let a=0;a<t;a++)n+=s;return n}toArchitectural(e){let t=Math.trunc(e/12),i=e-12*t,s=Math.trunc(i);if(Math.abs(i)<1e-12)return t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`;let{numerator:n,denominator:a}=r.getFraction(i,Math.pow(2,this.linearDecimalPlaces));if(n===0)return s===0?t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:t===0?this.suppressZeroFeet?`${s}${this.inchesSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`;let o;this.suppressZeroFeet&&t===0?o="":o=t+this.feetSymbol+this.feetInchesSeparator;let h="";switch(this.fractionType){case It.Diagonal:h=`\\A1;${o}${s}{\\H${this.fractionHeightScale}x;\\S${n}#${a};}${this.inchesSymbol}`;break;case It.Horizontal:h=`\\A1;${o}${s}{\\H${this.fractionHeightScale}x;\\S${n}/${a};}${this.inchesSymbol}`;break;case It.None:h=`${o}${s} ${n}/${a}${this.inchesSymbol}`;break}return h}toDecimal(e,t=!1){return r.formatNumber(e,this.getZeroHandlingFormat(t),this.decimalSeparator)}toDegrees(e){let t=e*(180/Math.PI);return r.formatNumber(t,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.degreesSymbol}toDegreesMinutesSeconds(e){let t=e*(180/Math.PI),i=(t-Math.trunc(t))*60,s=(i-Math.trunc(i))*60;if(this.angularDecimalPlaces===0)return`${Math.round(t)}${this.degreesSymbol}`;if(this.angularDecimalPlaces===1||this.angularDecimalPlaces===2)return`${Math.trunc(t)}${this.degreesSymbol}${Math.round(i)}${this.minutesSymbol}`;if(this.angularDecimalPlaces===3||this.angularDecimalPlaces===4)return`${Math.trunc(t)}${this.degreesSymbol}${Math.trunc(i)}${this.minutesSymbol}${Math.round(s)}${this.secondsSymbol}`;let n="0."+"0".repeat(this.angularDecimalPlaces-4);return`${Math.trunc(t)}${this.degreesSymbol}${Math.trunc(i)}${this.minutesSymbol}${r.formatNumber(s,n,this.decimalSeparator)}${this.secondsSymbol}`}toEngineering(e){let t=Math.trunc(e/12),i=e-12*t;if(Math.abs(i)<1e-12)return t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`;let s=r.formatNumber(i,this.getZeroHandlingFormat(),this.decimalSeparator);return t===0?this.suppressZeroFeet?`${i}${this.inchesSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`}toFractional(e){let t=Math.trunc(e),{numerator:i,denominator:s}=r.getFraction(e,Math.pow(2,this.linearDecimalPlaces));if(i===0)return`${Math.trunc(e)}`;let n="";switch(this.fractionType){case It.Diagonal:n=`\\A1;${t}{\\H${this.fractionHeightScale}x;\\S${i}#${s};}`;break;case It.Horizontal:n=`\\A1;${t}{\\H${this.fractionHeightScale}x;\\S${i}/${s};}`;break;case It.None:{n=`${t===0?"":`${t} `}${i}/${s}`;break}}return n}toGradians(e){let t=e*(200/Math.PI);return r.formatNumber(t,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.gradiansSymbol}toRadians(e){return r.formatNumber(e,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.radiansSymbol}toScientific(e){return e.toExponential(this.linearDecimalPlaces).toUpperCase()}static getFraction(e,t){let i=Math.round((e-Math.trunc(e))*t),s=r.getGCD(i,t);s<=0&&(s=1),i=Math.trunc(i/s);let n=Math.trunc(t/s);return{numerator:i,denominator:n}}static getGCD(e,t){let i=e,s=t;for(;s!==0;){let n=i%s;i=s,s=n}return i}static formatNumber(e,t,i){let s=t.split("."),n=s[0]||"0",a=s[1]||"",o=a.length,h=n==="#",f=a.length>0&&a[0]==="#",b=e.toFixed(o);if(i!=="."&&(b=b.replace(".",i)),f&&b.includes(i)){for(;b.endsWith("0");)b=b.slice(0,-1);b.endsWith(i)&&(b=b.slice(0,-1))}return h&&(b.startsWith("0"+i)?b=b.slice(1):b.startsWith("-0"+i)&&(b="-"+b.slice(2))),b}};var qs;(function(r){r[r.BeforeDimensionText=0]="BeforeDimensionText",r[r.AboveDimensionText=1]="AboveDimensionText",r[r.None=2]="None"})(qs||(qs={}));var oo;(function(r){r[r.NoBackground=0]="NoBackground",r[r.DrawingBackgroundColor=1]="DrawingBackgroundColor",r[r.DimensionTextBackgroundColor=2]="DimensionTextBackgroundColor"})(oo||(oo={}));var lo;(function(r){r[r.Centered=0]="Centered",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.OverFirstExtLine=3]="OverFirstExtLine",r[r.OverSecondExtLine=4]="OverSecondExtLine"})(lo||(lo={}));var ho;(function(r){r[r.Centered=0]="Centered",r[r.Above=1]="Above",r[r.Outside=2]="Outside",r[r.JIS=3]="JIS",r[r.Below=4]="Below"})(ho||(ho={}));var ol;(function(r){r[r.Both=0]="Both",r[r.ArrowsFirst=1]="ArrowsFirst",r[r.TextFirst=2]="TextFirst",r[r.BestFit=3]="BestFit"})(ol||(ol={}));var _i;(function(r){r[r.LeftToRight=0]="LeftToRight",r[r.RightToLeft=1]="RightToLeft"})(_i||(_i={}));var co;(function(r){r[r.MoveLineWithText=0]="MoveLineWithText",r[r.AddLeaderWhenTextMoved=1]="AddLeaderWhenTextMoved",r[r.FreeTextPosition=2]="FreeTextPosition"})(co||(co={}));D();x();R();var Nr;(function(r){r[r.None=0]="None",r[r.IsShape=1]="IsShape",r[r.VerticalText=4]="VerticalText",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Nr||(Nr={}));var Qs;(function(r){r[r.Regular=0]="Regular",r[r.Italic=1]="Italic",r[r.Bold=2]="Bold"})(Qs||(Qs={}));var wh;(function(r){r[r.None=0]="None",r[r.FlipX=2]="FlipX",r[r.FlipY=4]="FlipY"})(wh||(wh={}));var te=class r extends De{static DefaultName="Standard";get objectType(){return u.STYLE}get objectName(){return d.TableStyle}get subclassMarker(){return l.TextStyle}static get Default(){return new r(r.DefaultName)}get styleFlags(){return this.flags}set styleFlags(e){this.flags=e}filename="";bigFontFilename=null;height=0;width=1;lastHeight=0;obliqueAngle=0;mirrorFlag=wh.None;trueType=Qs.Regular;get isShapeFile(){return(this.styleFlags&Nr.IsShape)!==0}constructor(e){super(e)}};var uo;(function(r){r[r.Bottom=0]="Bottom",r[r.Middle=1]="Middle",r[r.Top=2]="Top"})(uo||(uo={}));var re=class r extends De{static get Default(){return new r(r.DefaultName)}alternateDimensioningSuffix="[]";alternateUnitDecimalPlaces=3;alternateUnitDimensioning=!1;alternateUnitFormat=Js.Decimal;alternateUnitRounding=0;alternateUnitScaleFactor=25.4;alternateUnitToleranceDecimalPlaces=3;alternateUnitToleranceZeroHandling=oe.SuppressZeroFeetAndInches;alternateUnitZeroHandling=oe.SuppressZeroFeetAndInches;angularDecimalPlaces=0;angularUnit=_n.DecimalDegrees;angularZeroHandling=jr.DisplayAll;arcLengthSymbolPosition=qs.BeforeDimensionText;get arrowBlock(){return this._dimArrowBlock}set arrowBlock(e){this._dimArrowBlock=e}get arrowSize(){return this._arrowSize}set arrowSize(e){if(e<0)throw new Error("The arrowSize must be equals or greater than zero.");this._arrowSize=e}centerMarkSize=.09;cursorUpdate=!1;decimalPlaces=2;decimalSeparator=".";get dimArrow1(){return this._dimArrow1}set dimArrow1(e){this._dimArrow1=e}get dimArrow2(){return this._dimArrow2}set dimArrow2(e){this._dimArrow2=e}dimensionFit=0;dimensionLineColor=B.ByBlock;dimensionLineExtension=0;dimensionLineGap=.625;dimensionLineIncrement=3.75;dimensionLineWeight=M.ByBlock;dimensionTextArrowFit=ol.BestFit;dimensionUnit=2;extensionLineColor=B.ByBlock;extensionLineExtension=1.25;extensionLineOffset=.625;extensionLineWeight=M.ByBlock;fixedExtensionLineLength=1;fractionFormat=It.Horizontal;generateTolerances=!1;isExtensionLineLengthFixed=!1;get joggedRadiusDimensionTransverseSegmentAngle(){return this._joggedRadiusDimensionTransverseSegmentAngle}set joggedRadiusDimensionTransverseSegmentAngle(e){let t=Math.round(e*1e6)/1e6,i=5*Math.PI/180,s=Math.PI/2;if(t<=i||t>=s)throw new Error("The joggedRadiusDimensionTransverseSegmentAngle must be in range of 5 to 90 degrees.");this._joggedRadiusDimensionTransverseSegmentAngle=e}get leaderArrow(){return this._leaderArrow}set leaderArrow(e){this._leaderArrow=e}limitsGeneration=!1;linearScaleFactor=1;linearUnitFormat=Js.Decimal;get lineType(){return this._lineType}set lineType(e){this._lineType=e}get lineTypeExt1(){return this._lineTypeExt1}set lineTypeExt1(e){this._lineTypeExt1=e}get lineTypeExt2(){return this._lineTypeExt2}set lineTypeExt2(e){this._lineTypeExt2=e}minusTolerance=0;get objectName(){return d.TableDimstyle}get objectType(){return u.DIMSTYLE}plusTolerance=0;postFix="<>";get prefix(){let{prefix:e}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");return e}set prefix(e){let{suffix:t}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");this.postFix=`${e}${this.postFix}${t}`}rounding=0;get scaleFactor(){return this._scaleFactor}set scaleFactor(e){if(e<0)throw new Error("The scaleFactor must be equals or greater than zero.");this._scaleFactor=e}separateArrowBlocks=!0;get style(){return this._style}set style(e){if(e==null)throw new Error("Style cannot be null.");this._style=e}get subclassMarker(){return l.DimensionStyle}get suffix(){let{suffix:e}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");return e}set suffix(e){let{prefix:t}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");this.postFix=`${t}${this.postFix}${e}`}suppressFirstDimensionLine=!1;suppressFirstExtensionLine=!1;suppressOutsideExtensions=!1;suppressSecondDimensionLine=!1;suppressSecondExtensionLine=!1;textBackgroundColor=B.ByBlock;textBackgroundFillMode=oo.NoBackground;textColor=B.ByBlock;textDirection=_i.LeftToRight;get textHeight(){return this._textHeight}set textHeight(e){if(e<=0)throw new Error("The textHeight must be greater than zero.");this._textHeight=e}textHorizontalAlignment=lo.Centered;textInsideExtensions=!1;textInsideHorizontal=!1;textMovement=co.MoveLineWithText;textOutsideExtensions=!1;textOutsideHorizontal=!1;textVerticalAlignment=ho.Above;textVerticalPosition=0;tickSize=0;toleranceAlignment=uo.Bottom;toleranceDecimalPlaces=2;toleranceScaleFactor=1;toleranceZeroHandling=oe.SuppressDecimalTrailingZeroes;zeroHandling=oe.SuppressDecimalTrailingZeroes;static DefaultName="Standard";static StyleOverrideEntryName="DSTYLE";_arrowSize=.18;_dimArrow1=null;_dimArrow2=null;_dimArrowBlock=null;_joggedRadiusDimensionTransverseSegmentAngle=Math.PI/4;_leaderArrow=null;_lineType=null;_lineTypeExt1=null;_lineTypeExt2=null;_scaleFactor=1;_style=te.Default;_textHeight=.18;constructor(e){super(e)}applyRounding(e,t=!1){let i=t?this.alternateUnitRounding:this.rounding;return i!==0&&(e=i*Math.round(e/i)),e}clone(){let e=super.clone();return e.style=this.style?.clone(),e.leaderArrow=this.leaderArrow?.clone()??null,e.arrowBlock=this.arrowBlock?.clone()??null,e.dimArrow1=this.dimArrow1?.clone()??null,e.dimArrow2=this.dimArrow2?.clone()??null,e.lineType=this.lineType?.clone()??null,e.lineTypeExt1=this.lineTypeExt1?.clone()??null,e.lineTypeExt2=this.lineTypeExt2?.clone()??null,e}getAlternateUnitStyleFormat(){let e=new ao;return e.linearDecimalPlaces=this.alternateUnitDecimalPlaces,e.angularDecimalPlaces=this.alternateUnitDecimalPlaces,e.decimalSeparator=this.decimalSeparator,e.fractionHeightScale=this.toleranceScaleFactor,e.fractionType=this.fractionFormat,e.linearZeroHandling=this.alternateUnitZeroHandling,e.angularZeroHandling=this.angularZeroHandling,e}getUnitStyleFormat(){let e=new ao;return e.linearDecimalPlaces=this.decimalPlaces,e.angularDecimalPlaces=this.angularDecimalPlaces===-1?this.decimalPlaces:this.angularDecimalPlaces,e.decimalSeparator=this.decimalSeparator,e.fractionHeightScale=this.toleranceScaleFactor,e.fractionType=this.fractionFormat,e.linearZeroHandling=this.zeroHandling,e.angularZeroHandling=this.angularZeroHandling,e}getDimStylePrefixAndSuffix(e,t,i){let s=-1;for(let n=0;n<e.length;n++)if(e[n]===t&&n+1<e.length&&e[n+1]===i){s=n;break}return s<0?{prefix:"",suffix:e}:{prefix:e.substring(0,s),suffix:e.substring(s+2)}}altMzf=0;altMzs="";mzf=0;mzs=""};D();x();R();var Mt;(function(r){r[r.None=0]="None",r[r.Top=1]="Top",r[r.Bottom=2]="Bottom",r[r.Front=3]="Front",r[r.Back=4]="Back",r[r.Left=5]="Left",r[r.Right=6]="Right"})(Mt||(Mt={}));var ot=class extends De{get objectType(){return u.UCS}get objectName(){return d.TableUcs}get subclassMarker(){return l.Ucs}origin=new c(0,0,0);xAxis=new c(1,0,0);yAxis=new c(0,1,0);orthographicType=Mt.None;orthographicViewType=Mt.None;elevation=0;constructor(e){super(e)}};var ll;(function(r){r[r.None=0]="None",r[r.Normal=1]="Normal",r[r.All=2]="All"})(ll||(ll={}));var dl;(function(r){r[r.CreateExplodedDimensions=0]="CreateExplodedDimensions",r[r.CreateNonAssociativeDimensions=1]="CreateNonAssociativeDimensions",r[r.CreateAssociativeDimensions=2]="CreateAssociativeDimensions"})(dl||(dl={}));var Qi;(function(r){r[r.ByLayer=0]="ByLayer",r[r.ByBlock=1]="ByBlock",r[r.ByDictionaryDefault=2]="ByDictionaryDefault",r[r.ByObjectId=3]="ByObjectId"})(Qi||(Qi={}));var hl;(function(r){r[r.NoIndex=0]="NoIndex",r[r.LayerIndex=1]="LayerIndex",r[r.SpatialIndex=2]="SpatialIndex",r[r.LayerAndSpatialIndex=3]="LayerAndSpatialIndex"})(hl||(hl={}));var cl;(function(r){r[r.English=0]="English",r[r.Metric=1]="Metric"})(cl||(cl={}));var ul;(function(r){r[r.Disabled=0]="Disabled",r[r.Selection=1]="Selection",r[r.Snap=2]="Snap",r[r.Redraw=4]="Redraw",r[r.Slide=8]="Slide",r[r.Regen=16]="Regen",r[r.Plotting=32]="Plotting",r[r.Postscript=64]="Postscript",r[r.All=127]="All"})(ul||(ul={}));var bi;(function(r){r[r.Viewport=0]="Viewport",r[r.Normal=1]="Normal"})(bi||(bi={}));var ml;(function(r){r[r.None=0]="None",r[r.QuadraticBSpline=5]="QuadraticBSpline",r[r.CubicBSpline=6]="CubicBSpline",r[r.Bezier=8]="Bezier"})(ml||(ml={}));var fl;(function(r){r[r.None=0]="None",r[r.DisplayAndPlot=1]="DisplayAndPlot",r[r.DisplayNotPlot=2]="DisplayNotPlot"})(fl||(fl={}));var _h;(function(r){r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom"})(_h||(_h={}));var lt=class{angleBase=0;angularDirection=al.ClockWise;angularUnit=_n.DecimalDegrees;get angularUnitPrecision(){return this._angularUnitPrecision}set angularUnitPrecision(e){if(e<0||e>8)throw new Error("AUPREC valid values are from 0 to 8");this._angularUnitPrecision=e}arrowBlockName="";associatedDimensions=!0;attributeVisibility=ll.Normal;blipMode=!1;cameraDisplayObjects=!1;cameraHeight=0;chamferAngle=0;chamferDistance1=0;chamferDistance2=0;chamferLength=0;codePage="ANSI_1252";createDateTime=new Date;createEllipseAsPolyline=!1;currentEntityColor=B.ByLayer;currentEntityLinetypeScale=1;currentEntityLineWeight=M.ByLayer;currentEntityPlotStyle=Qi.ByLayer;get currentLayer(){return this.document==null?this._currentLayer:this.document.layers.get(this.currentLayerName)}get currentLayerName(){return this._currentLayer.name}set currentLayerName(e){this.document!=null?this._currentLayer=this.document.layers.get(e):this._currentLayer=new Se(e)}get currentLineType(){return this.document==null?this._currentLineType:this.document.lineTypes.get(this.currentLineTypeName)}get currentLineTypeName(){return this._currentLineType.name}set currentLineTypeName(e){this.document!=null?this._currentLineType=this.document.lineTypes.get(e):this._currentLineType=new H(e)}currentMultiLineJustification=_h.Top;currentMultilineScale=20;currentMLineStyleName="Standard";get currentTextStyle(){return this.document==null?this._currentTextStyle:this.document.textStyles.get(this.currentTextStyleName)}get currentTextStyleName(){return this._currentTextStyle.name}set currentTextStyleName(e){this.document!=null?this._currentTextStyle=this.document.textStyles.get(e):this._currentTextStyle=new te(e)}dgnUnderlayFramesVisibility="";get dimensionAlternateDimensioningSuffix(){return this._dimensionStyleOverrides.alternateDimensioningSuffix}set dimensionAlternateDimensioningSuffix(e){this._dimensionStyleOverrides.alternateDimensioningSuffix=e}get dimensionAlternateUnitDecimalPlaces(){return this._dimensionStyleOverrides.alternateUnitDecimalPlaces}set dimensionAlternateUnitDecimalPlaces(e){this._dimensionStyleOverrides.alternateUnitDecimalPlaces=e}get dimensionAlternateUnitDimensioning(){return this._dimensionStyleOverrides.alternateUnitDimensioning}set dimensionAlternateUnitDimensioning(e){this._dimensionStyleOverrides.alternateUnitDimensioning=e}get dimensionAlternateUnitFormat(){return this._dimensionStyleOverrides.alternateUnitFormat}set dimensionAlternateUnitFormat(e){this._dimensionStyleOverrides.alternateUnitFormat=e}get dimensionAlternateUnitRounding(){return this._dimensionStyleOverrides.alternateUnitRounding}set dimensionAlternateUnitRounding(e){this._dimensionStyleOverrides.alternateUnitRounding=e}get dimensionAlternateUnitScaleFactor(){return this._dimensionStyleOverrides.alternateUnitScaleFactor}set dimensionAlternateUnitScaleFactor(e){this._dimensionStyleOverrides.alternateUnitScaleFactor=e}get dimensionAlternateUnitToleranceDecimalPlaces(){return this._dimensionStyleOverrides.alternateUnitToleranceDecimalPlaces}set dimensionAlternateUnitToleranceDecimalPlaces(e){this._dimensionStyleOverrides.alternateUnitToleranceDecimalPlaces=e}get dimensionAlternateUnitToleranceZeroHandling(){return this._dimensionStyleOverrides.alternateUnitToleranceZeroHandling}set dimensionAlternateUnitToleranceZeroHandling(e){this._dimensionStyleOverrides.alternateUnitToleranceZeroHandling=e}get dimensionAlternateUnitZeroHandling(){return this._dimensionStyleOverrides.alternateUnitZeroHandling}set dimensionAlternateUnitZeroHandling(e){this._dimensionStyleOverrides.alternateUnitZeroHandling=e}get dimensionAngularDimensionDecimalPlaces(){return this._dimensionStyleOverrides.angularDecimalPlaces}set dimensionAngularDimensionDecimalPlaces(e){this._dimensionStyleOverrides.angularDecimalPlaces=e}get dimensionAngularUnit(){return this._dimensionStyleOverrides.angularUnit}set dimensionAngularUnit(e){this._dimensionStyleOverrides.angularUnit=e}get dimensionAngularZeroHandling(){return this._dimensionStyleOverrides.angularZeroHandling}set dimensionAngularZeroHandling(e){this._dimensionStyleOverrides.angularZeroHandling=e}get dimensionArcLengthSymbolPosition(){return this._dimensionStyleOverrides.arcLengthSymbolPosition}set dimensionArcLengthSymbolPosition(e){this._dimensionStyleOverrides.arcLengthSymbolPosition=e}get dimensionArrowSize(){return this._dimensionStyleOverrides.arrowSize}set dimensionArrowSize(e){this._dimensionStyleOverrides.arrowSize=e}dimensionAssociativity=dl.CreateAssociativeDimensions;dimensionBlockName="";dimensionBlockNameFirst=null;dimensionBlockNameSecond=null;get dimensionCenterMarkSize(){return this._dimensionStyleOverrides.centerMarkSize}set dimensionCenterMarkSize(e){this._dimensionStyleOverrides.centerMarkSize=e}get dimensionCursorUpdate(){return this._dimensionStyleOverrides.cursorUpdate}set dimensionCursorUpdate(e){this._dimensionStyleOverrides.cursorUpdate=e}get dimensionDecimalPlaces(){return this._dimensionStyleOverrides.decimalPlaces}set dimensionDecimalPlaces(e){this._dimensionStyleOverrides.decimalPlaces=e}get dimensionDecimalSeparator(){return this._dimensionStyleOverrides.decimalSeparator}set dimensionDecimalSeparator(e){this._dimensionStyleOverrides.decimalSeparator=e}get dimensionDimensionTextArrowFit(){return this._dimensionStyleOverrides.dimensionTextArrowFit}set dimensionDimensionTextArrowFit(e){this._dimensionStyleOverrides.dimensionTextArrowFit=e}get dimensionExtensionLineColor(){return this._dimensionStyleOverrides.extensionLineColor}set dimensionExtensionLineColor(e){this._dimensionStyleOverrides.extensionLineColor=e}get dimensionExtensionLineExtension(){return this._dimensionStyleOverrides.extensionLineExtension}set dimensionExtensionLineExtension(e){this._dimensionStyleOverrides.extensionLineExtension=e}get dimensionExtensionLineOffset(){return this._dimensionStyleOverrides.extensionLineOffset}set dimensionExtensionLineOffset(e){this._dimensionStyleOverrides.extensionLineOffset=e}get dimensionFit(){return this._dimensionStyleOverrides.dimensionFit}set dimensionFit(e){this._dimensionStyleOverrides.dimensionFit=e}get dimensionFixedExtensionLineLength(){return this._dimensionStyleOverrides.fixedExtensionLineLength}set dimensionFixedExtensionLineLength(e){this._dimensionStyleOverrides.fixedExtensionLineLength=e}get dimensionFractionFormat(){return this._dimensionStyleOverrides.fractionFormat}set dimensionFractionFormat(e){this._dimensionStyleOverrides.fractionFormat=e}get dimensionGenerateTolerances(){return this._dimensionStyleOverrides.generateTolerances}set dimensionGenerateTolerances(e){this._dimensionStyleOverrides.generateTolerances=e}get dimensionIsExtensionLineLengthFixed(){return this._dimensionStyleOverrides.isExtensionLineLengthFixed}set dimensionIsExtensionLineLengthFixed(e){this._dimensionStyleOverrides.isExtensionLineLengthFixed=e}get dimensionJoggedRadiusDimensionTransverseSegmentAngle(){return this._dimensionStyleOverrides.joggedRadiusDimensionTransverseSegmentAngle}set dimensionJoggedRadiusDimensionTransverseSegmentAngle(e){this._dimensionStyleOverrides.joggedRadiusDimensionTransverseSegmentAngle=e}get dimensionLimitsGeneration(){return this._dimensionStyleOverrides.limitsGeneration}set dimensionLimitsGeneration(e){this._dimensionStyleOverrides.limitsGeneration=e}get dimensionLinearScaleFactor(){return this._dimensionStyleOverrides.linearScaleFactor}set dimensionLinearScaleFactor(e){this._dimensionStyleOverrides.linearScaleFactor=e}get dimensionLinearUnitFormat(){return this._dimensionStyleOverrides.linearUnitFormat}set dimensionLinearUnitFormat(e){this._dimensionStyleOverrides.linearUnitFormat=e}get dimensionLineColor(){return this._dimensionStyleOverrides.dimensionLineColor}set dimensionLineColor(e){this._dimensionStyleOverrides.dimensionLineColor=e}get dimensionLineExtension(){return this._dimensionStyleOverrides.dimensionLineExtension}set dimensionLineExtension(e){this._dimensionStyleOverrides.dimensionLineExtension=e}get dimensionLineGap(){return this._dimensionStyleOverrides.dimensionLineGap}set dimensionLineGap(e){this._dimensionStyleOverrides.dimensionLineGap=e}get dimensionLineIncrement(){return this._dimensionStyleOverrides.dimensionLineIncrement}set dimensionLineIncrement(e){this._dimensionStyleOverrides.dimensionLineIncrement=e}dimensionLineType="ByBlock";get dimensionLineWeight(){return this._dimensionStyleOverrides.dimensionLineWeight}set dimensionLineWeight(e){this._dimensionStyleOverrides.dimensionLineWeight=e}get dimensionMinusTolerance(){return this._dimensionStyleOverrides.minusTolerance}set dimensionMinusTolerance(e){this._dimensionStyleOverrides.minusTolerance=e}get dimensionPlusTolerance(){return this._dimensionStyleOverrides.plusTolerance}set dimensionPlusTolerance(e){this._dimensionStyleOverrides.plusTolerance=e}get dimensionPostFix(){return this._dimensionStyleOverrides.postFix}set dimensionPostFix(e){this._dimensionStyleOverrides.postFix=e}get dimensionRounding(){return this._dimensionStyleOverrides.rounding}set dimensionRounding(e){this._dimensionStyleOverrides.rounding=e}get dimensionScaleFactor(){return this._dimensionStyleOverrides.scaleFactor}set dimensionScaleFactor(e){this._dimensionStyleOverrides.scaleFactor=e}get dimensionSeparateArrowBlocks(){return this._dimensionStyleOverrides.separateArrowBlocks}set dimensionSeparateArrowBlocks(e){this._dimensionStyleOverrides.separateArrowBlocks=e}get currentDimensionStyle(){return this.document==null?this._currentDimensionStyle:this.document.dimensionStyles.get(this.currentDimensionStyleName)}get currentDimensionStyleName(){return this._currentDimensionStyle.name}set currentDimensionStyleName(e){this.document!=null?this._currentDimensionStyle=this.document.dimensionStyles.get(e):this._currentDimensionStyle=new re(e)}get dimensionSuppressFirstDimensionLine(){return this._dimensionStyleOverrides.suppressFirstDimensionLine}set dimensionSuppressFirstDimensionLine(e){this._dimensionStyleOverrides.suppressFirstDimensionLine=e}get dimensionSuppressFirstExtensionLine(){return this._dimensionStyleOverrides.suppressFirstExtensionLine}set dimensionSuppressFirstExtensionLine(e){this._dimensionStyleOverrides.suppressFirstExtensionLine=e}get dimensionSuppressOutsideExtensions(){return this._dimensionStyleOverrides.suppressOutsideExtensions}set dimensionSuppressOutsideExtensions(e){this._dimensionStyleOverrides.suppressOutsideExtensions=e}get dimensionSuppressSecondDimensionLine(){return this._dimensionStyleOverrides.suppressSecondDimensionLine}set dimensionSuppressSecondDimensionLine(e){this._dimensionStyleOverrides.suppressSecondDimensionLine=e}get dimensionSuppressSecondExtensionLine(){return this._dimensionStyleOverrides.suppressSecondExtensionLine}set dimensionSuppressSecondExtensionLine(e){this._dimensionStyleOverrides.suppressSecondExtensionLine=e}dimensionTex1="ByBlock";dimensionTex2="ByBlock";get dimensionTextBackgroundColor(){return this._dimensionStyleOverrides.textBackgroundColor}set dimensionTextBackgroundColor(e){this._dimensionStyleOverrides.textBackgroundColor=e}get dimensionTextBackgroundFillMode(){return this._dimensionStyleOverrides.textBackgroundFillMode}set dimensionTextBackgroundFillMode(e){this._dimensionStyleOverrides.textBackgroundFillMode=e}get dimensionTextColor(){return this._dimensionStyleOverrides.textColor}set dimensionTextColor(e){this._dimensionStyleOverrides.textColor=e}get dimensionTextDirection(){return this._dimensionStyleOverrides.textDirection}set dimensionTextDirection(e){this._dimensionStyleOverrides.textDirection=e}get dimensionTextHeight(){return this._dimensionStyleOverrides.textHeight}set dimensionTextHeight(e){this._dimensionStyleOverrides.textHeight=e}get dimensionTextHorizontalAlignment(){return this._dimensionStyleOverrides.textHorizontalAlignment}set dimensionTextHorizontalAlignment(e){this._dimensionStyleOverrides.textHorizontalAlignment=e}get dimensionTextInsideExtensions(){return this._dimensionStyleOverrides.textInsideExtensions}set dimensionTextInsideExtensions(e){this._dimensionStyleOverrides.textInsideExtensions=e}get dimensionTextInsideHorizontal(){return this._dimensionStyleOverrides.textInsideHorizontal}set dimensionTextInsideHorizontal(e){this._dimensionStyleOverrides.textInsideHorizontal=e}get dimensionTextMovement(){return this._dimensionStyleOverrides.textMovement}set dimensionTextMovement(e){this._dimensionStyleOverrides.textMovement=e}get dimensionTextOutsideExtensions(){return this._dimensionStyleOverrides.textOutsideExtensions}set dimensionTextOutsideExtensions(e){this._dimensionStyleOverrides.textOutsideExtensions=e}get dimensionTextOutsideHorizontal(){return this._dimensionStyleOverrides.textOutsideHorizontal}set dimensionTextOutsideHorizontal(e){this._dimensionStyleOverrides.textOutsideHorizontal=e}get dimensionTextStyle(){return this.document==null?this._dimensionTextStyle:this.document.textStyles.get(this.dimensionTextStyleName)}get dimensionTextStyleName(){return this._dimensionTextStyle.name}set dimensionTextStyleName(e){this.document!=null?this._dimensionTextStyle=this.document.textStyles.get(e):this._dimensionTextStyle=new te(e)}get dimensionTextVerticalAlignment(){return this._dimensionStyleOverrides.textVerticalAlignment}set dimensionTextVerticalAlignment(e){this._dimensionStyleOverrides.textVerticalAlignment=e}get dimensionTextVerticalPosition(){return this._dimensionStyleOverrides.textVerticalPosition}set dimensionTextVerticalPosition(e){this._dimensionStyleOverrides.textVerticalPosition=e}get dimensionTickSize(){return this._dimensionStyleOverrides.tickSize}set dimensionTickSize(e){this._dimensionStyleOverrides.tickSize=e}get dimensionToleranceAlignment(){return this._dimensionStyleOverrides.toleranceAlignment}set dimensionToleranceAlignment(e){this._dimensionStyleOverrides.toleranceAlignment=e}get dimensionToleranceDecimalPlaces(){return this._dimensionStyleOverrides.toleranceDecimalPlaces}set dimensionToleranceDecimalPlaces(e){this._dimensionStyleOverrides.toleranceDecimalPlaces=e}get dimensionToleranceScaleFactor(){return this._dimensionStyleOverrides.toleranceScaleFactor}set dimensionToleranceScaleFactor(e){this._dimensionStyleOverrides.toleranceScaleFactor=e}get dimensionToleranceZeroHandling(){return this._dimensionStyleOverrides.toleranceZeroHandling}set dimensionToleranceZeroHandling(e){this._dimensionStyleOverrides.toleranceZeroHandling=e}get dimensionUnit(){return this._dimensionStyleOverrides.dimensionUnit}set dimensionUnit(e){this._dimensionStyleOverrides.dimensionUnit=e}get dimensionZeroHandling(){return this._dimensionStyleOverrides.zeroHandling}set dimensionZeroHandling(e){this._dimensionStyleOverrides.zeroHandling=e}get dimensionstyleOverrides(){return this._dimensionStyleOverrides}displayLightGlyphs="";displayLineWeight=!1;displaySilhouetteCurves=!1;document=null;draftAngleFirstCrossSection=0;draftAngleSecondCrossSection=0;draftMagnitudeFirstCrossSection=0;draftMagnitudeSecondCrossSection=0;dw3DPrecision=0;dwgUnderlayFramesVisibility="";get elevation(){return this.modelSpaceUcs.elevation}set elevation(e){this.modelSpaceUcs.elevation=e}endCaps=0;entitySortingFlags=ul.Disabled;extendedNames=!0;get extensionLineWeight(){return this._dimensionStyleOverrides.extensionLineWeight}set extensionLineWeight(e){this._dimensionStyleOverrides.extensionLineWeight=e}externalReferenceClippingBoundaryType=fl.DisplayNotPlot;get facetResolution(){return this._facetResolution}set facetResolution(e){if(e<.01||e>10)throw new Error("FACETRES valid values are from 0.01 to 10.0");this._facetResolution=e}filletRadius=0;fillMode=!0;fingerPrintGuid=crypto.randomUUID?.()??"";haloGapPercentage=0;handleSeed=1;hideText=0;hyperLinkBase=null;indexCreationFlags=hl.NoIndex;insUnits=ie.Unitless;interfereColor=new B(1);intersectionDisplay=0;joinStyle=0;lastSavedBy="ACadSharp";latitude=37.795;lensLength=0;limitCheckingOn=!1;linearUnitFormat=Js.Decimal;get linearUnitPrecision(){return this._linearUnitPrecision}set linearUnitPrecision(e){if(e<0||e>8)throw new Error("LUPREC valid values are from 0 to 8");this._linearUnitPrecision=e}lineTypeScale=1;loadOLEObject=!1;loftedObjectNormals="";longitude=-122.394;maintenanceVersion=0;maxViewportCount=64;measurementUnits=cl.Metric;menuFileName=".";mirrorText=!1;modelSpaceExtMax=new c(0,0,0);modelSpaceExtMin=new c(0,0,0);modelSpaceInsertionBase=new c(0,0,0);modelSpaceLimitsMax=new C(0,0);modelSpaceLimitsMin=new C(0,0);get modelSpaceOrigin(){return this.modelSpaceUcs.origin}set modelSpaceOrigin(e){this.modelSpaceUcs.origin=e}modelSpaceOrthographicBackDOrigin=new c(0,0,0);modelSpaceOrthographicBottomDOrigin=new c(0,0,0);modelSpaceOrthographicFrontDOrigin=new c(0,0,0);modelSpaceOrthographicLeftDOrigin=new c(0,0,0);modelSpaceOrthographicRightDOrigin=new c(0,0,0);modelSpaceOrthographicTopDOrigin=new c(0,0,0);modelSpaceUcs=new ot;modelSpaceUcsBase=new ot;get modelSpaceXAxis(){return this.modelSpaceUcs.xAxis}set modelSpaceXAxis(e){this.modelSpaceUcs.xAxis=e}get modelSpaceYAxis(){return this.modelSpaceUcs.yAxis}set modelSpaceYAxis(e){this.modelSpaceUcs.yAxis=e}northDirection=0;numberOfSplineSegments=8;objectSnapMode=4133;obscuredColor=new B(0);obscuredType=0;orthoMode=!1;get paperSpaceBaseName(){return this.paperSpaceUcsBase.name}set paperSpaceBaseName(e){this.paperSpaceUcsBase.name=e}get paperSpaceElevation(){return this.paperSpaceUcs.elevation}set paperSpaceElevation(e){this.paperSpaceUcs.elevation=e}paperSpaceExtMax=new c(0,0,0);paperSpaceExtMin=new c(0,0,0);paperSpaceInsertionBase=new c(0,0,0);paperSpaceLimitsChecking=!1;paperSpaceLimitsMax=new C(0,0);paperSpaceLimitsMin=new C(0,0);paperSpaceLineTypeScaling=bi.Normal;get paperSpaceName(){return this.paperSpaceUcs.name}set paperSpaceName(e){this.paperSpaceUcs.name=e}paperSpaceOrthographicBackDOrigin=new c(0,0,0);paperSpaceOrthographicBottomDOrigin=new c(0,0,0);paperSpaceOrthographicFrontDOrigin=new c(0,0,0);paperSpaceOrthographicLeftDOrigin=new c(0,0,0);paperSpaceOrthographicRightDOrigin=new c(0,0,0);paperSpaceOrthographicTopDOrigin=new c(0,0,0);paperSpaceUcs=new ot;paperSpaceUcsBase=new ot;get paperSpaceXAxis(){return this.paperSpaceUcs.xAxis}set paperSpaceXAxis(e){this.paperSpaceUcs.xAxis=e}get paperSpaceYAxis(){return this.paperSpaceUcs.yAxis}set paperSpaceYAxis(e){this.paperSpaceUcs.yAxis=e}peditType=0;pickStyle=1;pointDisplayMode=0;pointDisplaySize=0;proxyGraphics=!0;regenMode=!0;get shadeEdge(){return this._shadeEdge}set shadeEdge(e){this._shadeEdge=e}shadeDiffuse=70;showModelSpaceInPaperSpace=!1;sketchIncrement=.1;sketchPolylineType=ml.None;solidVisualStyleObjectType=0;splineDegreeCurves=3;stackedTextAlignment=1;stackedTextSizePercentage=70;get stepsPerSecond(){return this._stepsPerSecond}set stepsPerSecond(e){this._stepsPerSecond=e}get surfaceIsolineCount(){return this._surfaceIsolineCount}set surfaceIsolineCount(e){this._surfaceIsolineCount=e}surfaceDensityM=6;surfaceDensityN=6;surfaceType=6;surfaceTabulation1=6;surfaceTabulation2=6;get textQuality(){return this._textQuality}set textQuality(e){this._textQuality=e}textSize=2.5;thickness=0;tileModeEnabled=!0;timeZone=0;totalEditingTime=0;traceWidthDefault=0;get ucsBaseName(){return this.modelSpaceUcsBase.name}set ucsBaseName(e){this.modelSpaceUcsBase.name=e}get ucsName(){return this.modelSpaceUcs.name}set ucsName(e){this.modelSpaceUcs.name=e}unitMode=0;universalCreateDateTime=new Date;universalUpdateDateTime=new Date;updateDateTime=new Date;updateDimensionsWhileDragging=!0;userDouble1=0;userDouble2=0;userDouble3=0;userDouble4=0;userDouble5=0;userElapsedTimeSpan=0;userShort1=0;userShort2=0;userShort3=0;userShort4=0;userShort5=0;userTimer=!1;get version(){return this._version}set version(e){switch(this._version=e,e){case m.AC1015:this.maintenanceVersion=20;break;case m.AC1018:this.maintenanceVersion=104;break;case m.AC1021:this.maintenanceVersion=50;break;case m.AC1024:this.maintenanceVersion=226;break;case m.AC1027:this.maintenanceVersion=125;break;case m.AC1032:this.maintenanceVersion=228;break;default:this.maintenanceVersion=0;break}}versionGuid=crypto.randomUUID?.()??"";get versionString(){return Z.getNameFromVersion(this.version)}set versionString(e){this.version=Z.getVersionFromName(e)}viewportDefaultViewScaleFactor=0;worldView=!0;xEdit=!1;_angularUnitPrecision=0;_currentLayer=Se.Default;_currentLineType=H.ByLayer;_currentTextStyle=te.Default;_dimensionStyleOverrides=new re("override");_currentDimensionStyle=re.Default;_dimensionTextStyle=te.Default;_facetResolution=.5;_linearUnitPrecision=4;_stepsPerSecond=2;_surfaceIsolineCount=4;_textQuality=50;_version=m.AC1032;_shadeEdge=0;constructor(e){typeof e=="number"?this.version=e:e&&typeof e=="object"?(this.version=m.AC1032,this.document=e):this.version=m.AC1032}requiredVersions=0;DIMSAV=0;polylineLineTypeGeneration=!1;regenerationMode=0;quickTextMode=!1;showSplineControlPoints=!1;showModelSpace=!1;retainXRefDependentVisibilitySettings=!1;spatialIndexMaxTreeDepth=0;splineType=0;shadeDiffuseToAmbientPercentage=70;textHeightDefault=.2;thicknessDefault=0;polylineWidthDefault=0;dimensionAltMzf=0;dimensionAltMzs="";dimensionMzs="";styleSheetName="";plotStyleMode=0;projectName="";stepSize=0;solidsRetainHistory=!1;showSolidsHistory=!1;sweptSolidWidth=0;sweptSolidHeight=0;solidLoftedShape=0;shadowMode=0;shadowPlaneLocation=0;dimensionMzf=0;static GetHeaderMap(){return new Map}SetValue(e,t){}toString(){return`${this.version}`}};kr();R();D();D();x();R();var gt=class r extends De{static get Default(){return new r(r.DefaultName)}get objectName(){return d.TableAppId}get objectType(){return u.APPID}get subclassMarker(){return l.ApplicationId}static BlockRepBTag="AcDbBlockRepBTag";static BlockRepETag="AcDbBlockRepETag";static DefaultName="ACAD";constructor(e){if(super(e),e!==void 0&&!e)throw new Error("Application id must have a name.")}};Te();rl();D();x();var Ce=class extends I{onAdd=null;onRemove=null;get count(){return this.entries.size}get objectName(){return d.TableEntry}get subclassMarker(){return l.Table}entries=new Map;constructor(){super()}add(e){(!e.name||!e.name.trim())&&(e.name=this.createName("unnamed")),this.addEntry(e.name,e)}addRange(e){for(let t of e)this.add(t)}tryAdd(e){let t=this.tryGetValue(e.name);return t!==void 0?t:(this.add(e),e)}contains(e){return this.entries.has(e.toUpperCase())}createDefaultEntries(){for(let e of this.defaultEntries)this.contains(e)}[Symbol.iterator](){return this.entries.values()[Symbol.iterator]()}remove(e){if(this.defaultEntries.some(s=>s.toUpperCase()===e.toUpperCase()))return null;let t=e.toUpperCase(),i=this.entries.get(t);return i?(this.entries.delete(t),i.owner=null,this.onRemove?.(this,new tr(i)),i.onNameChanged=null,i):null}tryGetValue(e){return this.entries.get(e.toUpperCase())}addEntry(e,t){this.entries.set(e.toUpperCase(),t),t.owner=this,t.onNameChanged=(i,s)=>{this.onEntryNameChanged(i,s)},this.onAdd?.(this,new tr(t))}addHandlePrefix(e){e.owner=this,e.onNameChanged=(i,s)=>{this.onEntryNameChanged(i,s)},this.onAdd?.(this,new tr(e));let t=`${e.handle}:${e.name}`;this.entries.set(t.toUpperCase(),e)}createName(e){let t=0;for(;this.entries.has(`${e}${t}`.toUpperCase());)t++;return`${e}${t}`}onEntryNameChanged(e,t){if(this.defaultEntries.some(s=>s.toUpperCase()===t.oldName.toUpperCase()))throw new Error(`The name ${t.oldName} belongs to a default entry.`);let i=this.entries.get(t.oldName.toUpperCase());i&&(this.entries.set(t.newName.toUpperCase(),i),this.entries.delete(t.oldName.toUpperCase()))}get(e){let t=this.entries.get(e.toUpperCase());if(t===void 0)throw new Error(`Entry '${e}' not found in table.`);return t}};var Vr=class extends Ce{get objectType(){return u.APPID_CONTROL_OBJ}get objectName(){return d.TableAppId}get defaultEntries(){return[gt.DefaultName]}createDefaultEntries(){this.contains(gt.DefaultName)||this.add(gt.Default)}constructor(){super()}};R();D();rl();var mo=class{onAdd=null;onRemove=null;owner;get count(){return this._entries.size}_entries=new Set;constructor(e){this.owner=e}getAt(e){let t=0;for(let i of this._entries){if(t===e)return i;t++}}add(e){if(e==null)throw new Error("item is null");if(e.owner!=null)throw new Error("Item already has an owner");if(this._entries.has(e))throw new Error("Item is already in the collection");this._entries.add(e),e.owner=this.owner,this.onAdd?.(this,new tr(e))}addRange(e){for(let t of e)this.add(t)}clear(){let e=[...this._entries];for(let t of e)this.remove(t)}remove(e){return this._entries.delete(e)?(e.owner=null,this.onRemove?.(this,new tr(e)),e):null}[Symbol.iterator](){return this._entries[Symbol.iterator]()}};D();x();R();var U=class r extends De{static get ModelSpace(){return new r(r.ModelSpaceName)}static get PaperSpace(){return new r(r.PaperSpaceName)}get attributeDefinitions(){return Array.from(this.entities).filter(e=>e.constructor?.name==="AttributeDefinition")}get blockEnd(){return this._blockEnd}set blockEnd(e){this._blockEnd=e,this._blockEnd.owner=this}get blockEntity(){return this._blockEntity}set blockEntity(e){this._blockEntity=e,this._blockEntity.owner=this}canScale=!0;entities;get evaluationGraph(){return null}get blockFlags(){return this.blockEntity.flags}set blockFlags(e){this.blockEntity.flags=e}get hasAttributes(){return this.attributeDefinitions.length>0}get isAnonymous(){return(this.blockFlags&ne.Anonymous)!==0}set isAnonymous(e){e?this.blockFlags|=ne.Anonymous:this.blockFlags&=~ne.Anonymous}get isDynamic(){return this.evaluationGraph!=null}isExplodable=!1;get isUnloaded(){return this.blockEntity.isUnloaded}set isUnloaded(e){this.blockEntity.isUnloaded=e}get layout(){return this._layout}set layout(e){this._layout=e}get objectName(){return d.TableBlockRecord}get objectType(){return u.BLOCK_HEADER}preview=null;get sortEntitiesTable(){return null}get source(){return null}get subclassMarker(){return l.BlockRecord}units=ie.Unitless;get viewports(){return Array.from(this.entities).filter(e=>e.constructor?.name==="Viewport")}static AnonymousPrefix="*A";static ModelSpaceName="*Model_Space";static PaperSpaceName="*Paper_Space";_blockEnd;_blockEntity;_layout=null;constructor(e){super(e),this._blockEntity=new Pr(this),this._blockEnd=new gs(this),this.entities=new mo(this)}clone(){let e=super.clone();e._layout=null,e.entities=new mo(e);for(let t of this.entities){let i=t.clone();e.entities.add(i)}return e.blockEntity=this.blockEntity.clone(),e.blockEntity.owner=e,e.blockEnd=this.blockEnd.clone(),e.blockEnd.owner=e,e}};var Ir=class extends Ce{get objectType(){return u.BLOCK_CONTROL_OBJ}get objectName(){return d.TableBlockRecord}get defaultEntries(){return[U.ModelSpaceName,U.PaperSpaceName]}constructor(){super()}createDefaultEntries(){this.contains(U.ModelSpaceName)||this.add(U.ModelSpace),this.contains(U.PaperSpaceName)||this.add(U.PaperSpace)}add(e){if(e.isAnonymous&&this.contains(e.name)){let t=this.tryGetValue(e.name);if(t&&t===e)throw new Error(`The BlockRecord with name ${e.name} has already been added.`);e.name=this.createName(U.AnonymousPrefix)}super.add(e)}};R();D();var Wt=class extends Ce{get objectType(){return u.DIMSTYLE_CONTROL_OBJ}get objectName(){return d.TableDimstyle}get defaultEntries(){return[re.DefaultName]}createDefaultEntries(){this.contains(re.DefaultName)||this.add(re.Default)}constructor(){super()}};R();D();var Mr=class extends Ce{get objectType(){return u.LAYER_CONTROL_OBJ}get objectName(){return d.TableLayer}get defaultEntries(){return[Se.DefaultName]}constructor(){super()}createDefaultEntries(){if(!this.contains(Se.DefaultName)){let e=Se.Default;e.lineType=H.Continuous,this.add(e)}}};R();D();var Wr=class extends Ce{get objectType(){return u.LTYPE_CONTROL_OBJ}get objectName(){return d.TableLinetype}get byLayer(){return this.get(H.ByLayerName)}get byBlock(){return this.get(H.ByBlockName)}get continuous(){return this.get(H.ContinuousName)}get defaultEntries(){return[H.ByLayerName,H.ByBlockName,H.ContinuousName]}constructor(){super()}createDefaultEntries(){this.contains(H.ByLayerName)||this.add(H.ByLayer),this.contains(H.ByBlockName)||this.add(H.ByBlock),this.contains(H.ContinuousName)||this.add(H.Continuous)}};R();D();var Hr=class extends Ce{get objectType(){return u.STYLE_CONTROL_OBJ}get objectName(){return d.TableStyle}get defaultEntries(){return[te.DefaultName]}createDefaultEntries(){this.contains(te.DefaultName)||this.add(te.Default)}constructor(){super()}};R();D();var Fr=class extends Ce{get objectType(){return u.UCS_CONTROL_OBJ}get objectName(){return d.TableUcs}get defaultEntries(){return[]}constructor(){super()}};R();D();var Ur=class extends Ce{get objectType(){return u.VIEW_CONTROL_OBJ}get objectName(){return d.TableView}get defaultEntries(){return[]}constructor(){super()}};R();D();D();x();R();var en;(function(r){r[r.Optimized2D=0]="Optimized2D",r[r.Wireframe=1]="Wireframe",r[r.HiddenLine=2]="HiddenLine",r[r.FlatShaded=3]="FlatShaded",r[r.GouraudShaded=4]="GouraudShaded",r[r.FlatShadedWithWireframe=5]="FlatShadedWithWireframe",r[r.GouraudShadedWithWireframe=6]="GouraudShadedWithWireframe"})(en||(en={}));var fo;(function(r){r[r.OneDistantLight=0]="OneDistantLight",r[r.TwoDistantLights=1]="TwoDistantLights"})(fo||(fo={}));var bn;(function(r){r[r._0=0]="_0",r[r._1=1]="_1",r[r._2=2]="_2",r[r._3=4]="_3",r[r._4=8]="_4"})(bn||(bn={}));var vr;(function(r){r[r.Off=0]="Off",r[r.OnLower=1]="OnLower",r[r.OffOrigin=2]="OffOrigin",r[r.OnOrigin=3]="OnOrigin"})(vr||(vr={}));var se;(function(r){r[r.Off=0]="Off",r[r.PerspectiveView=1]="PerspectiveView",r[r.FrontClipping=2]="FrontClipping",r[r.BackClipping=4]="BackClipping",r[r.Follow=8]="Follow",r[r.FrontClippingZ=16]="FrontClippingZ"})(se||(se={}));function Wc(r){let e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?new c(0,0,0):new c(r.x/e,r.y/e,r.z/e)}var xt=class r extends De{static DefaultName="*Active";get objectType(){return u.VPORT}get objectName(){return d.TableVport}get subclassMarker(){return l.VPort}static get Default(){return new r(r.DefaultName)}bottomLeft=new C(0,0);topRight=new C(1,1);center=new C(0,0);snapBasePoint=new C(0,0);snapSpacing=new C(.5,.5);gridSpacing=new C(10,10);get direction(){return this._direction}set direction(e){this._direction=Wc(e)}target=new c(0,0,0);viewHeight=10;aspectRatio=1;lensLength=50;frontClippingPlane=0;backClippingPlane=0;snapRotation=0;twistAngle=0;circleZoomPercent=1e3;renderMode=en.Optimized2D;viewMode=se.FrontClippingZ;ucsIconDisplay=vr.OnOrigin;snapOn=!1;showGrid=!0;isometricSnap=!1;snapIsoPair=0;origin=new c(0,0,0);xAxis=new c(1,0,0);yAxis=new c(0,1,0);namedUcs=null;baseUcs=null;orthographicType=Mt.None;elevation=0;gridFlags=bn._1|bn._2;minorGridLinesPerMajorGridLine=5;visualStyle=null;useDefaultLighting=!0;defaultLighting=fo.TwoDistantLights;brightness=0;contrast=0;ambientColor=new B(0);_direction=new c(0,0,1);constructor(e){super(e)}clone(){let e=super.clone();return e.baseUcs=this.baseUcs?this.baseUcs.clone():null,e.namedUcs=this.namedUcs?this.namedUcs.clone():null,e}};var zr=class extends Ce{get objectType(){return u.VPORT_CONTROL_OBJ}get objectName(){return d.TableVport}get defaultEntries(){return[xt.DefaultName]}createDefaultEntries(){this.contains(xt.DefaultName)||this.add(xt.Default)}constructor(){super()}add(e){this.contains(e.name)?this.addHandlePrefix(e):this.addEntry(e.name,e)}};var E;(function(r){r[r.None=0]="None",r[r.EraseAllowed=1]="EraseAllowed",r[r.TransformAllowed=2]="TransformAllowed",r[r.ColorChangeAllowed=4]="ColorChangeAllowed",r[r.LayerChangeAllowed=8]="LayerChangeAllowed",r[r.LinetypeChangeAllowed=16]="LinetypeChangeAllowed",r[r.LinetypeScaleChangeAllowed=32]="LinetypeScaleChangeAllowed",r[r.VisibilityChangeAllowed=64]="VisibilityChangeAllowed",r[r.CloningAllowed=128]="CloningAllowed",r[r.LineweightChangeAllowed=256]="LineweightChangeAllowed",r[r.PlotStyleNameChangeAllowed=512]="PlotStyleNameChangeAllowed",r[r.AllOperationsExceptCloningAllowed=895]="AllOperationsExceptCloningAllowed",r[r.AllOperationsAllowed=1023]="AllOperationsAllowed",r[r.DisablesProxyWarningDialog=1024]="DisablesProxyWarningDialog",r[r.R13FormatProxy=32768]="R13FormatProxy"})(E||(E={}));var F=class{applicationName="ObjectDBX Classes";classNumber=0;cppClassName="";dwgVersion=0;dxfName="";instanceCount=0;get isAnEntity(){return this._isAnEntity}set isAnEntity(e){e?this._itemClassId=498:this._itemClassId=499,this._isAnEntity=e}get itemClassId(){return this._itemClassId}set itemClassId(e){e===498?this._isAnEntity=!0:this._isAnEntity=!1,this._itemClassId=e}proxyFlags=E.None;wasZombie=!1;maintenanceVersion=0;_isAnEntity=!1;_itemClassId=0;toString(){return`${this.dxfName}:${this.classNumber}`}};x();D();var gi=class{get count(){return this._entries.size}get isReadOnly(){return!1}_entries=new Map;static updateDxfClasses(e){e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DictionaryWithDefault,classNumber:500+e.classes.count,dwgVersion:22,dxfName:d.ObjectDictionaryWithDefault,itemClassId:499,maintenanceVersion:42,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.AcDbPlaceHolder,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectPlaceholder,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Layout,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectLayout,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DictionaryVar,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectDictionaryVar,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectTableStyle,itemClassId:499,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Material,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectMaterial,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.VisualStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectVisualStyle,itemClassId:499,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Scale,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectScale,itemClassId:499,maintenanceVersion:1,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MLeaderStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectMLeaderStyle,itemClassId:499,maintenanceVersion:25,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.CellStyleMap,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectCellStyleMap,itemClassId:499,maintenanceVersion:25,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"ExAcXREFPanelObject",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"EXACXREFPANELOBJECT",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbImpNonPersistentObjectsCollection",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"NPOCOLLECTION",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbLayerIndex",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"LAYER_INDEX",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbSpatialIndex",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"SPATIAL_INDEX",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbIdBuffer",classNumber:500+e.classes.count,dwgVersion:m.AC1014,dxfName:"IDBUFFER",itemClassId:499,maintenanceVersion:0,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbSectionViewStyle",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDBSECTIONVIEWSTYLE",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbDetailViewStyle",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDBDETAILVIEWSTYLE",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Mesh,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.EntityMesh,itemClassId:498,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.SortentsTable,classNumber:500+e.classes.count,dwgVersion:m.AC1014,dxfName:d.ObjectSortEntsTable,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbTextObjectContextData",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDB_TEXTOBJECTCONTEXTDATA_CLASS",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"WipeOut",cppClassName:l.Wipeout,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.EntityWipeout,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.TransformAllowed|E.ColorChangeAllowed|E.LayerChangeAllowed|E.LinetypeChangeAllowed|E.LinetypeScaleChangeAllowed|E.VisibilityChangeAllowed|E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"WipeOut",cppClassName:"AcDbWipeoutVariables",classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:"WIPEOUTVARIABLES",itemClassId:499,maintenanceVersion:0,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"AcDbDimAssoc",cppClassName:"AcDbDimAssoc",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"DIMASSOC",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableEntity,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.EntityTable,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableContent,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectTableContent,itemClassId:499,maintenanceVersion:21,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbTableGeometry",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"TABLEGEOMETRY",itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImage,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.EntityImage,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.TransformAllowed|E.ColorChangeAllowed|E.LayerChangeAllowed|E.LinetypeChangeAllowed|E.LinetypeScaleChangeAllowed|E.VisibilityChangeAllowed|E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImageDef,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectImageDefinition,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImageDefReactor,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectImageDefinitionReactor,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DbColor,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.ObjectDBColor,itemClassId:499,maintenanceVersion:14,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.GeoData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectGeoData,itemClassId:499,maintenanceVersion:45,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MultiLeader,classNumber:500+e.classes.count,dwgVersion:m.MC0_0,dxfName:d.EntityMultiLeader,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PdfReference,classNumber:500+e.classes.count,dwgVersion:26,dxfName:d.EntityPdfUnderlay,itemClassId:498,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PdfDefinition,classNumber:500+e.classes.count,dwgVersion:26,dxfName:d.ObjectPdfDefinition,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterVariables,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectRasterVariables,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.SpatialFilter,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectSpatialFilter,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MultiLeaderObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.MC0_0,dxfName:d.ObjectMLeaderContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PlotSettings,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.ObjectPlotSettings,itemClassId:499,maintenanceVersion:42,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Field,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectField,itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.FieldList,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectFieldList,itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MTextAttributeObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.MTextAttributeObjectContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.BlkRefObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.BlkRefObjectContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1}))}add(e){this._entries.set(e.dxfName.toUpperCase(),e)}addOrUpdate(e){let t=e.dxfName.toUpperCase(),i=this._entries.get(t);i?i.instanceCount=e.instanceCount:this._entries.set(t,e)}clear(){this._entries.clear()}containsByName(e){return this._entries.has(e.toUpperCase())}contains(e){for(let t of this._entries.values())if(t===e)return!0;return!1}copyTo(e,t){let i=t;for(let s of this._entries.values())e[i++]=s}getByClassNumber(e){for(let t of this._entries.values())if(t.classNumber===e)return t;return null}getByName(e){return this._entries.get(e.toUpperCase())??null}[Symbol.iterator](){return this._entries.values()}remove(e){return this._entries.delete(e.dxfName.toUpperCase())}tryGetByClassNumber(e){for(let t of this._entries.values())if(t.classNumber===e)return{result:t,found:!0};return{result:null,found:!1}}tryGetByName(e){let t=this._entries.get(e.toUpperCase());return t?{result:t,found:!0}:{result:null,found:!1}}};var xs=class{appIds=null;blockRecords=null;classes=null;colors=null;dictionaryVariables=null;dimensionStyles=null;get entities(){return this.modelSpace?.entities}groups=null;get handle(){return 0}header=null;imageDefinitions=null;layers=null;layouts=null;lineTypes=null;materials=null;mLeaderStyles=null;mLineStyles=null;get modelSpace(){return this.blockRecords?.tryGetValue("*Model_Space")}get paperSpace(){return this.blockRecords?.tryGetValue("*Paper_Space")}pdfDefinitions=null;get rootDictionary(){return this._rootDictionary}set rootDictionary(e){this._rootDictionary=e,this._rootDictionary.owner=this,this.registerCollection(this._rootDictionary)}scales=null;summaryInfo=null;tableStyles=null;textStyles=null;uCSs=null;views=null;vPorts=null;vEntityControl=null;_cadObjects=new Map;_rootDictionary=null;constructor(e){this._cadObjects.set(this.handle,this),this.createDefaults(),e!==void 0&&this.header!=null&&(this.header.version=e)}createDefaults(){this.header==null&&(this.header=new lt(this)),this.summaryInfo=new Or,this.classes==null&&(this.classes=new gi),gi.updateDxfClasses(this),this.rootDictionary==null&&(this.rootDictionary=xe.createRoot()),this.appIds==null&&this.registerCollection(new Vr),this.blockRecords==null&&this.registerCollection(new Ir),this.dimensionStyles==null&&this.registerCollection(new Wt),this.layers==null&&this.registerCollection(new Mr),this.lineTypes==null&&this.registerCollection(new Wr),this.textStyles==null&&this.registerCollection(new Hr),this.uCSs==null&&this.registerCollection(new Fr),this.views==null&&this.registerCollection(new Ur),this.vPorts==null&&this.registerCollection(new zr),this.lineTypes&&typeof this.lineTypes.createDefaultEntries=="function"&&this.lineTypes.createDefaultEntries(),this.layers&&typeof this.layers.createDefaultEntries=="function"&&this.layers.createDefaultEntries(),this.blockRecords&&typeof this.blockRecords.createDefaultEntries=="function"&&this.blockRecords.createDefaultEntries(),this.textStyles&&typeof this.textStyles.createDefaultEntries=="function"&&this.textStyles.createDefaultEntries(),this.dimensionStyles&&typeof this.dimensionStyles.createDefaultEntries=="function"&&this.dimensionStyles.createDefaultEntries(),this.appIds&&typeof this.appIds.createDefaultEntries=="function"&&this.appIds.createDefaultEntries(),this.vPorts&&typeof this.vPorts.createDefaultEntries=="function"&&this.vPorts.createDefaultEntries()}getCadObject(e){return this._cadObjects.get(e)??null}tryGetCadObject(e){if(e===this.handle)return{found:!1,cadObject:null};let t=this._cadObjects.get(e);return t?{found:!0,cadObject:t}:{found:!1,cadObject:null}}restoreHandles(){let e=[...this._cadObjects.values()];this._cadObjects.clear();let t=1;this._cadObjects.set(0,this);for(let i=1;i<e.length;i++){let s=e[i];s.handle=t,t++,this._cadObjects.set(s.handle,s)}}toString(){return`${this.header?.toString()??"CadDocument"}`}updateCollections(e,t){}updateDxfClasses(e){e&&this.classes&&this.classes.clear(),gi.updateDxfClasses(this)}updateImageReactors(){}registerCollection(e){e!=null&&(e instanceof I&&(e.owner=this,this.addCadObject(e)),"onAdd"in e&&(e.onAdd=this.onAdd.bind(this)),"onRemove"in e&&(e.onRemove=this.onRemove.bind(this)),e instanceof Vr?this.appIds=e:e instanceof Ir?this.blockRecords=e:e instanceof Wt?this.dimensionStyles=e:e instanceof Mr?this.layers=e:e instanceof Wr?this.lineTypes=e:e instanceof Hr?this.textStyles=e:e instanceof Fr?this.uCSs=e:e instanceof Ur?this.views=e:e instanceof zr&&(this.vPorts=e))}unregisterCollection(e){}addCadObject(e){if(e.document!=null)throw new Error(`The item with handle ${e.handle} is already assigned to a document`);if(e.handle===0||this._cadObjects.has(e.handle)){let t=this._cadObjects.size;e.handle=t}this._cadObjects.set(e.handle,e),e.assignDocument(this)}onAdd(e,t){if(this.addCadObject(t.item),this.registerBlockMarkers(t.item),t.item&&"entities"in t.item&&t.item.entities){let i=t.item.entities;"onAdd"in i&&(i.onAdd=this.onAdd.bind(this)),"onRemove"in i&&(i.onRemove=this.onRemove.bind(this))}}onRemove(e,t){this.unregisterBlockMarkers(t.item),this.removeCadObject(t.item)}registerBlockMarkers(e){if(!(!e||!("blockEntity"in e)||!("blockEnd"in e)))for(let t of[e.blockEntity,e.blockEnd])t instanceof I&&t.document==null&&this.addCadObject(t)}unregisterBlockMarkers(e){if(!(!e||!("blockEntity"in e)||!("blockEnd"in e)))for(let t of[e.blockEntity,e.blockEnd])t instanceof I&&t.document===this&&this.removeCadObject(t)}removeCadObject(e){!this.tryGetCadObject(e.handle).found||!this._cadObjects.delete(e.handle)||e.unassignDocument()}updateCollectionDict(e,t){return{success:!1,dictionary:null}}};Te();var bh=class{name;DxfCodes=[];_propertyName;_referenceType=0;get referenceType(){return this._referenceType}set referenceType(e){this._referenceType=e}constructor(e,t){this._propertyName=e,this.name=t}getSystemValue(e,t){return t&&this._propertyName?t[this._propertyName]:null}getValue(e){return e&&this._propertyName?e[this._propertyName]:null}};var W;(function(r){r[r.Unknown=0]="Unknown",r[r.Long=1]="Long",r[r.Double=2]="Double",r[r.String=4]="String",r[r.Date=8]="Date",r[r.Point2D=16]="Point2D",r[r.Point3D=32]="Point3D",r[r.Handle=64]="Handle",r[r.Buffer=128]="Buffer",r[r.ResultBuffer=256]="ResultBuffer",r[r.General=512]="General"})(W||(W={}));var po;(function(r){r[r.NoUnits=0]="NoUnits",r[r.Distance=1]="Distance",r[r.Angle=2]="Angle",r[r.Area=4]="Area",r[r.Volume=8]="Volume",r[r.Currency=16]="Currency",r[r.Percentage=32]="Percentage"})(po||(po={}));var Ht=class{flags=0;format="";formattedValue="";get isEmpty(){return(this.flags&1)!==0}set isEmpty(e){e?this.flags|=1:this.flags&=-2}units=po.NoUnits;value=null;valueType=W.Unknown;setValue(e,t){switch(t!==void 0&&(this.valueType=t),this.valueType){case W.Point2D:case W.Point3D:case W.Long:case W.Double:case W.Date:case W.Handle:case W.String:case W.General:this.value=e;break;case W.Unknown:case W.Buffer:case W.ResultBuffer:default:throw new Error("Invalid operation for value type")}}toString(){return`${this.valueType}:${this.value}`}};rl();import*as gh from"fs";var tn=class r{code;rawHeader;rawImage;constructor(e,t,i){this.code=e??r.PreviewType.Unknown,this.rawHeader=t??new Uint8Array(0),this.rawImage=i??new Uint8Array(0)}save(e){let t=!1;switch(this.code){case r.PreviewType.Bmp:case r.PreviewType.Wmf:case r.PreviewType.Png:t=!1;break;case r.PreviewType.Unknown:default:throw new Error(`Preview with code ${this.code} not supported.`)}if(t&&this.rawHeader.length>0){let i=new Uint8Array(this.rawHeader.length+this.rawImage.length);i.set(this.rawHeader),i.set(this.rawImage,this.rawHeader.length),gh.writeFileSync(e,i);return}gh.writeFileSync(e,this.rawImage)}};(function(r){let e;(function(t){t[t.Unknown=0]="Unknown",t[t.Bmp=2]="Bmp",t[t.Wmf=3]="Wmf",t[t.Png=6]="Png"})(e=r.PreviewType||(r.PreviewType={}))})(tn||(tn={}));var gn=class{name="";dxfProperties=new Map;static addClassProperties(e,t,i){}static*cadObjectMapDxf(e){}};var V=class r extends gn{static _cache=new Map;constructor(e){if(super(),e instanceof r){this.name=e.name;for(let[t,i]of e.dxfProperties)this.dxfProperties.set(t,i)}else typeof e=="string"&&(this.name=e)}static createFromType(e,t){if(r._cache.has(e))return new r(r._cache.get(e));let i=new r;return i.name=t??e,r._cache.set(e,i),new r(i)}static Create(e,t){let i=typeof e=="string"?e:e.name;return r.createFromType(i,t)}clearCache(){r._cache.clear()}toString(){return`DxfClassMap:${this.name}`}};q();D();var Ae=class r extends gn{static _cache=new Map;subClasses=new Map;static create(e,t){let i=typeof e=="string"?e:e.name;if(r._cache.has(i)){let n=r._cache.get(i),a=new r;a.name=n.name;for(let[o,h]of n.dxfProperties)a.dxfProperties.set(o,h);for(let[o,h]of n.subClasses)a.subClasses.set(o,h);return a}let s=new r;return s.name=t??"",r._cache.set(i,s),s}static clearCache(){r._cache.clear()}toString(){return`DxfMap:${this.name}`}};q();var _;(function(r){r[r.None=0]="None",r[r.String=1]="String",r[r.Point3D=2]="Point3D",r[r.Double=3]="Double",r[r.Byte=4]="Byte",r[r.Int16=5]="Int16",r[r.Int32=6]="Int32",r[r.Int64=7]="Int64",r[r.Handle=8]="Handle",r[r.ObjectId=9]="ObjectId",r[r.Bool=10]="Bool",r[r.Chunk=11]="Chunk",r[r.Comment=12]="Comment",r[r.ExtendedDataString=13]="ExtendedDataString",r[r.ExtendedDataChunk=14]="ExtendedDataChunk",r[r.ExtendedDataHandle=15]="ExtendedDataHandle",r[r.ExtendedDataDouble=16]="ExtendedDataDouble",r[r.ExtendedDataInt16=17]="ExtendedDataInt16",r[r.ExtendedDataInt32=18]="ExtendedDataInt32"})(_||(_={}));var Be=class r{static isValidCode(e,t){return r.isValidGroupCode(r.transformValue(e),t)}static isValidGroupCode(e,t){switch(e){case _.String:case _.ExtendedDataString:case _.Comment:return typeof t=="string";case _.Point3D:return t!=null&&typeof t=="object";case _.Double:case _.ExtendedDataDouble:return typeof t=="number";case _.Byte:return typeof t=="number";case _.Int16:case _.ExtendedDataInt16:return typeof t=="number";case _.Int32:case _.ExtendedDataInt32:return typeof t=="number";case _.Int64:return typeof t=="number"||typeof t=="bigint";case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:return typeof t=="number";case _.Bool:return typeof t=="boolean";case _.Chunk:case _.ExtendedDataChunk:return t instanceof Uint8Array||Array.isArray(t);case _.None:default:return!1}}static transformValue(e){return e>=0&&e<=4?_.String:e===5?_.Handle:e>=6&&e<=9?_.String:e>=10&&e<=39?_.Point3D:e>=40&&e<=59?_.Double:e>=60&&e<=79?_.Int16:e>=90&&e<=99?_.Int32:e===100?_.String:e===101?_.String:e===102?_.String:e===105?_.Handle:e>=110&&e<=119?_.Double:e>=120&&e<=129?_.Double:e>=130&&e<=139?_.Double:e>=140&&e<=149?_.Double:e>=160&&e<=169?_.Int64:e>=170&&e<=179?_.Int16:e>=210&&e<=239?_.Double:e>=270&&e<=279?_.Int16:e>=280&&e<=289?_.Byte:e>=290&&e<=299?_.Bool:e>=300&&e<=309?_.String:e>=310&&e<=319?_.Chunk:e>=320&&e<=329?_.Handle:e>=330&&e<=369?_.ObjectId:e>=370&&e<=379?_.Int16:e>=380&&e<=389?_.Int16:e>=390&&e<=399?_.ObjectId:e>=400&&e<=409?_.Int16:e>=410&&e<=419?_.String:e>=420&&e<=429?_.Int32:e>=430&&e<=439?_.String:e>=440&&e<=449?_.Int32:e>=450&&e<=459?_.Int32:e>=460&&e<=469?_.Double:e>=470&&e<=479?_.String:e>=480&&e<=481?_.Handle:e===999?_.Comment:e>=1e3&&e<=1003?_.ExtendedDataString:e===1004?_.ExtendedDataChunk:e>=1005&&e<=1009?_.ExtendedDataHandle:e>=1010&&e<=1059?_.ExtendedDataDouble:e>=1060&&e<=1070?_.ExtendedDataInt16:e===1071?_.ExtendedDataInt32:_.None}};var pl=class{get assignedCode(){return this._assignedCode!==null?this._assignedCode:this.dxfCodes.length===1?this.dxfCodes[0]:p.Invalid}dxfCodes=[];referenceType=0;storedValue=null;get groupCode(){let e=this.dxfCodes[0];return Be.transformValue(e)}_assignedCode=null;_propertyName="";constructor(e,t){this._propertyName=e,this.dxfCodes=t}setValue(e,t,i){t&&this._propertyName&&(t[this._propertyName]=i)}getRawValue(e){return e&&this._propertyName?e[this._propertyName]:null}};var xh=class extends pl{constructor(e,t,i){typeof e=="string"?super(e,t):(super(t,i??[e]),this._assignedCode=e)}getCollectionCodes(){return null}getValue(e){return this.getRawValue(e)}toString(){let e="";for(let t of this.dxfCodes)e+=`${t}:`;return e+=this._propertyName,e}};x();R();D();x();var vd;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r[r.Baseline=3]="Baseline"})(vd||(vd={}));var xn=class extends A{baseHeight=0;binRecord=null;binRecordHandle=0;cleanupGroup=null;cleanupGroupHandle=0;endPoint=new c;height=0;justification=vd.Baseline;length=0;normal=new c(0,0,1);rawData=null;startPoint=new c;style=null;version=0;width=0;get objectName(){return d.EntityAecWall}get objectType(){return u.UNLISTED}get subclassMarker(){return l.AecWall}getBoundingBox(){throw new Error("Not implemented")}applyTransform(e){}};D();x();R();var dt=class extends A{center=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityCircle}get objectType(){return u.CIRCLE}get radius(){return this._radius}set radius(e){if(e<=0)throw new Error("The radius must be greater than 0.");this._radius=e}get radiusRatio(){return 1}get subclassMarker(){return l.Circle}thickness=0;_radius=1;constructor(){super()}applyTransform(e){}getBoundingBox(){let e=new c(this.center.x-this._radius,this.center.y-this._radius,this.center.z),t=new c(this.center.x+this._radius,this.center.y+this._radius,this.center.z);return{min:e,max:t}}polarCoordinateRelativeToCenter(e){return new c(0,0,0)}polygonalVertexes(e){if(e<2)throw new Error("The arc precision must be equal or greater than two.");return[]}};D();x();R();var Ft=class r extends dt{endAngle=Math.PI;get objectName(){return d.EntityArc}get objectType(){return u.ARC}startAngle=0;get subclassMarker(){return l.Arc}get sweep(){let e=this.startAngle,t=this.endAngle;return t<e&&(t+=Math.PI*2),e-t}constructor(e,t,i,s){super(),e!==void 0&&(this.center=e),t!==void 0&&(this.radius=t),i!==void 0&&(this.startAngle=i),s!==void 0&&(this.endAngle=s)}static createFromBulge(e,t,i){let{center:s,radius:n}=r.getCenter(e,t,i),a,o;i<0?(a=Math.atan2(t.y-s.y,t.x-s.x),o=Math.atan2(e.y-s.y,e.x-s.x)):(a=Math.atan2(e.y-s.y,e.x-s.x),o=Math.atan2(t.y-s.y,t.x-s.x));let h=new r;return h.center=new c(s.x,s.y,0),h.radius=n,h.startAngle=a,h.endAngle=o,h}static getBulge(e,t,i,s){let n=t.x-e.x,a=t.y-e.y,o=-a,h=n,f=i.x-e.x,b=i.y-e.y,S=Math.atan2(n*f+a*b,o*f+h*b);return s?S>0&&(S-=Math.PI*2):S<0&&(S+=Math.PI*2),Math.tan(S/4)}static getBulgeFromAngle(e){return Math.tan(e/4)}static getCenter(e,t,i){let s=4*Math.atan(Math.abs(i)),n=t.x-e.x,a=t.y-e.y,h=Math.sqrt(n*n+a*a)/2/Math.sin(s/2),f=(Math.PI-s)/2,b=Math.atan2(a,n)+Math.sign(i)*f;return{center:new C(e.x+h*Math.cos(b),e.y+h*Math.sin(b)),radius:h}}applyTransform(e){}getBoundingBox(){return null}getEndVertices(){let e=new c(this.center.x+this.radius*Math.cos(this.startAngle),this.center.y+this.radius*Math.sin(this.startAngle),0),t=new c(this.center.x+this.radius*Math.cos(this.endAngle),this.center.y+this.radius*Math.sin(this.endAngle),0);return{start:e,end:t}}polygonalVertexes(e){if(e<2)throw new Error("The arc precision must be equal or greater than two.");return[]}};var Oe;(function(r){r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight"})(Oe||(Oe={}));Te();D();x();R();var ht;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r[r.Aligned=3]="Aligned",r[r.Middle=4]="Middle",r[r.Fit=5]="Fit"})(ht||(ht={}));var ct;(function(r){r[r.Baseline=0]="Baseline",r[r.Bottom=1]="Bottom",r[r.Middle=2]="Middle",r[r.Top=3]="Top"})(ct||(ct={}));var rn;(function(r){r[r.None=0]="None",r[r.Backward=2]="Backward",r[r.UpsideDown=4]="UpsideDown"})(rn||(rn={}));var Je=class extends A{alignmentPoint=new c(0,0,0);get height(){return this._height}set height(e){if(e<=0)throw new Error("The Text height must be greater than zero.");this._height=e}horizontalAlignment=ht.Left;insertPoint=new c(0,0,0);get mirror(){return this._mirror}set mirror(e){this._mirror=e}normal=new c(0,0,1);get objectName(){return d.EntityText}get objectType(){return u.TEXT}obliqueAngle=0;rotation=0;get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}get subclassMarker(){return l.Text}thickness=0;get value(){return this._value}set value(e){if(e.length>256)throw new Error(`Text length cannot be superior to 256, current: ${e.length}`);this._value=e}verticalAlignment=ct.Baseline;widthFactor=1;_height=1;_mirror=rn.None;_style=te.Default;_value="";constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.textStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.textStyles.get(te.DefaultName))}};var Gr;(function(r){r[r.SingleLine=1]="SingleLine",r[r.MultiLine=2]="MultiLine",r[r.ConstantMultiLine=4]="ConstantMultiLine"})(Gr||(Gr={}));var wo;(function(r){r[r.None=0]="None",r[r.Hidden=1]="Hidden",r[r.Constant=2]="Constant",r[r.Verify=4]="Verify",r[r.Preset=8]="Preset"})(wo||(wo={}));var Dn=class extends Je{attributeType=Gr.SingleLine;flags=wo.None;isReallyLocked=!1;mText=null;get tag(){return this._tag}set tag(e){this._tag=e}version=0;verticalAlignment=ct.Baseline;_tag="";constructor(){super()}matchAttributeProperties(e){this.matchProperties(e),this.thickness=e.thickness,this.insertPoint=e.insertPoint,this.height=e.height,this.value=e.value,this.rotation=e.rotation,this.widthFactor=e.widthFactor,this.obliqueAngle=e.obliqueAngle,this.style.document!==e.style.document?this.style=e.style.clone():this.style=e.style,this.mirror=e.mirror,this.horizontalAlignment=e.horizontalAlignment,this.alignmentPoint=e.alignmentPoint,this.normal=e.normal,this.verticalAlignment=e.verticalAlignment,this.version=e.version,this.tag=e.tag,this.flags=e.flags,this.attributeType=e.attributeType,this.isReallyLocked=e.isReallyLocked,this.insertPoint=e.insertPoint}};D();x();R();var es=class extends Dn{get objectType(){return u.ATTDEF}get objectName(){return d.EntityAttributeDefinition}get subclassMarker(){return l.AttributeDefinition}prompt="";constructor(e){super(),e&&this.matchAttributeProperties(e)}};D();x();R();var Dt=class extends Dn{get objectName(){return d.EntityAttribute}get objectType(){return u.ATTRIB}get subclassMarker(){return l.Attribute}constructor(e){super(),e&&this.matchAttributeProperties(e)}};var rr;(function(r){r[r.None=0]="None",r[r.UseBackgroundFillColor=1]="UseBackgroundFillColor",r[r.UseDrawingWindowColor=2]="UseDrawingWindowColor",r[r.TextFrame=16]="TextFrame"})(rr||(rr={}));var qe;(function(r){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",r[r.NotClosed=32]="NotClosed",r[r.SelfIntersecting=64]="SelfIntersecting",r[r.TextIsland=128]="TextIsland",r[r.Duplicate=256]="Duplicate",r[r.IsAnnotative=512]="IsAnnotative",r[r.DoesNotSupportScale=1024]="DoesNotSupportScale",r[r.ForceAnnoAllVisible=2048]="ForceAnnoAllVisible",r[r.OrientToPaper=4096]="OrientToPaper",r[r.IsAnnotativeBlock=8192]="IsAnnotativeBlock"})(qe||(qe={}));x();var _o=class{acisIndex=0;applyTransformPresent=!1;color=B.ByLayer;hasRotation=!1;hasShear=!1;points=[];scale=0;selectionMarker=0;translation=new c(0,0,0);type=0;xAxis=new c(0,0,0);yAxis=new c(0,0,0);zAxis=new c(0,0,0);hasReflection=!1},wl=class{viewportDirectionFromTarget=new c(0,0,0);viewportId=0;viewportPerspective=!1;viewportTarget=new c(0,0,0);viewportUpDirection=new c(0,0,0);wires=[]},Ds=class extends A{point=new c(0,0,0);silhouettes=[];get subclassMarker(){return l.ModelerGeometry}wires=[];guid="";modelerFormatVersion=0;proprietaryData="";applyTransform(e){}getBoundingBox(){return null}};D();R();var ts=class extends Ds{get objectType(){return u.BODY}get objectName(){return d.EntityBody}};Te();var xi;(function(r){r[r.Outside=0]="Outside",r[r.Inside=1]="Inside"})(xi||(xi={}));var $r;(function(r){r[r.Rectangular=1]="Rectangular",r[r.Polygonal=2]="Polygonal"})($r||($r={}));var ir;(function(r){r[r.None=0]="None",r[r.ShowImage=1]="ShowImage",r[r.ShowNotAlignedImage=2]="ShowNotAlignedImage",r[r.UseClippingBoundary=4]="UseClippingBoundary",r[r.TransparencyIsOn=8]="TransparencyIsOn"})(ir||(ir={}));var Ss=class extends A{get brightness(){return this._brightness}set brightness(e){if(e<0||e>100)throw new Error(`Invalid Brightness value: ${e}, must be in range 0-100`);this._brightness=e}classVersion=0;clipBoundaryVertices=[];clipMode=xi.Outside;clippingState=!1;clipType=$r.Rectangular;get contrast(){return this._contrast}set contrast(e){if(e<0||e>100)throw new Error(`Invalid Contrast value: ${e}, must be in range 0-100`);this._contrast=e}get definition(){return this._definition}set definition(e){this.document!=null?this._definition=I.updateCollection(e,this.document.imageDefinitions):this._definition=e}get fade(){return this._fade}set fade(e){if(e<0||e>100)throw new Error(`Invalid Fade value: ${e}, must be in range 0-100`);this._fade=e}get flags(){return this._flags}set flags(e){this._flags=e}insertPoint=new c(0,0,0);get showImage(){return(this._flags&ir.ShowImage)!==0}set showImage(e){e?this._flags=this._flags|ir.ShowImage:this._flags=this._flags&~ir.ShowImage}size=new C(0,0);uVector=new c(1,0,0);vVector=new c(0,1,0);definitionReactor=null;_brightness=50;_contrast=50;_definition=null;_fade=0;_flags=ir.None;applyTransform(e){}clone(){let e=super.clone();return e._definition=this._definition?.clone?.()??null,e}getBoundingBox(){if(this.clipBoundaryVertices.length===0)return null;let e=1/0,t=1/0,i=-1/0,s=-1/0;for(let o of this.clipBoundaryVertices)o.x<e&&(e=o.x),o.y<t&&(t=o.y),o.x>i&&(i=o.x),o.y>s&&(s=o.y);let n=new c(e+this.insertPoint.x,t+this.insertPoint.y,this.insertPoint.z),a=new c(i+this.insertPoint.x,s+this.insertPoint.y,this.insertPoint.z);return{min:n,max:a}}assignDocument(e){super.assignDocument(e),this._definition=I.updateCollection(this._definition,e.imageDefinitions)}unassignDocument(){super.unassignDocument(),this._definition=this._definition?.clone?.()??null}imageDefinitionsOnRemove(e,t){t.item===this._definition&&(this._definition=null)}};var rs;(function(r){r[r.NoColumns=0]="NoColumns",r[r.StaticColumns=1]="StaticColumns",r[r.DynamicColumns=2]="DynamicColumns"})(rs||(rs={}));Te();x();var v;(function(r){r[r.Linear=0]="Linear",r[r.Aligned=1]="Aligned",r[r.Angular=2]="Angular",r[r.Diameter=3]="Diameter",r[r.Radius=4]="Radius",r[r.Angular3Point=5]="Angular3Point",r[r.Ordinate=6]="Ordinate",r[r.BlockReference=32]="BlockReference",r[r.OrdinateTypeX=64]="OrdinateTypeX",r[r.TextUserDefinedLocation=128]="TextUserDefinedLocation"})(v||(v={}));var sn;(function(r){r[r.None=0]="None",r[r.AtLeast=1]="AtLeast",r[r.Exact=2]="Exact"})(sn||(sn={}));var me=class extends A{attachmentPoint=Oe.TopLeft;get block(){return this._block}set block(e){this.document!=null?this._block=I.updateCollection(e,this.document.blockRecords):this._block=e}definitionPoint=new c(0,0,0);get flags(){return this._flags}set flags(e){this._flags=e}flipArrow1=!1;flipArrow2=!1;get hasStyleOverride(){return!1}horizontalDirection=0;insertionPoint=new c(0,0,0);get isAngular(){return(this._flags&v.Angular3Point)!==0||(this._flags&v.Angular)!==0}get isTextUserDefinedLocation(){return(this._flags&v.TextUserDefinedLocation)!==0}set isTextUserDefinedLocation(e){e?this._flags=this._flags|v.TextUserDefinedLocation:this._flags=this._flags&~v.TextUserDefinedLocation}lineSpacingFactor=0;lineSpacingStyle=sn.AtLeast;normal=new c(0,0,1);get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Dimension}text="";textMiddlePoint=new c(0,0,0);textRotation=0;version=0;_block=null;_flags;_style=re.Default;constructor(e){super(),this._flags=e,this._flags|=v.BlockReference}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),e._block=this._block?.clone()??null,e}getActiveDimensionStyle(){return this.hasStyleOverride?this.style:this.style}getMeasurementText(e){return this.measurement.toString()}getStyleOverrideMap(){return null}setDimensionOverride(e){}setStyleOverrideMap(e){}updateBlock(){this.createBlock()}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.dimensionStyles),this._block=I.updateCollection(this._block,e.blockRecords),this._block!=null&&(this._block.name=this.generateBlockName()),this._block=I.updateCollection(this._block,e.blockRecords)}unassignDocument(){super.unassignDocument(),this._style=this._style?.clone(),this._block=this._block?.clone()??null}createBlock(){this._block==null&&(this._block=new U(this.generateBlockName()),this._block.isAnonymous=!0),this.document!=null&&(this._block=I.updateCollection(this._block,this.document.blockRecords)),this._block.entities?.clear?.()}createDefinitionPoint(e){return null}createTextEntity(e,t){return null}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.dimensionStyles.get(re.DefaultName)),t.item===this._block&&(this._block=null)}generateBlockName(){return`*D${this.handle}`}};D();x();R();function Ec(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}var je=class r extends me{extLineRotation=0;firstPoint=new c(0,0,0);get measurement(){return Ec(this.firstPoint,this.secondPoint)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ALIGNED}get offset(){return Ec(this.secondPoint,this.definitionPoint)}set offset(e){}secondPoint=new c(0,0,0);get subclassMarker(){return l.AlignedDimension}constructor(e,t){super(v.Aligned),e&&(this.firstPoint=e),t&&(this.secondPoint=t)}static createWithType(e){let t=new r;return t._flags=e,t.definitionPoint=t.secondPoint,t}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();var St=class extends me{angleVertex=new c(0,0,0);get center(){return new c(0,0,0)}dimensionArc=new c(0,0,0);firstPoint=new c(0,0,0);get measurement(){return 0}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ANG_2_Ln}get offset(){let e=this.secondPoint.x-this.definitionPoint.x,t=this.secondPoint.y-this.definitionPoint.y,i=this.secondPoint.z-this.definitionPoint.z;return Math.sqrt(e*e+t*t+i*i)}set offset(e){}secondPoint=new c(0,0,0);get subclassMarker(){return l.Angular2LineDimension}constructor(){super(v.Angular)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){}};D();x();R();var Ct=class extends me{angleVertex=new c(0,0,0);firstPoint=new c(0,0,0);get measurement(){return 0}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ANG_3_Pt}secondPoint=new c(0,0,0);get subclassMarker(){return l.Angular3PointDimension}constructor(){super(v.Angular3Point)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();function Hc(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}function Fc(r,e){return new c((r.x+e.x)/2,(r.y+e.y)/2,(r.z+e.z)/2)}var Bt=class extends me{angleVertex=new c(0,0,0);get center(){return Fc(this.angleVertex,this.definitionPoint)}leaderLength=0;get measurement(){return Hc(this.definitionPoint,this.angleVertex)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_DIAMETER}get subclassMarker(){return l.DiametricDimension}constructor(){super(v.Diameter)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:new c(this.insertionPoint.x-this.angleVertex.x,this.insertionPoint.y-this.angleVertex.y,this.insertionPoint.z-this.angleVertex.z),max:new c(this.insertionPoint.x+this.angleVertex.x,this.insertionPoint.y+this.angleVertex.y,this.insertionPoint.z+this.angleVertex.z)}}updateBlock(){super.updateBlock()}};D();x();R();var Qe=class extends je{get measurement(){let e=new c(Math.cos(this.rotation),Math.sin(this.rotation),0),t=new c(this.secondPoint.x-this.firstPoint.x,this.secondPoint.y-this.firstPoint.y,this.secondPoint.z-this.firstPoint.z),i=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);if(i===0)return 0;let s=new c(t.x/i,t.y/i,t.z/i),n=Math.abs(e.x*s.x+e.y*s.y+e.z*s.z);return super.measurement*n}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_LINEAR}get offset(){return super.offset}set offset(e){}rotation=0;get subclassMarker(){return l.LinearDimension}constructor(){super(),this._flags=v.Linear|v.BlockReference}updateBlock(){this.createBlock()}};D();x();R();var yt=class extends me{featureLocation=new c(0,0,0);get isOrdinateTypeX(){return(this._flags&v.OrdinateTypeX)!==0}set isOrdinateTypeX(e){e?this._flags=this._flags|v.OrdinateTypeX:this._flags=this._flags&~v.OrdinateTypeX}leaderEndpoint=new c(0,0,0);get measurement(){let e=this.isOrdinateTypeX?new C(0,1):new C(1,0),t=Math.sin(this.horizontalDirection),i=Math.cos(this.horizontalDirection),s=new C(e.x*i-e.y*t,e.x*t+e.y*i),n=new C(this.definitionPoint.x-this.featureLocation.x,this.definitionPoint.y-this.featureLocation.y),a=s.x*n.x+s.y*n.y,o=new C(this.featureLocation.x+a*s.x,this.featureLocation.y+a*s.y),h=new C(this.definitionPoint.x-o.x,this.definitionPoint.y-o.y),f=h.x*h.x+h.y*h.y;return Math.sqrt(f)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ORDINATE}get subclassMarker(){return l.OrdinateDimension}constructor(){super(v.Ordinate)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.featureLocation.x,this.leaderEndpoint.x),y:Math.min(this.featureLocation.y,this.leaderEndpoint.y),z:Math.min(this.featureLocation.z,this.leaderEndpoint.z)},max:{x:Math.max(this.featureLocation.x,this.leaderEndpoint.x),y:Math.max(this.featureLocation.y,this.leaderEndpoint.y),z:Math.max(this.featureLocation.z,this.leaderEndpoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();function Uc(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}var Rt=class extends me{angleVertex=new c(0,0,0);leaderLength=0;get measurement(){return Uc(this.definitionPoint,this.angleVertex)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_RADIUS}get subclassMarker(){return l.RadialDimension}constructor(){super(v.Radius)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:new c(this.insertionPoint.x-this.angleVertex.x,this.insertionPoint.y-this.angleVertex.y,this.insertionPoint.z-this.angleVertex.z),max:new c(this.insertionPoint.x+this.angleVertex.x,this.insertionPoint.y+this.angleVertex.y,this.insertionPoint.z+this.angleVertex.z)}}updateBlock(){super.updateBlock()}};var bo;(function(r){r[r.LeftToRight=1]="LeftToRight",r[r.RightToLeft=2]="RightToLeft",r[r.TopToBottom=3]="TopToBottom",r[r.BottomToTop=4]="BottomToTop",r[r.ByStyle=5]="ByStyle"})(bo||(bo={}));D();x();R();var Ut=class extends A{center=new c(0,0,0);endParameter=Math.PI*2;get isFullEllipse(){return this.startParameter===0&&this.endParameter===Math.PI*2}get majorAxis(){return 2*Math.sqrt(this.majorAxisEndPoint.x**2+this.majorAxisEndPoint.y**2+this.majorAxisEndPoint.z**2)}majorAxisEndPoint=new c(1,0,0);get minorAxis(){return this.majorAxis*this.radiusRatio}get minorAxisEndpoint(){let e=Math.sqrt(this.majorAxisEndPoint.x**2+this.majorAxisEndPoint.y**2+this.majorAxisEndPoint.z**2);if(e===0)return new c(0,0,0);let t=this.majorAxisEndPoint.x/e,i=this.majorAxisEndPoint.y/e,s=this.majorAxisEndPoint.z/e,n=this.normal.y*s-this.normal.z*i,a=this.normal.z*t-this.normal.x*s,o=this.normal.x*i-this.normal.y*t,h=Math.sqrt(n*n+a*a+o*o);if(h===0)return new c(0,0,0);let f=this.radiusRatio*e;return new c(n/h*f,a/h*f,o/h*f)}normal=new c(0,0,1);get objectName(){return d.EntityEllipse}get objectType(){return u.ELLIPSE}get radiusRatio(){return this._radiusRatio}set radiusRatio(e){if(e<=0||e>1)throw new Error("Radius ratio must be a value between 0 (not included) and 1.");this._radiusRatio=e}get rotation(){return Math.atan2(this.majorAxisEndPoint.y,this.majorAxisEndPoint.x)}startParameter=0;get subclassMarker(){return l.Ellipse}thickness=0;_radiusRatio=1;applyTransform(e){}getBoundingBox(){return null}getEndVertices(){let e=this.polarCoordinateRelativeToCenter(this.startParameter),t=this.polarCoordinateRelativeToCenter(this.endParameter);return{start:e,end:t}}polarCoordinateRelativeToCenter(e){return new c(0,0,0)}polygonalVertexes(e){return[]}};D();x();R();var nn;(function(r){r[r.None=0]="None",r[r.First=1]="First",r[r.Second=2]="Second",r[r.Third=4]="Third",r[r.Fourth=8]="Fourth"})(nn||(nn={}));var Yr=class extends A{get objectType(){return u.FACE3D}get objectName(){return d.Entity3DFace}get subclassMarker(){return l.Face3d}firstCorner=new c(0,0,0);secondCorner=new c(0,0,0);thirdCorner=new c(0,0,0);fourthCorner=new c(0,0,0);flags=nn.None;constructor(){super()}getBoundingBox(){return null}applyTransform(e){}};var Sn=class r{value=0;color=B.ByLayer;clone(){let e=new r;return e.value=this.value,e.color=this.color,e}};D();x();R();var go=class r{enabled=!1;reserved=0;angle=0;shift=0;isSingleColorGradient=!1;colorTint=0;colors=[];name="";constructor(e){e&&(this.name=e)}clone(){let e=new r;return e.enabled=this.enabled,e.reserved=this.reserved,e.angle=this.angle,e.shift=this.shift,e.isSingleColorGradient=this.isSingleColorGradient,e.colorTint=this.colorTint,e.name=this.name,e.colors=this.colors.map(t=>t.clone()),e}};var Cn=class r{angle=0;basePoint=new C(0,0);dashLengths=[];get lineOffset(){let e=Math.cos(-this.angle),t=Math.sin(-this.angle);return this.offset.x*t+this.offset.y*e}offset=new C(0,0);get shift(){let e=Math.cos(-this.angle),t=Math.sin(-this.angle);return this.offset.x*e-this.offset.y*t}clone(){let e=new r;return e.angle=this.angle,e.basePoint=new C(this.basePoint.x,this.basePoint.y),e.offset=new C(this.offset.x,this.offset.y),e.dashLengths=[...this.dashLengths],e}},an=class r{static get Solid(){return new r("SOLID")}description="";lines=[];name;constructor(e){this.name=e}clone(){let e=new r(this.name);return e.description=this.description,e.lines=this.lines.map(t=>t.clone()),e}toString(){return this.name}update(e,t,i){for(let s of this.lines)s.angle+=t,s.dashLengths=s.dashLengths.map(n=>n*i)}};var xo;(function(r){r[r.PatternFill=0]="PatternFill",r[r.SolidFill=1]="SolidFill",r[r.Custom=2]="Custom"})(xo||(xo={}));var Do;(function(r){r[r.Normal=0]="Normal",r[r.Outer=1]="Outer",r[r.Ignore=2]="Ignore"})(Do||(Do={}));var sr;(function(r){r[r.Polyline=0]="Polyline",r[r.Line=1]="Line",r[r.CircularArc=2]="CircularArc",r[r.EllipticArc=3]="EllipticArc",r[r.Spline=4]="Spline"})(sr||(sr={}));var on=class{clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}},Xr=class extends on{center=new C(0,0);counterClockWise=!1;endAngle=0;radius=0;startAngle=0;get type(){return sr.CircularArc}applyTransform(e){}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},Zr=class extends on{center=new C(0,0);counterClockWise=!1;endAngle=0;majorAxisEndPoint=new C(0,0);minorToMajorRatio=0;startAngle=0;get type(){return sr.EllipticArc}applyTransform(e){}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},Kr=class extends on{end=new C(0,0);start=new C(0,0);get type(){return sr.Line}applyTransform(e){}getBoundingBox(){return null}toEntity(){return null}},is=class extends on{get bulges(){return this.vertices.map(e=>e.z)}get hasBulge(){return this.bulges.some(e=>e!==0)}isClosed=!1;get type(){return sr.Polyline}vertices=[];applyTransform(e){}clone(){let e=super.clone();return e.vertices=[...this.vertices],e}getBoundingBox(){return null}toEntity(){return null}},Jr=class extends on{controlPoints=[];degree=0;endTangent=new C(0,0);fitPoints=[];knots=[];isPeriodic=!1;isRational=!1;startTangent=new C(0,0);get weights(){return this.controlPoints.map(e=>e.z)}get type(){return sr.Spline}applyTransform(e){}clone(){let e=super.clone();return e.controlPoints=[...this.controlPoints],e.fitPoints=[...this.fitPoints],e.knots=[...this.knots],e}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},_l=class r{edges=[];entities=[];get flags(){let e=this._flags;return this.isPolyline?e=e|qe.Polyline:e=e&~qe.Polyline,e}set flags(e){this._flags=e}get isPolyline(){return this.edges.some(e=>e instanceof is)}_flags=0;constructor(e){e&&(this.edges=[...e])}applyTransform(e){for(let t of this.edges)t.applyTransform(e)}clone(){let e=new r;return e._flags=this._flags,e.entities=this.entities.map(t=>t.clone()),e.edges=this.edges.map(t=>t.clone()),e}getBoundingBox(){return null}getPoints(e=256){let t=[];for(let i of this.edges)i instanceof Xr?t.push(...i.polygonalVertexes(e)):i instanceof Zr?t.push(...i.polygonalVertexes(e)):i instanceof Kr?(t.push(new c(i.start.x,i.start.y,0)),t.push(new c(i.end.x,i.end.y,0))):i instanceof Jr&&t.push(...i.polygonalVertexes(e));return t}updateEdges(){this.entities.length!==0&&(this.edges=[])}},Tt=class extends A{elevation=0;gradientColor=new go;isAssociative=!1;isDouble=!1;isSolid=!1;normal=new c(0,0,1);get objectName(){return d.EntityHatch}get objectType(){return u.HATCH}paths=[];pattern=an.Solid;get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this.pattern?.update(new C(0,0),this._patternAngle,1)}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this.pattern?.update(new C(0,0),0,this._patternScale)}patternType=xo.PatternFill;pixelSize=0;seedPoints=[];style=Do.Normal;get subclassMarker(){return l.Hatch}_patternAngle=0;_patternScale=0;applyTransform(e){for(let t of this.paths)t.applyTransform(e)}clone(){let e=super.clone();return e.gradientColor=this.gradientColor?.clone(),e.pattern=this.pattern?.clone(),e.paths=this.paths.map(t=>t.clone()),e}*explode(){for(let e of this.paths)for(let t of e.edges)yield t.toEntity()}getBoundingBox(){return null}};var Di;(function(r){r[r.Opposite=0]="Opposite",r[r.Same=1]="Same"})(Di||(Di={}));var vt=class r extends Array{Seqend=null;constructor(...e){super(...e),Object.setPrototypeOf(this,r.prototype)}};D();x();R();var Ee=class extends A{attributes=new vt;block=null;columnCount=1;columnSpacing=0;get hasAttributes(){return this.attributes.length>0}get hasDynamicSubclass(){return!0}insertPoint=new c(0,0,0);get isMultiple(){return this.rowCount>1||this.columnCount>1}normal=new c(0,0,1);get objectName(){return d.EntityInsert}get objectType(){return this.rowCount>1||this.columnCount>1?u.MINSERT:u.INSERT}rotation=0;rowCount=1;rowSpacing=0;get subclassMarker(){return this.isMultiple?l.MInsert:l.Insert}get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_xscale=1;_yscale=1;_zscale=1;constructor(e){if(super(),e){e.document!=null?this.block=e.clone():this.block=e;let t=e.attributeDefinitions;if(t)for(let i of t)this.attributes.push(new Dt(i))}}applyTransform(e){for(let t of this.attributes)t.applyTransform(e)}clone(){let e=super.clone();e.block=this.block?.clone()??null,e.attributes=new vt;for(let t of this.attributes)e.attributes.push(t.clone());return e}*explode(){}getBoundingBox(){return null}getTransform(){return null}updateAttributes(){if(!this.block)return;let e=this.block.attributeDefinitions??[],t=e.map(n=>n.tag),i=this.attributes.map(n=>n.tag),s=new vt(...this.attributes.filter(n=>t.includes(n.tag)));s.Seqend=this.attributes.Seqend,this.attributes=s;for(let n of e)i.includes(n.tag)||this.attributes.push(new Dt(n))}assignDocument(e){if(super.assignDocument(e),this.block==null)return;let t=e.blockRecords?.get(this.block.name);t?this.block=t:e.blockRecords?.add(this.block)}unassignDocument(){this.block=this.block?.clone()??null,super.unassignDocument()}};var Si;(function(r){r[r.Chord=0]="Chord",r[r.SquareRoot=1]="SquareRoot",r[r.Uniform=2]="Uniform",r[r.Custom=15]="Custom"})(Si||(Si={}));Te();D();x();R();var So;(function(r){r[r.CreatedWithTextAnnotation=0]="CreatedWithTextAnnotation",r[r.CreatedWithToleranceAnnotation=1]="CreatedWithToleranceAnnotation",r[r.CreatedWithBlockReferenceAnnotation=2]="CreatedWithBlockReferenceAnnotation",r[r.CreatedWithoutAnnotation=3]="CreatedWithoutAnnotation"})(So||(So={}));var Co;(function(r){r[r.StraightLineSegments=0]="StraightLineSegments",r[r.Spline=1]="Spline"})(Co||(Co={}));var nr=class extends A{annotationOffset=new c(0,0,0);arrowHeadEnabled=!1;associatedAnnotation=null;blockOffset=new c(0,0,0);creationType=So.CreatedWithoutAnnotation;get hasHookline(){return this.vertices.length<=1,!1}hookLineDirection=Di.Opposite;horizontalDirection=new c(1,0,0);normal=new c(0,0,1);get objectName(){return d.EntityLeader}get objectType(){return u.LEADER}pathType=Co.StraightLineSegments;get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Leader}textHeight=0;textWidth=0;vertices=[];_style=re.Default;applyTransform(e){}clone(){let e=super.clone();return e._style=this._style?.clone(),e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.dimensionStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.dimensionStyles.get(re.DefaultName))}};var bl;(function(r){r[r.OneDistantLight=0]="OneDistantLight",r[r.TwoDistantLights=1]="TwoDistantLights"})(bl||(bl={}));D();x();R();var zt=class extends A{endPoint=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityLine}get objectType(){return u.LINE}startPoint=new c(0,0,0);get subclassMarker(){return l.Line}thickness=0;constructor(e,t){super(),e&&(this.startPoint=e),t&&(this.endPoint=t)}applyTransform(e){}getBoundingBox(){let e=new c(Math.min(this.startPoint.x,this.endPoint.x),Math.min(this.startPoint.y,this.endPoint.y),Math.min(this.startPoint.z,this.endPoint.z)),t=new c(Math.max(this.startPoint.x,this.endPoint.x),Math.max(this.startPoint.y,this.endPoint.y),Math.max(this.startPoint.z,this.endPoint.z));return{min:e,max:t}}};D();x();R();var At;(function(r){r[r.Default=0]="Default",r[r.Closed=1]="Closed",r[r.Plinegen=128]="Plinegen"})(At||(At={}));var Ci=class{location=new C(0,0);startWidth=0;endWidth=0;bulge=0;flags=0;curveTangent=0;id=0;constructor(e){e&&(this.location=new C(e.x,e.y))}getLocation3D(){return new c(this.location.x,this.location.y,0)}},qr=class extends A{constantWidth=0;elevation=0;get flags(){return this._flags}set flags(e){this._flags=e}get isClosed(){return(this._flags&At.Closed)!==0}set isClosed(e){e?this._flags=this._flags|At.Closed:this._flags=this._flags&~At.Closed}normal=new c(0,0,1);get objectName(){return d.EntityLwPolyline}get objectType(){return u.LWPOLYLINE}get subclassMarker(){return l.LwPolyline}thickness=0;vertices=[];_flags=At.Default;constructor(e){super(),e&&e.length>0&&("location"in e[0]?this.vertices=e:this.vertices=e.map(t=>new Ci(t)))}applyTransform(e){}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>{let i=new Ci;return i.location=new C(t.location.x,t.location.y),i.startWidth=t.startWidth,i.endWidth=t.endWidth,i.bulge=t.bulge,i.flags=t.flags,i.curveTangent=t.curveTangent,i.id=t.id,i}),e}getBoundingBox(){return null}};D();x();R();var ln=class{start;end;crease=null;constructor(e,t){this.start=e,this.end=t}toString(){return`${this.start}|${this.end}|${this.crease??""}`}},ar=class extends A{blendCrease=0;edges=[];faces=[];get objectName(){return d.EntityMesh}get objectType(){return u.UNLISTED}get subclassMarker(){return l.Mesh}subdivisionLevel=0;version=0;vertices=[];applyTransform(e){for(let t=0;t<this.vertices.length;t++);}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>new c(t.x,t.y,t.z)),e.edges=this.edges.map(t=>{let i=new ln(t.start,t.end);return i.crease=t.crease,i}),e.faces=this.faces.map(t=>[...t]),e}getBoundingBox(){return null}};D();x();R();var Bi;(function(r){r[r.Has=1]="Has",r[r.Closed=2]="Closed",r[r.NoStartCaps=4]="NoStartCaps",r[r.NoEndCaps=8]="NoEndCaps"})(Bi||(Bi={}));var Bo;(function(r){r[r.Top=0]="Top",r[r.Zero=1]="Zero",r[r.Bottom=2]="Bottom"})(Bo||(Bo={}));var Bn=class r{parameters=[];areaFillParameters=[];applyScale(e){this.parameters=this.parameters.map(t=>t*e),this.areaFillParameters=this.areaFillParameters.map(t=>t*e)}clone(){let e=new r;return e.parameters=[...this.parameters],e.areaFillParameters=[...this.areaFillParameters],e}},yn=class r{position=new c(0,0,0);direction=new c(0,0,0);miter=new c(0,0,0);segments=[];applyTransform(e){}clone(){let e=new r;return e.position=new c(this.position.x,this.position.y,this.position.z),e.direction=new c(this.direction.x,this.direction.y,this.direction.z),e.miter=new c(this.miter.x,this.miter.y,this.miter.z),e.segments=this.segments.map(t=>t.clone()),e}},or=class extends A{flags=Bi.Has;justification=Bo.Zero;normal=new c(0,0,1);get objectName(){return d.EntityMLine}get objectType(){return u.MLINE}scaleFactor=1;startPoint=new c(0,0,0);get style(){return this._style}set style(e){if(!e)throw new Error("MLine style cannot be null");this._style=e}get subclassMarker(){return l.MLine}vertices=[];_style=null;applyTransform(e){}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>t.clone()),e}getBoundingBox(){return null}};Te();D();x();R();var Dh=class r{columnType=rs.NoColumns;columnCount=0;flowReversed=!1;autoHeight=!1;width=0;gutter=0;heights=[];clone(){let e=new r;return e.columnType=this.columnType,e.columnCount=this.columnCount,e.flowReversed=this.flowReversed,e.autoHeight=this.autoHeight,e.width=this.width,e.gutter=this.gutter,e.heights=[...this.heights],e}},Ne=class extends A{alignmentPoint=new c(0,0,0);attachmentPoint=Oe.TopLeft;backgroundColor=null;backgroundFillFlags=rr.None;backgroundScale=1.5;backgroundTransparency=0;get columnData(){return this._columnData}set columnData(e){this._columnData=e}drawingDirection=bo.LeftToRight;get hasColumns(){return this._columnData!=null&&this._columnData.columnType!==rs.NoColumns}get height(){return this._height}set height(e){if(e<=0)throw new Error("The text height must be greater than zero.");this._height=e}horizontalWidth=0;insertPoint=new c(0,0,0);isAnnotative=!1;lineSpacing=1;lineSpacingStyle=sn.AtLeast;normal=new c(0,0,1);get objectName(){return d.EntityMText}get objectType(){return u.MTEXT}get plainText(){return this._value}rectangleHeight=0;rectangleWidth=0;get rotation(){return Math.atan2(this.alignmentPoint.y,this.alignmentPoint.x)}set rotation(e){this.alignmentPoint=new c(Math.cos(e),Math.sin(e),0)}get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}get subclassMarker(){return l.MText}get value(){return this._value}set value(e){this._value=e}verticalHeight=0;_height=1;_style=te.Default;_value="";_columnData=null;constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),this._columnData&&(e._columnData=this._columnData.clone()),e}getBoundingBox(){return null}getPlainTextLines(){return this.plainText.split(/\r\n|\r|\n/)}getTextLines(){return this._value.replace(/\\P/gi,`
2
- `).split(/\r\n|\r|\n/)}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.textStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.textStyles.get(te.DefaultName))}};D();x();R();var dn;(function(r){r[r.None=0]="None",r[r.Block=1]="Block",r[r.MText=2]="MText",r[r.Tolerance=3]="Tolerance"})(dn||(dn={}));var yo;(function(r){r[r.Invisible=0]="Invisible",r[r.StraightLineSegments=1]="StraightLineSegments",r[r.Spline=2]="Spline"})(yo||(yo={}));var Ro;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right"})(Ro||(Ro={}));var To;(function(r){r[r.Horizontal=0]="Horizontal",r[r.Vertical=1]="Vertical"})(To||(To={}));var Ao;(function(r){r[r.Left=1]="Left",r[r.Center=2]="Center",r[r.Right=3]="Right"})(Ao||(Ao={}));var Cs;(function(r){r[r.TopOfTopLine=0]="TopOfTopLine",r[r.MiddleOfTopLine=1]="MiddleOfTopLine",r[r.MiddleOfText=2]="MiddleOfText",r[r.MiddleOfBottomLine=3]="MiddleOfBottomLine",r[r.BottomOfBottomLine=4]="BottomOfBottomLine",r[r.BottomLine=5]="BottomLine",r[r.BottomOfTopLineUnderlineBottomLine=6]="BottomOfTopLineUnderlineBottomLine",r[r.BottomOfTopLineUnderlineTopLine=7]="BottomOfTopLineUnderlineTopLine",r[r.BottomofTopLineUnderlineAll=8]="BottomofTopLineUnderlineAll",r[r.CenterOfText=9]="CenterOfText",r[r.CenterOfTextOverline=10]="CenterOfTextOverline"})(Cs||(Cs={}));var zd;(function(r){r[r.None=0]="None",r[r.PathType=1]="PathType",r[r.LineColor=2]="LineColor",r[r.LeaderLineType=4]="LeaderLineType",r[r.LeaderLineWeight=8]="LeaderLineWeight",r[r.EnableLanding=16]="EnableLanding",r[r.LandingGap=32]="LandingGap",r[r.EnableDogleg=64]="EnableDogleg",r[r.LandingDistance=128]="LandingDistance",r[r.Arrowhead=256]="Arrowhead",r[r.ArrowheadSize=512]="ArrowheadSize",r[r.ContentType=1024]="ContentType",r[r.TextStyle=2048]="TextStyle",r[r.TextLeftAttachment=4096]="TextLeftAttachment",r[r.TextAngle=8192]="TextAngle",r[r.TextAlignment=16384]="TextAlignment",r[r.TextColor=32768]="TextColor",r[r.TextHeight=65536]="TextHeight",r[r.TextFrame=131072]="TextFrame",r[r.EnableUseDefaultMText=262144]="EnableUseDefaultMText",r[r.BlockContent=524288]="BlockContent",r[r.BlockContentColor=1048576]="BlockContentColor",r[r.BlockContentScale=2097152]="BlockContentScale",r[r.BlockContentRotation=4194304]="BlockContentRotation",r[r.BlockContentConnection=8388608]="BlockContentConnection",r[r.ScaleFactor=16777216]="ScaleFactor",r[r.TextRightAttachment=33554432]="TextRightAttachment",r[r.TextSwitchAlignmentType=67108864]="TextSwitchAlignmentType",r[r.TextAttachmentDirection=134217728]="TextAttachmentDirection",r[r.TextTopAttachment=268435456]="TextTopAttachment",r[r.TextBottomAttachment=536870912]="TextBottomAttachment"})(zd||(zd={}));var gl=class r{attributeDefinition=null;index=0;width=0;text="";clone(){let e=new r;return e.attributeDefinition=this.attributeDefinition,e.index=this.index,e.width=this.width,e.text=this.text,e}},lr=class extends A{arrowhead=null;arrowheadSize=0;blockAttributes=[];blockContentColor=B.ByBlock;blockContentConnection=0;blockContentId=null;blockContentRotation=0;blockContentScale=new c(1,1,1);contentType=dn.MText;contextData=null;enableAnnotationScale=!1;enableDogleg=!0;enableLanding=!0;extendedToText=!1;landingDistance=0;leaderLineType=null;leaderLineWeight=0;lineColor=B.ByBlock;get objectName(){return d.EntityMultiLeader}get objectType(){return u.UNLISTED}pathType=yo.StraightLineSegments;propertyOverrideFlags=0;scaleFactor=1;style=null;get subclassMarker(){return l.MultiLeader}textAlignment=Ro.Left;textAngle=0;textAttachmentDirection=To.Horizontal;textAttachmentPoint=Ao.Center;textBottomAttachment=Cs.CenterOfText;textColor=B.ByBlock;textFrame=!1;textLeftAttachment=Cs.MiddleOfTopLine;textRightAttachment=Cs.MiddleOfTopLine;textStyle=null;textTopAttachment=Cs.CenterOfText;textDirectionNegative=!1;textAligninIPE=!1;applyTransform(e){}clone(){let e=super.clone();return e.contextData=this.contextData,e.blockAttributes=this.blockAttributes.map(t=>t.clone()),e}getBoundingBox(){return null}};D();x();R();var xl;(function(r){r[r.Link=1]="Link",r[r.Embedded=2]="Embedded",r[r.Static=3]="Static"})(xl||(xl={}));var dr=class extends A{binaryData=new Uint8Array(0);isPaperSpace=!1;lowerRightCorner=new c(0,0,0);get objectName(){return d.EntityOle2Frame}get objectType(){return u.OLE2FRAME}oleObjectType=xl.Embedded;sourceApplication="";get subclassMarker(){return l.Ole2Frame}upperLeftCorner=new c(1,1,0);version=2;applyTransform(e){}getBoundingBox(){return null}};x();var Dl;(function(r){r[r.ClippingOn=1]="ClippingOn",r[r.ShowUnderlay=2]="ShowUnderlay",r[r.Monochrome=4]="Monochrome",r[r.AdjustForBackground=8]="AdjustForBackground",r[r.ClipInsideMode=16]="ClipInsideMode",r[r.Default=11]="Default"})(Dl||(Dl={}));var Sl=class extends A{clipBoundaryVertices=[];get contrast(){return this._contrast}set contrast(e){if(e<0||e>100)throw new Error(`Invalid Contrast value: ${e}, must be in range 0-100`);this._contrast=e}definition=null;get fade(){return this._fade}set fade(e){if(e<0||e>100)throw new Error(`Invalid Fade value: ${e}, must be in range 0-100`);this._fade=e}flags=Dl.Default;insertPoint=new c(0,0,0);normal=new c(0,0,1);rotation=0;get subclassMarker(){return l.Underlay}get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_contrast=100;_fade=0;_xscale=1;_yscale=1;_zscale=1;constructor(e){super(),e&&(this.definition=e)}applyTransform(e){}clone(){let e=super.clone();return e.definition=this.definition?.clone?.()??null,e.clipBoundaryVertices=[...this.clipBoundaryVertices],e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e)}unassignDocument(){super.unassignDocument(),this.definition=this.definition?.clone?.()??null}};D();R();var Qr=class extends Sl{get objectName(){return d.EntityPdfUnderlay}get objectType(){return u.UNLISTED}constructor(e){super(e)}};D();x();R();var Gt=class extends A{location=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityPoint}get objectType(){return u.POINT}rotation=0;get subclassMarker(){return l.Point}thickness=0;constructor(e){super(),e&&(this.location=e)}applyTransform(e){}getBoundingBox(){return null}};var Ve;(function(r){r[r.Default=0]="Default",r[r.ClosedPolylineOrClosedPolygonMeshInM=1]="ClosedPolylineOrClosedPolygonMeshInM",r[r.CurveFit=2]="CurveFit",r[r.SplineFit=4]="SplineFit",r[r.Polyline3D=8]="Polyline3D",r[r.PolygonMesh=16]="PolygonMesh",r[r.ClosedPolygonMeshInN=32]="ClosedPolygonMeshInN",r[r.PolyfaceMesh=64]="PolyfaceMesh",r[r.ContinuousLinetypePattern=128]="ContinuousLinetypePattern"})(Ve||(Ve={}));var Cl;(function(r){r[r.NoSmooth=0]="NoSmooth",r[r.Quadratic=5]="Quadratic",r[r.Cubic=6]="Cubic",r[r.BezierSurface=8]="BezierSurface"})(Cl||(Cl={}));var hr=class r extends A{static matchVerticesEntityProperties=!1;elevation=0;endWidth=0;get flags(){return this._flags}set flags(e){this._flags=e}get isClosed(){return(this._flags&Ve.ClosedPolylineOrClosedPolygonMeshInM)!==0}set isClosed(e){e?this._flags=this._flags|Ve.ClosedPolylineOrClosedPolygonMeshInM:(this._flags=this._flags&~Ve.ClosedPolylineOrClosedPolygonMeshInM,this._flags=this._flags&~Ve.ClosedPolygonMeshInN)}get layer(){return super.layer}set layer(e){if(super.layer=e,r.matchVerticesEntityProperties)for(let t of this.vertices)t instanceof A&&(t.layer=e)}get lineType(){return super.lineType}set lineType(e){if(super.lineType=e,r.matchVerticesEntityProperties)for(let t of this.vertices)t instanceof A&&(t.lineType=e)}normal=new c(0,0,1);smoothSurface=Cl.NoSmooth;startWidth=0;thickness=0;vertices=new vt;_flags=0;constructor(e){super(),e&&(this.vertices=new vt(...e))}applyTransform(e){}clone(){let e=super.clone();return e.vertices=new vt(...this.vertices.map(t=>t.clone())),e}static*explode(e,t){}};D();x();R();var ut=class extends hr{faces=[];get flags(){return super.flags|Ve.PolyfaceMesh}set flags(e){super.flags=e}get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_PFACE}get subclassMarker(){return l.PolyfaceMesh}clone(){let e=super.clone();return e.faces=this.faces.map(t=>t.clone()),e}getBoundingBox(){return null}};D();x();R();var Et=class extends hr{get flags(){return super.flags|Ve.PolygonMesh}set flags(e){super.flags=e}mSmoothSurfaceDensity=0;mVertexCount=0;nSmoothSurfaceDensity=0;nVertexCount=0;get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_MESH}get subclassMarker(){return l.PolygonMesh}getBoundingBox(){return null}};D();var Rn;(function(r){r[r.Default=0]="Default",r[r.CurveFittingExtraVertex=1]="CurveFittingExtraVertex",r[r.CurveFitTangent=2]="CurveFitTangent",r[r.NotUsed=4]="NotUsed",r[r.SplineVertexFromSplineFitting=8]="SplineVertexFromSplineFitting",r[r.SplineFrameControlPoint=16]="SplineFrameControlPoint",r[r.PolylineVertex3D=32]="PolylineVertex3D",r[r.PolygonMesh3D=64]="PolygonMesh3D",r[r.PolyfaceMeshVertex=128]="PolyfaceMeshVertex"})(Rn||(Rn={}));var Ue=class extends A{bulge=0;curveTangent=0;endWidth=0;get flags(){return this._flags}set flags(e){this._flags=e}id=0;location=new c(0,0,0);get objectName(){return d.EntityVertex}startWidth=0;_flags=Rn.Default;constructor(e){super(),e&&(this.location=e)}applyTransform(e){}getBoundingBox(){return null}toString(){return`${this.subclassMarker}|${this.location.x},${this.location.y},${this.location.z}`}};x();R();var ss=class extends Ue{get objectType(){return u.VERTEX_MESH}get subclassMarker(){return l.PolygonMeshVertex}constructor(e){super(e?new c(e.x,e.y,e.z):void 0)}};D();x();R();var et=class extends hr{get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_2D}get subclassMarker(){return l.Polyline}getBoundingBox(){return null}};D();x();R();x();R();var cr=class extends Ue{get objectType(){return u.VERTEX_3D}get subclassMarker(){return l.Polyline3dVertex}constructor(e){super(e)}};var tt=class extends hr{get flags(){return super.flags|Ve.Polyline3D}set flags(e){super.flags=e}get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_3D}get subclassMarker(){return l.Polyline3d}constructor(e){super(),e&&e.length>0&&(e[0]instanceof cr?this.vertices=new vt(...e):this.vertices=new vt(...e.map(t=>new cr(t))))}getBoundingBox(){return null}};D();x();R();var Tn=class extends A{get classId(){return this.dxfClass?.classNumber??0}get drawingFormat(){return this.version|this.maintenanceVersion<<16}dxfClass=null;maintenanceVersion=0;get objectName(){return d.EntityProxyEntity}get objectType(){return u.ACAD_PROXY_ENTITY}originalDataFormatDxf=!1;proxyClassId=498;get subclassMarker(){return l.ProxyEntity}version=m.Unknown;applyTransform(e){}getBoundingBox(){return null}};D();x();R();var ns=class extends Ss{get objectName(){return d.EntityImage}get objectType(){return u.UNLISTED}get subclassMarker(){return l.RasterImage}get definition(){return super.definition}set definition(e){if(e==null)throw new Error("value cannot be null");super.definition=e}constructor(e){super(),e&&(this.definition=e)}};D();x();R();var ei=class extends A{direction=new c(0,0,0);get objectName(){return d.EntityRay}get objectType(){return u.RAY}startPoint=new c(0,0,0);get subclassMarker(){return l.Ray}applyTransform(e){}getBoundingBox(){return null}};D();R();var as=class extends Ds{get objectType(){return u.REGION}get objectName(){return d.EntityRegion}};D();R();var Le=class extends A{get objectType(){return u.SEQEND}get objectName(){return d.EntitySeqend}constructor(e){super(),e&&(this.owner=e)}getBoundingBox(){return null}applyTransform(e){}};var Sh;(function(r){r[r.CastsAndReceivesShadows=0]="CastsAndReceivesShadows",r[r.CastsShadows=1]="CastsShadows",r[r.ReceivesShadows=2]="ReceivesShadows",r[r.IgnoresShadows=3]="IgnoresShadows"})(Sh||(Sh={}));Te();D();x();R();var ur=class extends A{get objectType(){return u.SHAPE}get objectName(){return d.EntityShape}get subclassMarker(){return l.Shape}thickness=0;insertionPoint=new c(0,0,0);size=1;get shapeStyle(){return this._style}set shapeStyle(e){if(e==null||!e.isShapeFile)throw new Error("value cannot be null and must be a shape file");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}rotation=0;relativeXScale=1;obliqueAngle=0;normal=new c(0,0,1);shapeIndex=0;_style;constructor(e){super(),e&&(this.shapeStyle=e)}clone(){let e=super.clone();return e._style=this._style?.clone(),e}getBoundingBox(){return null}applyTransform(e){}};D();x();R();var $t=class extends A{firstCorner=new c(0,0,0);fourthCorner=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntitySolid}get objectType(){return u.SOLID}secondCorner=new c(0,0,0);get subclassMarker(){return l.Solid}thickness=0;thirdCorner=new c(0,0,0);applyTransform(e){}getBoundingBox(){return null}};D();x();R();var ti=class extends Ds{get objectType(){return u.SOLID3D}get objectName(){return d.Entity3DSolid}get subclassMarker(){return l.Solid3D}};D();x();R();var Ie;(function(r){r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Periodic=2]="Periodic",r[r.Rational=4]="Rational",r[r.Planar=8]="Planar",r[r.Linear=16]="Linear"})(Ie||(Ie={}));var mt;(function(r){r[r.None=0]="None",r[r.MethodFitPoints=1]="MethodFitPoints",r[r.CVFrameShow=2]="CVFrameShow",r[r.Closed=4]="Closed",r[r.UseKnotParameter=8]="UseKnotParameter"})(mt||(mt={}));var mr=class r extends A{controlPoints=[];controlPointTolerance=1e-7;degree=3;endTangent=new c(0,0,0);fitPoints=[];fitTolerance=1e-10;get flags(){return this._flags}set flags(e){this._flags=e}get flags1(){return this._flags1}set flags1(e){this._flags1=e}get hasValidKnotCount(){let e=this.controlPoints.length+(this.isClosed?2:1)*this.degree+1;return this.knots.length===e}get isClosed(){return(this._flags&Ie.Closed)!==0}set isClosed(e){e?(this._flags=this._flags|Ie.Closed,this._flags1=this._flags1|mt.Closed):(this._flags=this._flags&~Ie.Closed,this._flags1=this._flags1&~mt.Closed)}get isPeriodic(){return(this._flags&Ie.Periodic)!==0}set isPeriodic(e){e?this._flags=this._flags|Ie.Periodic:this._flags=this._flags&~Ie.Periodic}knotParametrization=Si.Chord;knots=[];knotTolerance=1e-7;normal=new c(0,0,1);get objectName(){return d.EntitySpline}get objectType(){return u.SPLINE}startTangent=new c(0,0,0);get subclassMarker(){return l.Spline}weights=[];static MaxDegree=10;_flags=Ie.None;_flags1=mt.None;constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e.controlPoints=[...this.controlPoints],e.fitPoints=[...this.fitPoints],e.weights=[...this.weights],e.knots=[...this.knots],e}getBoundingBox(){return null}pointOnSpline(e){if(e<0||e>1)throw new Error("The parametric position must be a value between 0 and 1.");e===1&&(e-=Number.EPSILON);let{controlPts:t,weights:i,knots:s}=this.prepare(),{uStart:n,uEnd:a}=this.getStartAndEndKnots(s),o=(a-n)*e,h=n+o;return r.c(t,i,s,this.degree,h)}polygonalVertexes(e){if(e<2)throw new Error("The precision must be equal or greater than two.");let t=[],{controlPts:i,weights:s,knots:n}=this.prepare(),{uStart:a,uEnd:o}=this.getStartAndEndKnots(n);!this.isClosed&&!this.isPeriodic&&(e-=1);let h=(o-a)/e;for(let f=0;f<e;f++){let b=a+h*f;t.push(r.c(i,s,n,this.degree,b))}return this.isClosed||this.isPeriodic||t.push(i[i.length-1]),t}tryPointOnSpline(e){try{return{success:!0,point:this.pointOnSpline(e)}}catch{return{success:!1,point:new c(NaN,NaN,NaN)}}}tryPolygonalVertexes(e){try{return{success:!0,points:this.polygonalVertexes(e)}}catch{return{success:!1,points:[]}}}updateFromFitPoints(e=255){return!1}static c(e,t,i,s,n){let a=0,o=0,h=0,f=0;for(let S=0;S<e.length;S++){let N=r.computeNurb(i,S,s,n);f+=N*t[S],a+=t[S]*N*e[S].x,o+=t[S]*N*e[S].y,h+=t[S]*N*e[S].z}if(Math.abs(f)<Number.EPSILON)return new c(0,0,0);let b=1/f;return new c(b*a,b*o,b*h)}static computeNurb(e,t,i,s){if(i<=0)return e[t]<=s&&s<e[t+1]?1:0;let n=0;Math.abs(e[t+i]-e[t])<Number.EPSILON||(n=(s-e[t])/(e[t+i]-e[t]));let a=0;return Math.abs(e[t+i+1]-e[t+1])<Number.EPSILON||(a=(e[t+i+1]-s)/(e[t+i+1]-e[t+1])),n*r.computeNurb(e,t,i-1,s)+a*r.computeNurb(e,t+1,i-1,s)}static createKnotVector(e,t,i){let s;if(i){let n=e+2*t+1;s=new Array(n).fill(0);let a=1/(e-t);for(let o=0;o<n;o++)s[o]=(o-t)*a}else{let n=e+t+1;s=new Array(n).fill(0);let a;for(a=0;a<=t;a++)s[a]=0;for(;a<e;a++)s[a]=a-t;for(;a<n;a++)s[a]=e-t}return s}getStartAndEndKnots(e){return this.isClosed?{uStart:e[0],uEnd:e[e.length-1]}:this.isPeriodic?{uStart:e[this.degree],uEnd:e[e.length-this.degree-1]}:{uStart:e[0],uEnd:e[e.length-1]}}prepare(){let e=[...this.controlPoints],t=[...this.weights],i=[...this.knots],s=e.length;if(s===0)throw new Error("A spline entity with control points is required.");(t.length===0||t.length!==s)&&(t=new Array(s).fill(1)),(i.length===0||!this.hasValidKnotCount)&&(i=r.createKnotVector(s,this.degree,this.isPeriodic));let n,a;if(this.isPeriodic){n=new Array(s+this.degree),a=new Array(s+this.degree);for(let o=0;o<this.degree;o++){let h=s-this.degree+o;n[o]=e[h],a[o]=t[h]}for(let o=0;o<s;o++)n[this.degree+o]=e[o],a[this.degree+o]=t[o]}else n=e,a=t;return{controlPts:n,weights:a,knots:i}}};D();x();R();var Gd;(function(r){r[r.Single=1]="Single",r[r.Double=2]="Double"})(Gd||(Gd={}));var $d;(function(r){r[r.Right=1]="Right",r[r.Vertical=2]="Vertical",r[r.Left=4]="Left"})($d||($d={}));var Yd;(function(r){r[r.None=0]="None",r[r.EnableBreaks=1]="EnableBreaks",r[r.RepeatTopLabels=2]="RepeatTopLabels",r[r.RepeatBottomLabels=4]="RepeatBottomLabels",r[r.AllowManualPositions=8]="AllowManualPositions",r[r.AllowManualHeights=16]="AllowManualHeights"})(Yd||(Yd={}));var Xd;(function(r){r[r.None=0]="None",r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight"})(Xd||(Xd={}));var yi;(function(r){r[r.Unknown=0]="Unknown",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=4]="Bottom",r[r.Left=8]="Left",r[r.InsideVertical=16]="InsideVertical",r[r.InsideHorizontal=32]="InsideHorizontal"})(yi||(yi={}));var Zd;(function(r){r[r.Data=1]="Data",r[r.Label=2]="Label"})(Zd||(Zd={}));var Kd;(function(r){r[r.Unknown=0]="Unknown",r[r.Cell=1]="Cell",r[r.Row=2]="Row",r[r.Column=3]="Column",r[r.FormattedTableData=4]="FormattedTableData",r[r.Table=5]="Table"})(Kd||(Kd={}));var Jd;(function(r){r[r.Text=1]="Text",r[r.Block=2]="Block"})(Jd||(Jd={}));var Ch;(function(r){r[r.None=0]="None",r[r.Override=1]="Override"})(Ch||(Ch={}));var Bh;(function(r){r[r.None=0]="None",r[r.BorderType=1]="BorderType",r[r.LineWeight=2]="LineWeight",r[r.LineType=4]="LineType",r[r.Color=8]="Color",r[r.Invisibility=16]="Invisibility",r[r.DoubleLineSpacing=32]="DoubleLineSpacing",r[r.All=63]="All"})(Bh||(Bh={}));var yh;(function(r){r[r.None=0]="None",r[r.Flow=1]="Flow",r[r.StackedHorizontal=2]="StackedHorizontal",r[r.StackedVertical=4]="StackedVertical"})(yh||(yh={}));var qd;(function(r){r[r.Unknown=0]="Unknown",r[r.Value=1]="Value",r[r.Field=2]="Field",r[r.Block=4]="Block"})(qd||(qd={}));var Rh;(function(r){r[r.None=0]="None",r[r.ContentLocked=1]="ContentLocked",r[r.ContentReadOnly=2]="ContentReadOnly",r[r.Linked=4]="Linked",r[r.ContentModifiedAfterUpdate=8]="ContentModifiedAfterUpdate",r[r.FormatLocked=16]="FormatLocked",r[r.FormatReadOnly=32]="FormatReadOnly",r[r.FormatModifiedAfterUpdate=64]="FormatModifiedAfterUpdate"})(Rh||(Rh={}));var Th;(function(r){r[r.None=0]="None",r[r.DataType=1]="DataType",r[r.DataFormat=2]="DataFormat",r[r.Rotation=4]="Rotation",r[r.BlockScale=8]="BlockScale",r[r.Alignment=16]="Alignment",r[r.ContentColor=32]="ContentColor",r[r.TextStyle=64]="TextStyle",r[r.TextHeight=128]="TextHeight",r[r.AutoScale=256]="AutoScale",r[r.BackgroundColor=512]="BackgroundColor",r[r.MarginLeft=1024]="MarginLeft",r[r.MarginTop=2048]="MarginTop",r[r.MarginRight=4096]="MarginRight",r[r.MarginBottom=8192]="MarginBottom",r[r.ContentLayout=16384]="ContentLayout",r[r.MarginHorizontalSpacing=131072]="MarginHorizontalSpacing",r[r.MarginVerticalSpacing=262144]="MarginVerticalSpacing",r[r.MergeAll=32768]="MergeAll",r[r.FlowDirectionBottomToTop=65536]="FlowDirectionBottomToTop"})(Th||(Th={}));var Ah;(function(r){r[r.NoUnits=0]="NoUnits",r[r.Distance=1]="Distance",r[r.Angle=2]="Angle",r[r.Area=4]="Area",r[r.Volume=8]="Volume",r[r.Currency=16]="Currency",r[r.Percentage=32]="Percentage"})(Ah||(Ah={}));var $;(function(r){r[r.None=0]="None",r[r.TitleHorizontalTop=1]="TitleHorizontalTop",r[r.TitleHorizontalInsert=2]="TitleHorizontalInsert",r[r.TitleHorizontalBottom=4]="TitleHorizontalBottom",r[r.TitleVerticalLeft=8]="TitleVerticalLeft",r[r.TitleVerticalInsert=16]="TitleVerticalInsert",r[r.TitleVerticalRight=32]="TitleVerticalRight",r[r.HeaderHorizontalTop=64]="HeaderHorizontalTop",r[r.HeaderHorizontalInsert=128]="HeaderHorizontalInsert",r[r.HeaderHorizontalBottom=256]="HeaderHorizontalBottom",r[r.HeaderVerticalLeft=512]="HeaderVerticalLeft",r[r.HeaderVerticalInsert=1024]="HeaderVerticalInsert",r[r.HeaderVerticalRight=2048]="HeaderVerticalRight",r[r.DataHorizontalTop=4096]="DataHorizontalTop",r[r.DataHorizontalInsert=8192]="DataHorizontalInsert",r[r.DataHorizontalBottom=16384]="DataHorizontalBottom",r[r.DataVerticalLeft=32768]="DataVerticalLeft",r[r.DataVerticalInsert=65536]="DataVerticalInsert",r[r.DataVerticalRight=131072]="DataVerticalRight"})($||($={}));var de;(function(r){r[r.None=0]="None",r[r.TitleSuppressed=1]="TitleSuppressed",r[r.HeaderSuppressed=2]="HeaderSuppressed",r[r.FlowDirection=4]="FlowDirection",r[r.HorizontalCellMargin=8]="HorizontalCellMargin",r[r.VerticalCellMargin=16]="VerticalCellMargin",r[r.TitleRowColor=32]="TitleRowColor",r[r.HeaderRowColor=64]="HeaderRowColor",r[r.DataRowColor=128]="DataRowColor",r[r.TitleRowFillNone=256]="TitleRowFillNone",r[r.HeaderRowFillNone=512]="HeaderRowFillNone",r[r.DataRowFillNone=1024]="DataRowFillNone",r[r.TitleRowFillColor=2048]="TitleRowFillColor",r[r.HeaderRowFillColor=4096]="HeaderRowFillColor",r[r.DataRowFillColor=8192]="DataRowFillColor",r[r.TitleRowAlign=16384]="TitleRowAlign",r[r.HeaderRowAlign=32768]="HeaderRowAlign",r[r.DataRowAlign=65536]="DataRowAlign",r[r.TitleTextStyle=131072]="TitleTextStyle",r[r.HeaderTextStyle=262144]="HeaderTextStyle",r[r.DataTextStyle=524288]="DataTextStyle",r[r.TitleRowHeight=1048576]="TitleRowHeight",r[r.HeaderRowHeight=2097152]="HeaderRowHeight",r[r.DataRowHeight=4194304]="DataRowHeight"})(de||(de={}));var Eh;(function(r){r[r.None=0]="None",r[r.CellAlignment=1]="CellAlignment",r[r.BackgroundFillNone=2]="BackgroundFillNone",r[r.BackgroundColor=4]="BackgroundColor",r[r.ContentColor=8]="ContentColor",r[r.TextStyle=16]="TextStyle",r[r.TextHeight=32]="TextHeight",r[r.TopGridColor=64]="TopGridColor",r[r.TopGridLineWeight=1024]="TopGridLineWeight",r[r.TopVisibility=16384]="TopVisibility",r[r.RightGridColor=128]="RightGridColor",r[r.RightGridLineWeight=2048]="RightGridLineWeight",r[r.RightVisibility=32768]="RightVisibility",r[r.BottomGridColor=256]="BottomGridColor",r[r.BottomGridLineWeight=4096]="BottomGridLineWeight",r[r.BottomVisibility=65536]="BottomVisibility",r[r.LeftGridColor=512]="LeftGridColor",r[r.LeftGridLineWeight=8192]="LeftGridLineWeight",r[r.LeftVisibility=131072]="LeftVisibility"})(Eh||(Eh={}));var Lh=class{value=""},kh=class{name="";value=new Ht},Ph=class{distanceTopLeft=new c(0,0,0);distanceCenter=new c(0,0,0);contentWidth=0;contentHeight=0;width=0;height=0;flags=0},hn=class{bottomRowIndex=0;leftColumnIndex=0;rightColumnIndex=0;topRowIndex=0},Bs=class{alignment=0;color=B.ByBlock;hasData=!1;propertyFlags=0;propertyOverrideFlags=0;rotation=0;scale=0;textHeight=0;textStyle=null;valueDataType=0;valueFormatString="";valueUnitType=0},Ri=class{color=B.ByBlock;doubleLineSpacing=0;edgeFlags;isInvisible=!1;lineWeight=M.Default;propertyOverrideFlags=0;type=Gd.Single;constructor(e){this.edgeFlags=e}},cn=class{contentType=qd.Unknown;format=new Bs;cadValue=new Ht},os=class extends Bs{backgroundColor=B.ByBlock;bottomBorder=new Ri(yi.Bottom);bottomMargin=0;cellAlignment=Xd.None;contentColor=B.ByBlock;contentLayoutFlags=0;horizontalInsideBorder=new Ri(yi.InsideHorizontal);horizontalMargin=.06;isFillColorOn=!1;leftBorder=new Ri(yi.Left);marginHorizontalSpacing=0;marginOverrideFlags=0;marginVerticalSpacing=0;name="";rightBorder=new Ri(yi.Right);rightMargin=0;styleClass=Zd.Data;tableCellStylePropertyFlags=0;textColor=B.ByBlock;topBorder=new Ri(yi.Right);cellStyleType=Kd.Unknown;verticalInsideBorder=new Ri(yi.InsideVertical);verticalMargin=.06;id=0},ys=class{autoFit=!1;blockScale=0;borderHeight=0;borderWidth=0;get content(){return this.contents==null||this.hasMultipleContent?null:this.contents.length>0?this.contents[0]:null}contents=[];customData=0;customDataCollection=[];edgeFlags=0;geometry=null;hasLinkedData=!1;get hasMultipleContent(){return this.contents!=null&&this.contents.length>1}mergedValue=0;rotation=0;stateFlags=0;styleOverride=new os;toolTip="";type=Jd.Text;virtualEdgeFlag=0},Rs=class{name="";width=0;customData=0;cellStyleOverride=new os;customDataCollection=[]},Ts=class{height=0;customData=0;cellStyleOverride=new os;cells=[];customDataCollection=[]},Bl=class{position=new c(0,0,0);height=0},Qd=class{flags=Yd.None;flowDirection=$d.Right;breakSpacing=0;heights=[]},yl=class{position=new c(0,0,0);startRowIndex=0;endRowIndex=0},Ti=class extends Ee{get columns(){return this._content.columns}horizontalDirection=new c(0,0,0);get objectName(){return d.EntityTable}get objectType(){return u.UNLISTED}overrideBorderColor=!1;overrideBorderLineWeight=!1;overrideBorderVisibility=!1;overrideFlag=!1;get rows(){return this._content.rows}get style(){return this._content.style}set style(e){this._content.style=e}get subclassMarker(){return l.TableEntity}valueFlag=0;version=0;breakRowRanges=[];get content(){return this._content}tableBreakData=new Qd;_content=new eh;clone(){return super.clone()}getBoundingBox(){return null}getCell(e,t){return this.rows[e].cells[t]}},eh=class{columns=[];rows=[];style=null};Te();D();x();R();var Yt=class extends A{direction=new c(0,0,0);insertionPoint=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityTolerance}get objectType(){return u.TOLERANCE}get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Tolerance}text="";_style=re.Default;applyTransform(e){}getBoundingBox(){return null}};R();var Lt=class extends A{get objectType(){return u.UNDEFINED}get objectName(){return this._objectName}get subclassMarker(){return this._subclassMarker}_objectName;_subclassMarker;constructor(e){super(),e?(this._objectName=e.dxfName||"",this._subclassMarker=e.cppClassName||""):(this._objectName="",this._subclassMarker="")}applyTransform(e){}getBoundingBox(){return null}};x();R();var Xt=class extends Ue{get objectType(){return u.VERTEX_2D}get subclassMarker(){return l.PolylineVertex}constructor(e){super(e)}};x();R();var ri=class extends Ue{get objectType(){return u.VERTEX_PFACE}get subclassMarker(){return l.PolyfaceMeshVertex}};x();R();var Zt=class extends Ue{get objectType(){return u.VERTEX_PFACE_FACE}get subclassMarker(){return l.PolyfaceMeshFace}index1=0;index2=0;index3=0;index4=0;get flags(){return this._flags|Rn.PolyfaceMeshVertex}set flags(e){this._flags=e}};var Oh;(function(r){r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom"})(Oh||(Oh={}));D();x();R();var th;(function(r){r[r.PerspectiveMode=1]="PerspectiveMode",r[r.FrontClipping=2]="FrontClipping",r[r.BackClipping=4]="BackClipping",r[r.UcsFollow=8]="UcsFollow",r[r.FrontClipNotAtEye=16]="FrontClipNotAtEye",r[r.UcsIconVisibility=32]="UcsIconVisibility",r[r.UcsIconAtOrigin=64]="UcsIconAtOrigin",r[r.FastZoom=128]="FastZoom",r[r.SnapMode=256]="SnapMode",r[r.GridMode=512]="GridMode",r[r.IsometricSnapStyle=1024]="IsometricSnapStyle",r[r.HidePlotMode=2048]="HidePlotMode",r[r.IsoPairTop=4096]="IsoPairTop",r[r.IsoPairRight=8192]="IsoPairRight",r[r.ViewportZoomLocking=16384]="ViewportZoomLocking",r[r.CurrentlyAlwaysEnabled=32768]="CurrentlyAlwaysEnabled",r[r.NonRectangularClipping=65536]="NonRectangularClipping",r[r.ViewportOff=131072]="ViewportOff",r[r.DisplayGridBeyondDrawingLimits=262144]="DisplayGridBeyondDrawingLimits",r[r.AdaptiveGridDisplay=524288]="AdaptiveGridDisplay",r[r.SubdivisionGridBelowSpacing=1048576]="SubdivisionGridBelowSpacing"})(th||(th={}));var fr=class r extends A{ambientLightColor=null;backClipPlane=0;boundary=null;brightness=0;center=new c(0,0,0);circleZoomPercent=0;contrast=0;defaultLightingType=bl.OneDistantLight;displayUcsIcon=!1;elevation=0;frontClipPlane=0;frozenLayers=[];gridSpacing=new C(0,0);height=0;get id(){return 0}lensLength=0;majorGridLineFrequency=0;get objectName(){return d.EntityViewport}get objectType(){return u.VIEWPORT}renderMode=0;get representsPaper(){return this.id===r.PaperViewId}scale=null;get scaleFactor(){return this.height===0?1:1/(this.viewHeight/this.height)}shadePlotMode=0;snapAngle=0;snapBase=new C(0,0);snapSpacing=new C(0,0);status=0;styleSheetName="";get subclassMarker(){return l.Viewport}twistAngle=0;ucsOrigin=new c(0,0,0);ucsOrthographicType=0;ucsPerViewport=!1;ucsXAxis=new c(1,0,0);ucsYAxis=new c(0,1,0);useDefaultLighting=!1;viewCenter=new C(0,0);viewDirection=new c(0,0,1);viewHeight=0;viewTarget=new c(0,0,0);get viewWidth(){return this.height===0?0:this.viewHeight/this.height*this.width}visualStyle=null;width=0;static ASDK_XREC_ANNOTATION_SCALE_INFO="ASDK_XREC_ANNOTATION_SCALE_INFO";static PaperViewId=1;applyTransform(e){this.boundary!=null&&this.boundary.applyTransform(e)}clone(){let e=super.clone();return e.boundary=this.boundary?.clone()??null,e.visualStyle=this.visualStyle?.clone?.()??null,e.scale=this.scale?.clone?.()??null,e.frozenLayers=this.frozenLayers.map(t=>t.clone()),e}getBoundingBox(){return{min:new c(this.center.x-this.width/2,this.center.y-this.height/2,this.center.z),max:new c(this.center.x+this.width/2,this.center.y+this.height/2,this.center.z)}}getModelBoundingBox(){return{min:new c(this.viewCenter.x-this.viewWidth/2,this.viewCenter.y-this.viewHeight/2,0),max:new c(this.viewCenter.x+this.viewWidth/2,this.viewCenter.y+this.viewHeight/2,0)}}selectEntities(e=!0){if(this.document==null)throw new Error("Viewport needs to be assigned to a document.");return[]}assignDocument(e){super.assignDocument(e)}unassignDocument(){super.unassignDocument(),this.scale=this.scale?.clone?.()??null}};D();x();R();var ls=class extends Ss{get objectType(){return u.UNLISTED}get objectName(){return d.EntityWipeout}get subclassMarker(){return l.Wipeout}constructor(){super(),this.flags=ir.ShowImage|ir.ShowNotAlignedImage|ir.UseClippingBoundary}};D();x();R();var ii=class extends A{direction=new c(0,0,0);firstPoint=new c(0,0,0);get objectName(){return d.EntityXline}get objectType(){return u.XLINE}get subclassMarker(){return l.XLine}applyTransform(e){}getBoundingBox(){return null}};var Me=class extends Error{constructor(e){e!==void 0?super(`File version not supported: ${e}`):super("File version not recognized"),this.name="CadNotSupportedException"}};var Eo=class extends Error{innerError;constructor(e,t){super(e),this.name="DwgException",this.innerError=t??null}};var si=class extends Error{constructor(e,t){typeof e=="number"&&t!==void 0?super(`Invalid dxf code with value ${e}, at line ${t}.`):typeof e=="string"&&t!==void 0?super(`${e}, at line ${t}.`):super(e),this.name="DxfException"}};var jh=class{static cloneTyped(e){return e.clone()}};var Nh=class r{static InvalidCharacters=["\\","/",":","*","?",'"',"<",">","|",";",",","=","`"];static isValidDxfName(e,t=m.AC1032){if(!e.name||t<=m.AC1015&&e.name.length>31)return!1;if(e.name.length>255)return!1;for(let i of r.InvalidCharacters)if(e.name.includes(i))return!1;return!0}};var Rl=class{static getLineWeightValue(e){let t=Math.abs(e);return e===M.W0?.001:t/100}};var Vh=class{};var Lo;(function(r){r[r.Inches=0]="Inches",r[r.Millimeters=1]="Millimeters",r[r.Pixels=2]="Pixels"})(Lo||(Lo={}));var An=class{static toUnits(e){switch(e){case Lo.Inches:return ie.Inches;case Lo.Millimeters:return ie.Millimeters;case Lo.Pixels:default:return ie.Unitless}}};var Ih;(function(r){r[r.Horizontal=1]="Horizontal",r[r.Vertical=3]="Vertical",r[r.ByStyle=5]="ByStyle",r[r.ByStyleBadDoc=6]="ByStyleBadDoc"})(Ih||(Ih={}));var Mh;(function(r){r[r.None=0]="None",r[r.EndPoint=1]="EndPoint",r[r.MidPoint=2]="MidPoint",r[r.Center=4]="Center",r[r.Node=8]="Node",r[r.Quadrant=16]="Quadrant",r[r.Intersection=32]="Intersection",r[r.Insertion=64]="Insertion",r[r.Perpendicular=128]="Perpendicular",r[r.Tangent=256]="Tangent",r[r.Nearest=512]="Nearest",r[r.ClearsAllObjectSnaps=1024]="ClearsAllObjectSnaps",r[r.ApparentIntersection=2048]="ApparentIntersection",r[r.Extension=4096]="Extension",r[r.Parallel=8192]="Parallel",r[r.AllModes=16383]="AllModes",r[r.SwitchedOff=16384]="SwitchedOff"})(Mh||(Mh={}));var Wh;(function(r){r[r.FacesShadedEdgesNotHighlighted=0]="FacesShadedEdgesNotHighlighted",r[r.FacesShadedEdgesHighlightedInBlack=1]="FacesShadedEdgesHighlightedInBlack",r[r.FacesNotFilledEdgesInEntityColor=2]="FacesNotFilledEdgesInEntityColor",r[r.FacesInEntityColorEdgesInBlack=3]="FacesInEntityColorEdgesInBlack"})(Wh||(Wh={}));var As=class r{static toUInt16(e,t=0){return e[t]|e[t+1]<<8}static toInt16(e,t=0){let i=r.toUInt16(e,t);return i>32767?i-65536:i}static toUInt32(e,t=0){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}static toInt32(e,t=0){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}static toFloat64(e,t=0){return new DataView(e.buffer,e.byteOffset+t,8).getFloat64(0,!0)}static toFloat32(e,t=0){return new DataView(e.buffer,e.byteOffset+t,4).getFloat32(0,!0)}static getBytes(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24&255,t}static getBytes32(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24&255,t}};kr();J();R();x();var pr=class extends O{get objectType(){return u.UNDEFINED}get objectName(){return this.dxfClass?this.dxfClass.dxfName:"UNKNOWN"}get subclassMarker(){return this.dxfClass?this.dxfClass.cppClassName:l.Entity}dxfClass;constructor(e){super(),this.dxfClass=e}};var g;(function(r){r[r.NotImplemented=-1]="NotImplemented",r[r.None=0]="None",r[r.NotSupported=1]="NotSupported",r[r.Warning=2]="Warning",r[r.Error=3]="Error"})(g||(g={}));var kt=class{message;notificationType;exception;get Message(){return this.message}get NotificationType(){return this.notificationType}get Exception(){return this.exception}constructor(e,t=g.None,i=null){this.message=e,this.notificationType=t,this.exception=i}};var En=class{OnNotification=null;AppIds=new Vr;BlockRecords=new Ir;DimensionStyles=new Wt;DocumentToBuild;InitialHandSeed=0;Layers=new Mr;LineTypesTable=new Wr;TextStyles=new Hr;UCSs=new Fr;Version;Views=new Ur;VPorts=new zr;cadObjects=new Map;cadObjectsTemplates=new Map;dictionaryTemplates=new Map;tableEntryTemplates=new Map;tableTemplates=new Map;templatesMap=new Map;unassignedObjects=[];constructor(e,t){this.Version=e,this.DocumentToBuild=t}AddTemplate(e){this.addToMap(e)&&(this.isDictionaryTemplate(e)?this.dictionaryTemplates.set(e.CadObject.handle,e):this.isTableTemplate(e)?this.tableTemplates.set(e.CadObject.handle,e):this.isTableEntryTemplate(e)?this.tableEntryTemplates.set(e.CadObject.handle,e):this.cadObjectsTemplates.set(e.CadObject.handle,e))}BuildDocument(){for(let e of this.tableEntryTemplates.values())e.Build(this);for(let e of this.cadObjectsTemplates.values())e.Build(this)}BuildTable(e){let t=this.tableTemplates.get(e.handle);t?t.Build(this):this.Notify(`Table ${e.objectName} not found in the document`,g.Warning)}BuildTables(){this.BuildTable(this.AppIds),this.BuildTable(this.TextStyles),this.BuildTable(this.LineTypesTable),this.BuildTable(this.Layers),this.BuildTable(this.UCSs),this.BuildTable(this.Views),this.BuildTable(this.BlockRecords),this.BuildTable(this.DimensionStyles),this.BuildTable(this.VPorts)}GetObjectTemplate(e){let t=this.templatesMap.get(e);return t||null}Notify(e,t=g.None,i=null){this.OnNotification?.(this,new kt(e,t,i))}RegisterTables(){this.DocumentToBuild.registerCollection(this.AppIds),this.DocumentToBuild.registerCollection(this.TextStyles),this.DocumentToBuild.registerCollection(this.LineTypesTable),this.DocumentToBuild.registerCollection(this.Layers),this.DocumentToBuild.registerCollection(this.UCSs),this.DocumentToBuild.registerCollection(this.Views),this.DocumentToBuild.registerCollection(this.BlockRecords),this.DocumentToBuild.registerCollection(this.DimensionStyles),this.DocumentToBuild.registerCollection(this.VPorts)}TryGetCadObject(e){if(e==null||e===0)return null;let t=this.cadObjects.get(e);return t?t instanceof Lt&&!this.KeepUnknownEntities||t instanceof pr&&!this.KeepUnknownNonGraphicalObjects?null:t:null}TryGetObjectTemplate(e){if(e==null||e===0)return null;let t=this.templatesMap.get(e);return t||null}TryGetTableEntry(e){if(!e||e.length===0)return null;let t=null,i=[this.AppIds,this.Layers,this.LineTypesTable,this.UCSs,this.Views,this.DimensionStyles,this.TextStyles,this.VPorts,this.BlockRecords];for(let s of i){let n=s.tryGetValue(e);if(n)return n}return null}buildDictionaries(){for(let e of this.dictionaryTemplates.values())e.Build(this);if(!this.DocumentToBuild.rootDictionary){let e=[];for(let t of this.dictionaryTemplates.values())t.CadObject instanceof xe&&t.CadObject.owner==null&&e.push(t.CadObject);e.length!==1?this.Notify("The root dictionary could not be found.",g.Warning):this.DocumentToBuild.rootDictionary=e[0]}this.DocumentToBuild.updateCollections(!0,!1)}createMissingHandles(){for(let e of this.unassignedObjects)e.CadObject.handle=this.InitialHandSeed+1,this.AddTemplate(e);this.unassignedObjects=[]}registerTable(e,t){e?this.DocumentToBuild.registerCollection(e):this.DocumentToBuild.registerCollection(new t)}addToMap(e){return e.CadObject.handle===0?(this.pushUnassigned(e),!1):this.templatesMap.has(e.CadObject.handle)?(this.Notify(`Repeated handle found ${e.CadObject.handle}.`,g.Warning),e.CadObject.handle=0,this.pushUnassigned(e),!1):(e.CadObject.handle>this.InitialHandSeed&&(this.InitialHandSeed=e.CadObject.handle),this.templatesMap.set(e.CadObject.handle,e),this.cadObjects.set(e.CadObject.handle,e.CadObject),!0)}pushUnassigned(e){Array.isArray(this.unassignedObjects)||(this.unassignedObjects=[]);try{this.unassignedObjects.push(e)}catch(t){if(t instanceof RangeError){this.Notify("Resetting unassigned object queue due to invalid array length.",g.Warning,t),this.unassignedObjects=[e];return}throw t}}isDictionaryTemplate(e){return"CadObject"in e&&e.CadObject instanceof xe}isTableTemplate(e){return"EntryHandles"in e}isTableEntryTemplate(e){return"Type"in e&&"Name"in e&&!("EntryHandles"in e)}};var Ln=class{OnNotification=null;Configuration;_document=new xs;_encoding="utf-8";_fileStream;constructor(e,t=null){t&&(this.OnNotification=t),this._fileStream=e,this.Configuration=this.createDefaultConfiguration()}Dispose(){}getListedEncoding(e){return"utf-8"}triggerNotification(e,t,i=null){this.onNotificationEvent(null,new kt(e,t,i))}onNotificationEvent(e,t){this.OnNotification?.(this,t)}};var kn=class{Failsafe=!0;KeepUnknownEntities=!1;KeepUnknownNonGraphicalObjects=!1};var Es=class{OnNotification=null;Configuration;_document;_encoding="utf-8";_stream;constructor(e,t){this._stream=e,this._document=t,this.Configuration=this.createDefaultConfiguration()}Write(){if(this._document.updateImageReactors(),this._document.updateDxfClasses(this.Configuration.ResetDxfClasses),this.Configuration.UpdateDimensionsInModel&&this.updateDimensions(this._document.modelSpace),this.Configuration.UpdateDimensionsInBlocks)for(let e of this._document.blockRecords)e.Name.toLowerCase()!==U.ModelSpaceName.toLowerCase()&&this.updateDimensions(e);this._encoding=this.getListedEncoding(this._document.header.CodePage)}getListedEncoding(e){let t=Z.getCodePage(e);return"utf-8"}triggerNotification(e,t,i){typeof e=="string"?this.OnNotification?.(this,new kt(e,t,i??null)):this.OnNotification?.(e,t)}updateDimensions(e){for(let t of e.entities)t instanceof me&&t.updateBlock()}};var Ls=class{CloseStream=!0;ResetDxfClasses=!1;UpdateDimensionsInBlocks=!1;UpdateDimensionsInModel=!1;WriteXData=!0;WriteXRecords=!0;WriteShapes=!1};var ko=class{static toUInt64(e,t=0){let i=0;for(let s=0;s<8;s++)i=i*256+e[t+s];return i}static toUInt32(e,t=0){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}static toUInt16(e,t=0){return e[t]<<8|e[t+1]}};var ds=class r{static CrcTable=new Uint16Array([0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448]);static Crc32Table=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);static ApplyCrc8(e,t){let i=e;for(let s=0;s<t.length;++s){let n=(t[s]^i&255)&255;i=i>>8&255^r.CrcTable[n&255]}return i}};var Tl=class r{_data;_position=0;_seed;get Seed(){return~this._seed>>>0}get Length(){return this._data.length}get Position(){return this._position}set Position(e){this._position=e}constructor(e,t,i=!1){if(i){let s=1;for(let n=0;n<e.length;++n){s=s*214013+2531011|0;let a=s>>16&255;e[n]=(e[n]^a)&255}}this._data=e,this._seed=~t>>>0}static fromStream(e,t){return new r(e,t,!1)}Read(e,t,i){let s=t+i,n=Math.min(i,this._data.length-this._position);for(let a=0;a<n;++a)e[t+a]=this._data[this._position+a],this._seed=(this._seed>>>8^ds.Crc32Table[(this._seed^this._data[this._position+a])&255])>>>0;return this._position+=n,n}Write(e,t,i){let s=t+i;for(let n=t;n<s;++n)this._seed=(this._seed>>>8^ds.Crc32Table[(this._seed^e[n])&255])>>>0;for(let n=0;n<i;n++)this._data[this._position+n]=e[t+n];this._position+=i}};var wr=class r{_data;_position=0;Seed;get Length(){return this._data.length}get Position(){return this._position}set Position(e){this._position=e}constructor(e,t){this._data=e,this.Seed=t}Read(e,t,i){let s=Math.min(i,this._data.length-this._position),n=t+s;for(let a=t;a<n;++a)e[a]=this._data[this._position+(a-t)],this.Seed=r.decode(this.Seed,e[a]);return this._position+=s,s}Write(e,t,i){let s=t+i;for(let n=t;n<s;++n)this.Seed=r.decode(this.Seed,e[n]);for(let n=0;n<i;n++)this._data[this._position+n]=e[t+n];this._position+=i}static GetCRCValue(e,t,i,s){let n=e,a=i,o=s;for(;o-- >0;)n=r.decode(n,t[a]),a++;return n}static decode(e,t){let i=t^e&255;return e=(e>>>8^ds.CrcTable[i])&65535,e}};var rt=class{static MagicSequence=(()=>{let e=new Uint8Array(256),t=1;for(let i=0;i<256;i++)t=t*214013+2531011|0,e[i]=t>>16&255;return e})();static CompressionCalculator(e){return 31-(e+32-1)%32}static Calculate(e,t,i,s){let n=e&65535,a=e>>>16&65535,o=i,h=s;for(;h!==0;){let f=Math.min(5552,h);h-=f;for(let b=0;b<f;b++)n+=t[o],a+=n,o++;n%=65521,a%=65521}return(a<<16|n&65535)>>>0}};var Pn=class{_handles=new Map;get CMATERIAL(){return this.GetHandle("CMATERIAL")}set CMATERIAL(e){this.SetHandle("CMATERIAL",e)}get CLAYER(){return this.GetHandle("CLAYER")}set CLAYER(e){this.SetHandle("CLAYER",e)}get TEXTSTYLE(){return this.GetHandle("TEXTSTYLE")}set TEXTSTYLE(e){this.SetHandle("TEXTSTYLE",e)}get CELTYPE(){return this.GetHandle("CELTYPE")}set CELTYPE(e){this.SetHandle("CELTYPE",e)}get DIMSTYLE(){return this.GetHandle("DIMSTYLE")}set DIMSTYLE(e){this.SetHandle("DIMSTYLE",e)}get CMLSTYLE(){return this.GetHandle("CMLSTYLE")}set CMLSTYLE(e){this.SetHandle("CMLSTYLE",e)}get UCSNAME_PSPACE(){return this.GetHandle("UCSNAME_PSPACE")}set UCSNAME_PSPACE(e){this.SetHandle("UCSNAME_PSPACE",e)}get UCSNAME_MSPACE(){return this.GetHandle("UCSNAME_MSPACE")}set UCSNAME_MSPACE(e){this.SetHandle("UCSNAME_MSPACE",e)}get PUCSORTHOREF(){return this.GetHandle("PUCSORTHOREF")}set PUCSORTHOREF(e){this.SetHandle("PUCSORTHOREF",e)}get PUCSBASE(){return this.GetHandle("PUCSBASE")}set PUCSBASE(e){this.SetHandle("PUCSBASE",e)}get UCSORTHOREF(){return this.GetHandle("UCSORTHOREF")}set UCSORTHOREF(e){this.SetHandle("UCSORTHOREF",e)}get DIMTXSTY(){return this.GetHandle("DIMTXSTY")}set DIMTXSTY(e){this.SetHandle("DIMTXSTY",e)}get DIMLDRBLK(){return this.GetHandle("DIMLDRBLK")}set DIMLDRBLK(e){this.SetHandle("DIMLDRBLK",e)}get DIMBLK(){return this.GetHandle("DIMBLK")}set DIMBLK(e){this.SetHandle("DIMBLK",e)}get DIMBLK1(){return this.GetHandle("DIMBLK1")}set DIMBLK1(e){this.SetHandle("DIMBLK1",e)}get DIMBLK2(){return this.GetHandle("DIMBLK2")}set DIMBLK2(e){this.SetHandle("DIMBLK2",e)}get DICTIONARY_LAYOUTS(){return this.GetHandle("DICTIONARY_LAYOUTS")}set DICTIONARY_LAYOUTS(e){this.SetHandle("DICTIONARY_LAYOUTS",e)}get DICTIONARY_PLOTSETTINGS(){return this.GetHandle("DICTIONARY_PLOTSETTINGS")}set DICTIONARY_PLOTSETTINGS(e){this.SetHandle("DICTIONARY_PLOTSETTINGS",e)}get DICTIONARY_PLOTSTYLES(){return this.GetHandle("DICTIONARY_PLOTSTYLES")}set DICTIONARY_PLOTSTYLES(e){this.SetHandle("DICTIONARY_PLOTSTYLES",e)}get CPSNID(){return this.GetHandle("CPSNID")}set CPSNID(e){this.SetHandle("CPSNID",e)}get PAPER_SPACE(){return this.GetHandle("PAPER_SPACE")}set PAPER_SPACE(e){this.SetHandle("PAPER_SPACE",e)}get MODEL_SPACE(){return this.GetHandle("MODEL_SPACE")}set MODEL_SPACE(e){this.SetHandle("MODEL_SPACE",e)}get BYLAYER(){return this.GetHandle("BYLAYER")}set BYLAYER(e){this.SetHandle("BYLAYER",e)}get BYBLOCK(){return this.GetHandle("BYBLOCK")}set BYBLOCK(e){this.SetHandle("BYBLOCK",e)}get CONTINUOUS(){return this.GetHandle("CONTINUOUS")}set CONTINUOUS(e){this.SetHandle("CONTINUOUS",e)}get DIMLTYPE(){return this.GetHandle("DIMLTYPE")}set DIMLTYPE(e){this.SetHandle("DIMLTYPE",e)}get DIMLTEX1(){return this.GetHandle("DIMLTEX1")}set DIMLTEX1(e){this.SetHandle("DIMLTEX1",e)}get DIMLTEX2(){return this.GetHandle("DIMLTEX2")}set DIMLTEX2(e){this.SetHandle("DIMLTEX2",e)}get VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT(){return this.GetHandle("VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT")}set VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT(e){this.SetHandle("VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT",e)}get DICTIONARY_ACAD_GROUP(){return this.GetHandle("DICTIONARY_ACAD_GROUP")}set DICTIONARY_ACAD_GROUP(e){this.SetHandle("DICTIONARY_ACAD_GROUP",e)}get DICTIONARY_ACAD_MLINESTYLE(){return this.GetHandle("DICTIONARY_ACAD_MLINESTYLE")}set DICTIONARY_ACAD_MLINESTYLE(e){this.SetHandle("DICTIONARY_ACAD_MLINESTYLE",e)}get DICTIONARY_NAMED_OBJECTS(){return this.GetHandle("DICTIONARY_NAMED_OBJECTS")}set DICTIONARY_NAMED_OBJECTS(e){this.SetHandle("DICTIONARY_NAMED_OBJECTS",e)}get BLOCK_CONTROL_OBJECT(){return this.GetHandle("BLOCK_CONTROL_OBJECT")}set BLOCK_CONTROL_OBJECT(e){this.SetHandle("BLOCK_CONTROL_OBJECT",e)}get LAYER_CONTROL_OBJECT(){return this.GetHandle("LAYER_CONTROL_OBJECT")}set LAYER_CONTROL_OBJECT(e){this.SetHandle("LAYER_CONTROL_OBJECT",e)}get STYLE_CONTROL_OBJECT(){return this.GetHandle("STYLE_CONTROL_OBJECT")}set STYLE_CONTROL_OBJECT(e){this.SetHandle("STYLE_CONTROL_OBJECT",e)}get LINETYPE_CONTROL_OBJECT(){return this.GetHandle("LINETYPE_CONTROL_OBJECT")}set LINETYPE_CONTROL_OBJECT(e){this.SetHandle("LINETYPE_CONTROL_OBJECT",e)}get VIEW_CONTROL_OBJECT(){return this.GetHandle("VIEW_CONTROL_OBJECT")}set VIEW_CONTROL_OBJECT(e){this.SetHandle("VIEW_CONTROL_OBJECT",e)}get UCS_CONTROL_OBJECT(){return this.GetHandle("UCS_CONTROL_OBJECT")}set UCS_CONTROL_OBJECT(e){this.SetHandle("UCS_CONTROL_OBJECT",e)}get VPORT_CONTROL_OBJECT(){return this.GetHandle("VPORT_CONTROL_OBJECT")}set VPORT_CONTROL_OBJECT(e){this.SetHandle("VPORT_CONTROL_OBJECT",e)}get APPID_CONTROL_OBJECT(){return this.GetHandle("APPID_CONTROL_OBJECT")}set APPID_CONTROL_OBJECT(e){this.SetHandle("APPID_CONTROL_OBJECT",e)}get DIMSTYLE_CONTROL_OBJECT(){return this.GetHandle("DIMSTYLE_CONTROL_OBJECT")}set DIMSTYLE_CONTROL_OBJECT(e){this.SetHandle("DIMSTYLE_CONTROL_OBJECT",e)}get DICTIONARY_MATERIALS(){return this.GetHandle("DICTIONARY_MATERIALS")}set DICTIONARY_MATERIALS(e){this.SetHandle("DICTIONARY_MATERIALS",e)}get DICTIONARY_COLORS(){return this.GetHandle("DICTIONARY_COLORS")}set DICTIONARY_COLORS(e){this.SetHandle("DICTIONARY_COLORS",e)}get DICTIONARY_VISUALSTYLE(){return this.GetHandle("DICTIONARY_VISUALSTYLE")}set DICTIONARY_VISUALSTYLE(e){this.SetHandle("DICTIONARY_VISUALSTYLE",e)}get INTERFEREOBJVS(){return this.GetHandle("INTERFEREOBJVS")}set INTERFEREOBJVS(e){this.SetHandle("INTERFEREOBJVS",e)}get INTERFEREVPVS(){return this.GetHandle("INTERFEREVPVS")}set INTERFEREVPVS(e){this.SetHandle("INTERFEREVPVS",e)}get DRAGVS(){return this.GetHandle("DRAGVS")}set DRAGVS(e){this.SetHandle("DRAGVS",e)}get UCSBASE(){return this.GetHandle("UCSBASE")}set UCSBASE(e){this.SetHandle("UCSBASE",e)}GetHandle(e){return this._handles.get(e)??null}SetHandle(e,t){this._handles.set(e,t)}GetHandles(){return Array.from(this._handles.values())}UpdateHeader(e,t){let i;i=t.TryGetCadObject(this.CLAYER),i&&(e.currentLayerName=i.name),i=t.TryGetCadObject(this.CELTYPE),i&&(e.currentLineTypeName=i.name),i=t.TryGetCadObject(this.CMLSTYLE),i&&(e.currentMLineStyleName=i.name),i=t.TryGetCadObject(this.TEXTSTYLE),i&&(e.currentTextStyleName=i.name),i=t.TryGetCadObject(this.DIMTXSTY),i&&(e.dimensionTextStyleName=i.name),i=t.TryGetCadObject(this.DIMSTYLE),i&&(e.currentDimensionStyleName=i.name);let s;s=t.TryGetCadObject(this.DIMBLK),s&&(e.dimensionBlockName=s.name),s=t.TryGetCadObject(this.DIMLDRBLK),s&&(e.dimensionBlockName=s.name),s=t.TryGetCadObject(this.DIMBLK1),s&&(e.dimensionBlockNameFirst=s.name),s=t.TryGetCadObject(this.DIMBLK2),s&&(e.dimensionBlockNameSecond=s.name)}};var On=class extends En{Configuration;HeaderHandles=new Pn;BlockRecordTemplates=[];PaperSpaceEntities=[];ModelSpaceEntities=[];get KeepUnknownEntities(){return this.Configuration.KeepUnknownEntities}get KeepUnknownNonGraphicalObjects(){return this.Configuration.KeepUnknownNonGraphicalObjects}constructor(e,t,i){super(e,t),this.Configuration=i}BuildDocument(){this.createMissingHandles();for(let e of this.BlockRecordTemplates)e.SetBlockToRecord(this,this.HeaderHandles);this.RegisterTables(),this.BuildTables(),this.buildDictionaries(),super.BuildDocument(),this.ensureDefaultTableEntries(),this.HeaderHandles.UpdateHeader(this.DocumentToBuild.header,this)}ensureDefaultTableEntries(){let e=this.DocumentToBuild;e.lineTypes&&typeof e.lineTypes.createDefaultEntries=="function"&&e.lineTypes.createDefaultEntries(),e.layers&&typeof e.layers.createDefaultEntries=="function"&&e.layers.createDefaultEntries(),e.blockRecords&&typeof e.blockRecords.createDefaultEntries=="function"&&e.blockRecords.createDefaultEntries(),e.textStyles&&typeof e.textStyles.createDefaultEntries=="function"&&e.textStyles.createDefaultEntries(),e.dimensionStyles&&typeof e.dimensionStyles.createDefaultEntries=="function"&&e.dimensionStyles.createDefaultEntries(),e.appIds&&typeof e.appIds.createDefaultEntries=="function"&&e.appIds.createDefaultEntries(),e.vPorts&&typeof e.vPorts.createDefaultEntries=="function"&&e.vPorts.createDefaultEntries()}};var Hh=null,Ai=class{AcadVersion;PreviewAddress=-1;AcadMaintenanceVersion=0;DrawingCodePage=0;constructor(e){this.AcadVersion=e??m.Unknown}static registerFactory(e){Hh=e}static CreateFileHeader(e){if(!Hh)throw new Error("DwgFileHeader factory not registered. Import DwgFileHeaderFactory first.");return Hh(e)}};var T=class r{static AcDbObjects="AcDb:AcDbObjects";static AppInfo="AcDb:AppInfo";static AuxHeader="AcDb:AuxHeader";static Classes="AcDb:Classes";static FileDepList="AcDb:FileDepList";static Handles="AcDb:Handles";static Header="AcDb:Header";static ObjFreeSpace="AcDb:ObjFreeSpace";static Preview="AcDb:Preview";static RevHistory="AcDb:RevHistory";static SummaryInfo="AcDb:SummaryInfo";static Template="AcDb:Template";static EndSentinels=new Map([[r.Header,new Uint8Array([48,132,224,220,2,33,199,86,160,131,151,71,177,146,204,160])],[r.Classes,new Uint8Array([114,94,59,71,59,86,7,58,63,35,11,160,24,48,73,117])],[r.Preview,new Uint8Array([224,218,146,248,43,201,215,215,98,168,53,192,98,187,239,212])]]);static StartSentinels=new Map([[r.Header,new Uint8Array([207,123,31,35,253,222,56,169,95,124,104,184,78,109,51,95])],[r.Classes,new Uint8Array([141,161,196,184,196,169,248,197,192,220,244,95,231,207,182,138])],[r.Preview,new Uint8Array([31,37,109,7,212,54,40,40,157,87,202,63,157,68,16,43])]]);static GetSectionLocatorByName(e){switch(e){case r.Header:return 0;case r.Classes:return 1;case r.Handles:return 2;case r.ObjFreeSpace:return 3;case r.Template:return 4;case r.AuxHeader:return 5;default:return null}}};var _r=class{PageType=1097008187;Name="";CompressedSize=0;PageCount=0;DecompressedSize=29696;_compressed=2;get CompressedCode(){return this._compressed}set CompressedCode(e){if(e===1||e===2)this._compressed=e;else throw new Error("Invalid compressed code")}get IsCompressed(){return this._compressed===2}SectionId=0;Encrypted=0;HashCode=null;Encoding=null;LocalSections=[];constructor(e){e!==void 0&&(this.Name=e)}};var Ei=class extends Ai{static EndSentinel=new Uint8Array([149,160,78,40,153,130,26,229,94,65,224,95,157,58,77,0]);Records=new Map;_descriptors=new Map;constructor(e){super(e)}AddSection(e){this._descriptors.has(e)||this._descriptors.set(e,new _r(e))}GetDescriptor(e){let t=this._descriptors.get(e);if(t)return t;let i=new _r(e),s=T.GetSectionLocatorByName(e);if(s!==null){let n=this.Records.get(s);n&&(i.CompressedSize=n.Size,i.DecompressedSize=n.Size,i.PageCount=1,i.CompressedCode=1)}return this._descriptors.set(e,i),i}};var hs=class extends Ei{DwgVersion=0;AppReleaseVersion=0;SummaryInfoAddr=0;SecurityType=0;VbaProjectAddr=0;RootTreeNodeGap=0;GapArraySize=0;CRCSeed=0;LastPageId=0;LastSectionAddr=0;SecondHeaderAddr=0;GapAmount=0;SectionAmount=0;SectionPageMapId=0;PageMapAddress=0;SectionMapId=0;SectionArrayPageSize=0;RigthGap=0;LeftGap=0;Descriptors=new Map;constructor(e){super(e)}AddSection(e){this.Descriptors.set(e,new _r(e))}AddSectionDescriptor(e){this.Descriptors.set(e.Name,e)}GetDescriptor(e){return this.Descriptors.get(e)}};var Al=class extends hs{CompressedMetadata;constructor(e){super(e)}};Ai.registerFactory(r=>{switch(r){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(r);case m.AC1012:case m.AC1014:case m.AC1015:return new Ei(r);case m.AC1018:return new hs(r);case m.AC1021:return new Al(r);case m.AC1024:case m.AC1027:case m.AC1032:return new hs(r);default:break}return null});var cs=class{Compression=2;IsEmpty=!1;Offset=0;CompressedSize=0;PageNumber=0;DecompressedSize=0;Seeker=0;Size=0;Checksum=0;CRC=0;PageSize=0;ODA=0;SectionMap=0;constructor(e){e!==void 0&&(this.SectionMap=e)}};var ft=class{Number=null;Seeker=0;Size=0;Stream=null;constructor(e,t,i){e!==void 0&&(this.Number=e??null),t!==void 0&&(this.Seeker=t),i!==void 0&&(this.Size=i)}IsInTheRecord(e){return e>=this.Seeker&&e<this.Seeker+this.Size}toString(){return`Number : ${this.Number} | Seeker : ${this.Seeker} | Size : ${this.Size}`}};var El=class{HeaderSize=112;FileSize=0;PagesMapCrcCompressed=0;PagesMapCorrectionFactor=0;PagesMapCrcSeed=0;Map2Offset=0;Map2Id=0;PagesMapOffset=0;Header2offset=0;PagesMapSizeCompressed=0;PagesMapSizeUncompressed=0;PagesAmount=0;PagesMaxId=0;SectionsMap2Id=0;PagesMapId=0;Unknow0x20=32;Unknow0x40=64;PagesMapCrcUncompressed=0;Unknown0xF800=63488;Unknown4=4;Unknown1=1;SectionsAmount=0;SectionsMapCrcUncompressed=0;SectionsMapSizeCompressed=0;SectionsMapId=0;SectionsMapSizeUncompressed=0;SectionsMapCrcCompressed=0;SectionsMapCorrectionFactor=0;SectionsMapCrcSeed=0;StreamVersion=393472;CrcSeed=0;CrcSeedEncoded=0;RandomSeed=0;HeaderCRC64=0};var Po=class extends kn{CrcCheck=!1;ReadSummaryInfo=!0};var Y=class r{OnNotification=null;R13_14Only;R13_15Only;R2000Plus;R2004Pre;R2007Pre;R2004Plus;R2007Plus;R2010Plus;R2013Plus;R2018Plus;_version;constructor(e){this._version=e,this.R13_14Only=e===m.AC1014||e===m.AC1012,this.R13_15Only=e>=m.AC1012&&e<=m.AC1015,this.R2000Plus=e>=m.AC1015,this.R2004Pre=e<m.AC1018,this.R2007Pre=e<=m.AC1021,this.R2004Plus=e>=m.AC1018,this.R2007Plus=e>=m.AC1021,this.R2010Plus=e>=m.AC1024,this.R2013Plus=e>=m.AC1027,this.R2018Plus=e>=m.AC1032}static CheckSentinel(e,t){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(e[i]!==t[i])return!1;return!0}checkSentinel(e,t){let i=e.readSentinel();r.CheckSentinel(i,t)||this.notify(`Invalid section sentinel found in ${this.SectionName}`,g.Warning)}notify(e,t,i=null){this.OnNotification?.(this,new kt(e,t,i))}};var Q=class r{static Epsilon=1e-12;static PI=Math.PI;static HalfPI=Math.PI/2;static TwoPI=Math.PI*2;static DegToRad(e){return e*(Math.PI/180)}static RadToDeg(e){return e*(180/Math.PI)}static RadToGrad(e){return e*(200/Math.PI)}static IsZero(e){return Math.abs(e)<r.Epsilon}static FixZero(e){return r.IsZero(e)?0:e}static Sin(e){return r.FixZero(Math.sin(e))}static Cos(e){return r.FixZero(Math.cos(e))}};var it=class r{m00=1;m01=0;m02=0;m03=0;m10=0;m11=1;m12=0;m13=0;m20=0;m21=0;m22=1;m23=0;m30=0;m31=0;m32=0;m33=1;constructor(e){if(!(!e||e.length===0)){if(e.length!==16)throw new Error("Matrix4 requires 16 values.");[this.m00,this.m01,this.m02,this.m03,this.m10,this.m11,this.m12,this.m13,this.m20,this.m21,this.m22,this.m23,this.m30,this.m31,this.m32,this.m33]=e}}get M00(){return this.m00}set M00(e){this.m00=e}get M01(){return this.m01}set M01(e){this.m01=e}get M02(){return this.m02}set M02(e){this.m02=e}get M03(){return this.m03}set M03(e){this.m03=e}get M10(){return this.m10}set M10(e){this.m10=e}get M11(){return this.m11}set M11(e){this.m11=e}get M12(){return this.m12}set M12(e){this.m12=e}get M13(){return this.m13}set M13(e){this.m13=e}get M20(){return this.m20}set M20(e){this.m20=e}get M21(){return this.m21}set M21(e){this.m21=e}get M22(){return this.m22}set M22(e){this.m22=e}get M23(){return this.m23}set M23(e){this.m23=e}get M30(){return this.m30}set M30(e){this.m30=e}get M31(){return this.m31}set M31(e){this.m31=e}get M32(){return this.m32}set M32(e){this.m32=e}get M33(){return this.m33}set M33(e){this.m33=e}static identity(){return new r}get(e,t){let i=`m${e}${t}`;return this[i]}setElement(e,t,i){let s=`m${e}${t}`;this[s]=i}};var rh=class r{min;max;get Min(){return this.min}set Min(e){this.min=e}get Max(){return this.max}set Max(e){this.max=e}get width(){return this.max.x-this.min.x}get height(){return this.max.y-this.min.y}get Width(){return this.width}get Height(){return this.height}get center(){return new c((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,(this.min.z+this.max.z)/2)}get Center(){return this.center}constructor(e,t){this.min=e??new c(1/0,1/0,1/0),this.max=t??new c(-1/0,-1/0,-1/0)}static Null=new r;static Infinite=new r(new c(-1/0,-1/0,-1/0),new c(1/0,1/0,1/0));static FromPoints(e){if(!e||e.length===0)return r.Null;let t=new r;for(let i of e)t.min=new c(Math.min(t.min.x,i.x),Math.min(t.min.y,i.y),Math.min(t.min.z,i.z)),t.max=new c(Math.max(t.max.x,i.x),Math.max(t.max.y,i.y),Math.max(t.max.z,i.z));return t}};var ih=class r{translation;scale;eulerRotation;get Translation(){return this.translation}set Translation(e){this.translation=e}get Scale(){return this.scale}set Scale(e){this.scale=e}get EulerRotation(){return this.eulerRotation}set EulerRotation(e){this.eulerRotation=e}constructor(e,t,i){this.translation=e??new c(0,0,0),this.scale=t??new c(1,1,1),this.eulerRotation=i??new c(0,0,0)}get matrix(){let e=new it,t=this.scale.x,i=this.scale.y,s=this.scale.z,n=this.eulerRotation.x,a=this.eulerRotation.y,o=this.eulerRotation.z,h=Math.cos(n),f=Math.sin(n),b=Math.cos(a),S=Math.sin(a),N=Math.cos(o),L=Math.sin(o);return e.m00=b*N*t,e.m01=-(b*L)*i,e.m02=S*s,e.m10=(h*L+N*f*S)*t,e.m11=(h*N-f*S*L)*i,e.m12=-(b*f)*s,e.m20=(f*L-h*N*S)*t,e.m21=(N*f+h*S*L)*i,e.m22=h*b*s,e.m03=this.translation.x,e.m13=this.translation.y,e.m23=this.translation.z,e}get Matrix(){return this.matrix}applyTransform(e){let t=this.matrix;return new c(t.m00*e.x+t.m01*e.y+t.m02*e.z+t.m03,t.m10*e.x+t.m11*e.y+t.m12*e.z+t.m13,t.m20*e.x+t.m21*e.y+t.m22*e.z+t.m23)}static CreateTranslation(e){return new r(e)}static CreateScaling(e,t){let i=new r(void 0,e);return t&&(i.translation=new c(t.x*(1-e.x),t.y*(1-e.y),t.z*(1-e.z))),i}static CreateRotation(e,t){let i=new r;return e.z!==0?i.eulerRotation=new c(0,0,t):e.y!==0?i.eulerRotation=new c(0,t,0):i.eulerRotation=new c(t,0,0),i}};var Lc=new Map;function jn(r,e){Lc.set(r,e)}var be=class{bitShift=0;get position(){return this._position}set position(e){this._position=e,this.bitShift=0}isEmpty=!1;encoding="utf-8";get stream(){return this._stream}_stream;_view;_position;_lastByte=0;constructor(e,t){this._stream=e,this._view=new DataView(e.buffer,e.byteOffset,e.byteLength),this._position=0}static getStreamHandler(e,t,i,s=!1){let n,a;switch(e){case m.Unknown:case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(e);case m.AC1012:case m.AC1014:a="AC12";break;case m.AC1015:a="AC15";break;case m.AC1018:a="AC18";break;case m.AC1021:a="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:a="AC24";break;default:throw new Me}let o=Lc.get(a);if(!o)throw new Error(`DwgStreamReader factory for ${a} not registered. Import DwgStreamReaderFactory first.`);return n=new o(t,s),i!==void 0&&(n.encoding=i),n}readByte(){if(this.bitShift===0)return this._lastByte=this._stream[this._position++],this._lastByte;let e=this._lastByte<<this.bitShift&255;return this._lastByte=this._stream[this._position++],(e|this._lastByte>>>8-this.bitShift)&255}readBytes(e){let t=new Uint8Array(e);return this.applyShiftToArr(e,t),t}setPositionByFlag(e){this.setPositionInBits(e);let t=this.readBit(),i=e;if(t){let s=this.applyFlagToPosition(e);i=s.length-s.strDataSize,this.setPositionInBits(i)}else this.isEmpty=!0,this.position=this._stream.length;return i}readBit(){if(this.bitShift===0){this.advanceByte();let t=(this._lastByte&128)===128;return this.bitShift=1,t}let e=(this._lastByte<<this.bitShift&128)===128;return++this.bitShift,this.bitShift&=7,e}readBitAsShort(){return this.readBit()?1:0}read2Bits(){let e;if(this.bitShift===0)this.advanceByte(),e=this._lastByte>>>6,this.bitShift=2;else if(this.bitShift===7){let t=this._lastByte<<1&2;this.advanceByte(),e=t|this._lastByte>>>7,this.bitShift=1}else e=this._lastByte>>>6-this.bitShift&3,++this.bitShift,++this.bitShift,this.bitShift&=7;return e}readBitShort(){let e;switch(this.read2Bits()){case 0:e=this.readShortLittleEndian();break;case 1:if(this.bitShift===0){this.advanceByte(),e=this._lastByte;break}e=this.applyShiftToLastByte();break;case 2:e=0;break;case 3:e=256;break;default:throw this.throwException("ReadBitShort")}return e>32767&&(e-=65536),e}readBitShortAsBool(){return this.readBitShort()!==0}readBitLong(){let e;switch(this.read2Bits()){case 0:e=this.readIntLittleEndian();break;case 1:if(this.bitShift===0){this.advanceByte(),e=this._lastByte;break}e=this.applyShiftToLastByte();break;case 2:e=0;break;default:throw new Error("Failed to read ReadBitLong")}return e}readBitLongLong(){let e=0,t=this.read3bits();for(let i=0;i<t;++i){let s=this.readByte();e+=s<<(i<<3)}return e}readBitDouble(){let e;switch(this.read2Bits()){case 0:e=this.readDoubleLittleEndian();break;case 1:e=1;break;case 2:e=0;break;default:throw this.throwException("ReadBitDouble")}return e}read2BitDouble(){return new C(this.readBitDouble(),this.readBitDouble())}read3BitDouble(){return new c(this.readBitDouble(),this.readBitDouble(),this.readBitDouble())}readRawChar(){return this.readByte()}readRawLong(){return this.readIntLittleEndian()}readRawULong(){return this.readULongLittleEndian()}read2RawDouble(){return new C(this.readDouble(),this.readDouble())}read3RawDouble(){return new c(this.readDouble(),this.readDouble(),this.readDouble())}readModularChar(){let e=0,t=this.readByte(),i=t&127;if((t&128)!==0)for(;;){e+=7;let s=this.readByte();if(i|=(s&127)<<e,(s&128)===0)break}return i}readSignedModularChar(){let e;if(this.bitShift===0)if(this.advanceByte(),(this._lastByte&128)===0)e=this._lastByte&63,(this._lastByte&64)>0&&(e=-e);else{let t=0,i=this._lastByte&127;for(;t+=7,this.advanceByte(),(this._lastByte&128)!==0;)i|=(this._lastByte&127)<<t;e=i|(this._lastByte&63)<<t,(this._lastByte&64)>0&&(e=-e)}else{let t=this.applyShiftToLastByte();if((t&128)===0)e=t&63,(t&64)>0&&(e=-e);else{let i=0,s=t&127,n;for(;i+=7,n=this.applyShiftToLastByte(),(n&128)!==0;)s|=(n&127)<<i;e=s|(n&63)<<i,(n&64)>0&&(e=-e)}}return e}readModularShort(){let e=15,t=this.readByte(),i=this.readByte(),s=(i&128)===0,n=t|(i&127)<<8;for(;!s;)t=this.readByte(),i=this.readByte(),s=(i&128)===0,n|=t<<e,e+=8,n|=(i&127)<<e,e+=7;return n}handleReference(){return this.handleReferenceWithRefAndType(0).handle}handleReferenceWithRef(e){return this.handleReferenceWithRefAndType(e).handle}handleReferenceWithRefAndType(e){let t=this.readByte(),i=t>>>4,s=t&15,n=i&3,a;if(i<=5)a=this.readHandle(s);else if(i===6)a=e+1;else if(i===8)a=e-1;else if(i===10){let o=this.readHandle(s);a=e+o}else if(i===12){let o=this.readHandle(s);a=e-o}else throw new Eo(`[HandleReference] invalid reference code with value: ${i}`);return{handle:a,reference:n}}readHandle(e){let t=new Uint8Array(e),i=new Uint8Array(8);for(let o=0;o<e;o++)t[o]=this._stream[this._position++];if(this.bitShift===0)for(let o=0;o<e;++o)i[e-1-o]=t[o];else{let o=8-this.bitShift;for(let h=0;h<e;++h){let f=this._lastByte<<this.bitShift&255;this._lastByte=t[h];let b=(f|this._lastByte>>>o)&255;i[e-1-h]=b}}for(let o=e;o<8;++o)i[o]=0;let s=new DataView(i.buffer),n=s.getUint32(0,!0),a=s.getUint32(4,!0);return n+a*4294967296}readTextUnicode(){let e=this.readShort(),t=this.readByte(),i;return e===0?i="":i=this.readStringEncoded(e,this.getEncodingFromCodePage(t)),i}readVariableText(){let e=this.readBitShort(),t;return e>0?t=this.readStringEncoded(e,this.encoding).replace(/\0/g,""):t="",t}readSentinel(){return this.readBytes(16)}read2BitDoubleWithDefault(e){return new C(this.readBitDoubleWithDefault(e.x),this.readBitDoubleWithDefault(e.y))}read3BitDoubleWithDefault(e){return new c(this.readBitDoubleWithDefault(e.x),this.readBitDoubleWithDefault(e.y),this.readBitDoubleWithDefault(e.z))}readCmColor(e=!1){let t=this.readBitShort();return new B(t)}readEnColor(){let e=this.readBitShort();return{color:new B(e),transparency:Ke.ByLayer,flag:!1}}readColorByIndex(){return new B(this.readBitShort())}readObjectType(){return this.readBitShort()}readBitExtrusion(){return this.read3BitDouble()}readBitDoubleWithDefault(e){let t=new Uint8Array(8),i=new DataView(new ArrayBuffer(8));i.setFloat64(0,e,!0);for(let s=0;s<8;s++)t[s]=new Uint8Array(i.buffer)[s];switch(this.read2Bits()){case 0:return e;case 1:if(this.bitShift===0)this.advanceByte(),t[0]=this._lastByte,this.advanceByte(),t[1]=this._lastByte,this.advanceByte(),t[2]=this._lastByte,this.advanceByte(),t[3]=this._lastByte;else{let s=8-this.bitShift;t[0]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[0]=(t[0]|this._lastByte>>>s)&255,t[1]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[1]=(t[1]|this._lastByte>>>s)&255,t[2]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[2]=(t[2]|this._lastByte>>>s)&255,t[3]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[3]=(t[3]|this._lastByte>>>s)&255}return new DataView(t.buffer).getFloat64(0,!0);case 2:if(this.bitShift===0)this.advanceByte(),t[4]=this._lastByte,this.advanceByte(),t[5]=this._lastByte,this.advanceByte(),t[0]=this._lastByte,this.advanceByte(),t[1]=this._lastByte,this.advanceByte(),t[2]=this._lastByte,this.advanceByte(),t[3]=this._lastByte;else{let s=8-this.bitShift;t[4]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[4]=(t[4]|this._lastByte>>>s)&255,t[5]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[5]=(t[5]|this._lastByte>>>s)&255,t[0]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[0]=(t[0]|this._lastByte>>>s)&255,t[1]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[1]=(t[1]|this._lastByte>>>s)&255,t[2]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[2]=(t[2]|this._lastByte>>>s)&255,t[3]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[3]=(t[3]|this._lastByte>>>s)&255}return new DataView(t.buffer).getFloat64(0,!0);case 3:return this.readDouble();default:throw this.throwException("ReadBitDoubleWithDefault")}}readBitThickness(){return this.readBitDouble()}read8BitJulianDate(){return this.julianToDate(this.readInt(),this.readInt())}readDateTime(){return this.julianToDate(this.readBitLong(),this.readBitLong())}readTimeSpan(){let e=this.readBitLong(),t=this.readBitLong();return e*36e5+t}positionInBits(){let e=this._position*8;return this.bitShift>0&&(e+=this.bitShift-8),e}setPositionInBits(e){this.position=e>>3,this.bitShift=e&7,!(this.bitShift<=0)&&this.advanceByte()}advanceByte(){this._lastByte=this._stream[this._position++]}advance(e){e>1&&(this._position+=e-1),this.readByte()}resetShift(){this.bitShift>0&&(this.bitShift=0),this.advanceByte();let e=this._lastByte;return this.advanceByte(),(e|this._lastByte<<8)&65535}readShort(){let e=this.readByte(),t=this.readByte(),i=e|t<<8;return i>32767&&(i-=65536),i}readShortLittleEndian(){return this.readShort()}readShortBigEndian(){let e=this.readByte(),t=this.readByte(),i=e<<8|t;return i>32767&&(i-=65536),i}readInt(){let e=this.readByte(),t=this.readByte(),i=this.readByte(),s=this.readByte();return e|t<<8|i<<16|s<<24}readIntLittleEndian(){return this.readInt()}readUInt(){return this.readInt()>>>0}readDouble(){let e=this.readBytes(8);return new DataView(e.buffer,e.byteOffset,8).getFloat64(0,!0)}readDoubleLittleEndian(){return this.readDouble()}readUShort(){let e=this.readByte(),t=this.readByte();return(e|t<<8)&65535}readULongLittleEndian(){let e=this.readByte(),t=this.readByte(),i=this.readByte(),s=this.readByte(),n=this.readByte(),a=this.readByte(),o=this.readByte(),h=this.readByte(),f=(e|t<<8|i<<16|s<<24)>>>0,b=(n|a<<8|o<<16|h<<24)>>>0;return f+b*4294967296}readStringEncoded(e,t){let i=this.readBytes(e);return new TextDecoder(t).decode(i)}applyFlagToPosition(e){let t=e-16;this.setPositionInBits(t);let i=this.readUShort();if((i&32768)>0){t-=16,this.setPositionInBits(t),i&=32767;let s=this.readUShort();i+=(s&65535)<<15}return{length:t,strDataSize:i}}applyShiftToLastByte(){let e=this._lastByte<<this.bitShift&255;return this.advanceByte(),(e|this._lastByte>>>8-this.bitShift)&255}throwException(e){return new Eo(`Failed to read ${e||"unknown"}`)}applyShiftToArr(e,t){for(let s=0;s<e;s++)t[s]=this._stream[this._position++];if(this.bitShift<=0)return;let i=8-this.bitShift;for(let s=0;s<e;++s){let n=this._lastByte<<this.bitShift&255;this._lastByte=t[s];let a=(n|this._lastByte>>>i)&255;t[s]=a}}read3bits(){let e=0;this.readBit()&&(e=1);let t=e<<1&255;this.readBit()&&(t|=1);let i=t<<1&255;return this.readBit()&&(i|=1),i}julianToDate(e,t){let i=(e-24405875e-1)*86400;try{return new Date(i*1e3+t)}catch{return new Date(0)}}getEncodingFromCodePage(e){switch(e){case 0:return"utf-8";case 1:return"ascii";case 28591:return"iso-8859-1";case 1252:return"windows-1252";case 1250:return"windows-1250";case 1251:return"windows-1251";case 1253:return"windows-1253";case 1254:return"windows-1254";case 1255:return"windows-1255";case 1256:return"windows-1256";case 1257:return"windows-1257";case 1258:return"windows-1258";case 932:return"shift_jis";case 936:return"gb2312";case 949:return"euc-kr";case 950:return"big5";case 65001:return"utf-8";default:return"windows-1252"}}};var Nn=class extends be{constructor(e,t){super(e,t)}};var Vn=class extends Nn{constructor(e,t){super(e,t)}readBitExtrusion(){return this.readBit()?c.AxisZ:this.read3BitDouble()}readBitThickness(){return this.readBit()?0:this.readBitDouble()}};var ks=class extends Vn{constructor(e,t){super(e,t)}readCmColor(e=!1){let t=B.ByLayer,i=this.readBitShort(),s=this.readBitLong()>>>0,n=new Uint8Array(4);n[0]=s&255,n[1]=s>>>8&255,n[2]=s>>>16&255,n[3]=s>>>24&255,s===3221225472?t=B.ByLayer:(s&16777216)!==0?t=new B(n[0]):t=B.fromTrueColor(n[2]<<16|n[1]<<8|n[0]);let a=this.readByte(),o="";(a&1)===1&&(o=this.readVariableText());let h="";return(a&2)===2&&(h=this.readVariableText()),t}readEnColor(){let e=new B(0),t=Ke.ByLayer,i=!1,s=this.readBitShort();if(s!==0){let n=s&65280&65535;if((n&16384)>0)e=B.ByBlock,i=!0;else if((n&32768)>0){let a=this.readBitLong()>>>0,o=new Uint8Array(4);o[0]=a&255,o[1]=a>>>8&255,o[2]=a>>>16&255,o[3]=a>>>24&255,e=B.fromTrueColor(o[2]<<16|o[1]<<8|o[0])}else e=new B(s&4095);if((n&8192)>0){let a=this.readBitLong();t=Ke.fromAlphaValue(a)}else t=Ke.ByLayer}else e=B.ByBlock,t=Ke.Opaque;return{color:e,transparency:t,flag:i}}};var In=class extends ks{constructor(e,t){super(e,t)}readTextUnicode(){let e=this.readShortLittleEndian(),t;if(e===0)t="";else{let i=e<<1&65535;t=this.readStringEncoded(i,"utf-16le").replace(/\0/g,"")}return t}readVariableText(){let e=this.readBitShort(),t;if(e===0)t="";else{let i=e<<1&65535;t=this.readStringEncoded(i,"utf-16le").replace(/\0/g,"")}return t}};var Ll=class extends In{constructor(e,t){super(e,t)}readObjectType(){let e=this.read2Bits(),t=0;switch(e){case 0:t=this.readByte();break;case 1:t=496+this.readByte();break;case 2:t=this.readShort();break;case 3:t=this.readShort();break}return t}};jn("AC12",Nn);jn("AC15",Vn);jn("AC18",ks);jn("AC21",In);jn("AC24",Ll);var us=class{get encoding(){return this._mainReader.encoding}set encoding(e){this._mainReader.encoding=e,this._textReader.encoding=e,this._handleReader.encoding=e}get stream(){throw new Error("InvalidOperation")}get bitShift(){throw new Error("InvalidOperation")}set bitShift(e){throw new Error("InvalidOperation")}get position(){return this._mainReader.position}set position(e){throw new Error("InvalidOperation")}isEmpty=!1;_mainReader;_textReader;_handleReader;constructor(e,t,i){this._mainReader=e,this._textReader=t,this._handleReader=i}advance(e){this._mainReader.advance(e)}advanceByte(){throw new Error("InvalidOperation")}handleReference(){return this._handleReader.handleReference()}handleReferenceWithRef(e){return this._handleReader.handleReferenceWithRef(e)}handleReferenceWithRefAndType(e){return this._handleReader.handleReferenceWithRefAndType(e)}positionInBits(){return this._mainReader.positionInBits()}read2Bits(){return this._mainReader.read2Bits()}read2RawDouble(){return this._mainReader.read2RawDouble()}read3RawDouble(){return this._mainReader.read3RawDouble()}read3BitDouble(){return this._mainReader.read3BitDouble()}readBit(){return this._mainReader.readBit()}readBitAsShort(){return this._mainReader.readBitAsShort()}readBitDouble(){return this._mainReader.readBitDouble()}read2BitDouble(){return this._mainReader.read2BitDouble()}readBitLong(){return this._mainReader.readBitLong()}readBitLongLong(){return this._mainReader.readBitLongLong()}readBitShort(){return this._mainReader.readBitShort()}readBitShortAsBool(){return this._mainReader.readBitShortAsBool()}readByte(){return this._mainReader.readByte()}readBytes(e){return this._mainReader.readBytes(e)}read2BitDoubleWithDefault(e){return this._mainReader.read2BitDoubleWithDefault(e)}read3BitDoubleWithDefault(e){return this._mainReader.read3BitDoubleWithDefault(e)}readCmColor(e=!1){if(!(this._mainReader instanceof ks)&&!e)return this._mainReader.readCmColor();let t=this.readBitShort(),i=this.readBitLong()>>>0,s=new Uint8Array(4);s[0]=i&255,s[1]=i>>>8&255,s[2]=i>>>16&255,s[3]=i>>>24&255;let n;i===3221225472?n=B.ByLayer:(i&16777216)!==0?n=new B(s[0]):n=B.fromTrueColor(s[2]<<16|s[1]<<8|s[0]);let a=this.readByte(),o="";(a&1)===1&&(o=this.readVariableText());let h="";return(a&2)===2&&(h=this.readVariableText()),n}readEnColor(){return this._mainReader.readEnColor()}read8BitJulianDate(){return this._mainReader.read8BitJulianDate()}readDateTime(){return this._mainReader.readDateTime()}readDouble(){return this._mainReader.readDouble()}readInt(){return this._mainReader.readInt()}readModularChar(){return this._mainReader.readModularChar()}readSignedModularChar(){return this._mainReader.readSignedModularChar()}readModularShort(){return this._mainReader.readModularShort()}readColorByIndex(){return new B(this.readBitShort())}readObjectType(){return this._mainReader.readObjectType()}readBitExtrusion(){return this._mainReader.readBitExtrusion()}readBitDoubleWithDefault(e){return this._mainReader.readBitDoubleWithDefault(e)}readBitThickness(){return this._mainReader.readBitThickness()}readRawChar(){return this._mainReader.readRawChar()}readRawLong(){return this._mainReader.readRawLong()}readRawULong(){return this._mainReader.readRawULong()}readSentinel(){return this._mainReader.readSentinel()}readShort(){return this._mainReader.readShort()}readShortBigEndian(){return this._mainReader.readShortBigEndian()}readTextUnicode(){return this._textReader.isEmpty?"":this._textReader.readTextUnicode()}readTimeSpan(){return this._mainReader.readTimeSpan()}readUInt(){return this._mainReader.readUInt()}readVariableText(){return this._textReader.isEmpty?"":this._textReader.readVariableText()}resetShift(){return this._mainReader.resetShift()}setPositionInBits(e){this._mainReader.setPositionInBits(e)}setPositionByFlag(e){throw new Error("InvalidOperation")}};var kl=class extends Y{get SectionName(){return T.Classes}_fileHeader;_sreader;constructor(e,t,i){super(e),this._sreader=t,this._fileHeader=i}read(){let e=new gi;this.checkSentinel(this._sreader,T.StartSentinels.get(this.SectionName));let t=this._sreader.readRawLong(),i=this._sreader.position+t;if(this._fileHeader.AcadVersion>=m.AC1024&&this._fileHeader.AcadMaintenanceVersion>3||this._fileHeader.AcadVersion>m.AC1027){let n=this._sreader.readRawLong()}let s=0;if(this.R2007Plus){s=this._sreader.positionInBits()+this._sreader.readRawLong()-1;let n=this._sreader.positionInBits();i=this._sreader.setPositionByFlag(s),this._sreader.setPositionInBits(n);let a=be.getStreamHandler(this._version,this._sreader.stream);a.setPositionInBits(i),this._sreader=new us(this._sreader,a,null),this._sreader.readBitLong(),this._sreader.readBit()}for(this._fileHeader.AcadVersion===m.AC1018&&(this._sreader.readBitShort(),this._sreader.readRawChar(),this._sreader.readRawChar(),this._sreader.readBit());this.getCurrPos(this._sreader)<i;){let n=new F;n.classNumber=this._sreader.readBitShort(),n.proxyFlags=this._sreader.readBitShort(),n.applicationName=this._sreader.readVariableText(),n.cppClassName=this._sreader.readVariableText(),n.dxfName=this._sreader.readVariableText(),n.wasZombie=this._sreader.readBit(),n.itemClassId=this._sreader.readBitShort(),this.R2004Plus&&(n.instanceCount=this._sreader.readBitLong(),n.dwgVersion=this._sreader.readBitLong(),n.maintenanceVersion=this._sreader.readBitLong(),this._sreader.readBitLong(),this._sreader.readBitLong()),e.addOrUpdate(n)}return this.R2007Plus&&this._sreader.setPositionInBits(s+1),this._sreader.resetShift(),this.checkSentinel(this._sreader,T.EndSentinels.get(this.SectionName)),e}getCurrPos(e){return this.R2007Plus?e.positionInBits():e.position}};var Pl=class extends Y{get SectionName(){return T.Handles}_sreader;constructor(e,t){super(e),this._sreader=t}read(){let e=new Map;for(;;){let t=0,i=0,s=this._sreader.readShortBigEndian();if(s===2)break;let n=this._sreader.position,a=s-2;a>2032&&(a=2032);let o=n+a;for(;this._sreader.position<o;){let f=this._sreader.readModularChar();t+=f,i+=this._sreader.readSignedModularChar(),f>0?e.set(t,i):this.notify(`Negative offset: ${f} for the handle: ${t}`,g.Warning)}let h=(this._sreader.readByte()<<8)+this._sreader.readByte()}return e}};var Ol=class extends Y{get SectionName(){return T.Header}_reader;_header;constructor(e,t,i){super(e),this._reader=t,this._header=i,this._header.version=e}read(e){let t=this._reader,i=new Pn;this.checkSentinel(this._reader,T.StartSentinels.get(this.SectionName));let s=this._reader.readRawLong();if(this.R2010Plus&&e>3||this.R2018Plus){let S=this._reader.readRawLong()}let n=this._reader.positionInBits();if(this.R2007Plus){let S=this._reader.readRawLong(),N=n+S-1,L=be.getStreamHandler(this._version,new Uint8Array(this._reader.stream));L.setPositionByFlag(N);let j=be.getStreamHandler(this._version,new Uint8Array(this._reader.stream));j.setPositionInBits(N+1),this._reader=new us(this._reader,L,j)}this.R2013Plus&&(this._header.requiredVersions=this._reader.readBitLongLong()),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readBitLong(),this._reader.readBitLong(),this.R13_14Only&&this._reader.readBitShort(),this.R2004Pre&&this._reader.handleReference(),this._header.associatedDimensions=this._reader.readBit(),this._header.updateDimensionsWhileDragging=this._reader.readBit(),this.R13_14Only&&(this._header.DIMSAV=this._reader.readBit()?1:0),this._header.polylineLineTypeGeneration=this._reader.readBit(),this._header.orthoMode=this._reader.readBit(),this._header.regenerationMode=this._reader.readBit()?1:0,this._header.fillMode=this._reader.readBit(),this._header.quickTextMode=this._reader.readBit(),this._header.paperSpaceLineTypeScaling=this._reader.readBit()?bi.Normal:bi.Viewport,this._header.limitCheckingOn=this._reader.readBit(),this.R13_14Only&&(this._header.blipMode=this._reader.readBit()),this.R2004Plus&&this._reader.readBit(),this._header.userTimer=this._reader.readBit(),this._header.sketchPolylineType=this._reader.readBit()?1:0,this._header.angularDirection=this._reader.readBitAsShort(),this._header.showSplineControlPoints=this._reader.readBit(),this.R13_14Only&&(this._reader.readBit(),this._reader.readBit()),this._header.mirrorText=this._reader.readBit(),this._header.worldView=this._reader.readBit(),this.R13_14Only&&this._reader.readBit(),this._header.showModelSpace=this._reader.readBit(),this._header.paperSpaceLimitsChecking=this._reader.readBit(),this._header.retainXRefDependentVisibilitySettings=this._reader.readBit(),this.R13_14Only&&this._reader.readBit(),this._header.displaySilhouetteCurves=this._reader.readBit(),this._header.createEllipseAsPolyline=this._reader.readBit(),this._header.proxyGraphics=this._reader.readBitShortAsBool(),this.R13_14Only&&this._reader.readBitShort(),this._header.spatialIndexMaxTreeDepth=this._reader.readBitShort(),this._header.linearUnitFormat=this._reader.readBitShort();let a=this._reader.readBitShort();a>=0&&a<=8&&(this._header.linearUnitPrecision=a),this._header.angularUnit=this._reader.readBitShort();let o=this._reader.readBitShort();o>=0&&o<=8&&(this._header.angularUnitPrecision=o),this.R13_14Only&&(this._header.objectSnapMode=this._reader.readBitShort()),this._header.attributeVisibility=this._reader.readBitShort(),this.R13_14Only&&this._reader.readBitShort(),this._header.pointDisplayMode=this._reader.readBitShort(),this.R13_14Only&&this._reader.readBitShort(),this.R2004Plus&&(this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitLong()),this._header.userShort1=this._reader.readBitShort(),this._header.userShort2=this._reader.readBitShort(),this._header.userShort3=this._reader.readBitShort(),this._header.userShort4=this._reader.readBitShort(),this._header.userShort5=this._reader.readBitShort(),this._header.numberOfSplineSegments=this._reader.readBitShort(),this._header.surfaceDensityM=this._reader.readBitShort(),this._header.surfaceDensityM=this._reader.readBitShort(),this._header.surfaceType=this._reader.readBitShort(),this._header.surfaceTabulation1=this._reader.readBitShort(),this._header.surfaceTabulation2=this._reader.readBitShort(),this._header.splineType=this._reader.readBitShort(),this._header.shadeEdge=this._reader.readBitShort(),this._header.shadeDiffuseToAmbientPercentage=this._reader.readBitShort(),this._header.unitMode=this._reader.readBitShort(),this._header.maxViewportCount=this._reader.readBitShort();let h=this._reader.readBitShort();h>=0&&h<=2047&&(this._header.surfaceIsolineCount=h),this._header.currentMultiLineJustification=this._reader.readBitShort();let f=this._reader.readBitShort();f>=0&&f<=100&&(this._header.textQuality=f),this._header.lineTypeScale=this._reader.readBitDouble(),this._header.textHeightDefault=this._reader.readBitDouble(),this._header.traceWidthDefault=this._reader.readBitDouble(),this._header.sketchIncrement=this._reader.readBitDouble(),this._header.filletRadius=this._reader.readBitDouble(),this._header.thicknessDefault=this._reader.readBitDouble(),this._header.angleBase=this._reader.readBitDouble(),this._header.pointDisplaySize=this._reader.readBitDouble(),this._header.polylineWidthDefault=this._reader.readBitDouble(),this._header.userDouble1=this._reader.readBitDouble(),this._header.userDouble2=this._reader.readBitDouble(),this._header.userDouble3=this._reader.readBitDouble(),this._header.userDouble4=this._reader.readBitDouble(),this._header.userDouble5=this._reader.readBitDouble(),this._header.chamferDistance1=this._reader.readBitDouble(),this._header.chamferDistance2=this._reader.readBitDouble(),this._header.chamferLength=this._reader.readBitDouble(),this._header.chamferAngle=this._reader.readBitDouble();let b=this._reader.readBitDouble();if(b>0&&b<=10&&(this._header.facetResolution=b),this._header.currentMultilineScale=this._reader.readBitDouble(),this._header.currentEntityLinetypeScale=this._reader.readBitDouble(),this._header.menuFileName=this._reader.readVariableText(),this._header.createDateTime=this._reader.readDateTime(),this._header.updateDateTime=this._reader.readDateTime(),this.R2004Plus&&(this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitLong()),this._header.totalEditingTime=this._reader.readTimeSpan(),this._header.userElapsedTimeSpan=this._reader.readTimeSpan(),this._header.currentEntityColor=this._reader.readCmColor(),this._header.handleSeed=t.handleReference(),i.CLAYER=this._reader.handleReference(),i.TEXTSTYLE=this._reader.handleReference(),i.CELTYPE=this._reader.handleReference(),this.R2007Plus&&(i.CMATERIAL=this._reader.handleReference()),i.DIMSTYLE=this._reader.handleReference(),i.CMLSTYLE=this._reader.handleReference(),this.R2000Plus&&(this._header.viewportDefaultViewScaleFactor=this._reader.readBitDouble()),this._header.paperSpaceInsertionBase=this._reader.read3BitDouble(),this._header.paperSpaceExtMin=this._reader.read3BitDouble(),this._header.paperSpaceExtMax=this._reader.read3BitDouble(),this._header.paperSpaceLimitsMin=this._reader.read2RawDouble(),this._header.paperSpaceLimitsMax=this._reader.read2RawDouble(),this._header.paperSpaceElevation=this._reader.readBitDouble(),this._header.paperSpaceUcs=this._reader.read3BitDouble(),this._header.paperSpaceXAxis=this._reader.read3BitDouble(),this._header.paperSpaceYAxis=this._reader.read3BitDouble(),i.UCSNAME_PSPACE=this._reader.handleReference(),this.R2000Plus&&(i.PUCSORTHOREF=this._reader.handleReference(),this._reader.readBitShort(),i.PUCSBASE=this._reader.handleReference(),this._header.paperSpaceOrthographicTopDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicBottomDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicLeftDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicRightDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicFrontDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicBackDOrigin=this._reader.read3BitDouble()),this._header.modelSpaceInsertionBase=this._reader.read3BitDouble(),this._header.modelSpaceExtMin=this._reader.read3BitDouble(),this._header.modelSpaceExtMax=this._reader.read3BitDouble(),this._header.modelSpaceLimitsMin=this._reader.read2RawDouble(),this._header.modelSpaceLimitsMax=this._reader.read2RawDouble(),this._header.elevation=this._reader.readBitDouble(),this._header.modelSpaceOrigin=this._reader.read3BitDouble(),this._header.modelSpaceXAxis=this._reader.read3BitDouble(),this._header.modelSpaceYAxis=this._reader.read3BitDouble(),i.UCSNAME_MSPACE=this._reader.handleReference(),this.R2000Plus&&(i.UCSORTHOREF=this._reader.handleReference(),this._reader.readBitShort(),i.UCSBASE=this._reader.handleReference(),this._header.modelSpaceOrthographicTopDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicBottomDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicLeftDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicRightDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicFrontDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicBackDOrigin=this._reader.read3BitDouble(),this._header.dimensionPostFix=this._reader.readVariableText(),this._header.dimensionAlternateDimensioningSuffix=this._reader.readVariableText()),this.R13_14Only&&(this._header.dimensionGenerateTolerances=this._reader.readBit(),this._header.dimensionLimitsGeneration=this._reader.readBit(),this._header.dimensionTextInsideHorizontal=this._reader.readBit(),this._header.dimensionTextOutsideHorizontal=this._reader.readBit(),this._header.dimensionSuppressFirstExtensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondExtensionLine=this._reader.readBit(),this._header.dimensionAlternateUnitDimensioning=this._reader.readBit(),this._header.dimensionTextOutsideExtensions=this._reader.readBit(),this._header.dimensionSeparateArrowBlocks=this._reader.readBit(),this._header.dimensionTextInsideExtensions=this._reader.readBit(),this._header.dimensionSuppressOutsideExtensions=this._reader.readBit(),this._header.dimensionAlternateUnitDecimalPlaces=this._reader.readRawChar(),this._header.dimensionZeroHandling=this._reader.readRawChar(),this._header.dimensionSuppressFirstDimensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondDimensionLine=this._reader.readBit(),this._header.dimensionToleranceAlignment=this._reader.readRawChar(),this._header.dimensionTextHorizontalAlignment=this._reader.readRawChar(),this._header.dimensionFit=this._reader.readRawChar(),this._header.dimensionCursorUpdate=this._reader.readBit(),this._header.dimensionToleranceZeroHandling=this._reader.readRawChar(),this._header.dimensionAlternateUnitZeroHandling=this._reader.readRawChar(),this._header.dimensionAlternateUnitToleranceZeroHandling=this._reader.readRawChar(),this._header.dimensionTextVerticalAlignment=this._reader.readRawChar(),this._header.dimensionUnit=this._reader.readBitShort(),this._header.dimensionAngularDimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAlternateUnitFormat=this._reader.readBitShort(),this._header.dimensionAlternateUnitToleranceDecimalPlaces=this._reader.readBitShort(),i.DIMTXSTY=this._reader.handleReference()),this._header.dimensionScaleFactor=this._reader.readBitDouble(),this._header.dimensionArrowSize=this._reader.readBitDouble(),this._header.dimensionExtensionLineOffset=this._reader.readBitDouble(),this._header.dimensionLineIncrement=this._reader.readBitDouble(),this._header.dimensionExtensionLineExtension=this._reader.readBitDouble(),this._header.dimensionRounding=this._reader.readBitDouble(),this._header.dimensionLineExtension=this._reader.readBitDouble(),this._header.dimensionPlusTolerance=this._reader.readBitDouble(),this._header.dimensionMinusTolerance=this._reader.readBitDouble(),this.R2007Plus){this._header.dimensionFixedExtensionLineLength=this._reader.readBitDouble();let S=this._reader.readBitDouble(),N=Math.round(S*1e6)/1e6,L=5*Math.PI/180;N>L&&N<Math.PI/2&&(this._header.dimensionJoggedRadiusDimensionTransverseSegmentAngle=S),this._header.dimensionTextBackgroundFillMode=this._reader.readBitShort(),this._header.dimensionTextBackgroundColor=this._reader.readCmColor()}if(this.R2000Plus&&(this._header.dimensionGenerateTolerances=this._reader.readBit(),this._header.dimensionLimitsGeneration=this._reader.readBit(),this._header.dimensionTextInsideHorizontal=this._reader.readBit(),this._header.dimensionTextOutsideHorizontal=this._reader.readBit(),this._header.dimensionSuppressFirstExtensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondExtensionLine=this._reader.readBit(),this._header.dimensionTextVerticalAlignment=this._reader.readBitShort(),this._header.dimensionZeroHandling=this._reader.readBitShort(),this._header.dimensionAngularZeroHandling=this._reader.readBitShort()),this.R2007Plus&&(this._header.dimensionArcLengthSymbolPosition=this._reader.readBitShort()),this._header.dimensionTextHeight=this._reader.readBitDouble(),this._header.dimensionCenterMarkSize=this._reader.readBitDouble(),this._header.dimensionTickSize=this._reader.readBitDouble(),this._header.dimensionAlternateUnitScaleFactor=this._reader.readBitDouble(),this._header.dimensionLinearScaleFactor=this._reader.readBitDouble(),this._header.dimensionTextVerticalPosition=this._reader.readBitDouble(),this._header.dimensionToleranceScaleFactor=this._reader.readBitDouble(),this._header.dimensionLineGap=this._reader.readBitDouble(),this.R13_14Only&&(this._header.dimensionPostFix=this._reader.readVariableText(),this._header.dimensionAlternateDimensioningSuffix=this._reader.readVariableText(),this._header.dimensionBlockName=this._reader.readVariableText(),this._header.dimensionBlockNameFirst=this._reader.readVariableText(),this._header.dimensionBlockNameSecond=this._reader.readVariableText()),this.R2000Plus&&(this._header.dimensionAlternateUnitRounding=this._reader.readBitDouble(),this._header.dimensionAlternateUnitDimensioning=this._reader.readBit(),this._header.dimensionAlternateUnitDecimalPlaces=this._reader.readBitShort()&255,this._header.dimensionTextOutsideExtensions=this._reader.readBit(),this._header.dimensionSeparateArrowBlocks=this._reader.readBit(),this._header.dimensionTextInsideExtensions=this._reader.readBit(),this._header.dimensionSuppressOutsideExtensions=this._reader.readBit()),this._header.dimensionLineColor=this._reader.readCmColor(),this._header.dimensionExtensionLineColor=this._reader.readCmColor(),this._header.dimensionTextColor=this._reader.readCmColor(),this.R2000Plus&&(this._header.dimensionAngularDimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAlternateUnitFormat=this._reader.readBitShort(),this._header.dimensionAlternateUnitToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAngularUnit=this._reader.readBitShort(),this._header.dimensionFractionFormat=this._reader.readBitShort(),this._header.dimensionLinearUnitFormat=this._reader.readBitShort(),this._header.dimensionDecimalSeparator=String.fromCharCode(this._reader.readBitShort()),this._header.dimensionTextMovement=this._reader.readBitShort(),this._header.dimensionTextHorizontalAlignment=this._reader.readBitShort()&255,this._header.dimensionSuppressFirstDimensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondDimensionLine=this._reader.readBit(),this._header.dimensionToleranceAlignment=this._reader.readBitShort()&255,this._header.dimensionToleranceZeroHandling=this._reader.readBitShort()&255,this._header.dimensionAlternateUnitZeroHandling=this._reader.readBitShort()&255,this._header.dimensionAlternateUnitToleranceZeroHandling=this._reader.readBitShort()&255,this._header.dimensionCursorUpdate=this._reader.readBit(),this._header.dimensionDimensionTextArrowFit=this._reader.readBitShort()),this.R2007Plus&&(this._header.dimensionIsExtensionLineLengthFixed=this._reader.readBit()),this.R2010Plus&&(this._header.dimensionTextDirection=this._reader.readBit()?1:0,this._header.dimensionAltMzf=this._reader.readBitDouble(),this._header.dimensionAltMzs=this._reader.readVariableText(),this._header.dimensionFit=this._reader.readBitDouble(),this._header.dimensionMzs=this._reader.readVariableText()),this.R2000Plus&&(i.DIMTXSTY=this._reader.handleReference(),i.DIMLDRBLK=this._reader.handleReference(),i.DIMBLK=this._reader.handleReference(),i.DIMBLK1=this._reader.handleReference(),i.DIMBLK2=this._reader.handleReference()),this.R2007Plus&&(i.DIMLTYPE=this._reader.handleReference(),i.DIMLTEX1=this._reader.handleReference(),i.DIMLTEX2=this._reader.handleReference()),this.R2000Plus&&(this._header.dimensionLineWeight=this._reader.readBitShort(),this._header.extensionLineWeight=this._reader.readBitShort()),i.BLOCK_CONTROL_OBJECT=this._reader.handleReference(),i.LAYER_CONTROL_OBJECT=this._reader.handleReference(),i.STYLE_CONTROL_OBJECT=this._reader.handleReference(),i.LINETYPE_CONTROL_OBJECT=this._reader.handleReference(),i.VIEW_CONTROL_OBJECT=this._reader.handleReference(),i.UCS_CONTROL_OBJECT=this._reader.handleReference(),i.VPORT_CONTROL_OBJECT=this._reader.handleReference(),i.APPID_CONTROL_OBJECT=this._reader.handleReference(),i.DIMSTYLE_CONTROL_OBJECT=this._reader.handleReference(),this.R13_15Only&&(i.VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT=this._reader.handleReference()),i.DICTIONARY_ACAD_GROUP=this._reader.handleReference(),i.DICTIONARY_ACAD_MLINESTYLE=this._reader.handleReference(),i.DICTIONARY_NAMED_OBJECTS=this._reader.handleReference(),this.R2000Plus&&(this._header.stackedTextAlignment=this._reader.readBitShort(),this._header.stackedTextSizePercentage=this._reader.readBitShort(),this._header.hyperLinkBase=this._reader.readVariableText(),this._header.styleSheetName=this._reader.readVariableText(),i.DICTIONARY_LAYOUTS=this._reader.handleReference(),i.DICTIONARY_PLOTSETTINGS=this._reader.handleReference(),i.DICTIONARY_PLOTSTYLES=this._reader.handleReference()),this.R2004Plus&&(i.DICTIONARY_MATERIALS=this._reader.handleReference(),i.DICTIONARY_COLORS=this._reader.handleReference()),this.R2007Plus&&(i.DICTIONARY_VISUALSTYLE=this._reader.handleReference(),this.R2013Plus&&(i.DICTIONARY_VISUALSTYLE=this._reader.handleReference())),this.R2000Plus){let S=this._reader.readBitLong();this._header.currentEntityLineWeight=S&31,this._header.endCaps=S&96,this._header.joinStyle=S&384,this._header.displayLineWeight=(S&512)===1,this._header.xEdit=(S&1024)===1,this._header.extendedNames=(S&2048)===1,this._header.plotStyleMode=S&8192,this._header.loadOLEObject=(S&16384)===1,this._header.insUnits=this._reader.readBitShort(),this._header.currentEntityPlotStyle=this._reader.readBitShort(),this._header.currentEntityPlotStyle===Qi.ByObjectId&&(i.CPSNID=this._reader.handleReference()),this._header.fingerPrintGuid=this._reader.readVariableText(),this._header.versionGuid=this._reader.readVariableText()}if(this.R2004Plus&&(this._header.entitySortingFlags=this._reader.readByte(),this._header.indexCreationFlags=this._reader.readByte(),this._header.hideText=this._reader.readByte(),this._header.externalReferenceClippingBoundaryType=this._reader.readByte(),this._header.dimensionAssociativity=this._reader.readByte(),this._header.haloGapPercentage=this._reader.readByte(),this._header.obscuredColor=new B(this._reader.readBitShort()),this._header.interfereColor=new B(this._reader.readBitShort()),this._header.obscuredType=this._reader.readByte(),this._header.intersectionDisplay=this._reader.readByte(),this._header.projectName=this._reader.readVariableText()),i.PAPER_SPACE=this._reader.handleReference(),i.MODEL_SPACE=this._reader.handleReference(),i.BYLAYER=this._reader.handleReference(),i.BYBLOCK=this._reader.handleReference(),i.CONTINUOUS=this._reader.handleReference(),this.R2007Plus){this._header.cameraDisplayObjects=this._reader.readBit(),this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitDouble();let S=this._reader.readBitDouble();S>=1&&S<=30&&(this._header.stepsPerSecond=S),this._header.stepSize=this._reader.readBitDouble(),this._header.dw3DPrecision=this._reader.readBitDouble(),this._header.lensLength=this._reader.readBitDouble(),this._header.cameraHeight=this._reader.readBitDouble(),this._header.solidsRetainHistory=this._reader.readRawChar()!==0,this._header.showSolidsHistory=this._reader.readRawChar()!==0,this._header.sweptSolidWidth=this._reader.readBitDouble(),this._header.sweptSolidHeight=this._reader.readBitDouble(),this._header.draftAngleFirstCrossSection=this._reader.readBitDouble(),this._header.draftAngleSecondCrossSection=this._reader.readBitDouble(),this._header.draftMagnitudeFirstCrossSection=this._reader.readBitDouble(),this._header.draftMagnitudeSecondCrossSection=this._reader.readBitDouble(),this._header.solidLoftedShape=this._reader.readBitShort(),this._header.loftedObjectNormals=String.fromCharCode(this._reader.readRawChar()),this._header.latitude=this._reader.readBitDouble(),this._header.longitude=this._reader.readBitDouble(),this._header.northDirection=this._reader.readBitDouble(),this._header.timeZone=this._reader.readBitLong(),this._header.displayLightGlyphs=String.fromCharCode(this._reader.readRawChar()),this._reader.readRawChar(),this._header.dwgUnderlayFramesVisibility=String.fromCharCode(this._reader.readRawChar()),this._header.dgnUnderlayFramesVisibility=String.fromCharCode(this._reader.readRawChar()),this._reader.readBit(),this._header.interfereColor=this._reader.readCmColor(),i.INTERFEREOBJVS=this._reader.handleReference(),i.INTERFEREVPVS=this._reader.handleReference(),i.DRAGVS=this._reader.handleReference(),this._header.shadowMode=this._reader.readByte(),this._header.shadowPlaneLocation=this._reader.readBitDouble()}try{t.setPositionInBits(n+s*8),t.resetShift(),this.checkSentinel(this._reader,T.EndSentinels.get(this.SectionName))}catch(S){this.notify("An error ocurred at the end of the Header reading",g.Error,S instanceof Error?S:void 0)}return{objectPointers:i}}};R();q();D();var Pt=class{CadObject;EDataTemplate=new Map;EDataTemplateByAppName=new Map;HasBeenBuilt=!1;OwnerHandle=null;ReactorsHandles=new Set;XDictHandle=null;constructor(e){this.CadObject=e}Build(e){this.HasBeenBuilt||(this.HasBeenBuilt=!0,this.build(e))}toString(){return`${this.CadObject?.toString()}`}build(e){let t=e.TryGetCadObject(this.XDictHandle);t&&(this.CadObject.xDictionary=t);for(let i of this.ReactorsHandles){let s=e.TryGetCadObject(i);s?this.CadObject.addReactor(s):e.Notify(`Reactor with handle ${i} not found`,g.Warning)}for(let[i,s]of this.EDataTemplate){let n=e.TryGetCadObject(i);n?this.CadObject.extendedData.set(n,s):e.Notify(`AppId in extended data with handle ${i} not found`,g.Warning)}for(let[i,s]of this.EDataTemplateByAppName){let n=e.TryGetTableEntry(i);n?this.CadObject.extendedData.set(n,s):e.Notify(`AppId in extended data with handle ${i} not found`,g.Warning)}}*getEntitiesCollection(e,t,i){let s=e.GetObjectTemplate(t);for(s||(e.Notify(`Leading entity with handle ${t} not found.`,g.Warning),s=e.GetObjectTemplate(i));s&&(yield s.CadObject,s.CadObject.handle!==i);)s.NextEntity!=null?s=e.GetObjectTemplate(s.NextEntity):s=e.GetObjectTemplate(s.CadObject.handle+1)}getTableReference(e,t,i){let s=e.TryGetCadObject(t);if(s)return s;let n=e.TryGetTableEntry(i);return n||((i&&i.length>0||t!=null&&t!==0)&&e.Notify(`Table reference with handle: ${t} | name: ${i} not found for ${this.CadObject.constructor.name} with handle ${this.CadObject.handle}`,g.Warning),null)}};var G=class extends Pt{constructor(e){super(e)}};var k=class extends G{bookColorName=null;ColorHandle=null;EntityMode=0;LayerHandle=null;LayerName=null;LineTypeHandle=null;LineTypeName=null;LtypeFlags=null;MaterialHandle=null;NextEntity=null;PrevEntity=null;constructor(e){super(e)}SetUnlinkedReferences(){this.LayerName&&this.LayerName.length>0&&(this.CadObject.layer=new Se(this.LayerName)),this.LineTypeName&&this.LineTypeName.length>0&&(this.CadObject.lineType=new H(this.LineTypeName))}build(e){super.build(e);let t=this.getTableReference(e,this.LayerHandle,this.LayerName??"");switch(t&&(this.CadObject.layer=t),this.LtypeFlags){case 0:this.LineTypeName=H.ByLayerName;break;case 1:this.LineTypeName=H.ByBlockName;break;case 2:this.LineTypeName=H.ContinuousName;break}let i=this.getTableReference(e,this.LineTypeHandle,this.LineTypeName??"");i&&(this.CadObject.lineType=i);let s=e.TryGetCadObject(this.ColorHandle);if(s)this.CadObject.bookColor=s;else if(this.bookColorName&&this.bookColorName.length>0&&e.DocumentToBuild!=null&&e.DocumentToBuild.colors!=null){let n=e.DocumentToBuild.colors.TryGet(this.bookColorName);n&&(this.CadObject.bookColor=n)}}},ke=class extends k{constructor(e){super(e)}};var K=class extends G{constructor(e){super(e)}};var fe=class extends G{get Type(){return this.CadObject.constructor.name}get Name(){return this.CadObject.name}constructor(e){super(e)}build(e){super.build(e)}};var br=class extends fe{BeginBlockHandle=null;BlockEntityTemplate=null;EndBlockHandle=null;FirstEntityHandle=null;InsertHandles=[];LastEntityHandle=null;LayoutHandle=null;OwnedObjectsHandlers=new Set;ReferenceTemplates=new Set;constructor(e){super(e??new U)}SetBlockToRecord(e,t){let i=e.TryGetCadObject(this.BeginBlockHandle);i&&(i.name&&i.name.length>0&&(this.CadObject.name=i.name),i.flags=this.CadObject.blockEntity.flags,i.basePoint=this.CadObject.blockEntity.basePoint,i.xRefPath=this.CadObject.blockEntity.xRefPath,i.comments=this.CadObject.blockEntity.comments,i.isUnloaded=this.CadObject.blockEntity.isUnloaded,this.CadObject.blockEntity=i);let s=e.TryGetCadObject(this.EndBlockHandle);s&&(this.CadObject.blockEnd=s),this.ensureCorrectNaming(e,t.MODEL_SPACE,U.ModelSpaceName),this.ensureCorrectNaming(e,t.PAPER_SPACE,U.PaperSpaceName)}build(e){super.build(e);let t=e.TryGetCadObject(this.LayoutHandle);if(t&&(this.CadObject.layout=t),this.FirstEntityHandle!=null&&this.FirstEntityHandle!==0)for(let i of this.getEntitiesCollection(e,this.FirstEntityHandle,this.LastEntityHandle))this.addEntity(e,i);else{if(this.BlockEntityTemplate!==null)for(let i of this.BlockEntityTemplate.OwnedObjectsHandlers)this.OwnedObjectsHandlers.add(i);for(let i of this.OwnedObjectsHandlers){let s=e.TryGetCadObject(i);s&&this.addEntity(e,s)}}for(let i of this.ReferenceTemplates)this.addEntity(e,i.CadObject)}addEntity(e,t){!e.KeepUnknownEntities&&t instanceof Lt||this.CadObject.entities.add(t)}ensureCorrectNaming(e,t,i){this.CadObject.handle===t&&this.CadObject.name.toLowerCase()!==i.toLowerCase()&&(e.Notify(`Invalid name for ${this.CadObject.name} changed to ${i}`,g.Warning),this.CadObject.name=i)}};var st=class extends Pt{EntryHandles=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.EntryHandles){let i=e.TryGetCadObject(t);if(i)try{this.CadObject.add(i)}catch(s){e.Notify(`[${this.CadObject.subclassMarker}] error adding entry`,g.Error,s)}}}};var Mn=class extends st{ModelSpaceHandle=null;PaperSpaceHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=e.TryGetCadObject(this.ModelSpaceHandle);t&&this.CadObject.add(t);let i=e.TryGetCadObject(this.PaperSpaceHandle);i&&this.CadObject.add(i)}};R();var gr=class extends k{StyleHandle=null;BlockHandle=null;BlockName=null;StyleName=null;constructor(e){super(e??new Wn)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.StyleHandle,this.StyleName??"");i&&(t.style=i);let s=this.getTableReference(e,this.BlockHandle,this.BlockName??"");s&&(t.block=s)}SetDimensionFlags(e){let t=this.CadObject;t.flags=e}SetDimensionObject(e){e.handle=this.CadObject.handle,e.owner=this.CadObject.owner,e.xDictionary=this.CadObject.xDictionary,e.color=this.CadObject.color,e.lineWeight=this.CadObject.lineWeight,e.lineTypeScale=this.CadObject.lineTypeScale,e.isInvisible=this.CadObject.isInvisible,e.transparency=this.CadObject.transparency;let t=this.CadObject;if(e.version=t.version,e.definitionPoint=t.definitionPoint,e.textMiddlePoint=t.textMiddlePoint,e.insertionPoint=t.insertionPoint,e.normal=t.normal,e.isTextUserDefinedLocation=t.isTextUserDefinedLocation,e.attachmentPoint=t.attachmentPoint,e.lineSpacingStyle=t.lineSpacingStyle,e.lineSpacingFactor=t.lineSpacingFactor,e.text=t.text,e.textRotation=t.textRotation,e.horizontalDirection=t.horizontalDirection,e.flags=t.flags,this.CadObject instanceof je&&e instanceof Qe){let i=this.CadObject,s=e;s.firstPoint=i.firstPoint,s.secondPoint=i.secondPoint,s.extLineRotation=i.extLineRotation}this.CadObject=e}},Wn=class extends me{get objectType(){return u.INVALID}get measurement(){return 0}getBoundingBox(){return null}constructor(){super(v.Linear)}};var Hn=class extends fe{DIMBL_Name=null;DIMBLK=null;DIMBLK1=null;DIMBLK1_Name=null;DIMBLK2=null;DIMBLK2_Name=null;DIMLDRBLK=null;Dimltex1=0;Dimltex2=0;Dimltype=null;TextStyle_Name=null;TextStyleHandle=null;BlockHandle=null;DxfFlagsAssigned=!1;constructor(e){super(e??new re)}build(e){super.build(e);let t=this.getTableReference(e,this.TextStyleHandle,this.TextStyle_Name??"");t&&(this.CadObject.style=t);let i=this.getTableReference(e,this.Dimltype,"");i&&(this.CadObject.lineType=i);let s=this.getTableReference(e,this.Dimltex1,"");s&&(this.CadObject.lineTypeExt1=s);let n=this.getTableReference(e,this.Dimltex2,"");n&&(this.CadObject.lineTypeExt2=n);let a=this.getTableReference(e,this.DIMLDRBLK,this.DIMBL_Name??"");a&&(this.CadObject.leaderArrow=a);let o=this.getTableReference(e,this.DIMBLK1,this.DIMBLK1_Name??"");o&&(this.CadObject.dimArrow1=o);let h=this.getTableReference(e,this.DIMBLK2,this.DIMBLK2_Name??"");h&&(this.CadObject.dimArrow2=h);let f=this.getTableReference(e,this.BlockHandle,"")}};var Li=class extends ke{HatchPatternName=null;PathTemplates=[];constructor(e){super(e??new Tt)}build(e){super.build(e);for(let t of this.PathTemplates)this.CadObject.paths.push(t.Path),t.Build(e)}};(function(r){class e{Path=new _l;Handles=new Set;Build(i){for(let s of this.Handles){let n=i.TryGetCadObject(s);n&&this.Path.entities.push(n)}}}r.CadBoundaryPathTemplate=e})(Li||(Li={}));var xr=class extends k{HasAtts=!1;OwnedObjectsCount=0;BlockHeaderHandle=null;BlockName=null;FirstAttributeHandle=null;EndAttributeHandle=null;SeqendHandle=null;OwnedObjectsHandlers=new Set;constructor(e){super(e??new Ee)}build(e){super.build(e);let t=this.CadObject;if(!(t instanceof Ee))return;let i=this.getTableReference(e,this.BlockHeaderHandle,this.BlockName??"");i?t.block=i:e.Notify(`Block ${this.BlockHeaderHandle} | ${this.BlockName} not found for Insert ${this.CadObject.handle}`,g.Warning);let s=e.TryGetCadObject(this.SeqendHandle);if(s&&(t.attributes.Seqend=s,s.owner=t),this.FirstAttributeHandle!=null){let n=this.getEntitiesCollection(e,this.FirstAttributeHandle,this.EndAttributeHandle);for(let a of n)t.attributes.push(a),a.owner=t}else for(let n of this.OwnedObjectsHandlers){let a=e.TryGetCadObject(n);a&&(t.attributes.push(a),a.owner=t)}}};var Fn=class extends fe{LayerControlHandle=0;PlotStyleHandle=0;MaterialHandle=0;LineTypeHandle=null;LineTypeName=null;TrueColorName=null;constructor(e){super(e??new Se)}build(e){super.build(e);let t=e.TryGetCadObject(this.MaterialHandle),i=this.getTableReference(e,this.LineTypeHandle,this.LineTypeName??"");i?this.CadObject.lineType=i:e.Notify(`Linetype with handle ${this.LineTypeHandle} could not be found for layer ${this.CadObject.name}`,g.Warning)}};J();D();x();R();var Ps;(function(r){r[r.None=0]="None",r[r.PlotViewportBorders=1]="PlotViewportBorders",r[r.ShowPlotStyles=2]="ShowPlotStyles",r[r.PlotCentered=4]="PlotCentered",r[r.PlotHidden=8]="PlotHidden",r[r.UseStandardScale=16]="UseStandardScale",r[r.PlotPlotStyles=32]="PlotPlotStyles",r[r.ScaleLineweights=64]="ScaleLineweights",r[r.PrintLineweights=128]="PrintLineweights",r[r.DrawViewportsFirst=512]="DrawViewportsFirst",r[r.ModelType=1024]="ModelType",r[r.UpdatePaper=2048]="UpdatePaper",r[r.ZoomToPaperOnUpdate=4096]="ZoomToPaperOnUpdate",r[r.Initializing=8192]="Initializing",r[r.PrevPlotInit=16384]="PrevPlotInit"})(Ps||(Ps={}));var jl;(function(r){r[r.Inches=0]="Inches",r[r.Millimeters=1]="Millimeters",r[r.Pixels=2]="Pixels"})(jl||(jl={}));var ni;(function(r){r[r.NoRotation=0]="NoRotation",r[r.Degrees90=1]="Degrees90",r[r.Degrees180=2]="Degrees180",r[r.Degrees270=3]="Degrees270"})(ni||(ni={}));var Oo;(function(r){r[r.AsDisplayed=0]="AsDisplayed",r[r.Wireframe=1]="Wireframe",r[r.Hidden=2]="Hidden",r[r.Rendered=3]="Rendered"})(Oo||(Oo={}));var jo;(function(r){r[r.Draft=0]="Draft",r[r.Preview=1]="Preview",r[r.Normal=2]="Normal",r[r.Presentation=3]="Presentation",r[r.Maximum=4]="Maximum",r[r.Custom=5]="Custom"})(jo||(jo={}));var un=class{left;bottom;right;top;get bottomLeftCorner(){return new C(this.left,this.bottom)}get topCorner(){return new C(this.right,this.top)}constructor(e=0,t=0,i=0,s=0){this.left=e,this.bottom=t,this.right=i,this.top=s}};var sh;(function(r){r[r.DrawingExtents=0]="DrawingExtents",r[r.Limits=1]="Limits",r[r.View=2]="View",r[r.Window=3]="Window",r[r.Layout=4]="Layout",r[r.Display=5]="Display"})(sh||(sh={}));var nh;(function(r){r[r.ScaleToFit=0]="ScaleToFit",r[r.UserDefined=1]="UserDefined"})(nh||(nh={}));var pt=class extends O{_denominatorScale=1;_numeratorScale=1;_shadePlotDPI=300;get denominatorScale(){return this._denominatorScale}set denominatorScale(e){if(e<=0)throw new Error("Value must be greater than zero");this._denominatorScale=e}flags=Ps.DrawViewportsFirst|Ps.PrintLineweights|Ps.PlotPlotStyles|Ps.UseStandardScale;get numeratorScale(){return this._numeratorScale}set numeratorScale(e){if(e<=0)throw new Error("Value must be greater than zero");this._numeratorScale=e}get objectName(){return d.ObjectPlotSettings}get objectType(){return u.UNLISTED}pageName="none_device";paperHeight=0;paperImageOrigin=new C(0,0);paperImageOriginX=0;paperImageOriginY=0;paperRotation=ni.NoRotation;paperSize="ISO_A4_(210.00_x_297.00_MM)";paperUnits=jl.Millimeters;paperWidth=0;plotOriginX=0;plotOriginY=0;plotType=sh.DrawingExtents;plotViewName="";get printScale(){return this.numeratorScale/this.denominatorScale}scaledFit=nh.ScaleToFit;get shadePlotDPI(){return this._shadePlotDPI}set shadePlotDPI(e){if(e<100||e>32767)throw new Error("The valid shade plot DPI values range from 100 to 32767.");this._shadePlotDPI=e}shadePlotIDHandle=0;shadePlotMode=Oo.AsDisplayed;shadePlotResolutionMode=jo.Draft;standardScale=1;styleSheet="";get subclassMarker(){return l.PlotSettings}systemPrinterName="";unprintableMargin=new un;windowLowerLeftX=0;windowLowerLeftY=0;windowUpperLeftX=0;windowUpperLeftY=0;constructor(e){super(e)}};D();x();R();var No;(function(r){r[r.None=0]="None",r[r.PaperSpaceLinetypeScaling=1]="PaperSpaceLinetypeScaling",r[r.LimitsChecking=2]="LimitsChecking"})(No||(No={}));var nt=class r extends pt{_blockRecord=null;_lastViewport=null;get associatedBlock(){return this._blockRecord}set associatedBlock(e){if(e==null)throw new Error("value cannot be null");this._blockRecord=e,this._blockRecord.layout=this}baseUCS=null;elevation=0;insertionBasePoint=new c(0,0,0);get isPaperSpace(){return this.name?.toLowerCase()!==r.ModelLayoutName.toLowerCase()}get lastActiveViewport(){return this._lastViewport}set lastActiveViewport(e){this._lastViewport=e}layoutFlags=No.PaperSpaceLinetypeScaling;maxExtents=new c(231.3,175.5,0);maxLimits=new C(277,202.5);minExtents=new c(25.7,19.5,0);minLimits=new C(-20,-7.5);get objectName(){return d.ObjectLayout}get objectType(){return u.LAYOUT}origin=new c(0,0,0);get subclassMarker(){return l.Layout}tabOrder=0;ucs=null;ucsOrthographicType=0;get viewports(){return this.associatedBlock?.viewports??null}xAxis=new c(1,0,0);yAxis=new c(0,1,0);static ModelLayoutName="Model";static PaperLayoutName="Layout1";constructor(e,t){super(),e!=null&&(this.name=e)}addViewport(e){this.associatedBlock?.entities?.push(e)}clone(){return super.clone()}toString(){return`${this.objectName}:${this.name}`}updatePaperViewport(){!this.isPaperSpace||this.associatedBlock==null}};var Un=class extends G{PaperSpaceBlockHandle=null;ActiveViewportHandle=null;BaseUcsHandle=null;NamesUcsHandle=null;LasActiveViewportHandle=null;ViewportHandles=new Set;constructor(e){super(e??new nt)}build(e){super.build(e);let t=e.TryGetCadObject(this.PaperSpaceBlockHandle);t&&(this.CadObject.associatedBlock=t);let i=e.TryGetCadObject(this.ActiveViewportHandle);i&&(this.CadObject.lastActiveViewport=i);let s=e.TryGetCadObject(this.BaseUcsHandle);s&&(this.CadObject.baseUCS=s);let n=e.TryGetCadObject(this.NamesUcsHandle);n&&(this.CadObject.ucs=n);for(let a of this.ViewportHandles){let o=e.TryGetCadObject(a)}}};var vn=class extends ke{Dimasz=0;DIMSTYLEHandle=0;DIMSTYLEName="";AnnotationHandle=0;constructor(e){super(e??new nr)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.DIMSTYLEHandle,this.DIMSTYLEName);i&&(t.style=i);let s=e.TryGetCadObject(this.AnnotationHandle);s&&(t.associatedAnnotation=s)}};var ki=class extends fe{LtypeControlHandle=null;TotalLen=null;SegmentTemplates=[];constructor(e){super(e??new H)}build(e){super.build(e);for(let t of this.SegmentTemplates)t.Build(e),this.CadObject.addSegment(t.Segment)}};(function(r){class e{StyleHandle=null;Segment=new nl;Build(i){let s=i.TryGetCadObject(this.StyleHandle);s&&(this.Segment.style=s)}}r.SegmentTemplate=e})(ki||(ki={}));J();x();var Nl=class extends O{get subclassMarker(){return l.ObjectContextData}version=3;hasFileToExtensionDictionary=!0;default=!1};J();D();x();R();var Ge=class r extends O{static DefaultName="1:1";static get Default(){let e=new r;return e.name=r.DefaultName,e.paperUnits=1,e.drawingUnits=1,e.isUnitScale=!0,e}get objectType(){return u.UNLISTED}get objectName(){return d.ObjectScale}get subclassMarker(){return l.Scale}paperUnits=0;drawingUnits=0;isUnitScale=!1;get scaleFactor(){return this.paperUnits/this.drawingUnits}constructor(e){super(e)}applyTo(e){return e*this.scaleFactor}};Te();x();var Os=class extends Nl{get scale(){return this._scale}set scale(e){if(!e)throw new Error("value cannot be null");this.document!=null?this._scale=I.updateCollection(e,this.document.scales):this._scale=e}get subclassMarker(){return l.AnnotScaleObjectContextData}_scale=Ge.Default;clone(){let e=super.clone();return e._scale=this._scale?.clone(),e}};D();x();R();var Vo=class r{startPoint;endPoint;constructor(e=new c(0,0,0),t=new c(0,0,0)){this.startPoint=e,this.endPoint=t}clone(){return new r(new c(this.startPoint.x,this.startPoint.y,this.startPoint.z),new c(this.endPoint.x,this.endPoint.y,this.endPoint.z))}},zn=class r{arrowhead=null;arrowheadSize=0;breakInfoCount=0;index=0;lineColor=B.ByLayer;_lineType=null;get lineType(){return this._lineType}set lineType(e){this._lineType=e}lineWeight=0;overrideFlags=0;pathType=0;points=[];segmentIndex=0;startEndPoints=[];document=null;assignDocument(e){this.document=e}clone(){let e=new r;return e.arrowheadSize=this.arrowheadSize,e.breakInfoCount=this.breakInfoCount,e.index=this.index,e.lineColor=this.lineColor,e.lineWeight=this.lineWeight,e.overrideFlags=this.overrideFlags,e.pathType=this.pathType,e.segmentIndex=this.segmentIndex,e.points=this.points.map(t=>new c(t.x,t.y,t.z)),e.startEndPoints=this.startEndPoints.map(t=>t.clone()),e}unassignDocument(){this.document=null}},Gn=class r{breakStartEndPointsPairs=[];connectionPoint=new c(0,0,0);contentValid=!1;direction=new c(0,0,0);landingDistance=0;leaderIndex=0;lines=[];textAttachmentDirection=0;unknown=!1;clone(){let e=new r;return e.connectionPoint=new c(this.connectionPoint.x,this.connectionPoint.y,this.connectionPoint.z),e.contentValid=this.contentValid,e.direction=new c(this.direction.x,this.direction.y,this.direction.z),e.landingDistance=this.landingDistance,e.leaderIndex=this.leaderIndex,e.textAttachmentDirection=this.textAttachmentDirection,e.unknown=this.unknown,e.breakStartEndPointsPairs=this.breakStartEndPointsPairs.map(t=>t.clone()),e.lines=this.lines.map(t=>t.clone()),e}},Dr=class extends Os{arrowheadSize=0;backgroundFillColor=B.ByLayer;backgroundFillEnabled=!1;backgroundMaskFillOn=!1;backgroundScaleFactor=0;backgroundTransparency=0;baseDirection=new c(0,0,0);basePoint=new c(0,0,0);baseVertical=new c(0,0,0);_blockContent=null;get blockContent(){return this._blockContent}set blockContent(e){this._blockContent=e}blockContentColor=B.ByLayer;blockContentConnection=0;blockContentLocation=new c(0,0,0);blockContentNormal=new c(0,0,0);blockContentRotation=0;blockContentScale=new c(1,1,1);boundaryHeight=0;boundaryWidth=0;columnFlowReversed=!1;columnGutter=0;columnSizes=[];columnType=0;columnWidth=0;contentBasePoint=new c(0,0,0);direction=new c(0,0,0);flowDirection=0;hasContentsBlock=!1;hasTextContents=!1;landingGap=0;leaderRoots=[];lineSpacing=0;lineSpacingFactor=0;normalReversed=!1;get objectName(){return d.ObjectMLeaderContextData}get objectType(){return u.UNLISTED}scaleFactor=0;get subclassMarker(){return l.MultiLeaderObjectContextData}textAlignment=0;textAttachmentPoint=0;textBottomAttachment=0;textColor=B.ByLayer;textHeight=0;textHeightAutomatic=!1;textLabel="";textLeftAttachment=0;textLocation=new c(0,0,0);textNormal=new c(0,0,0);textRightAttachment=0;textRotation=0;_textStyle=null;get textStyle(){return this._textStyle}set textStyle(e){if(e==null)throw new Error("value cannot be null");this._textStyle=e}textTopAttachment=0;transformationMatrix=it.identity();wordBreak=!1;clone(){let e=super.clone();return e.leaderRoots=this.leaderRoots.map(t=>t.clone()),e}};var ms=class extends K{scaleHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.scaleHandle);i&&(t.scale=i)}};var ai=class extends ms{BlockRecordHandle=0;leaderLineTemplates=[];TextStyleHandle=0;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.TextStyleHandle);i&&(t.textStyle=i);let s=e.TryGetCadObject(this.BlockRecordHandle);s&&(t.blockContent=s);for(let n of this.leaderLineTemplates)n.Build(e)}};(function(r){class e{ArrowSymbolHandle=null;LeaderLine;LineTypeHandle=null;constructor(i){this.LeaderLine=i??new zn}Build(i){let s=i.TryGetCadObject(this.LineTypeHandle);s&&(this.LeaderLine.lineType=s);let n=i.TryGetCadObject(this.ArrowSymbolHandle);n&&(this.LeaderLine.arrowhead=n)}}r.LeaderLineTemplate=e})(ai||(ai={}));var $n=class extends ke{ArrowheadHandle=0;ArrowheadHandles=new Map;BlockAttributeHandles=new Map;BlockContentHandle=0;CadMLeaderAnnotContextTemplate;LeaderLineTypeHandle=null;LeaderStyleHandle=0;MTextStyleHandle=0;constructor(e){let t=e??new lr;super(t),this.CadMLeaderAnnotContextTemplate=new ai(t.contextData)}build(e){super.build(e),this.CadMLeaderAnnotContextTemplate.Build(e);let t=this.CadObject,i=e.TryGetCadObject(this.LeaderStyleHandle);i&&(t.style=i);let s=e.TryGetCadObject(this.LeaderLineTypeHandle);s&&(t.leaderLineType=s);let n=e.TryGetCadObject(this.MTextStyleHandle);n&&(t.textStyle=n);let a=e.TryGetCadObject(this.BlockContentHandle);a&&(t.blockContentId=a);let o=e.TryGetCadObject(this.ArrowheadHandle);o&&(t.arrowhead=o);for(let[h,f]of this.ArrowheadHandles);for(let h of t.blockAttributes){let f=this.BlockAttributeHandles.get(h);if(f!==void 0){let b=e.TryGetCadObject(f);b&&(h.attributeDefinition=b)}}}};J();D();x();R();var Io;(function(r){r[r.LeaderHeadFirst=0]="LeaderHeadFirst",r[r.LeaderTailFirst=1]="LeaderTailFirst"})(Io||(Io={}));var Mo;(function(r){r[r.ContentFirst=0]="ContentFirst",r[r.LeaderFirst=1]="LeaderFirst"})(Mo||(Mo={}));var $e=class r extends O{static get default_(){return new r(r.DefaultName)}alignSpace=0;_arrowhead=null;get arrowhead(){return this._arrowhead}set arrowhead(e){this._arrowhead=e}arrowheadSize=.18;_blockContent=null;get blockContent(){return this._blockContent}set blockContent(e){this._blockContent=e}blockContentColor=B.ByBlock;blockContentConnection=0;blockContentRotation=0;_blockContentScale=new c(1,1,1);get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentScaleX(){return this._blockContentScale.x}set blockContentScaleX(e){this._blockContentScale.x=e}get blockContentScaleY(){return this._blockContentScale.y}set blockContentScaleY(e){this._blockContentScale.y=e}get blockContentScaleZ(){return this._blockContentScale.z}set blockContentScaleZ(e){this._blockContentScale.z=e}breakGapSize=.125;contentType=dn.MText;defaultTextContents="";description="";enableBlockContentRotation=!1;enableBlockContentScale=!1;enableDogleg=!0;enableLanding=!0;firstSegmentAngleConstraint=0;isAnnotative=!1;landingDistance=.36;landingGap=.09;leaderDrawOrder=Io.LeaderHeadFirst;_leaderLineType=null;get leaderLineType(){return this._leaderLineType}set leaderLineType(e){if(e==null)throw new Error("value cannot be null");this._leaderLineType=e}leaderLineWeight=0;lineColor=B.ByLayer;maxLeaderSegmentsPoints=2;multiLeaderDrawOrder=Mo.ContentFirst;get objectName(){return d.ObjectMLeaderStyle}get objectType(){return u.UNLISTED}overwritePropertyValue=!1;pathType=0;scaleFactor=1;secondSegmentAngleConstraint=0;get subclassMarker(){return l.MLeaderStyle}textAlignAlwaysLeft=!1;textAlignment=0;textAngle=0;textAttachmentDirection=0;textBottomAttachment=0;textColor=B.ByBlock;textFrame=!1;textHeight=.18;textLeftAttachment=0;textRightAttachment=0;_textStyle=null;get textStyle(){return this._textStyle}set textStyle(e){if(e==null)throw new Error("value cannot be null");this._textStyle=e}textTopAttachment=0;unknownFlag298=!1;static DefaultName="Standard";constructor(e=""){super(e)}clone(){return super.clone()}};var Yn=class extends G{ArrowheadHandle=null;BlockContentHandle=null;LeaderLineTypeHandle=null;MTextStyleHandle=null;constructor(e){super(e??new $e)}build(e){super.build(e);let t=e.TryGetCadObject(this.LeaderLineTypeHandle);t&&(this.CadObject.leaderLineType=t);let i=e.TryGetCadObject(this.ArrowheadHandle);i&&(this.CadObject.arrowhead=i);let s=e.TryGetCadObject(this.MTextStyleHandle);s&&(this.CadObject.textStyle=s);let n=e.TryGetCadObject(this.BlockContentHandle);n&&(this.CadObject.blockContent=n)}};var Xn=class extends ke{MLineStyleHandle=null;MLineStyleName=null;NVertex=null;NElements=null;_currVertex=null;_currSegmentElement=null;constructor(e){super(e??new or)}TryReadVertex(e,t){let i=this.CadObject;switch(e){case 11:return this._currVertex=new yn,i.vertices.push(this._currVertex),this._currVertex.position=new c(t,this._currVertex.position.Y,this._currVertex.position.Z),!0;case 21:return this._currVertex&&(this._currVertex.position=new c(this._currVertex.position.X,t,this._currVertex.position.Z)),!0;case 31:return this._currVertex&&(this._currVertex.position=new c(this._currVertex.position.X,this._currVertex.position.Y,t)),!0;case 12:return this._currVertex&&(this._currVertex.direction=new c(t,this._currVertex.direction.Y,this._currVertex.direction.Z)),!0;case 22:return this._currVertex&&(this._currVertex.direction=new c(this._currVertex.direction.X,t,this._currVertex.direction.Z)),!0;case 32:return this._currVertex&&(this._currVertex.direction=new c(this._currVertex.direction.X,this._currVertex.direction.Y,t)),!0;case 13:return this._currVertex&&(this._currVertex.miter=new c(t,this._currVertex.miter.Y,this._currVertex.miter.Z)),!0;case 23:return this._currVertex&&(this._currVertex.miter=new c(this._currVertex.miter.X,t,this._currVertex.miter.Z)),!0;case 33:return this._currVertex&&(this._currVertex.miter=new c(this._currVertex.miter.X,this._currVertex.miter.Y,t)),!0;case 74:return this._currSegmentElement=new Bn,this._currVertex&&this._currVertex.segments.push(this._currSegmentElement),!0;case 41:return this._currSegmentElement?.parameters.push(t),!0;case 42:return this._currSegmentElement?.areaFillParameters.push(t),!0;case 75:return!0;default:return!1}}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.MLineStyleHandle);i&&(t.style=i)}};J();Te();D();x();R();var ge;(function(r){r[r.None=0]="None",r[r.FillOn=1]="FillOn",r[r.DisplayJoints=2]="DisplayJoints",r[r.StartSquareCap=16]="StartSquareCap",r[r.StartInnerArcsCap=32]="StartInnerArcsCap",r[r.StartRoundCap=64]="StartRoundCap",r[r.EndSquareCap=256]="EndSquareCap",r[r.EndInnerArcsCap=512]="EndInnerArcsCap",r[r.EndRoundCap=1024]="EndRoundCap"})(ge||(ge={}));var js=class r{color=B.ByLayer;_lineType=null;get lineType(){return this._lineType}set lineType(e){this._lineType=I.updateCollectionStatic(e,this.owner?.document?.lineTypes)}offset=0;owner=null;clone(){let e=new r;return e.color=this.color,e.offset=this.offset,e.owner=null,e._lineType=this._lineType,e}assignDocument(e){this._lineType=I.updateCollectionStatic(this._lineType,e.lineTypes)}unassignDocument(){}},wt=class r extends O{static get default_(){let e=new r(r.DefaultName);e.startAngle=Math.PI/2,e.endAngle=Math.PI/2;let t=new js;t.offset=.5,e.addElement(t);let i=new js;return i.offset=-.5,e.addElement(i),e}description="";get elements(){return this._elements}endAngle=Math.PI/2;fillColor=B.ByLayer;flags=ge.None;get objectName(){return d.ObjectMLineStyle}get objectType(){return u.MLINESTYLE}startAngle=Math.PI/2;get subclassMarker(){return l.MLineStyle}static DefaultName="Standard";_elements=[];constructor(e){super(e)}addElement(e){if(e.owner!=null)throw new Error(`Element already assigned to a MLineStyle: ${e.owner.name}`);e.lineType=I.updateCollection(e.lineType,this.document?.lineTypes),e.owner=this,this._elements.push(e)}clone(){let e=super.clone();e._elements=[];for(let t of this._elements)e.addElement(t.clone());return e}};var Pi=class extends G{ElementTemplates=[];constructor(e){super(e??new wt)}build(e){super.build(e);for(let t of this.ElementTemplates)t.Build(e)}};(function(r){class e{Element;LineTypeHandle=null;LinetypeIndex=null;LineTypeName=null;constructor(i){this.Element=i}Build(i){let s=i.TryGetCadObject(this.LineTypeHandle);if(s)this.Element.lineType=s;else if(s=i.TryGetTableEntry(this.LineTypeName??""),s)this.Element.lineType=s;else if(this.LinetypeIndex!=null)if(this.LinetypeIndex===32767){let n=i.TryGetTableEntry(H.ByLayerName);n&&(this.Element.lineType=n)}else if(this.LinetypeIndex===32766){let n=i.TryGetTableEntry(H.ByBlockName);n&&(this.Element.lineType=n)}else try{let n=i.LineTypesTable;if(n){let a=Array.from(n);this.LinetypeIndex<a.length&&(this.Element.lineType=a[this.LinetypeIndex])}}catch(n){i.Notify(`Linetype not assigned, index ${this.LinetypeIndex}`,g.Error,n)}}}r.ElementTemplate=e})(Pi||(Pi={}));J();D();x();R();var Oi;(function(r){r[r.None=0]="None",r[r.NoAutoTransform=1]="NoAutoTransform",r[r.ScaleMapper=2]="ScaleMapper",r[r.IncludeCurrentBlock=4]="IncludeCurrentBlock"})(Oi||(Oi={}));var oi;(function(r){r[r.Current=0]="Current",r[r.Override=1]="Override"})(oi||(oi={}));var ee;(function(r){r[r.UseCurrentScene=0]="UseCurrentScene",r[r.UseImageFile=1]="UseImageFile",r[r.Procedural=2]="Procedural"})(ee||(ee={}));var ji;(function(r){r[r.None=0]="None",r[r.Planar=1]="Planar",r[r.Box=2]="Box",r[r.Cylinder=3]="Cylinder",r[r.Sphere=4]="Sphere"})(ji||(ji={}));var Ni;(function(r){r[r.None=0]="None",r[r.Tile=1]="Tile",r[r.Crop=2]="Crop",r[r.Clamp=3]="Clamp"})(Ni||(Ni={}));var at=class extends O{ambientColor=B.ByLayer;_ambientColorFactor=1;get ambientColorFactor(){return this._ambientColorFactor}set ambientColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._ambientColorFactor=e}ambientColorMethod=oi.Current;bumpAutoTransform=Oi.NoAutoTransform;bumpMapBlendFactor=1;bumpMapFileName="";bumpMapSource=ee.UseImageFile;bumpMatrix=[];bumpProjectionMethod=ji.Planar;bumpTilingMethod=Ni.Tile;channelFlags=0;description="";diffuseAutoTransform=Oi.NoAutoTransform;diffuseColor=B.ByLayer;_diffuseColorFactor=1;get diffuseColorFactor(){return this._diffuseColorFactor}set diffuseColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._diffuseColorFactor=e}diffuseColorMethod=oi.Current;diffuseMapBlendFactor=1;diffuseMapFileName="";diffuseMapSource=ee.UseImageFile;diffuseMatrix=[];diffuseProjectionMethod=ji.Planar;diffuseTilingMethod=Ni.Tile;illuminationModel=0;get objectName(){return d.ObjectMaterial}get objectType(){return u.UNLISTED}opacity=1;opacityAutoTransform=Oi.NoAutoTransform;opacityMapBlendFactor=1;opacityMapFileName="";opacityMapSource=ee.UseImageFile;opacityMatrix=[];opacityProjectionMethod=ji.Planar;opacityTilingMethod=Ni.Tile;reflectionAutoTransform=Oi.NoAutoTransform;reflectionMapBlendFactor=1;reflectionMapFileName="";reflectionMapSource=ee.UseImageFile;reflectionMatrix=[];reflectionProjectionMethod=ji.Planar;reflectionTilingMethod=Ni.Tile;reflectivity=0;refractionAutoTransform=Oi.NoAutoTransform;refractionIndex=1;refractionMapBlendFactor=1;refractionMapFileName="";refractionMapSource=ee.UseImageFile;refractionMatrix=[];refractionProjectionMethod=ji.Planar;refractionTilingMethod=Ni.Tile;specularAutoTransform=Oi.NoAutoTransform;specularColor=B.ByLayer;_specularColorFactor=1;get specularColorFactor(){return this._specularColorFactor}set specularColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._specularColorFactor=e}specularColorMethod=oi.Current;specularGlossFactor=.5;specularMapBlendFactor=1;specularMapFileName="";specularMapSource=ee.UseImageFile;specularMatrix=[];specularProjectionMethod=ji.Planar;specularTilingMethod=Ni.Tile;get subclassMarker(){return l.Material}translucence=0;static ByBlockName="ByBlock";static ByLayerName="ByLayer";static GlobalName="Global";constructor(e){super(e)}};var Zn=class extends G{constructor(e){super(e??new at)}build(e){super.build(e)}};var Kn=class extends ke{SubclassMarker=!1;constructor(e){super(e??new ar)}};var Jn=class extends ke{Chunks=[];constructor(e){super(e??new dr)}build(e){if(super.build(e),this.Chunks.length>0){let t=this.Chunks.reduce((n,a)=>n+a.length,0),i=new Uint8Array(t),s=0;for(let n of this.Chunks)i.set(n,s),s+=n.length;this.CadObject.binaryData=i}if(this.CadObject.binaryData&&this.CadObject.binaryData.length>0){let t=new DataView(this.CadObject.binaryData.buffer,this.CadObject.binaryData.byteOffset),i=2;this.CadObject.upperLeftCorner=this.read3Double(t,i),i+=24,i+=24,this.CadObject.lowerRightCorner=this.read3Double(t,i)}}read3Double(e,t){let i=e.getFloat64(t,!0),s=e.getFloat64(t+8,!0),n=e.getFloat64(t+16,!0);return new c(i,s,n)}};R();var Kt=class extends k{FirstVertexHandle=null;LastVertexHandle=null;SeqendHandle=null;OwnedObjectsHandlers=new Set;constructor(e){super(e||new Fh)}SetPolyLineObject(e){e.handle=this.CadObject.handle,e.color=this.CadObject.color,e.lineWeight=this.CadObject.lineWeight,e.lineTypeScale=this.CadObject.lineTypeScale,e.isInvisible=this.CadObject.isInvisible,e.transparency=this.CadObject.transparency,this.CadObject=e}addVertices(e,...t){let i=this.CadObject;if(i instanceof et)for(let s of t)i.vertices.push(s),s.owner=i;else if(i instanceof tt)for(let s of t)i.vertices.push(s),s.owner=i;else if(i instanceof ut)for(let s of t)this.addPolyfaceMeshVertex(e,i,s);else if(i instanceof Et)for(let s of t)i.vertices.push(s),s.owner=i;else e.Notify(`Unknown polyline type ${this.CadObject.subclassMarker}`,g.Warning)}build(e){super.build(e);let t=e.TryGetCadObject(this.SeqendHandle);if(t&&this.setSeqend(e,t),this.FirstVertexHandle!=null){let i=Array.from(this.getEntitiesCollection(e,this.FirstVertexHandle,this.LastVertexHandle));this.addVertices(e,...i)}else if(this.CadObject instanceof ut)this.buildPolyfaceMesh(this.CadObject,e);else for(let i of this.OwnedObjectsHandlers){let s=e.TryGetCadObject(i);if(s)this.addVertices(e,s);else{let n=e.TryGetCadObject(i);n?this.setSeqend(e,n):e.Notify(`Vertex ${i} not found for polyline ${this.CadObject.handle}`,g.Warning)}}}setSeqend(e,t){let i=this.CadObject;t.owner=i,i instanceof et||i instanceof tt||i instanceof ut||i instanceof Et?i.vertices.Seqend=t:e.Notify(`Unknown polyline type ${this.CadObject.subclassMarker}`,g.Warning)}buildPolyfaceMesh(e,t){for(let i of this.OwnedObjectsHandlers){let s=t.TryGetCadObject(i);s&&this.addPolyfaceMeshVertex(t,e,s)}}addPolyfaceMeshVertex(e,t,i){i instanceof ri?(t.vertices.push(i),i.owner=t):i instanceof Zt?(t.faces.push(i),i.owner=t):i instanceof Le?(t.vertices.Seqend=i,i.owner=t):e.Notify(`Unidentified type for PolyfaceMesh ${i.constructor.name}`)}},Fh=class extends hr{get objectType(){return u.INVALID}get subclassMarker(){return"PolyLinePlaceholder"}getBoundingBox(){return null}};var Vl=class extends G{constructor(e){super(e)}};var qn=class extends k{ShapeIndex=null;ShapeFileHandle=null;ShapeFileName=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.ShapeFileHandle,this.ShapeFileName??"");i&&(i.isShapeFile?t.shapeStyle=i:e.Notify(`Shape style ${this.ShapeFileHandle} | ${this.ShapeFileName} not found`,g.Warning))}};var Qn=class extends ke{HistoryHandle=null;constructor(e){super(e??new ti)}};var ea=class extends ke{constructor(e){super(e??new mr)}};var Sr=class extends k{StyleHandle=null;StyleName=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.StyleHandle,this.StyleName??"");i&&(t.style=i)}};var Ns=class extends Sr{MTextTemplate=null;constructor(e){super(e)}build(e){super.build(e),this.MTextTemplate!==null&&this.MTextTemplate.Build(e)}};var ta=class extends k{DimensionStyleHandle=null;DimensionStyleName=null;constructor(e){super(e??new Yt)}build(e){super.build(e);let t=this.getTableReference(e,this.DimensionStyleHandle,this.DimensionStyleName);t&&(this.CadObject.style=t)}};var ra=class extends fe{constructor(e){super(e??new ot)}};D();x();R();var Vi=class extends De{get objectType(){return u.VIEW}get objectName(){return d.TableView}get subclassMarker(){return l.View}height=0;width=0;lensLength=0;frontClipping=0;backClipping=0;angle=0;viewMode=se.Off;isUcsAssociated=!1;isPlottable=!1;renderMode=en.Optimized2D;center=new C(0,0);direction=new c(0,0,0);target=new c(0,0,0);visualStyle=null;ucsOrigin=new c(0,0,0);ucsXAxis=new c(0,0,0);ucsYAxis=new c(0,0,0);ucsElevation=0;ucsOrthographicType=Mt.None;constructor(e){super(e)}clone(){let e=super.clone();return e.visualStyle=this.visualStyle?.clone?.()??null,e}};var ia=class extends fe{VisualStyleHandle=null;NamedUcsHandle=null;UcsHandle=null;constructor(e){super(e??new Vi)}build(e){super.build(e)}};var sa=class extends ke{ViewportHeaderHandle=null;BoundaryHandle=null;NamedUcsHandle=null;BaseUcsHandle=null;VisualStyleHandle=null;ViewportId=null;BlockHandle=null;FrozenLayerHandles=new Set;constructor(e){super(e??new fr)}build(e){super.build(e);let t=e.TryGetCadObject(this.BoundaryHandle);t?this.CadObject.boundary=t:this.BoundaryHandle!=null&&this.BoundaryHandle>0&&e.Notify(`Boundary ${this.BoundaryHandle} not found for viewport ${this.CadObject.handle}`,g.Warning),this.NamedUcsHandle!=null&&this.NamedUcsHandle>0&&e.Notify(`Named ucs not implemented for Viewport, handle ${this.NamedUcsHandle}`),this.BaseUcsHandle!=null&&this.BaseUcsHandle>0&&e.Notify(`Base ucs not implemented for Viewport, handle ${this.BaseUcsHandle}`);for(let i of this.FrozenLayerHandles){let s=e.TryGetCadObject(i);s?this.CadObject.frozenLayers.push(s):e.Notify(`Frozen layer ${i} not found for viewport ${this.CadObject.handle}`,g.Warning)}}};Te();R();var Il=class extends Pt{EntryHandles=new Set;constructor(){super(new Uh)}build(e){super.build(e)}},Uh=class extends I{get objectType(){return u.INVALID}get subclassMarker(){return""}};var Ml=class extends fe{BlockHandle=null;constructor(e){super(e)}};var na=class extends fe{VportControlHandle=0;BackgroundHandle=null;StyleHandle=null;SunHandle=null;NamedUcsHandle=null;BaseUcsHandle=null;constructor(e){super(e??new xt)}build(e){super.build(e);let t=e.TryGetCadObject(this.BaseUcsHandle);t?this.CadObject.baseUcs=t:this.BaseUcsHandle!=null&&this.BaseUcsHandle>0&&e.Notify(`Boundary ${this.BaseUcsHandle} not found for viewport ${this.CadObject.handle}`,g.Warning);let i=e.TryGetCadObject(this.NamedUcsHandle);i?this.CadObject.baseUcs=i:this.NamedUcsHandle!=null&&this.NamedUcsHandle>0&&e.Notify(`Boundary ${this.BaseUcsHandle} not found for viewport ${this.CadObject.handle}`,g.Warning);let s=e.TryGetCadObject(this.StyleHandle)}};var mn=class extends k{ImgDefHandle=null;ImgReactorHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.ImgDefHandle);i&&(t.definition=i);let s=e.TryGetCadObject(this.ImgReactorHandle);s&&(t.definitionReactor=s)}};kr();var Vs=class extends G{Entries=new Map;constructor(e){super(e??new xe)}build(e){if(super.build(e),this.OwnerHandle!=null&&this.OwnerHandle===0&&e.DocumentToBuild.rootDictionary==null)if(e instanceof On){let t=e;this.CadObject.handle===t.HeaderHandles.DICTIONARY_NAMED_OBJECTS?e.DocumentToBuild.rootDictionary=this.CadObject:e.DocumentToBuild.rootDictionary=this.CadObject}else e.DocumentToBuild.rootDictionary=this.CadObject;for(let[t,i]of this.Entries){let s=e.TryGetCadObject(i);if(s){(!s.name||s.name.length===0)&&(s.name=t);try{this.CadObject.add(s)}catch(n){e.Notify(`Error when trying to add the entry ${s.name} to ${this.CadObject.name}|${this.CadObject.handle}`,g.Error,n)}}else e.Notify(`Entry not found ${t}|${i} for dictionary ${this.CadObject.name}|${this.CadObject.handle}`,g.Warning)}}};kr();D();x();R();var Cr=class extends xe{defaultEntry=null;get objectName(){return d.ObjectDictionaryWithDefault}get objectType(){return u.UNLISTED}get subclassMarker(){return l.DictionaryWithDefault}constructor(e,t){super(e),t&&(this.defaultEntry=t)}};var aa=class extends Vs{DefaultEntryHandle=null;constructor(e){super(e??new Cr)}build(e){super.build(e);let t=e.TryGetCadObject(this.DefaultEntryHandle);t&&(this.CadObject.defaultEntry=t)}};J();D();x();R();var Wo;(function(r){r[r.Unknown=0]="Unknown",r[r.LocalGrid=1]="LocalGrid",r[r.ProjectedGrid=2]="ProjectedGrid",r[r.Geographic=3]="Geographic"})(Wo||(Wo={}));var We;(function(r){r[r.R2009=1]="R2009",r[r.R2010=2]="R2010",r[r.R2013=3]="R2013"})(We||(We={}));var Ho;(function(r){r[r.None=1]="None",r[r.UserSpecifiedScaleFactor=2]="UserSpecifiedScaleFactor",r[r.GridScaleAtReferencePoint=3]="GridScaleAtReferencePoint",r[r.Prismodial=4]="Prismodial"})(Ho||(Ho={}));var oa=class{index1=0;index2=0;index3=0},la=class{source=new C(0,0);destination=new C(0,0);toString(){return`src:${this.source.x},${this.source.y} dest:${this.destination.x},${this.destination.y}`}},Jt=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectGeoData}get subclassMarker(){return l.GeoData}version=We.R2013;coordinatesType=Wo.LocalGrid;hostBlock=null;designPoint=new c(0,0,0);referencePoint=new c(0,0,0);northDirection=new C(0,1);horizontalUnitScale=1;verticalUnitScale=1;horizontalUnits=0;verticalUnits=0;upDirection=new c(0,0,1);scaleEstimationMethod=Ho.None;enableSeaLevelCorrection=!1;userSpecifiedScaleFactor=0;seaLevelElevation=0;coordinateProjectionRadius=0;coordinateSystemDefinition="";geoRssTag="";observationFromTag="";observationToTag="";observationCoverageTag="";points=[];faces=[]};var da=class extends G{HostBlockHandle=null;constructor(e){super(e??new Jt)}build(e){super.build(e);let t=this.getTableReference(e,this.HostBlockHandle,"");t&&(this.CadObject.hostBlock=t)}};J();D();x();R();var Ot=class extends O{description="";get entities(){return this._entities}get isUnnamed(){return!this.name||this.name.startsWith("*")}get objectName(){return d.TableGroup}get objectType(){return u.GROUP}selectable=!0;get subclassMarker(){return l.Group}_entities=[];constructor(e){super(e)}add(e){if(this.document!==e.document)throw new Error("The Group and the entity must belong to the same document.");this._entities.push(e),e.addReactor(this)}addRange(e){for(let t of e)this.add(t)}clear(){for(let e of this._entities)e.removeReactor(this);this._entities=[]}remove(e){e.removeReactor(this);let t=this._entities.indexOf(e);return t>=0?(this._entities.splice(t,1),!0):!1}clone(){let e=super.clone();return e._entities=[],e}};var ha=class extends G{Handles=new Set;constructor(e){super(e??new Ot)}build(e){super.build(e);for(let t of this.Handles){let i=e.GetObjectTemplate(t);if(i){i.Build(e);try{this.CadObject.add(i.CadObject)}catch(s){e.Notify(`Entity with handle ${t} could not be added to group ${this.CadObject.handle}`,g.Error,s)}}else e.Notify(`Entity with handle ${t} not found for group ${this.CadObject.handle}`,g.Warning)}}};J();D();x();R();var ah=class{sortHandle=0;entity=null;constructor(e,t){this.entity=e,this.sortHandle=t}toString(){return`${this.sortHandle} | ${this.entity?.toString()}`}compareTo(e){return this.sortHandle<e.sortHandle?-1:this.sortHandle>e.sortHandle?1:0}},Br=class r extends O{blockOwner=null;get objectName(){return d.ObjectSortEntsTable}get objectType(){return u.UNLISTED}get subclassMarker(){return l.SortentsTable}static DictionaryEntryName="ACAD_SORTENTS";_sorters=[];constructor(e){super(r.DictionaryEntryName),e&&(this.blockOwner=e)}add(e,t){this._sorters.push(new ah(e,t))}clear(){this._sorters.length=0}clone(){let e=super.clone();return e._sorters=[],e}getSorterHandle(e){let t=this._sorters.find(i=>i.entity===e);return t?t.sortHandle:e.handle}remove(e){let t=this._sorters.findIndex(i=>i.entity===e);return t<0?!1:(this._sorters.splice(t,1),!0)}[Symbol.iterator](){return[...this._sorters].sort((t,i)=>t.compareTo(i))[Symbol.iterator]()}};var ca=class extends G{BlockOwnerHandle=null;Values=[];constructor(e){super(e??new Br)}build(e){super.build(e);let t=e.TryGetCadObject(this.BlockOwnerHandle);if(t)if(t instanceof U)this.CadObject.blockOwner=t;else{e.Notify(`Block owner for SortEntitiesTable ${this.CadObject.handle} is not a block ${t.constructor.name} | ${t.handle}`,g.Warning);return}else{e.Notify(`Block owner for SortEntitiesTable ${this.CadObject.handle} not found`,g.Warning);return}for(let i of this.Values){let s=e.TryGetCadObject(i[1]);s?this.CadObject.add(s,i[0]):e.Notify(`Entity in SortEntitiesTable ${this.CadObject.handle} not found ${i[1]}`,g.Warning)}}};J();D();x();R();var Fo;(function(r){r[r.Down=0]="Down",r[r.Up=1]="Up"})(Fo||(Fo={}));var Ye=class r extends O{static get default_(){return new r(r.DefaultName)}cellStyles=[];dataCellStyle={};description="";flags=0;flowDirection=Fo.Down;headerCellStyle={};horizontalCellMargin=.06;get objectName(){return d.TableStyle}get objectType(){return u.UNLISTED}get subclassMarker(){return l.TableStyle}suppressHeaderRow=!1;suppressTitle=!1;tableCellStyle={};titleCellStyle={};verticalCellMargin=.06;static DefaultName="Standard";constructor(e=""){super(e)}};var ua=class extends xr{BlockOwnerHandle=null;cadTableCellTemplates=[];get CurrentCell(){return this.CurrentCellTemplate.Cell}CurrentCellTemplate;HorizontalMargin=null;NullHandle=null;styleHandle=null;get TableEntity(){return this.CadObject}_currCellIndex=0;constructor(e){super(e??new Ti)}CreateCell(e){let t=Math.floor(this._currCellIndex/this.TableEntity.columns.length),i=new ys;i.type=e,this.TableEntity.rows[t].cells.push(i),this.CurrentCellTemplate=new Uo(i),this.cadTableCellTemplates.push(this.CurrentCellTemplate),this._currCellIndex++}build(e){super.build(e);for(let t of this.cadTableCellTemplates)t.Build(e)}},ma=class{Format;TextStyleHandle=null;TextStyleName=null;constructor(e){this.Format=e}Build(e){throw new Error("Not implemented")}},jt=class extends ma{BorderLinetypePairs=[];get CellStyle(){return this.Format}textStyleHandle=null;constructor(e){super(e??new os)}},vh=class{AttDefHandle=null;_tableAtt;constructor(e){this._tableAtt=e}Build(e){throw new Error("Not implemented")}},fa=class{BlockRecordHandle=null;CadValueTemplate=null;Content;FieldHandle=null;constructor(e){this.Content=e}Build(e){throw new Error("Not implemented")}},Uo=class{AttributeHandles=new Set;Cell;ContentTemplates=[];FormatTextHeight=null;StyleId=0;TextStyleOverrideHandle=null;UnknownHandle=null;ValueHandle=null;constructor(e){this.Cell=e}Build(e){let t=e.TryGetCadObject(this.ValueHandle)}};var pa=class extends Pt{CellStyleTemplates=[];CurrentCellStyleTemplate;constructor(e){super(e??new Ye)}CreateCurrentCellStyleTemplate(){return this.CurrentCellStyleTemplate=new jt,this.CellStyleTemplates.push(this.CurrentCellStyleTemplate),this.CurrentCellStyleTemplate}build(e){super.build(e);for(let t of this.CellStyleTemplates)this.CadObject.cellStyles.push(t.CellStyle)}};J();Te();D();x();R();il();var oh=class{code;value;owner;get groupCode(){return Be.transformValue(this.code)}get hasLinkedObject(){let e=this.groupCode;return e===5||e===105}constructor(e,t,i){this.code=e,this.value=t,this.owner=i}getReference(){return this.hasLinkedObject&&this.value instanceof I?this.value.document!==this.owner.document?null:this.value:null}toString(){return`${this.code}:${this.value}`}},_t=class extends O{cloningFlags=bs.NotApplicable;get entries(){return this._entries}get objectName(){return d.ObjectXRecord}get objectType(){return u.XRECORD}get subclassMarker(){return l.XRecord}_entries=[];constructor(e){super(e)}createEntry(e,t){this._entries.push(new oh(e,t,this))}CreateEntry(e,t){this.createEntry(e,t)}};var wa=class extends Pt{_entries=[];constructor(e){super(e??new _t)}AddHandleReference(e,t){this._entries.push([e,t])}build(e){super.build(e);for(let t of this._entries){let i=e.TryGetCadObject(t[1]);i?this.CadObject.createEntry(t[0],i):e.Notify(`XRecord reference not found ${t[0]}|${t[1]}`,g.Warning)}}};var _a=class extends K{constructor(e){super(e)}},ba=class extends k{constructor(e){super(e)}};var ga=class extends k{DefinitionHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.DefinitionHandle);i?t.definition=i:e.Notify(`UnderlayDefinition not found for ${this.CadObject.handle}`,g.Warning)}};J();D();x();R();var he;(function(r){r[r.None=0]="None",r[r.FirstPointReference=1]="FirstPointReference",r[r.SecondPointReference=2]="SecondPointReference",r[r.ThirdPointReference=4]="ThirdPointReference",r[r.FourthPointReference=8]="FourthPointReference"})(he||(he={}));var vo;(function(r){r[r.None=0]="None",r[r.Endpoint=1]="Endpoint",r[r.Midpoint=2]="Midpoint",r[r.Center=3]="Center",r[r.Node=4]="Node",r[r.Quadrant=5]="Quadrant",r[r.Intersection=6]="Intersection",r[r.Insertion=7]="Insertion",r[r.Perpendicular=8]="Perpendicular",r[r.Tangent=9]="Tangent",r[r.Nearest=10]="Nearest",r[r.ApparentIntersection=11]="ApparentIntersection",r[r.Parallel=12]="Parallel",r[r.StartPoint=13]="StartPoint"})(vo||(vo={}));var zo;(function(r){r[r.Unknown=0]="Unknown",r[r.Parallel=1]="Parallel",r[r.Perpendicular=2]="Perpendicular"})(zo||(zo={}));var Go;(function(r){r[r.Unknown=0]="Unknown",r[r.Edge=1]="Edge",r[r.Face=2]="Face"})(Go||(Go={}));var fs=class{geometryParameter=0;objectOsnapType=vo.None;osnapPoint=new c(0,0,0);subentType=Go.Unknown;gsMarker=0;intersectionSubType=Go.Unknown;intersectionGsMarker=0;hasLastPointRef=!1;geometry=null},Xe=class extends O{associativityFlags=he.None;dimension=null;firstPointRef=null;fourthPointRef=null;isTransSpace=!1;get objectName(){return d.ObjectDimensionAssociation}get objectType(){return u.UNLISTED}rotatedDimensionType=zo.Unknown;secondPointRef=null;get subclassMarker(){return l.DimensionAssociation}thirdPointRef=null;static OsnapPointRefClassName="AcDbOsnapPointRef"};var Ii=class extends G{DimensionHandle=null;FirstPointRef=null;FourthPointRef=null;SecondPointRef=null;ThirdPointRef=null;constructor(e){super(e??new Xe)}build(e){super.build(e);let t=e.TryGetCadObject(this.DimensionHandle);t&&(this.CadObject.dimension=t),this.FirstPointRef!==null&&(this.CadObject.firstPointRef=this.FirstPointRef.OsnapPointRef,this.FirstPointRef.Build(e)),this.SecondPointRef!==null&&(this.CadObject.secondPointRef=this.SecondPointRef.OsnapPointRef,this.SecondPointRef.Build(e)),this.ThirdPointRef!==null&&(this.CadObject.thirdPointRef=this.ThirdPointRef.OsnapPointRef,this.ThirdPointRef.Build(e)),this.FourthPointRef!==null&&(this.CadObject.fourthPointRef=this.FourthPointRef.OsnapPointRef,this.FourthPointRef.Build(e))}};(function(r){class e{ObjectHandle=null;OsnapPointRef;constructor(i){this.OsnapPointRef=i}Build(i){let s=i.TryGetCadObject(this.ObjectHandle);s&&(this.OsnapPointRef.geometry=s)}}r.OsnapPointRefTemplate=e})(Ii||(Ii={}));J();D();x();R();var zh=class{},xa=class r{index=0;nextNodeIndex=0;next=null;flags=0;data1=0;data2=0;data3=0;data4=0;expression=null;clone(){let e=new r;return e.index=this.index,e.nextNodeIndex=this.nextNodeIndex,e.flags=this.flags,e.data1=this.data1,e.data2=this.data2,e.data3=this.data3,e.data4=this.data4,e.next=this.next?.clone()??null,e.expression=this.expression?.clone()??null,e}},yr=class extends O{edges=[];nodes=[];get objectName(){return d.ObjectEvalGraph}get objectType(){return u.UNLISTED}get subclassMarker(){return l.EvalGraph}value96=0;value97=0;static DictionaryEntryName="ACAD_ENHANCEDBLOCK";clone(){let e=super.clone();return e.nodes=this.nodes.map(t=>t.clone()),e}};var Mi=class extends G{NodeTemplates=[];constructor(e){super(e??new yr)}build(e){super.build(e);for(let t of this.NodeTemplates)t.Build(e),this.CadObject.nodes.push(t.Node)}};(function(r){class e{Node=new xa;ExpressionHandle=null;Build(i){let s=i.TryGetCadObject(this.ExpressionHandle);s?this.Node.expression=s:i.Notify(`Evaluation graph couldn't find the EvaluationExpression with handle ${this.ExpressionHandle}`,g.Warning)}}r.GraphNodeTemplate=e})(Mi||(Mi={}));var Da=class extends G{constructor(e){super(e)}};var Is=class extends Da{get blockElement(){return this.CadObject}constructor(e){super(e)}};var Sa=class extends Is{get blockAction(){return this.CadObject}entityHandles=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.entityHandles){let i=e.TryGetCadObject(t);i?this.blockAction.entities.push(i):e.Notify(`[${this.blockAction.toString()}] entity with handle ${t} not found.`)}}};var Wl=class extends Sa{get BlockFlipAction(){return this.CadObject}constructor(e){super(e)}};var Ca=class extends Is{get blockParameter(){return this.CadObject}constructor(e){super(e)}};var Ba=class extends Ca{get block2PtParameter(){return this.CadObject}constructor(e){super(e)}};var Hl=class extends Ba{get BlockFlipParameter(){return this.CadObject}constructor(e){super(e)}};Te();x();R();var ya=class extends I{id=0;get objectType(){return u.UNLISTED}get subclassMarker(){return l.EvalGraphExpr}value98=0;value99=0};x();var Ms=class extends ya{get subclassMarker(){return l.BlockElement}elementName="";value1071=0};x();var Ra=class extends Ms{get subclassMarker(){return l.BlockParameter}value280=!1;value281=!1};x();var Ws=class extends Ra{firstPoint=new c(0,0,0);secondPoint=new c(0,0,0);get subclassMarker(){return l.Block2PtParameter}value170=0;value171=0;value172=0;value173=0;value174=0;value177=0;value303="";value304="";value94=0;value95=0};D();x();var Hs=class extends Ws{description="";name="";nameOffset=0;get objectName(){return d.ObjectBlockRotationParameter}point=new c(0,0,0);get subclassMarker(){return l.BlockRotationParameter}value141=0;value142=0;value143=0;value175=0;value307="";value96=0};var Ta=class extends Ba{constructor(e){super(e??new Hs)}};x();var Aa=class extends Ra{get subclassMarker(){return l.Block1PtParameter}location=new c(0,0,0);value93=0;value170=0;value171=0};D();x();var Ea=class r{name="";entities=[];expressions=[];clone(){let e=new r;return e.name=this.name,e.entities=this.entities.map(t=>t.clone?t.clone():{...t}),e.expressions=this.expressions.map(t=>t.clone()),e}},Fs=class extends Aa{description="";entities=[];name="";get objectName(){return d.ObjectBlockVisibilityParameter}_states=new Map;get states(){return this._states}get subclassMarker(){return l.BlockVisibilityParameter}value91=!1;addState(e){this._states.set(e.name,e)}clone(){let e=super.clone();e.entities=this.entities.map(t=>t.clone?t.clone():{...t}),e._states=new Map;for(let[t,i]of this._states){let s=i.clone();e._states.set(s.name,s)}return e}};var Fl=class extends Ca{get block1PtParameter(){return this.CadObject}constructor(e){super(e)}};var Wi=class extends Fl{entityHandles=[];StateTemplates=[];constructor(e){super(e??new Fs)}build(e){super.build(e);let t=this.CadObject;for(let i of this.entityHandles){let s=e.TryGetCadObject(i);s?t.entities.push(s):e.Notify(`[${t.toString()}] entity with handle ${i} not found.`)}for(let i of this.StateTemplates)i.Build(e,this.entityHandles),t.addState(i.state)}};(function(r){class e{state=new Ea;entityHandles=new Set;expressionHandles=new Set;constructor(i){i&&(this.state=i)}Build(i,s){this.setEntities(i,this.state.entities,this.entityHandles,s),this.setEntities(i,this.state.expressions,this.expressionHandles,null)}setEntities(i,s,n,a){for(let o of n){a!==null&&!a.includes(o)&&i.Notify(`[${this.state.toString()}] parent does not contain handle ${o}.`);let h=i.TryGetCadObject(o);h?s.push(h):i.Notify(`[${this.state.toString()}] object with handle ${o} not found.`)}}}r.StateTemplate=e})(Wi||(Wi={}));x();var La=class extends Ms{actionPoint=new c(0,0,0);entities=[];get subclassMarker(){return l.BlockAction}value70=0};x();var Ul=class extends La{get subclassMarker(){return l.BlockActionBasePt}value1011=new c(0,0,0);value1012=new c(0,0,0);value280=!1;value301="";value302="";value92=0;value93=0};x();var Us=class extends Ul{get subclassMarker(){return l.BlockRotationAction}value303="";value94=0};var vl=class extends Sa{constructor(e){super(e)}};var ka=class extends vl{constructor(e){super(e??new Us)}};J();D();x();var Rr=class extends O{block=null;get objectName(){return d.ObjectBlockRepresentationData}get subclassMarker(){return l.BlockRepresentationData}value70=0};var Pa=class extends G{BlockHandle=null;constructor(e){super(e??new Rr)}build(e){super.build(e);let t=this.getTableReference(e,this.BlockHandle,"");t&&(this.CadObject.block=t)}};x();var vs=class extends Ms{location=new c(0,0,0);get subclassMarker(){return l.BlockGrip}value280=0;value91=0;value92=0;value93=0};D();x();var Oa=class extends vs{get objectName(){return d.ObjectBlockRotationGrip}get subclassMarker(){return l.BlockRotationGrip}};var ja=class extends Is{constructor(e){super(e)}};var Na=class extends ja{constructor(e){super(e??new Oa)}};D();x();var Va=class extends vs{get objectName(){return d.ObjectBlockVisibilityGrip}get subclassMarker(){return l.BlockVisibilityGrip}};var Ia=class extends ja{constructor(e){super(e??new Va)}};D();x();var zs=class extends ya{get objectName(){return d.ObjectBlockGripLocationComponent}get subclassMarker(){return l.BlockGripExpression}value300="";value91=0};var Ma=class extends Da{constructor(e){super(e??new zs)}};var Wa=class extends G{CadObjectsHandles=[];CadValueTemplates=[];ChildrenHandles=[];constructor(e){super(e)}build(e){super.build(e);for(let t of this.CadObjectsHandles){let i=e.TryGetCadObject(t);i?this.CadObject.cadObjects.push(i):e.Notify(`[${this.CadObject.subclassMarker}] CadObject with handle ${t} not found.`,g.Warning)}for(let t of this.ChildrenHandles){let i=e.TryGetCadObject(t);i?this.CadObject.children.push(i):e.Notify(`[${this.CadObject.subclassMarker}] CadObject with handle ${t} not found.`,g.Warning)}}};var Ha=class extends G{OwnedObjectsHandlers=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.OwnedObjectsHandlers){let i=e.TryGetCadObject(t);i?this.CadObject.fields.push(i):e.Notify(`Field ${t} not found for FieldList ${this.CadObject.handle}`,g.Warning)}}};var Fa=class{CadValue;ValueHandle=null;constructor(e){this.CadValue=e}Build(e){let t=e.TryGetCadObject(this.ValueHandle);t&&this.CadValue.setValue(t,W.Handle)}};var zl=class extends k{BinRecordHandle=null;CleanupGroupHandle=null;RawData=null;StyleHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject;this.RawData!==null&&(t.rawData=this.RawData);let i=e.TryGetCadObject(this.BinRecordHandle);i&&(t.binRecord=i);let s=e.TryGetCadObject(this.StyleHandle);s&&(t.style=s);let n=e.TryGetCadObject(this.CleanupGroupHandle);n&&(t.cleanupGroup=n)}};R();var Gl=class extends De{get objectType(){return u.VP_ENT_HDR}};kr();J();D();x();R();var He=class extends O{static CurrentAnnotationScale="CANNOSCALE";static CurrentMultiLeaderStyle="CMLEADERSTYLE";static CurrentTableStyle="CTABLESTYLE";static WipeoutFrame="WIPEOUTFRAME";get objectName(){return d.ObjectDictionaryVar}objectSchemaNumber=0;get objectType(){return u.UNLISTED}get subclassMarker(){return l.DictionaryVariables}value="";constructor(e,t){super(e),t!==void 0&&(this.value=t)}};J();D();x();R();var $o;(function(r){r[r.None=0]="None",r[r.Centimeters=2]="Centimeters",r[r.Inches=5]="Inches"})($o||($o={}));var Tr=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectImageDefinition}get subclassMarker(){return l.RasterImageDef}classVersion=0;fileName="";size=new C(0,0);defaultSize=new C(1,1);isLoaded=!0;units=$o.None};J();D();x();R();var li=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectImageDefinitionReactor}get subclassMarker(){return l.RasterImageDefReactor}classVersion=2;image=null};J();D();x();var Yo;(function(r){r[r.Draft=0]="Draft",r[r.High=1]="High"})(Yo||(Yo={}));var Ar=class extends O{classVersion=0;displayQuality=Yo.High;isDisplayFrameShown=!1;get objectName(){return d.ObjectRasterVariables}get subclassMarker(){return l.RasterVariables}units=0};J();D();x();R();var $l;(function(r){r[r.NoEdges=0]="NoEdges",r[r.Isolines=1]="Isolines",r[r.FacetEdges=2]="FacetEdges"})($l||($l={}));var Yl;(function(r){r[r.NoColor=0]="NoColor",r[r.ObjectColor=1]="ObjectColor",r[r.BackgroundColor=2]="BackgroundColor",r[r.CustomColor=3]="CustomColor",r[r.Monochrome=4]="Monochrome",r[r.Tinted=5]="Tinted",r[r.Desaturated=6]="Desaturated"})(Yl||(Yl={}));var Xl;(function(r){r[r.Invisible=0]="Invisible",r[r.Visible=1]="Visible",r[r.Phong=2]="Phong",r[r.Gooch=3]="Gooch"})(Xl||(Xl={}));var Zl;(function(r){r[r.NoLighting=0]="NoLighting",r[r.PerFaceLighting=1]="PerFaceLighting",r[r.PerVertexLighting=2]="PerVertexLighting"})(Zl||(Zl={}));var Kl;(function(r){r[r.None=0]="None",r[r.Opacity=1]="Opacity",r[r.Specular=2]="Specular"})(Kl||(Kl={}));var di=class extends O{brightness=0;color=B.ByLayer;description="";displaySettings=0;edgeApplyStyleFlag=0;edgeColor=0;edgeCreaseAngle=0;edgeIntersectionColor=B.ByLayer;edgeIntersectionLineType=0;edgeIsolineCount=0;edgeJitter=0;edgeModifiers=0;edgeObscuredColor=B.ByLayer;edgeObscuredLineType=0;edgeOverhang=0;edgeSilhouetteColor=B.ByLayer;edgeSilhouetteWidth=0;edgeStyle=0;edgeStyleModel=$l.NoEdges;edgeWidth=0;faceColorMode=Yl.NoColor;faceLightingModel=Xl.Invisible;faceLightingQuality=Zl.NoLighting;faceModifiers=Kl.None;faceOpacityLevel=0;faceSpecularLevel=0;faceStyleMonoColor=B.ByLayer;haloGap=0;internalFlag=!1;get objectName(){return d.ObjectVisualStyle}get objectType(){return u.UNLISTED}opacityLevel=0;precisionFlag=!1;rasterFile="";shadowType=0;get subclassMarker(){return l.VisualStyle}type=0;static DefaultName="2dWireframe"};J();x();R();var Jl=class extends O{get objectType(){return u.UNLISTED}get subclassMarker(){return l.UnderlayDefinition}file=""};D();var hi=class extends Jl{get objectName(){return d.ObjectPdfDefinition}_page="";get page(){return this._page}set page(e){this._page=e||""}};J();D();x();R();var ci=class extends O{get objectType(){return u.ACDBPLACEHOLDER}get objectName(){return d.ObjectPlaceholder}get subclassMarker(){return l.AcDbPlaceHolder}};J();D();x();var ui=class extends O{get objectName(){return d.ObjectDBColor}get subclassMarker(){return l.DbColor}get name(){return this.colorName?`${this.bookName}$${this.colorName}`:""}set name(e){if(e.includes("$")){let t=e.split("$");this.bookName=t[0],this.colorName=t[t.length-1]}else this.colorName=e}colorName="";bookName="";color=B.ByBlock;constructor(e,t){super(e),t&&(this.bookName=t)}};J();D();x();var Er=class extends O{get classId(){return this.dxfClass?.classNumber??0}get drawingFormat(){return this.version|this.maintenanceVersion<<16}dxfClass=null;maintenanceVersion=0;get objectName(){return d.ObjectProxyObject}originalDataFormatDxf=!1;proxyClassId=499;binaryData=null;data=null;get subclassMarker(){return l.ProxyObject}version=m.Unknown};J();x();R();var ql=class extends O{static FilterEntryName="ACAD_FILTER";get objectType(){return u.UNLISTED}get subclassMarker(){return l.Filter}constructor(e){super(e)}};D();x();R();var qt=class extends ql{static SpatialFilterEntryName="SPATIAL";backDistance=0;boundaryPoints=[];clipBackPlane=!1;clipFrontPlane=!1;displayBoundary=!1;frontDistance=0;insertTransform=it.identity();inverseInsertTransform=it.identity();normal=new c(0,0,1);get objectName(){return d.ObjectSpatialFilter}get objectType(){return u.UNLISTED}origin=new c(0,0,1);get subclassMarker(){return l.SpatialFilter}constructor(e){super(e)}};D();x();var Ql=class extends La{caption301="";caption302="";caption303="";caption304="";get objectName(){return d.ObjectBlockFlipAction}get subclassMarker(){return l.BlockFlipAction}value92=0;value93=0;value94=0;value95=0};D();x();var ed=class extends Ws{get objectName(){return d.ObjectBlockFlipParameter}get subclassMarker(){return l.BlockFlipParameter}caption="";description="";baseStateName="";flippedStateName="";captionLocation=new c(0,0,0);caption309="";value96=0;caption1001="";point1010=new c(0,0,0)};D();var mi=class extends Os{insertionPoint=new c(0,0,0);get objectName(){return d.BlkRefObjectContextData}rotation=0;get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_xscale=1;_yscale=1;_zscale=1};J();D();x();var Xo;(function(r){r[r.Never=0]="Never",r[r.OnOpen=1]="OnOpen",r[r.OnSave=2]="OnSave",r[r.OnPlot=4]="OnPlot",r[r.OnPackedETransmit=8]="OnPackedETransmit",r[r.OnRegeneration=16]="OnRegeneration",r[r.OnDemand=32]="OnDemand"})(Xo||(Xo={}));var Zo;(function(r){r[r.NotEvaluated=1]="NotEvaluated",r[r.Success=2]="Success",r[r.EvaluatorNotFound=4]="EvaluatorNotFound",r[r.SyntaxError=8]="SyntaxError",r[r.InvalidCode=16]="InvalidCode",r[r.InvalidContext=32]="InvalidContext",r[r.OtherError=64]="OtherError"})(Zo||(Zo={}));var Ko;(function(r){r[r.Unknown=0]="Unknown",r[r.Initialized=1]="Initialized",r[r.Compiled=2]="Compiled",r[r.Modified=4]="Modified",r[r.Evaluated=8]="Evaluated",r[r.Cached=16]="Cached"})(Ko||(Ko={}));var Jo;(function(r){r[r.None=0]="None",r[r.NoFieldResult=1]="NoFieldResult"})(Jo||(Jo={}));var fi=class extends O{cadObjects=[];children=[];evaluationErrorCode=0;evaluationErrorMessage="";evaluationOptionFlags=Xo.Never;evaluationStatusFlags=Zo.NotEvaluated;evaluatorId="";fieldCode="";fieldStateFlags=Ko.Unknown;filingOptionFlags=Jo.None;formatString="";get objectName(){return d.ObjectField}get subclassMarker(){return l.Field}value=new Ht;values=new Map};J();D();x();R();var pi=class extends O{fields=[];get objectName(){return d.ObjectFieldList}get objectType(){return u.UNLISTED}get subclassMarker(){return l.FieldList}clone(){let e=super.clone();return e.fields=[...this.fields],e}};J();D();x();R();var Gs=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectAecCleanupGroupDef}get subclassMarker(){return l.AecDbCleanupGroupDef}version=0;description="";rawData=null;constructor(e){super(e)}};J();D();x();R();var $s=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectAecWallStyle}get subclassMarker(){return l.AecDbWallStyle}version=0;description="";rawData=null;constructor(e){super(e)}};J();D();x();R();var Ys=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectBinRecord}get subclassMarker(){return l.BinRecord}version=0;binaryData=new Uint8Array(0)};q();bt();var Hi=class extends ae{constructor(e){super(p.ExtendedDataAsciiString,e)}};wn();q();bt();var Ua=class extends ae{constructor(e,t){super(e,t)}resolveReference(e){return e.getCadObject(this.value)}};var va=class extends Ua{constructor(e){super(p.ExtendedDataLayerName,e)}};q();bt();var Fi=class extends ae{constructor(e){super(p.ExtendedDataBinaryChunk,e)}};q();var za=class extends Ua{constructor(e){super(p.ExtendedDataHandle,e)}};q();bt();var Ui=class extends ae{constructor(e){super(p.ExtendedDataWorldXDisp,e)}};q();bt();var vi=class extends ae{constructor(e){super(p.ExtendedDataDist,e)}};q();bt();var zi=class extends ae{constructor(e){super(p.ExtendedDataScale,e)}};q();bt();var Gi=class extends ae{constructor(e){super(p.ExtendedDataXCoordinate,e)}};q();bt();var $i=class extends ae{constructor(e){super(p.ExtendedDataWorldXDir,e)}};q();bt();var Yi=class extends ae{constructor(e){super(p.ExtendedDataInteger16,e)}};q();bt();var Xi=class extends ae{constructor(e){super(p.ExtendedDataInteger32,e)}};q();bt();var Zi=class extends ae{constructor(e){super(p.ExtendedDataReal,e)}};q();bt();var Ki=class extends ae{constructor(e){super(p.ExtendedDataWorldXCoordinate,e)}};var td=class r extends Y{get sectionName(){return T.AcDbObjects}_classes;_crcReader;_map;_memoryStream;_readedObjects=new Map;_reader;_builder;_handles;_handlesReader;_mergedReaders;_objectInitialPos=0;_objectReader;_size=0;_textReader;constructor(e,t,i,s,n,a){super(e),this._builder=t,this._reader=i,this._handles=[...s],this._map=new Map(n),this._classes=new Map;for(let o of a)this._classes.set(o.classNumber,o);this._memoryStream=new Uint8Array(i.stream),this._crcReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream))}read(){for(;this._handles.length>0;){let e=this._handles.shift(),t=this._map.get(e);if(t===void 0||this._builder.TryGetObjectTemplate(e)!==void 0||this._readedObjects.has(e))continue;let i=this.getEntityType(t);this._readedObjects.set(e,i);let s=null;try{s=this.readObject(i)}catch(n){if(!this._builder.Configuration.Failsafe)throw n;let a=this._classes.get(i);a?this._builder.Notify(`Could not read ${a.dxfName} number ${a.classNumber} with handle: ${e}`,g.Error,n):this._builder.Notify(`Could not read ${i} with handle: ${e}`,g.Error,n);continue}s!=null&&this._builder.AddTemplate(s)}}getEntityType(e){let t=u.INVALID;if(this._crcReader.position=e,this._size=this._crcReader.readModularShort(),this._size<=0)return t;let i=this._size<<3;if(this.R2010Plus){let s=this._crcReader.readModularChar(),n=this._crcReader.positionInBits()+i-s;this._objectReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._objectReader.setPositionInBits(this._crcReader.positionInBits()),this._objectInitialPos=this._objectReader.positionInBits(),t=this._objectReader.readObjectType(),this._handlesReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._handlesReader.setPositionInBits(n),this._textReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader.setPositionByFlag(n-1),this._mergedReaders=new us(this._objectReader,this._textReader,this._handlesReader)}else this._objectReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._objectReader.setPositionInBits(this._crcReader.positionInBits()),this._handlesReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader=this._objectReader,this._objectInitialPos=this._objectReader.positionInBits(),t=this._objectReader.readObjectType();return t}handleReference(e=0){let t=e===0?this._handlesReader.handleReference():this._handlesReader.handleReferenceWithRef(e);return t!==0&&this._builder.TryGetObjectTemplate(t)===void 0&&!this._readedObjects.has(t)&&this._handles.push(t),t}readCommonData(e){this._version>=m.AC1015&&this._version<m.AC1024&&this.updateHandleReader(),e.CadObject.handle=this._objectReader.handleReference(),this.readExtendedData(e)}readCommonEntityData(e){let t=e.CadObject;if(this.readCommonData(e),this._objectReader.readBit()){let i=this._version>=m.AC1024?this._objectReader.readBitLongLong():this._objectReader.readRawLong();this._objectReader.advance(i)}this._version>=m.AC1012&&this._version<=m.AC1014&&this.updateHandleReader(),this.readEntityMode(e)}readCommonNonEntityData(e){this.readCommonData(e),this.R13_14Only&&this.updateHandleReader(),e.OwnerHandle=this.handleReference(e.CadObject.handle),this.readReactorsAndDictionaryHandle(e)}readEntityMode(e){let t=e.CadObject;e.EntityMode=this._objectReader.read2Bits(),e.EntityMode===0?e.OwnerHandle=this._handlesReader.handleReferenceWithRef(t.handle):e.EntityMode===1?this._builder.PaperSpaceEntities.push(t):e.EntityMode===2&&this._builder.ModelSpaceEntities.push(t),this.readReactorsAndDictionaryHandle(e),this.R13_14Only&&(e.LayerHandle=this.handleReference(),this._objectReader.readBit()||(e.LineTypeHandle=this.handleReference())),!this.R2004Plus&&!this._objectReader.readBit()?(e.PrevEntity=this.handleReference(t.handle),e.NextEntity=this.handleReference(t.handle)):this.R2004Plus||(this._readedObjects.has(t.handle-1)||this._handles.push(t.handle-1),this._readedObjects.has(t.handle+1)||this._handles.push(t.handle+1));let{color:i,transparency:s,flag:n}=this._objectReader.readEnColor();if(t.color=i,t.transparency=s,this._version>=m.AC1018&&n&&(e.ColorHandle=this.handleReference()),t.lineTypeScale=this._objectReader.readBitDouble(),!(this._version>=m.AC1015)){t.isInvisible=(this._objectReader.readBitShort()&1)===0;return}e.LayerHandle=this.handleReference(),e.LtypeFlags=this._objectReader.read2Bits(),e.LtypeFlags===3&&(e.LineTypeHandle=this.handleReference()),this.R2007Plus&&(this._objectReader.read2Bits()===3&&(e.MaterialHandle=this.handleReference()),this._objectReader.readByte()),this._objectReader.read2Bits()===3&&this.handleReference(),this.R2010Plus&&(this._objectReader.readBit()&&this.handleReference(),this._objectReader.readBit()&&this.handleReference(),this._objectReader.readBit()&&this.handleReference()),t.isInvisible=(this._objectReader.readBitShort()&1)===1,t.lineWeight=Z.toValue(this._objectReader.readByte())}readExtendedData(e){let t=this._objectReader.readBitShort();for(;t!==0;){let i=this._objectReader.handleReference(),s=this._objectReader.position+t,n=this.readExtendedDataRecords(s);e.EDataTemplate.set(i,n),t=this._objectReader.readBitShort()}}readExtendedDataRecords(e){let t=[];for(;this._objectReader.position<e;){let i=1e3+this._objectReader.readByte(),s=null;switch(i){case p.ExtendedDataAsciiString:case p.ExtendedDataRegAppName:s=new Hi(this._objectReader.readTextUnicode());break;case p.ExtendedDataControlString:s=new Pe(this._objectReader.readByte()===1);break;case p.ExtendedDataLayerName:{let n=this._objectReader.readBytes(8),a=ko.toUInt64(n);s=new va(a);break}case p.ExtendedDataBinaryChunk:s=new Fi(this._objectReader.readBytes(this._objectReader.readByte()));break;case p.ExtendedDataHandle:{let n=this._objectReader.readBytes(8),a=ko.toUInt64(n);s=new za(a);break}case p.ExtendedDataXCoordinate:s=new Gi(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXCoordinate:s=new Ki(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXDisp:s=new Ui(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXDir:s=new $i(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataReal:s=new Zi(this._objectReader.readDouble());break;case p.ExtendedDataDist:s=new vi(this._objectReader.readDouble());break;case p.ExtendedDataScale:s=new zi(this._objectReader.readDouble());break;case p.ExtendedDataInteger16:s=new Yi(this._objectReader.readShort());break;case p.ExtendedDataInteger32:s=new Xi(this._objectReader.readRawLong());break;default:return this._objectReader.readBytes(e-this._objectReader.position),this._builder.Notify(`Unknown code for extended data: ${i}`,g.Warning),t}t.push(s)}return t}readReactorsAndDictionaryHandle(e){let t=this._objectReader.readBitLong();for(let s=0;s<t;++s)e.ReactorsHandles.add(this.handleReference());let i=!1;this.R2004Plus&&(i=this._objectReader.readBit()),i||(e.XDictHandle=this.handleReference()),this.R2013Plus&&this._objectReader.readBit()}readXrefDependantBit(e){if(this.R2007Plus)(this._objectReader.readBitShort()&256)>0&&(e.flags|=Vt.XrefDependent);else{this._objectReader.readBit()&&(e.flags|=Vt.Referenced);let t=this._objectReader.readBitShort()-1;this._objectReader.readBit()&&(e.flags|=Vt.XrefDependent)}}updateHandleReader(){let e=this._objectReader.readRawLong();this._handlesReader.setPositionInBits(e+this._objectInitialPos),this._version===m.AC1021&&(this._textReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader.setPositionByFlag(e+this._objectInitialPos-1)),this._mergedReaders=new us(this._objectReader,this._textReader,this._handlesReader)}static looksLikeUtf16Le(e,t){if(e==null||t<0||t+1>=e.length)return!1;let i=!1;for(let s=t;s+1<e.length;s+=2){let n=e[s],a=e[s+1];if(n===0&&a===0)return i;if(a!==0)return!1;n!==0&&(i=!0)}return!1}readObject(e){let t=null;switch(e){case u.TEXT:t=this.readText();break;case u.ATTRIB:t=this.readAttribute();break;case u.ATTDEF:t=this.readAttributeDefinition();break;case u.BLOCK:t=this.readBlock();break;case u.ENDBLK:t=this.readEndBlock();break;case u.SEQEND:t=this.readSeqend();break;case u.INSERT:t=this.readInsert();break;case u.MINSERT:t=this.readMInsert();break;case u.VERTEX_2D:t=this.readVertex2D();break;case u.VERTEX_3D:t=this.readVertex3D(new cr);break;case u.VERTEX_PFACE:t=this.readVertex3D(new ri);break;case u.VERTEX_MESH:t=this.readVertex3D(new ss);break;case u.VERTEX_PFACE_FACE:t=this.readPfaceVertex();break;case u.POLYLINE_2D:t=this.readPolyline2D();break;case u.POLYLINE_3D:t=this.readPolyline3D();break;case u.ARC:t=this.readArc();break;case u.CIRCLE:t=this.readCircle();break;case u.LINE:t=this.readLine();break;case u.DIMENSION_ORDINATE:t=this.readDimOrdinate();break;case u.DIMENSION_LINEAR:t=this.readDimLinear();break;case u.DIMENSION_ALIGNED:t=this.readDimAligned();break;case u.DIMENSION_ANG_3_Pt:t=this.readDimAngular3pt();break;case u.DIMENSION_ANG_2_Ln:t=this.readDimLine2pt();break;case u.DIMENSION_RADIUS:t=this.readDimRadius();break;case u.DIMENSION_DIAMETER:t=this.readDimDiameter();break;case u.POINT:t=this.readPoint();break;case u.FACE3D:t=this.read3dFace();break;case u.POLYLINE_PFACE:t=this.readPolyfaceMesh();break;case u.POLYLINE_MESH:t=this.readPolylineMesh();break;case u.SOLID:case u.TRACE:t=this.readSolid();break;case u.SHAPE:t=this.readShape();break;case u.VIEWPORT:t=this.readViewport();break;case u.ELLIPSE:t=this.readEllipse();break;case u.SPLINE:t=this.readSpline();break;case u.REGION:t=this.readModelerGeometry(new k(new as));break;case u.SOLID3D:t=this.readSolid3D();break;case u.BODY:t=this.readModelerGeometry(new k(new ts));break;case u.RAY:t=this.readRay();break;case u.XLINE:t=this.readXLine();break;case u.DICTIONARY:t=this.readDictionary();break;case u.MTEXT:t=this.readMText();break;case u.LEADER:t=this.readLeader();break;case u.TOLERANCE:t=this.readTolerance();break;case u.MLINE:t=this.readMLine();break;case u.BLOCK_CONTROL_OBJ:t=this.readBlockControlObject(),this._builder.BlockRecords=t.CadObject;break;case u.BLOCK_HEADER:t=this.readBlockHeader();break;case u.LAYER_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Mr),this._builder.Layers=t.CadObject;break;case u.LAYER:t=this.readLayer();break;case u.STYLE_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Hr),this._builder.TextStyles=t.CadObject;break;case u.STYLE:t=this.readTextStyle();break;case u.LTYPE_CONTROL_OBJ:t=this.readLTypeControlObject(),this._builder.LineTypesTable=t.CadObject;break;case u.LTYPE:t=this.readLType();break;case u.VIEW_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Ur),this._builder.Views=t.CadObject;break;case u.VIEW:t=this.readView();break;case u.UCS_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Fr),this._builder.UCSs=t.CadObject;break;case u.UCS:t=this.readUcs();break;case u.VPORT_CONTROL_OBJ:t=this.readDocumentTableGeneric(new zr),this._builder.VPorts=t.CadObject;break;case u.VPORT:t=this.readVPort();break;case u.APPID_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Vr),this._builder.AppIds=t.CadObject;break;case u.APPID:t=this.readAppId();break;case u.DIMSTYLE_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Wt),this._builder.DimensionStyles=t.CadObject;break;case u.DIMSTYLE:t=this.readDimStyle();break;case u.VP_ENT_HDR_CTRL_OBJ:t=this.readViewportEntityControl();break;case u.VP_ENT_HDR:t=this.readViewportEntityHeader();break;case u.GROUP:t=this.readGroup();break;case u.MLINESTYLE:t=this.readMLineStyle();break;case u.LWPOLYLINE:t=this.readLWPolyline();break;case u.HATCH:t=this.readHatch();break;case u.XRECORD:t=this.readXRecord();break;case u.ACDBPLACEHOLDER:t=this.readPlaceHolder();break;case u.LAYOUT:t=this.readLayout();break;case u.ACAD_PROXY_ENTITY:t=this.readProxyEntity();break;case u.ACAD_PROXY_OBJECT:t=this.readProxyObject();break;case u.OLE2FRAME:t=this.readOle2Frame();break;case u.OLEFRAME:case u.DUMMY:return t=this.readUnknownEntity(null),this._builder.Notify(`Unlisted object with DXF name ${e} has been read as an UnknownEntity`,g.Warning),t;case u.VBA_PROJECT:case u.LONG_TRANSACTION:return t=this.readUnknownNonGraphicalObject(null),this._builder.Notify(`Unlisted object with DXF name ${e} has been read as an UnknownNonGraphicalObject`,g.Warning),t;case u.UNDEFINED:case u.UNKNOW_3A:case u.UNKNOW_3B:case u.UNKNOW_36:case u.UNKNOW_37:case u.UNKNOW_9:break;default:return this.readUnlistedType(e)}return t==null&&this._builder.Notify(`Object type not implemented: ${e}`,g.NotImplemented),t}readUnlistedType(e){let t=this._classes.get(e);if(!t)return null;let i=null;switch(t.dxfName){case d.EntityAecWall:i=this.readAecWall();break;case d.ObjectBinRecord:i=this.readBinRecord();break;case d.ObjectAecWallStyle:i=this.readAecWallStyle();break;case d.ObjectAecCleanupGroupDef:i=this.readAecCleanupGroup();break;case"ACDBDICTIONARYWDFLT":i=this.readDictionaryWithDefault();break;case"ACDBPLACEHOLDER":i=this.readPlaceHolder();break;case"ACAD_TABLE":i=this.readTableEntity();break;case d.ObjectDimensionAssociation:i=this.readDimensionAssociation();break;case"DBCOLOR":i=this.readDbColor();break;case"DICTIONARYVAR":i=this.readDictionaryVar();break;case"DICTIONARYWDFLT":i=this.readDictionaryWithDefault();break;case d.ObjectGeoData:i=this.readGeoData();break;case"GROUP":i=this.readGroup();break;case"HATCH":i=this.readHatch();break;case"IMAGE":i=this.readCadImage(new ns);break;case"IMAGEDEF":i=this.readImageDefinition();break;case"IMAGEDEF_REACTOR":i=this.readImageDefinitionReactor();break;case"LAYOUT":i=this.readLayout();break;case"LWPLINE":case"LWPOLYLINE":i=this.readLWPolyline();break;case"MATERIAL":i=this.readMaterial();break;case"MESH":i=this.readMesh();break;case"MULTILEADER":i=this.readMultiLeader();break;case"ACDB_MLEADEROBJECTCONTEXTDATA_CLASS":i=this.readMultiLeaderAnnotContext();break;case"MLEADERSTYLE":i=this.readMultiLeaderStyle();break;case"PDFDEFINITION":i=this.readPdfDefinition();break;case"PDFUNDERLAY":case"PDFREFERENCE":i=this.readPdfUnderlay();break;case"SCALE":i=this.readScale();break;case"SORTENTSTABLE":i=this.readSortentsTable();break;case"RASTERVARIABLES":i=this.readRasterVariables();break;case"WIPEOUT":i=this.readCadImage(new ls);break;case"XRECORD":i=this.readXRecord();break;case d.ObjectEvalGraph:i=this.readEvaluationGraph();break;case d.ObjectBlockRotationParameter:i=this.readBlockRotationParameter();break;case d.ObjectBlockVisibilityParameter:i=this.readBlockVisibilityParameter();break;case"BLOCKFLIPPARAMETER":i=this.readBlockFlipParameter();break;case d.ObjectBlockRepresentationData:i=this.readBlockRepresentationData();break;case d.ObjectBlockGripLocationComponent:i=this.readBlockGripLocationComponent();break;case d.ObjectBlockRotationGrip:{let s=new Na;this.readBlockGrip(s),i=s;break}case d.ObjectBlockVisibilityGrip:{let s=new Ia;this.readBlockGrip(s),i=s;break}case d.ObjectBlockFlipAction:i=this.readBlockFlipAction();break;case d.ObjectBlockRotateAction:i=this.readBlockRotateAction();break;case"SPATIAL_FILTER":i=this.readSpatialFilter();break;case"ACAD_PROXY_ENTITY":i=this.readProxyEntity();break;case"ACAD_PROXY_OBJECT":i=this.readProxyObject();break;case d.ObjectVisualStyle:i=this.readVisualStyle();break;case d.ObjectPlotSettings:i=this.readPlotSettings();break;case d.ObjectTableStyle:i=this.readTableStyle();break;case d.BlkRefObjectContextData:i=this.readBlkRefObjectContextData();break;case d.MTextAttributeObjectContextData:i=this.readMTextAttributeObjectContextData();break;case d.ObjectFieldList:i=this.readFieldList();break;case d.ObjectField:i=this.readField();break}return i==null&&t.isAnEntity?(i=this.readUnknownEntity(t),this._builder.Notify(`Unlisted object with DXF name ${t.dxfName} has been read as an UnknownEntity`,g.Warning)):i==null&&!t.isAnEntity&&(i=this.readUnknownNonGraphicalObject(t),this._builder.Notify(`Unlisted object with DXF name ${t.dxfName} has been read as an UnknownNonGraphicalObject`,g.Warning)),i}read3dFace(){let e=new Yr,t=new k(e);if(this.readCommonEntityData(t),this.R13_14Only&&(e.firstCorner=this._objectReader.read3BitDouble(),e.secondCorner=this._objectReader.read3BitDouble(),e.thirdCorner=this._objectReader.read3BitDouble(),e.fourthCorner=this._objectReader.read3BitDouble(),e.flags=this._objectReader.readBitShort()),this.R2000Plus){let i=this._objectReader.readBit(),s=this._objectReader.readBit(),n=this._objectReader.readDouble(),a=this._objectReader.readDouble(),o=0;s||(o=this._objectReader.readDouble()),e.firstCorner=new c(n,a,o),e.secondCorner=this._objectReader.read3BitDoubleWithDefault(e.firstCorner),e.thirdCorner=this._objectReader.read3BitDoubleWithDefault(e.secondCorner),e.fourthCorner=this._objectReader.read3BitDoubleWithDefault(e.thirdCorner),i||(e.flags=this._objectReader.readBitShort())}return t}readArc(){let e=new Ft,t=new k(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return e.radius=i<=0?Q.Epsilon:i,e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),e.startAngle=this._objectReader.readBitDouble(),e.endAngle=this._objectReader.readBitDouble(),t}readCircle(){let e=new dt,t=new k(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return e.radius=i<=0?Q.Epsilon:i,e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),t}readLine(){let e=new zt,t=new k(e);if(this.readCommonEntityData(t),this.R13_14Only&&(e.startPoint=this._objectReader.read3BitDouble(),e.endPoint=this._objectReader.read3BitDouble()),this.R2000Plus){let i=this._objectReader.readBit(),s=this._objectReader.readDouble(),n=this._objectReader.readBitDoubleWithDefault(s),a=this._objectReader.readDouble(),o=this._objectReader.readBitDoubleWithDefault(a),h=0,f=0;i||(h=this._objectReader.readDouble(),f=this._objectReader.readBitDoubleWithDefault(h)),e.startPoint=new c(s,a,h),e.endPoint=new c(n,o,f)}return e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),t}readPoint(){let e=new Gt,t=new k(e);return this.readCommonEntityData(t),e.location=this._objectReader.read3BitDouble(),e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),e.rotation=this._objectReader.readBitDouble(),t}readEllipse(){let e=new Ut,t=new k(e);return this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble(),e.majorAxisEndPoint=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.radiusRatio=this._objectReader.readBitDouble(),e.startParameter=this._objectReader.readBitDouble(),e.endParameter=this._objectReader.readBitDouble(),t}readRay(){let e=new ei,t=new k(e);return this.readCommonEntityData(t),e.startPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),t}readXLine(){let e=new ii,t=new k(e);return this.readCommonEntityData(t),e.firstPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),t}readSolid(){let e=new $t,t=new k(e);this.readCommonEntityData(t),e.thickness=this._objectReader.readBitThickness();let i=this._objectReader.readBitDouble(),s=this._objectReader.read2RawDouble();return e.firstCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.secondCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.thirdCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.fourthCorner=new c(s.x,s.y,i),e.normal=this._objectReader.readBitExtrusion(),t}readBlock(){let e=new Pr(new U),t=new k(e);this.readCommonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),t}readEndBlock(){let e=new gs(new U),t=new k(e);return this.readCommonEntityData(t),t}readSeqend(){let e=new k(new Le);return this.readCommonEntityData(e),e}readShape(){let e=new ur,t=new qn(e);return this.readCommonEntityData(t),e.insertionPoint=this._objectReader.read3BitDouble(),e.size=this._objectReader.readBitDouble(),e.rotation=this._objectReader.readBitDouble(),e.relativeXScale=this._objectReader.readBitDouble(),e.obliqueAngle=this._objectReader.readBitDouble(),e.thickness=this._objectReader.readBitDouble(),e.shapeIndex=this._objectReader.readBitShort()&65535,e.normal=this._objectReader.read3BitDouble(),t.ShapeFileHandle=this.handleReference(),t}readTolerance(){let e=new Yt,t=new ta(e);return this.readCommonEntityData(t),this.R13_14Only&&(this._objectReader.readBitShort(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),e.insertionPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.text=this._textReader.readVariableText(),t.DimensionStyleHandle=this.handleReference(),t}readPlaceHolder(){let e=new K(new ci);return this.readCommonNonEntityData(e),e}readUnknownEntity(e){let t=new Lt(e),i=new ba(t);return this.readCommonEntityData(i),i}readUnknownNonGraphicalObject(e){let t=new pr(e),i=new _a(t);return this.readCommonNonEntityData(i),i}readBlockControlObject(){let e=new Mn(new Ir);return this.readDocumentTable(e),e.ModelSpaceHandle=this.handleReference(),e.PaperSpaceHandle=this.handleReference(),e}readBlockHeader(){let e=new U,t=e.blockEntity,i=new br(e);this._builder.BlockRecordTemplates.push(i),this.readCommonNonEntityData(i);let s=this._textReader.readVariableText();(s.toLowerCase()===U.ModelSpaceName.toLowerCase()||s.toLowerCase()===U.PaperSpaceName.toLowerCase())&&(e.name=s),this.readXrefDependantBit(i.CadObject),this._objectReader.readBit()&&(t.flags|=ne.Anonymous);let n=this._objectReader.readBit();this._objectReader.readBit()&&(t.flags|=ne.XRef),this._objectReader.readBit()&&(t.flags|=ne.XRefOverlay),this.R2000Plus&&(t.isUnloaded=this._objectReader.readBit());let a=0;this.R2004Plus&&!(t.flags&ne.XRef)&&!(t.flags&ne.XRefOverlay)&&(a=this._objectReader.readBitLong()),t.basePoint=this._objectReader.read3BitDouble(),t.xRefPath=this._textReader.readVariableText();let o=0;if(this.R2000Plus){for(let b=this._objectReader.readByte();b!==0;b=this._objectReader.readByte())++o;t.comments=this._textReader.readVariableText();let h=this._objectReader.readBitLong(),f=[];for(let b=0;b<h;++b)f.push(this._objectReader.readByte());e.preview=new Uint8Array(f)}if(this.R2007Plus&&(e.units=this._objectReader.readBitShort(),e.isExplodable=this._objectReader.readBit(),e.canScale=this._objectReader.readByte()>0),this.handleReference(),i.BeginBlockHandle=this.handleReference(),this._version>=m.AC1012&&this._version<=m.AC1015&&!(t.flags&ne.XRef)&&!(t.flags&ne.XRefOverlay)&&(i.FirstEntityHandle=this.handleReference(),i.LastEntityHandle=this.handleReference()),this.R2004Plus)for(let h=0;h<a;++h)i.OwnedObjectsHandlers.add(this.handleReference());if(i.EndBlockHandle=this.handleReference(),this.R2000Plus){for(let h=0;h<o;++h)i.InsertHandles.push(this.handleReference());i.LayoutHandle=this.handleReference()}return i}readDocumentTable(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();for(let i=0;i<t;++i)e.EntryHandles.add(this.handleReference());return e}readDocumentTableGeneric(e){let t=new st(e);return this.readDocumentTable(t)}readLTypeControlObject(){let e=new st(new Wr);return this.readDocumentTable(e),e.EntryHandles.add(this.handleReference()),e.EntryHandles.add(this.handleReference()),e}readAppId(){let e=new gt,t=new fe(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(e),this._objectReader.readByte(),this.handleReference(),t}readTextStyle(){let e=new te,t=new fe(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),this._objectReader.readBit()&&(e.flags|=Nr.IsShape),this._objectReader.readBit()&&(e.flags|=Nr.VerticalText),e.height=this._objectReader.readBitDouble(),e.width=this._objectReader.readBitDouble(),e.obliqueAngle=this._objectReader.readBitDouble(),e.mirrorFlag=this._objectReader.readByte(),e.lastHeight=this._objectReader.readBitDouble(),e.filename=this._textReader.readVariableText(),e.bigFontFilename=this._textReader.readVariableText(),this.handleReference(),t}readLayer(){let e=new Se,t=new Fn(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();if(i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),this.R13_14Only&&(this._objectReader.readBit()&&(e.flags|=ze.Frozen),e.isOn=this._objectReader.readBit(),this._objectReader.readBit()&&(e.flags|=ze.FrozenNewViewports),this._objectReader.readBit()&&(e.flags|=ze.Locked)),this.R2000Plus){let n=this._objectReader.readBitShort();(n&1)>0&&(e.flags|=ze.Frozen),e.isOn=(n&2)===0,(n&4)>0&&(e.flags|=ze.FrozenNewViewports),(n&8)>0&&(e.flags|=ze.Locked),e.plotFlag=(n&16)>0;let a=(n&992)>>5;e.lineWeight=Z.toValue(a)}let s=this._mergedReaders.readCmColor();return e.color=s.isByBlock||s.isByLayer?new B(30):s,t.LayerControlHandle=this.handleReference(),this.R2000Plus&&(t.PlotStyleHandle=this.handleReference()),this.R2007Plus&&(t.MaterialHandle=this.handleReference()),t.LineTypeHandle=this.handleReference(),this.R2013Plus&&this.handleReference(),t}readLType(){let e=new H,t=new ki(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),e.description=this._textReader.readVariableText(),t.TotalLen=this._objectReader.readBitDouble(),e.alignment=String.fromCharCode(this._objectReader.readRawChar());let s=this._objectReader.readByte(),n=!1;for(let o=0;o<s;o++){let h=new ki.SegmentTemplate;h.Segment.length=this._objectReader.readBitDouble(),h.Segment.shapeNumber=this._objectReader.readBitShort(),h.Segment.offset=new C(this._objectReader.readDouble(),this._objectReader.readDouble()),h.Segment.scale=this._objectReader.readBitDouble(),h.Segment.rotation=this._objectReader.readBitDouble(),h.Segment.shapeFlags=this._objectReader.readBitShort(),h.Segment.shapeFlags&Ze.Text&&(n=!0),t.SegmentTemplates.push(h)}let a=null;this._version<=m.AC1018&&(a=this._objectReader.readBytes(256)),this.R2007Plus&&n&&(a=this._objectReader.readBytes(512)),n&&a&&this.readLineTypeSegmentTexts(t.SegmentTemplates,a),t.LtypeControlHandle=this.handleReference();for(let o=0;o<s;o++)t.SegmentTemplates[o].StyleHandle=this.handleReference();return t}readLineTypeSegmentTexts(e,t){if(!(!e||!t||t.length===0))for(let i of e){if(!(i.Segment.shapeFlags&Ze.Text))continue;let s=i.Segment.shapeNumber&65535;if(s>=t.length){this._builder.Notify(`Unable to read linetype text segment; offset ${s} is outside the available buffer (${t.length} bytes).`,g.Warning),i.Segment.text="",i.Segment.shapeNumber=0;continue}i.Segment.text=this.readLineTypeTextString(t,s),i.Segment.shapeNumber=0}}readLineTypeTextString(e,t){if(!e||t<0||t>=e.length)return"";if(r.looksLikeUtf16Le(e,t)){let s=t;for(;s+1<e.length&&!(e[s]===0&&e[s+1]===0);)s+=2;return new TextDecoder("utf-16le").decode(e.slice(t,s))}let i=t;for(;i<e.length&&e[i]!==0;)i++;return i===t?"":new TextDecoder("ascii").decode(e.slice(t,i))}readCommonDimensionData(e){this.readCommonEntityData(e);let t=e.CadObject;this.R2010Plus&&(t.version=this._objectReader.readByte()),t.normal=this._objectReader.read3BitDouble();let i=this._objectReader.read2RawDouble(),s=this._objectReader.readBitDouble();t.textMiddlePoint=new c(i.x,i.y,s);let n=this._objectReader.readByte();t.isTextUserDefinedLocation=(n&1)===0,t.text=this._textReader.readVariableText(),t.textRotation=this._objectReader.readBitDouble(),t.horizontalDirection=this._objectReader.readBitDouble();let a=new c(this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),o=this._objectReader.readBitDouble();this.R2000Plus&&(t.attachmentPoint=this._objectReader.readBitShort(),t.lineSpacingStyle=this._objectReader.readBitShort(),t.lineSpacingFactor=this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),this.R2007Plus&&(this._objectReader.readBit(),t.flipArrow1=this._objectReader.readBit(),t.flipArrow2=this._objectReader.readBit());let h=this._objectReader.read2RawDouble();t.insertionPoint=new c(h.x,h.y,s)}readCommonDimensionAlignedData(e){let t=e.CadObject;t.firstPoint=this._objectReader.read3BitDouble(),t.secondPoint=this._objectReader.read3BitDouble(),t.definitionPoint=this._objectReader.read3BitDouble(),t.extLineRotation=this._objectReader.readBitDouble()}readCommonDimensionHandles(e){e.StyleHandle=this.handleReference(),e.BlockHandle=this.handleReference()}readDimAligned(){let e=new je,t=new gr(e);return this.readCommonDimensionData(t),this.readCommonDimensionAlignedData(t),this.readCommonDimensionHandles(t),t}readDimAngular3pt(){let e=new Ct,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.firstPoint=this._objectReader.read3BitDouble(),e.secondPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),this.readCommonDimensionHandles(t),t}readDimDiameter(){let e=new Bt,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.leaderLength=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readDimLine2pt(){let e=new St,t=new gr(e);this.readCommonDimensionData(t);let i=this._objectReader.read2RawDouble();return e.dimensionArc=new c(i.x,i.y,e.textMiddlePoint.z),e.firstPoint=this._objectReader.read3BitDouble(),e.secondPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.definitionPoint=this._objectReader.read3BitDouble(),this.readCommonDimensionHandles(t),t}readDimLinear(){let e=new Qe,t=new gr(e);return this.readCommonDimensionData(t),this.readCommonDimensionAlignedData(t),e.rotation=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readDimOrdinate(){let e=new yt,t=new gr(e);this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.featureLocation=this._objectReader.read3BitDouble(),e.leaderEndpoint=this._objectReader.read3BitDouble();let i=this._objectReader.readByte();return e.isOrdinateTypeX=(i&1)!==0,this.readCommonDimensionHandles(t),t}readDimRadius(){let e=new Rt,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.leaderLength=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readText(){let e=new Je,t=new Sr(e);return this.readCommonTextData(t),t}readAttribute(){let e=new Dt,t=new Ns(e);return this.readCommonTextData(t),this.readCommonAttData(t),t}readAttributeDefinition(){let e=new es,t=new Ns(e);return this.readCommonTextData(t),this.readCommonAttData(t),this.R2010Plus&&(e.version=this._objectReader.readByte()),e.prompt=this._textReader.readVariableText(),t}readCommonAttData(e){let t=e.CadObject;switch(this.R2010Plus&&(t.version=this._objectReader.readByte()),this.R2018Plus&&(t.attributeType=this._objectReader.readByte()),t.attributeType){case Gr.MultiLine:case Gr.ConstantMultiLine:{t.mText=new Ne;let i=new Sr(t.mText);e.MTextTemplate=i,this.readEntityMode(i),this.readMTextBody(i,!1);let s=this._objectReader.readBitShort();s>0&&(this._objectReader.readBytes(s),this.handleReference(),this._objectReader.readBitShort());break}}t.tag=this._textReader.readVariableText(),this._objectReader.readBitShort(),t.flags=this._objectReader.readByte(),this.R2007Plus&&(t.isReallyLocked=this._objectReader.readBit())}readCommonTextData(e){this.readCommonEntityData(e);let t=e.CadObject,i=0,s;if(this.R13_14Only){i=this._objectReader.readBitDouble(),s=this._objectReader.read2RawDouble(),t.insertPoint=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),t.alignmentPoint=new c(s.x,s.y,i),t.normal=this._objectReader.read3BitDouble(),t.thickness=this._objectReader.readBitDouble(),t.obliqueAngle=this._objectReader.readBitDouble(),t.rotation=this._objectReader.readBitDouble(),t.height=this._objectReader.readBitDouble(),t.widthFactor=this._objectReader.readBitDouble(),t.value=this._textReader.readVariableText(),t.mirror=this._objectReader.readBitShort(),t.horizontalAlignment=this._objectReader.readBitShort(),t.verticalAlignment=this._objectReader.readBitShort(),e.StyleHandle=this.handleReference();return}let n=this._objectReader.readByte();if((n&1)===0&&(i=this._objectReader.readDouble()),s=this._objectReader.read2RawDouble(),t.insertPoint=new c(s.x,s.y,i),(n&2)===0){let a=this._objectReader.readBitDoubleWithDefault(t.insertPoint.x),o=this._objectReader.readBitDoubleWithDefault(t.insertPoint.y);t.alignmentPoint=new c(a,o,i)}t.normal=this._objectReader.readBitExtrusion(),t.thickness=this._objectReader.readBitThickness(),(n&4)===0&&(t.obliqueAngle=this._objectReader.readDouble()),(n&8)===0&&(t.rotation=this._objectReader.readDouble()),t.height=this._objectReader.readDouble(),(n&16)===0&&(t.widthFactor=this._objectReader.readDouble()),t.value=this._textReader.readVariableText(),(n&32)===0&&(t.mirror=this._objectReader.readBitShort()),(n&64)===0&&(t.horizontalAlignment=this._objectReader.readBitShort()),(n&128)===0&&(t.verticalAlignment=this._objectReader.readBitShort()),e.StyleHandle=this.handleReference()}readInsert(){let e=new xr(new Ee);return this.readInsertCommonData(e),this.readInsertCommonHandles(e),e}readMInsert(){let e=new Ee,t=new xr(e);return this.readInsertCommonData(t),e.columnCount=this._objectReader.readBitShort()&65535,e.rowCount=this._objectReader.readBitShort()&65535,e.columnSpacing=this._objectReader.readBitDouble(),e.rowSpacing=this._objectReader.readBitDouble(),this.readInsertCommonHandles(t),t}readInsertCommonData(e){let t=e.CadObject;if(this.readCommonEntityData(e),t.insertPoint=this._objectReader.read3BitDouble(),this.R13_14Only){let i=this._objectReader.read3BitDouble();t.xScale=i.x,t.yScale=i.y,t.zScale=i.z}if(this.R2000Plus)switch(this._objectReader.read2Bits()){case 0:t.xScale=this._objectReader.readDouble(),t.yScale=this._objectReader.readBitDoubleWithDefault(t.xScale),t.zScale=this._objectReader.readBitDoubleWithDefault(t.xScale);break;case 1:t.yScale=this._objectReader.readBitDoubleWithDefault(t.xScale),t.zScale=this._objectReader.readBitDoubleWithDefault(t.xScale);break;case 2:{let i=this._objectReader.readDouble();t.xScale=i,t.yScale=i,t.zScale=i;break}case 3:t.xScale=1,t.yScale=1,t.zScale=1;break}t.rotation=this._objectReader.readBitDouble(),t.normal=this._objectReader.read3BitDouble(),e.HasAtts=this._objectReader.readBit(),e.OwnedObjectsCount=0,this.R2004Plus&&e.HasAtts&&(e.OwnedObjectsCount=this._objectReader.readBitLong())}readInsertCommonHandles(e){if(e.BlockHeaderHandle=this.handleReference(),!!e.HasAtts){if(this._version>=m.AC1012&&this._version<=m.AC1015)e.FirstAttributeHandle=this.handleReference(),e.EndAttributeHandle=this.handleReference();else if(this.R2004Plus)for(let t=0;t<e.OwnedObjectsCount;++t)e.OwnedObjectsHandlers.add(this.handleReference());e.SeqendHandle=this.handleReference()}}readVertex2D(){let e=new Xt,t=new k(e);this.readCommonEntityData(t),e.flags=this._objectReader.readByte(),e.location=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return i<0?(e.startWidth=-i,e.endWidth=-i):(e.startWidth=i,e.endWidth=this._objectReader.readBitDouble()),e.bulge=this._objectReader.readBitDouble(),this.R2010Plus&&(e.id=this._objectReader.readBitLong()),e.curveTangent=this._objectReader.readBitDouble(),t}readVertex3D(e){let t=new k(e);return this.readCommonEntityData(t),e.flags=this._objectReader.readByte(),e.location=this._objectReader.read3BitDouble(),t}readPfaceVertex(){let e=new Zt,t=new k(e);return this.readCommonEntityData(t),e.index1=this._objectReader.readBitShort(),e.index2=this._objectReader.readBitShort(),e.index3=this._objectReader.readBitShort(),e.index4=this._objectReader.readBitShort(),t}readPolyline2D(){let e=new et,t=new Kt(e);if(this.readCommonEntityData(t),e.flags=this._objectReader.readBitShort(),e.smoothSurface=this._objectReader.readBitShort(),e.startWidth=this._objectReader.readBitDouble(),e.endWidth=this._objectReader.readBitDouble(),e.thickness=this._objectReader.readBitThickness(),e.elevation=this._objectReader.readBitDouble(),e.normal=this._objectReader.readBitExtrusion(),this.R2004Plus){let i=this._objectReader.readBitLong();for(let s=0;s<i;++s)t.OwnedObjectsHandlers.add(this.handleReference())}return this._version>=m.AC1012&&this._version<=m.AC1015&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),t.SeqendHandle=this.handleReference(),t}readPolyline3D(){let e=new tt,t=new Kt(e);this.readCommonEntityData(t);let i=this._objectReader.readByte(),s=(i&1)>0,n=(i&2)>0;if((s||n)&&(e.flags|=Ve.SplineFit),e.flags|=Ve.Polyline3D,(this._objectReader.readByte()&1)>0&&(e.flags|=Ve.ClosedPolylineOrClosedPolygonMeshInM),this.R2004Plus){let a=this._objectReader.readBitLong();for(let o=0;o<a;++o)t.OwnedObjectsHandlers.add(this.handleReference())}return this._version>=m.AC1012&&this._version<=m.AC1015&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),t.SeqendHandle=this.handleReference(),t}readPolyfaceMesh(){let e=new Kt(new ut);if(this.readCommonEntityData(e),this._objectReader.readBitShort(),this._objectReader.readBitShort(),this.R2004Plus){let t=this._objectReader.readBitLong();for(let i=0;i<t;i++)e.OwnedObjectsHandlers.add(this.handleReference())}return this.R13_15Only&&(e.FirstVertexHandle=this.handleReference(),e.LastVertexHandle=this.handleReference()),e.SeqendHandle=this.handleReference(),e}readPolylineMesh(){let e=new Et,t=new Kt(e);if(this.readCommonEntityData(t),e.flags=this._objectReader.readBitShort(),e.smoothSurface=this._objectReader.readBitShort(),e.mVertexCount=this._objectReader.readBitShort(),e.nVertexCount=this._objectReader.readBitShort(),e.mSmoothSurfaceDensity=this._objectReader.readBitShort(),e.nSmoothSurfaceDensity=this._objectReader.readBitShort(),this.R13_15Only&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),this.R2004Plus){let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)t.OwnedObjectsHandlers.add(this.handleReference())}return t.SeqendHandle=this.handleReference(),t}readLWPolyline(){let e=new qr,t=new k(e);try{this.readCommonEntityData(t);let i=this._objectReader.readBitShort();(i&256)!==0&&(e.flags|=At.Plinegen),(i&512)!==0&&(e.flags|=At.Closed),(i&4)!==0&&(e.constantWidth=this._objectReader.readBitDouble()),(i&8)!==0&&(e.elevation=this._objectReader.readBitDouble()),(i&2)!==0&&(e.thickness=this._objectReader.readBitDouble()),(i&1)!==0&&(e.normal=this._objectReader.read3BitDouble());let s=this._objectReader.readBitLong(),n=0;(i&16)!==0&&(n=this._objectReader.readBitLong());let a=0;(i&1024)!==0&&(a=this._objectReader.readBitLong());let o=0;if((i&32)!==0&&(o=this._objectReader.readBitLong()),this.R13_14Only)for(let h=0;h<s;h++){let f=this._objectReader.read2RawDouble();e.vertices.push(new Ci(f))}if(this.R2000Plus&&s>0){let h=this._objectReader.read2RawDouble();e.vertices.push(new Ci(h));for(let f=1;f<s;f++)h=this._objectReader.read2BitDoubleWithDefault(h),e.vertices.push(new Ci(h))}for(let h=0;h<n;h++)e.vertices[h].bulge=this._objectReader.readBitDouble();for(let h=0;h<a;h++)e.vertices[h].id=this._objectReader.readBitLong();for(let h=0;h<o;h++){let f=e.vertices[h];f.startWidth=this._objectReader.readBitDouble(),f.endWidth=this._objectReader.readBitDouble()}}catch(i){return this._builder.Notify(`Exception while reading LwPolyline: ${i.constructor?.name||"Error"}`,g.Error,i),t}return t}readSpline(){let e=new mr,t=new ea(e);this.readCommonEntityData(t);let i=this._objectReader.readBitLong();this.R2013Plus?(e.flags1=this._mergedReaders.readBitLong(),e.isClosed=!!(e.flags1&mt.Closed),e.knotParametrization=this._mergedReaders.readBitLong(),i=e.knotParametrization===Si.Custom||(e.flags1&mt.UseKnotParameter)===0?1:2):i===2?e.flags1|=mt.MethodFitPoints:e.knotParametrization=Si.Custom,e.degree=this._objectReader.readBitLong();let s=0,n=0,a=0,o=!1;switch(i){case 1:this._objectReader.readBit()&&(e.flags|=Ie.Rational),this._objectReader.readBit()&&(e.flags|=Ie.Closed),this._objectReader.readBit()&&(e.flags|=Ie.Periodic),e.knotTolerance=this._objectReader.readBitDouble(),e.controlPointTolerance=this._objectReader.readBitDouble(),n=this._objectReader.readBitLong(),a=this._objectReader.readBitLong(),o=this._objectReader.readBit();break;case 2:e.fitTolerance=this._objectReader.readBitDouble(),e.startTangent=this._objectReader.read3BitDouble(),e.endTangent=this._objectReader.read3BitDouble(),s=this._objectReader.readBitLong();break}for(let h=0;h<n;h++)e.knots.push(this._objectReader.readBitDouble());for(let h=0;h<a;h++)e.controlPoints.push(this._objectReader.read3BitDouble()),o&&e.weights.push(this._objectReader.readBitDouble());for(let h=0;h<s;h++)e.fitPoints.push(this._objectReader.read3BitDouble());return t}readMesh(){let e=new ar,t=new Kn(e);this.readCommonEntityData(t),e.version=this._objectReader.readBitShort(),e.blendCrease=this._objectReader.readBit()?1:0,e.subdivisionLevel=this._objectReader.readBitLong();let i=this._objectReader.readBitLong();for(let o=0;o<i;o++)e.vertices.push(this._objectReader.read3BitDouble());let s=this._objectReader.readBitLong();for(let o=0;o<s;o++){let h=this._objectReader.readBitLong(),f=[];for(let b=0;b<h;b++)f.push(this._objectReader.readBitLong());o+=h,e.faces.push([...f])}let n=this._objectReader.readBitLong();for(let o=0;o<n;o++){let h=this._objectReader.readBitLong(),f=this._objectReader.readBitLong();e.edges.push(new ln(h,f))}let a=this._objectReader.readBitLong();for(let o=0;o<a;o++)e.edges[o].crease=this._objectReader.readBitDouble();return this._objectReader.readBitLong(),t}readViewport(){let e=new fr,t=new sa(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble(),e.width=this._objectReader.readBitDouble(),e.height=this._objectReader.readBitDouble(),this.R2000Plus&&(e.viewTarget=this._objectReader.read3BitDouble(),e.viewDirection=this._objectReader.read3BitDouble(),e.twistAngle=this._objectReader.readBitDouble(),e.viewHeight=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClipPlane=this._objectReader.readBitDouble(),e.backClipPlane=this._objectReader.readBitDouble(),e.snapAngle=this._objectReader.readBitDouble(),e.viewCenter=this._objectReader.read2RawDouble(),e.snapBase=this._objectReader.read2RawDouble(),e.snapSpacing=this._objectReader.read2RawDouble(),e.gridSpacing=this._objectReader.read2RawDouble(),e.circleZoomPercent=this._objectReader.readBitShort()),this.R2007Plus&&(e.majorGridLineFrequency=this._objectReader.readBitShort());let i=0;if(this.R2000Plus&&(i=this._objectReader.readBitLong(),e.status=this._objectReader.readBitLong(),e.styleSheetName=this._textReader.readVariableText(),e.renderMode=this._objectReader.readByte(),e.displayUcsIcon=this._objectReader.readBit(),e.ucsPerViewport=this._objectReader.readBit(),e.ucsOrigin=this._objectReader.read3BitDouble(),e.ucsXAxis=this._objectReader.read3BitDouble(),e.ucsYAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort()),this.R2004Plus&&(e.shadePlotMode=this._objectReader.readBitShort()),this.R2007Plus&&(e.useDefaultLighting=this._objectReader.readBit(),e.defaultLightingType=this._objectReader.readByte(),e.brightness=this._objectReader.readBitDouble(),e.contrast=this._objectReader.readBitDouble(),e.ambientLightColor=this._objectReader.readCmColor()),this.R13_14Only&&(t.ViewportHeaderHandle=this.handleReference()),this.R2000Plus){for(let s=0;s<i;++s)t.FrozenLayerHandles.add(this.handleReference());t.BoundaryHandle=this.handleReference()}return this._version===m.AC1015&&(t.ViewportHeaderHandle=this.handleReference()),this.R2000Plus&&(t.NamedUcsHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference()),this.R2007Plus&&(this.handleReference(),this.handleReference(),this.handleReference(),this.handleReference()),t}readViewportEntityControl(){let e=new Il;this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();for(let i=0;i<t;++i)e.EntryHandles.add(this.handleReference());return e}readViewportEntityHeader(){let e=new Gl,t=new Ml(e);return this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(t.CadObject),this._objectReader.readBit(),this.handleReference(),this.handleReference(),t.BlockHandle=this.handleReference(),t}readMText(){let e=new Ne,t=new Sr(e);return this.readMTextBody(t,!0)}readMTextBody(e,t){let i=e.CadObject;if(t&&this.readCommonEntityData(e),i.insertPoint=this._objectReader.read3BitDouble(),i.normal=this._objectReader.read3BitDouble(),i.alignmentPoint=this._objectReader.read3BitDouble(),i.rectangleWidth=this._objectReader.readBitDouble(),this.R2007Plus&&(i.rectangleHeight=this._objectReader.readBitDouble()),i.height=this._objectReader.readBitDouble(),i.attachmentPoint=this._objectReader.readBitShort(),i.drawingDirection=this._objectReader.readBitShort(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),i.value=this._textReader.readVariableText(),e.StyleHandle=this.handleReference(),this.R2000Plus&&(i.lineSpacingStyle=this._objectReader.readBitShort(),i.lineSpacing=this._objectReader.readBitDouble(),this._objectReader.readBit()),this.R2004Plus&&(i.backgroundFillFlags=this._objectReader.readBitLong(),((i.backgroundFillFlags&rr.UseBackgroundFillColor)!==0||this._version>m.AC1027&&(i.backgroundFillFlags&rr.TextFrame)>0)&&(i.backgroundScale=this._objectReader.readBitDouble(),i.backgroundColor=this._mergedReaders.readCmColor(),i.backgroundTransparency=this._objectReader.readBitLong())),!this.R2018Plus)return e;if(i.isAnnotative=!this._objectReader.readBit(),!i.isAnnotative&&(this._objectReader.readBitShort(),this._objectReader.readBit(),this.handleReference(),this._objectReader.readBitLong(),this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),i.columnData.columnType=this._objectReader.readBitShort(),i.columnData.columnType!==rs.NoColumns)){let s=this._objectReader.readBitLong();if(i.columnData.width=this._objectReader.readBitDouble(),i.columnData.gutter=this._objectReader.readBitDouble(),i.columnData.autoHeight=this._objectReader.readBit(),i.columnData.flowReversed=this._objectReader.readBit(),!i.columnData.autoHeight&&i.columnData.columnType===rs.DynamicColumns&&s>0)for(let n=0;n<s;++n)i.columnData.heights.push(this._objectReader.readBitDouble())}return e}readHatch(){let e=new Tt,t=new Li(e);if(this.readCommonEntityData(t),this.R2004Plus){e.gradientColor.enabled=this._objectReader.readBitLong()!==0,e.gradientColor.reserved=this._objectReader.readBitLong(),e.gradientColor.angle=this._objectReader.readBitDouble(),e.gradientColor.shift=this._objectReader.readBitDouble(),e.gradientColor.isSingleColorGradient=this._objectReader.readBitLong()>0,e.gradientColor.colorTint=this._objectReader.readBitDouble();let a=this._objectReader.readBitLong();for(let o=0;o<a;++o){let h=new Sn;h.value=this._objectReader.readBitDouble(),h.color=this._mergedReaders.readCmColor(),e.gradientColor.colors.push(h)}e.gradientColor.name=this._textReader.readVariableText()}e.elevation=this._objectReader.readBitDouble(),e.normal=this._objectReader.read3BitDouble(),e.pattern=new an(this._textReader.readVariableText()),e.isSolid=this._objectReader.readBit(),e.isAssociative=this._objectReader.readBit();let i=this._objectReader.readBitLong(),s=!1;for(let a=0;a<i;a++){let o=new Li.CadBoundaryPathTemplate,h=this._objectReader.readBitLong();if(o.Path.flags=h,h&qe.Derived&&(s=!0),h&qe.Polyline){let b=new is,S=this._objectReader.readBit();b.isClosed=this._objectReader.readBit();let N=this._objectReader.readBitLong();for(let L=0;L<N;++L){let j=this._objectReader.read2RawDouble(),we=0;S&&(we=this._objectReader.readBitDouble()),b.vertices.push(new c(j.x,j.y,we))}o.Path.edges.push(b)}else{let b=this._objectReader.readBitLong();for(let S=0;S<b;++S)switch(this._objectReader.readByte()){case 1:{let L=new Kr;L.start=this._objectReader.read2RawDouble(),L.end=this._objectReader.read2RawDouble(),o.Path.edges.push(L)}break;case 2:{let L=new Xr;L.center=this._objectReader.read2RawDouble(),L.radius=this._objectReader.readBitDouble(),L.startAngle=this._objectReader.readBitDouble(),L.endAngle=this._objectReader.readBitDouble(),L.counterClockWise=this._objectReader.readBit(),o.Path.edges.push(L)}break;case 3:{let L=new Zr;L.center=this._objectReader.read2RawDouble(),L.majorAxisEndPoint=this._objectReader.read2RawDouble(),L.minorToMajorRatio=this._objectReader.readBitDouble(),L.startAngle=this._objectReader.readBitDouble(),L.endAngle=this._objectReader.readBitDouble(),L.counterClockWise=this._objectReader.readBit(),o.Path.edges.push(L)}break;case 4:{let L=new Jr;L.degree=this._objectReader.readBitLong(),L.isRational=this._objectReader.readBit(),L.isPeriodic=this._objectReader.readBit();let j=this._objectReader.readBitLong(),we=this._objectReader.readBitLong();for(let z=0;z<j;++z)L.knots.push(this._objectReader.readBitDouble());for(let z=0;z<we;++z){let X=this._objectReader.read2RawDouble(),qi=0;L.isRational&&(qi=this._objectReader.readBitDouble()),L.controlPoints.push(new c(X.x,X.y,qi))}if(this.R2010Plus){let z=this._objectReader.readBitLong();if(z>0){for(let X=0;X<z;++X)L.fitPoints.push(this._objectReader.read2RawDouble());L.startTangent=this._objectReader.read2RawDouble(),L.endTangent=this._objectReader.read2RawDouble()}}o.Path.edges.push(L);break}}}let f=this._objectReader.readBitLong();for(let b=0;b<f;b++)o.Handles.add(this.handleReference());t.PathTemplates.push(o)}if(e.style=this._objectReader.readBitShort(),e.patternType=this._objectReader.readBitShort(),!e.isSolid){e.patternAngle=this._objectReader.readBitDouble(),e.patternScale=this._objectReader.readBitDouble(),e.isDouble=this._objectReader.readBit();let a=this._objectReader.readBitShort();for(let o=0;o<a;++o){let h=new Cn;h.angle=this._objectReader.readBitDouble(),h.basePoint=this._objectReader.read2BitDouble(),h.offset=this._objectReader.read2BitDouble();let f=this._objectReader.readBitShort();for(let b=0;b<f;++b)h.dashLengths.push(this._objectReader.readBitDouble());e.pattern.lines.push(h)}}s&&(e.pixelSize=this._objectReader.readBitDouble());let n=this._objectReader.readBitLong();for(let a=0;a<n;++a)e.seedPoints.push(this._objectReader.read2RawDouble());return t}readModelerGeometry(e){let t=e.CadObject;if(this.readCommonEntityData(e),!this.R2013Plus&&!this._mergedReaders.readBit())return this.readModelerGeometryData(e),e;if(this._mergedReaders.readBit()){this._mergedReaders.readBit()&&(t.point=this._objectReader.read3BitDouble());let n=this._mergedReaders.readBitLong();if(this._mergedReaders.readBit()){let o=this._mergedReaders.readBitLong();for(let h=0;h<o;h++){let f=new _o;this.readWire(f),t.wires.push(f)}}let a=this._mergedReaders.readBitLong();for(let o=0;o<a;o++){let h=new wl;if(h.viewportId=this._mergedReaders.readBitLongLong(),h.viewportTarget=this._mergedReaders.read3BitDouble(),h.viewportDirectionFromTarget=this._mergedReaders.read3BitDouble(),h.viewportUpDirection=this._mergedReaders.read3BitDouble(),h.viewportPerspective=this._mergedReaders.readBit(),this._mergedReaders.readBit()){let f=this._mergedReaders.readBitLong();for(let b=0;b<f;b++){let S=new _o;this.readWire(S),h.wires.push(S)}}t.silhouettes.push(h)}if(!this._mergedReaders.readBit())return this.readModelerGeometryData(e),e}return this.R2007Plus&&this._mergedReaders.readBitLong(),e}readModelerGeometryData(e){this._mergedReaders.readBit();let t=this._mergedReaders.readBitShort();this.notify(`Stream data reader hasn't been implemented for ${e.CadObject.objectName}`,g.NotImplemented)}readSolid3D(){let e=new ti,t=new Qn(e);return this.readModelerGeometry(t),this.R2007Plus&&(t.HistoryHandle=this._mergedReaders.handleReference()),t}readWire(e){e.type=this._mergedReaders.readByte(),e.selectionMarker=this._mergedReaders.readBitLong();let t=this._mergedReaders.readBitShort();t=t>256?256:t,e.color=new B(t),e.acisIndex=this._mergedReaders.readBitLong();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++)e.points.push(this._mergedReaders.read3BitDouble());e.applyTransformPresent=this._mergedReaders.readBit(),e.applyTransformPresent&&(e.xAxis=this._mergedReaders.read3BitDouble(),e.yAxis=this._mergedReaders.read3BitDouble(),e.zAxis=this._mergedReaders.read3BitDouble(),e.translation=this._mergedReaders.read3BitDouble(),e.scale=this._mergedReaders.readBitDouble(),e.hasRotation=this._mergedReaders.readBit(),e.hasReflection=this._mergedReaders.readBit(),e.hasShear=this._mergedReaders.readBit())}readCadImage(e){let t=new mn(e);switch(this.readCommonEntityData(t),e.classVersion=this._objectReader.readBitLong(),e.insertPoint=this._objectReader.read3BitDouble(),e.uVector=this._objectReader.read3BitDouble(),e.vVector=this._objectReader.read3BitDouble(),e.size=this._objectReader.read2RawDouble(),e.flags=this._objectReader.readBitShort(),e.clippingState=this._objectReader.readBit(),e.brightness=this._objectReader.readByte(),e.contrast=this._objectReader.readByte(),e.fade=this._objectReader.readByte(),this.R2010Plus&&(e.clipMode=this._objectReader.readBit()?xi.Inside:xi.Outside),e.clipType=this._objectReader.readBitShort(),e.clipType){case $r.Rectangular:e.clipBoundaryVertices.push(this._objectReader.read2RawDouble()),e.clipBoundaryVertices.push(this._objectReader.read2RawDouble());break;case $r.Polygonal:{let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.clipBoundaryVertices.push(this._objectReader.read2RawDouble());break}}return t.ImgDefHandle=this.handleReference(),t.ImgReactorHandle=this.handleReference(),t}readImageDefinition(){let e=new Tr,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._mergedReaders.readBitLong(),e.size=this._mergedReaders.read2RawDouble(),e.fileName=this._mergedReaders.readVariableText(),e.isLoaded=this._mergedReaders.readBit(),e.units=this._mergedReaders.readByte(),e.defaultSize=this._mergedReaders.read2RawDouble(),t}readImageDefinitionReactor(){let e=new li,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._objectReader.readBitLong(),t}readOle2Frame(){let e=new dr,t=new Jn(e);this.readCommonEntityData(t),e.version=this._mergedReaders.readBitShort(),this.R2000Plus&&this._mergedReaders.readBitShort();let i=this._mergedReaders.readBitLong();return t.CadObject.binaryData=this._mergedReaders.readBytes(i),this.R2000Plus&&this._mergedReaders.readByte(),t}readPdfDefinition(){let e=new hi,t=new K(e);return this.readCommonNonEntityData(t),e.file=this._objectReader.readVariableText(),e.page=this._objectReader.readVariableText(),t}readPdfUnderlay(){let e=new Qr,t=new ga(e);this.readCommonEntityData(t),e.normal=this._objectReader.read3BitDouble(),e.insertPoint=this._objectReader.read3BitDouble(),e.rotation=this._objectReader.readBitDouble(),e.xScale=this._objectReader.readBitDouble(),e.yScale=this._objectReader.readBitDouble(),e.zScale=this._objectReader.readBitDouble(),e.flags=this._objectReader.readByte(),e.contrast=this._objectReader.readByte(),e.fade=this._objectReader.readByte(),t.DefinitionHandle=this.handleReference();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++)e.clipBoundaryVertices.push(this._mergedReaders.read2RawDouble());return t}readProxyEntity(){let e=new Tn,t=new k(e);return this.readCommonEntityData(t),this.readCommonProxyData(e),t}readProxyObject(){let e=new Er,t=new K(e);return this.readCommonNonEntityData(t),this.readCommonProxyData(e),t}readCommonProxyData(e){let t=this._mergedReaders.readBitLong(),i=this._classes.get(t);if(i&&(e.dxfClass=i),this.R2000Plus){if(this._version>m.AC1015&&this._mergedReaders.readVariableText(),this.R2018Plus)e.version=this._mergedReaders.readBitLong(),e.maintenanceVersion=this._mergedReaders.readBitLong();else{let s=this._mergedReaders.readBitLong();e.version=s&65535,e.maintenanceVersion=s>>16}e.originalDataFormatDxf=this._mergedReaders.readBit()}}readDictionary(){let e=new xe,t=new Vs(e);return this.readCommonDictionary(t),t}readDictionaryVar(){let e=new He,t=new K(e);return this.readCommonNonEntityData(t),this._objectReader.readByte(),e.value=this._textReader.readVariableText(),t}readDictionaryWithDefault(){let e=new Cr,t=new aa(e);return this.readCommonDictionary(t),t.DefaultEntryHandle=this.handleReference(),t}readCommonDictionary(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();this._version===m.AC1014&&this._objectReader.readByte(),this.R2000Plus&&(e.CadObject.clonningFlags=this._objectReader.readBitShort(),e.CadObject.hardOwnerFlag=this._objectReader.readByte()>0);for(let i=0;i<t;++i){let s=this._textReader.readVariableText(),n=this.handleReference();n===0||!s||s.length===0||e.Entries.set(s,n)}}readGroup(){let e=new Ot,t=new ha(e);this.readCommonNonEntityData(t),e.description=this._textReader.readVariableText(),this._objectReader.readBitShort(),e.selectable=this._objectReader.readBitShort()>0;let i=this._objectReader.readBitLong();for(let s=0;s<i;++s)t.Handles.add(this.handleReference());return t}readXRecord(){let e=new _t,t=new wa(e);this.readCommonNonEntityData(t);let i=this._objectReader.readBitLong()+this._objectReader.position;for(;this._objectReader.position<i;){let n=this._objectReader.readShort();switch(Be.transformValue(n)){case _.String:case _.ExtendedDataString:e.createEntry(n,this._objectReader.readTextUnicode());break;case _.Point3D:e.createEntry(n,new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case _.Double:case _.ExtendedDataDouble:e.createEntry(n,this._objectReader.readDouble());break;case _.Byte:e.createEntry(n,this._objectReader.readByte());break;case _.Int16:case _.ExtendedDataInt16:e.createEntry(n,this._objectReader.readShort());break;case _.Int32:case _.ExtendedDataInt32:e.createEntry(n,this._objectReader.readRawLong());break;case _.Int64:e.createEntry(n,this._objectReader.readRawULong());break;case _.Handle:{let o=this._objectReader.readTextUnicode(),h=parseInt(o,16);isNaN(h)?this.notify(`Failed to parse ${o} to handle`,g.Warning):t.AddHandleReference(n,h);break}case _.Bool:e.createEntry(n,this._objectReader.readByte()>0);break;case _.Chunk:case _.ExtendedDataChunk:e.createEntry(n,this._objectReader.readBytes(this._objectReader.readByte()));break;case _.ObjectId:case _.ExtendedDataHandle:t.AddHandleReference(n,this._objectReader.readRawULong());break;default:this.notify(`Unidentified GroupCodeValueType ${n} for XRecord [${e.handle}]`,g.Warning);break}}this.R2000Plus&&(e.cloningFlags=this._objectReader.readBitShort());let s=this._objectInitialPos+this._size*8-7;for(;this._handlesReader.positionInBits()<s;)this.handleReference();return t}readSortentsTable(){let e=new Br,t=new ca(e);this.readCommonNonEntityData(t),t.BlockOwnerHandle=this.handleReference();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++){let n=this._objectReader.handleReference(),a=this.handleReference();t.Values.push([n,a])}return t}readScale(){let e=new Ge,t=new K(e);return this.readCommonNonEntityData(t),this._mergedReaders.readBitShort(),e.name=this._mergedReaders.readVariableText(),e.paperUnits=this._mergedReaders.readBitDouble(),e.drawingUnits=this._mergedReaders.readBitDouble(),e.isUnitScale=this._mergedReaders.readBit(),t}readRasterVariables(){let e=new Ar,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._mergedReaders.readBitLong(),e.isDisplayFrameShown=this._mergedReaders.readBitShort()!==0,e.displayQuality=this._mergedReaders.readBitShort(),e.units=this._mergedReaders.readBitShort(),t}readDbColor(){let e=new ui,t=new K(e);this.readCommonNonEntityData(t);let i=this._objectReader.readBitShort();if(this.R2004Plus){let s=this._objectReader.readBitLong()>>>0,n=this._objectReader.readByte();(n&1)>0&&(e.colorName=this._textReader.readVariableText()),(n&2)>0&&(e.bookName=this._textReader.readVariableText());let a=As.getBytes(s);e.color=new B(a[2],a[1],a[0])}else e.color=new B(i);return t}readDimStyle(){let e=new re,t=new Hn(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(e),this.R13_14Only&&(e.generateTolerances=this._objectReader.readBit(),e.limitsGeneration=this._objectReader.readBit(),e.textOutsideHorizontal=this._objectReader.readBit(),e.suppressFirstExtensionLine=this._objectReader.readBit(),e.suppressSecondExtensionLine=this._objectReader.readBit(),e.textInsideHorizontal=this._objectReader.readBit(),e.alternateUnitDimensioning=this._objectReader.readBit(),e.textOutsideExtensions=this._objectReader.readBit(),e.separateArrowBlocks=this._objectReader.readBit(),e.textInsideExtensions=this._objectReader.readBit(),e.suppressOutsideExtensions=this._objectReader.readBit(),e.alternateUnitDecimalPlaces=this._objectReader.readByte(),e.zeroHandling=this._objectReader.readRawChar(),e.suppressFirstDimensionLine=this._objectReader.readBit(),e.suppressSecondDimensionLine=this._objectReader.readBit(),e.toleranceAlignment=this._objectReader.readRawChar(),e.textHorizontalAlignment=this._objectReader.readByte(),e.dimensionFit=this._objectReader.readRawChar(),e.cursorUpdate=this._objectReader.readBit(),e.toleranceZeroHandling=this._objectReader.readByte(),e.alternateUnitZeroHandling=this._objectReader.readByte(),e.alternateUnitToleranceZeroHandling=this._objectReader.readByte(),e.textVerticalAlignment=this._objectReader.readByte(),e.dimensionUnit=this._objectReader.readBitShort(),e.angularUnit=this._objectReader.readBitShort(),e.decimalPlaces=this._objectReader.readBitShort(),e.toleranceDecimalPlaces=this._objectReader.readBitShort(),e.alternateUnitFormat=this._objectReader.readBitShort(),e.alternateUnitToleranceDecimalPlaces=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),e.arrowSize=this._objectReader.readBitDouble(),e.extensionLineOffset=this._objectReader.readBitDouble(),e.dimensionLineIncrement=this._objectReader.readBitDouble(),e.extensionLineExtension=this._objectReader.readBitDouble(),e.rounding=this._objectReader.readBitDouble(),e.dimensionLineExtension=this._objectReader.readBitDouble(),e.plusTolerance=this._objectReader.readBitDouble(),e.minusTolerance=this._objectReader.readBitDouble(),e.textHeight=this._objectReader.readBitDouble(),e.centerMarkSize=this._objectReader.readBitDouble(),e.tickSize=this._objectReader.readBitDouble(),e.alternateUnitScaleFactor=this._objectReader.readBitDouble(),e.linearScaleFactor=this._objectReader.readBitDouble(),e.textVerticalPosition=this._objectReader.readBitDouble(),e.toleranceScaleFactor=this._objectReader.readBitDouble(),e.dimensionLineGap=this._objectReader.readBitDouble(),e.postFix=this._textReader.readVariableText(),e.alternateDimensioningSuffix=this._textReader.readVariableText(),t.DIMBL_Name=this._textReader.readVariableText(),t.DIMBLK1_Name=this._textReader.readVariableText(),t.DIMBLK2_Name=this._textReader.readVariableText(),e.dimensionLineColor=this._objectReader.readColorByIndex(),e.extensionLineColor=this._objectReader.readColorByIndex(),e.textColor=this._objectReader.readColorByIndex()),this.R2000Plus&&(e.postFix=this._textReader.readVariableText(),e.alternateDimensioningSuffix=this._textReader.readVariableText(),e.scaleFactor=this._objectReader.readBitDouble(),e.arrowSize=this._objectReader.readBitDouble(),e.extensionLineOffset=this._objectReader.readBitDouble(),e.dimensionLineIncrement=this._objectReader.readBitDouble(),e.extensionLineExtension=this._objectReader.readBitDouble(),e.rounding=this._objectReader.readBitDouble(),e.dimensionLineExtension=this._objectReader.readBitDouble(),e.plusTolerance=this._objectReader.readBitDouble(),e.minusTolerance=this._objectReader.readBitDouble()),this.R2007Plus&&(e.fixedExtensionLineLength=this._objectReader.readBitDouble(),e.joggedRadiusDimensionTransverseSegmentAngle=this._objectReader.readBitDouble(),e.textBackgroundFillMode=this._objectReader.readBitShort(),e.textBackgroundColor=this._mergedReaders.readCmColor()),this.R2000Plus&&(e.generateTolerances=this._objectReader.readBit(),e.limitsGeneration=this._objectReader.readBit(),e.textInsideHorizontal=this._objectReader.readBit(),e.textOutsideHorizontal=this._objectReader.readBit(),e.suppressFirstExtensionLine=this._objectReader.readBit(),e.suppressSecondExtensionLine=this._objectReader.readBit(),e.textVerticalAlignment=this._objectReader.readBitShort(),e.zeroHandling=this._objectReader.readBitShort(),e.angularZeroHandling=this._objectReader.readBitShort()),this.R2007Plus&&(e.arcLengthSymbolPosition=this._objectReader.readBitShort()),this.R2000Plus&&(e.textHeight=this._objectReader.readBitDouble(),e.centerMarkSize=this._objectReader.readBitDouble(),e.tickSize=this._objectReader.readBitDouble(),e.alternateUnitScaleFactor=this._objectReader.readBitDouble(),e.linearScaleFactor=this._objectReader.readBitDouble(),e.textVerticalPosition=this._objectReader.readBitDouble(),e.toleranceScaleFactor=this._objectReader.readBitDouble(),e.dimensionLineGap=this._objectReader.readBitDouble(),e.alternateUnitRounding=this._objectReader.readBitDouble(),e.alternateUnitDimensioning=this._objectReader.readBit(),e.alternateUnitDecimalPlaces=this._objectReader.readBitShort(),e.textOutsideExtensions=this._objectReader.readBit(),e.separateArrowBlocks=this._objectReader.readBit(),e.textInsideExtensions=this._objectReader.readBit(),e.suppressOutsideExtensions=this._objectReader.readBit(),e.dimensionLineColor=this._mergedReaders.readCmColor(),e.extensionLineColor=this._mergedReaders.readCmColor(),e.textColor=this._mergedReaders.readCmColor(),e.angularDecimalPlaces=this._objectReader.readBitShort(),e.decimalPlaces=this._objectReader.readBitShort(),e.toleranceDecimalPlaces=this._objectReader.readBitShort(),e.alternateUnitFormat=this._objectReader.readBitShort(),e.alternateUnitToleranceDecimalPlaces=this._objectReader.readBitShort(),e.angularUnit=this._objectReader.readBitShort(),e.fractionFormat=this._objectReader.readBitShort(),e.linearUnitFormat=this._objectReader.readBitShort(),e.decimalSeparator=String.fromCharCode(this._objectReader.readBitShort()),e.textMovement=this._objectReader.readBitShort(),e.textHorizontalAlignment=this._objectReader.readBitShort(),e.suppressFirstDimensionLine=this._objectReader.readBit(),e.suppressSecondDimensionLine=this._objectReader.readBit(),e.toleranceAlignment=this._objectReader.readBitShort(),e.toleranceZeroHandling=this._objectReader.readBitShort(),e.alternateUnitZeroHandling=this._objectReader.readBitShort(),e.alternateUnitToleranceZeroHandling=this._objectReader.readBitShort(),e.cursorUpdate=this._objectReader.readBit(),e.dimensionFit=this._objectReader.readBitShort()),this.R2007Plus&&(e.isExtensionLineLengthFixed=this._objectReader.readBit()),this.R2010Plus&&(e.textDirection=this._objectReader.readBit()?_i.RightToLeft:_i.LeftToRight,e.altMzf=this._objectReader.readBitDouble(),e.altMzs=this._textReader.readVariableText(),e.mzf=this._objectReader.readBitDouble(),e.mzs=this._textReader.readVariableText()),this.R2000Plus&&(e.dimensionLineWeight=this._objectReader.readBitShort(),e.extensionLineWeight=this._objectReader.readBitShort()),this._objectReader.readBit(),t.BlockHandle=this.handleReference(),t.TextStyleHandle=this.handleReference(),this.R2000Plus&&(t.DIMLDRBLK=this.handleReference(),t.DIMBLK=this.handleReference(),t.DIMBLK1=this.handleReference(),t.DIMBLK2=this.handleReference()),this.R2007Plus&&(t.Dimltype=this.handleReference(),t.Dimltex1=this.handleReference(),t.Dimltex2=this.handleReference()),t}readView(){let e=new Vi,t=new ia(e);return this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.height=this._objectReader.readBitDouble(),e.width=this._objectReader.readBitDouble(),e.center=this._objectReader.read2RawDouble(),e.target=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.angle=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClipping=this._objectReader.readBitDouble(),e.backClipping=this._objectReader.readBitDouble(),this._objectReader.readBit()&&(e.viewMode|=se.PerspectiveView),this._objectReader.readBit()&&(e.viewMode|=se.FrontClipping),this._objectReader.readBit()&&(e.viewMode|=se.BackClipping),this._objectReader.readBit()&&(e.viewMode|=se.FrontClippingZ),this.R2000Plus&&(e.renderMode=this._objectReader.readByte()),this.R2007Plus&&(this._mergedReaders.readBit(),this._mergedReaders.readByte(),this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble(),this._mergedReaders.readCmColor()),this._objectReader.readBit()&&(e.flags|=1),this.R2000Plus&&(e.isUcsAssociated=this._objectReader.readBit(),e.isUcsAssociated&&(e.ucsOrigin=this._objectReader.read3BitDouble(),e.ucsXAxis=this._objectReader.read3BitDouble(),e.ucsYAxis=this._objectReader.read3BitDouble(),e.ucsElevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort())),this.handleReference(),this.R2007Plus&&(e.isPlottable=this._objectReader.readBit(),this.handleReference(),this.handleReference(),this.handleReference()),this.R2000Plus&&e.isUcsAssociated&&(t.UcsHandle=this.handleReference(),t.NamedUcsHandle=this.handleReference()),this.R2007Plus&&this.handleReference(),t}readVPort(){let e=new xt,t=new na(e);if(this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.viewHeight=this._objectReader.readBitDouble(),e.aspectRatio=this._objectReader.readBitDouble()/e.viewHeight,e.center=this._objectReader.read2RawDouble(),e.target=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.twistAngle=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClippingPlane=this._objectReader.readBitDouble(),e.backClippingPlane=this._objectReader.readBitDouble(),this._objectReader.readBit()&&(e.viewMode|=se.PerspectiveView),this._objectReader.readBit()&&(e.viewMode|=se.FrontClipping),this._objectReader.readBit()&&(e.viewMode|=se.BackClipping),this._objectReader.readBit()&&(e.viewMode|=se.FrontClippingZ),this.R2000Plus&&(e.renderMode=this._objectReader.readByte()),this.R2007Plus&&(e.useDefaultLighting=this._objectReader.readBit(),e.defaultLighting=this._objectReader.readByte(),e.brightness=this._objectReader.readBitDouble(),e.contrast=this._objectReader.readBitDouble(),e.ambientColor=this._mergedReaders.readCmColor()),e.bottomLeft=this._objectReader.read2RawDouble(),e.topRight=this._objectReader.read2RawDouble(),this._objectReader.readBit()&&(e.viewMode|=se.Follow),e.circleZoomPercent=this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()&&(e.ucsIconDisplay=vr.OnLower),this._objectReader.readBit()&&(e.ucsIconDisplay=vr.OnOrigin),e.showGrid=this._objectReader.readBit(),e.gridSpacing=this._objectReader.read2RawDouble(),e.snapOn=this._objectReader.readBit(),e.isometricSnap=this._objectReader.readBit(),e.snapIsoPair=this._objectReader.readBitShort(),e.snapRotation=this._objectReader.readBitDouble(),e.snapBasePoint=this._objectReader.read2RawDouble(),e.snapSpacing=this._objectReader.read2RawDouble(),this.R2000Plus){this._objectReader.readBit();let i=this._objectReader.readBit();e.origin=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.orthographicType=this._objectReader.readBitShort()}return this.R2007Plus&&(e.gridFlags=this._objectReader.readBitShort(),e.minorGridLinesPerMajorGridLine=this._objectReader.readBitShort()),t.VportControlHandle=this.handleReference(),this.R2007Plus&&(t.BackgroundHandle=this.handleReference(),t.StyleHandle=this.handleReference(),t.SunHandle=this.handleReference()),this.R2000Plus&&(t.NamedUcsHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference()),t}readUcs(){let e=new ot,t=new ra(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.origin=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),this.R2000Plus&&(e.elevation=this._objectReader.readBitDouble(),e.orthographicViewType=this._objectReader.readBitShort(),e.orthographicType=this._objectReader.readBitShort());let i=this.handleReference();if(this.R2000Plus){let s=this.handleReference(),n=this.handleReference()}return t}readLayout(){let e=new nt,t=new Un(e);this.readCommonNonEntityData(t),this.readPlotSettingsData(e),e.name=this._textReader.readVariableText(),e.tabOrder=this._objectReader.readBitLong(),e.layoutFlags=this._objectReader.readBitShort(),e.origin=this._objectReader.read3BitDouble(),e.minLimits=this._objectReader.read2RawDouble(),e.maxLimits=this._objectReader.read2RawDouble(),e.insertionBasePoint=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort(),e.minExtents=this._objectReader.read3BitDouble(),e.maxExtents=this._objectReader.read3BitDouble();let i=0;if(this.R2004Plus&&(i=this._objectReader.readBitLong()),t.PaperSpaceBlockHandle=this.handleReference(),t.ActiveViewportHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference(),t.NamesUcsHandle=this.handleReference(),this.R2004Plus)for(let s=0;s<i;s++)t.ViewportHandles.add(this.handleReference());return t}readLeader(){let e=new nr,t=new vn(e);this.readCommonEntityData(t),this._objectReader.readBit(),e.creationType=this._objectReader.readBitShort(),e.pathType=this._objectReader.readBitShort();let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.vertices.push(this._objectReader.read3BitDouble());return this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.horizontalDirection=this._objectReader.read3BitDouble(),e.blockOffset=this._objectReader.read3BitDouble(),this._version>=m.AC1014&&(e.annotationOffset=this._objectReader.read3BitDouble()),this.R13_14Only&&(e.style.dimensionLineGap=this._objectReader.readBitDouble()),this._version<=m.AC1021&&(e.textHeight=this._objectReader.readBitDouble(),e.textWidth=this._objectReader.readBitDouble()),e.hookLineDirection=this._objectReader.readBit()?Di.Same:Di.Opposite,e.arrowHeadEnabled=this._objectReader.readBit(),this.R13_14Only&&(this._objectReader.readBitShort(),t.Dimasz=this._objectReader.readBitDouble(),this._objectReader.readBit(),this._objectReader.readBit(),this._objectReader.readBitShort(),this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()),this.R2000Plus&&(this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()),t.AnnotationHandle=this.handleReference(),t.DIMSTYLEHandle=this.handleReference(),t}readMultiLeader(){let e=new lr,t=new $n(e);if(this.readCommonEntityData(t),this.R2010Plus){let s=this._objectReader.readBitShort()}if(this.readMultiLeaderAnnotContextData(e.contextData,t.CadMLeaderAnnotContextTemplate),t.LeaderStyleHandle=this.handleReference(),e.propertyOverrideFlags=this._objectReader.readBitLong(),e.pathType=this._objectReader.readBitShort(),e.lineColor=this._mergedReaders.readCmColor(),t.LeaderLineTypeHandle=this.handleReference(),e.leaderLineWeight=this._objectReader.readBitLong(),e.enableLanding=this._objectReader.readBit(),e.enableDogleg=this._objectReader.readBit(),e.landingDistance=this._objectReader.readBitDouble(),t.ArrowheadHandle=this.handleReference(),e.arrowheadSize=this._objectReader.readBitDouble(),e.contentType=this._objectReader.readBitShort(),t.MTextStyleHandle=this.handleReference(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAngle=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.textColor=this._mergedReaders.readCmColor(),e.textFrame=this._objectReader.readBit(),t.BlockContentHandle=this.handleReference(),e.blockContentColor=this._mergedReaders.readCmColor(),e.blockContentScale=this._objectReader.read3BitDouble(),e.blockContentRotation=this._objectReader.readBitDouble(),e.blockContentConnection=this._objectReader.readBitShort(),e.enableAnnotationScale=this._objectReader.readBit(),this.R2007Pre){let s=this._objectReader.readBitLong();for(let n=0;n<s;n++){let a=this._objectReader.readBit();t.ArrowheadHandles.set(this.handleReference(),a)}}let i=this._objectReader.readBitLong();for(let s=0;s<i;s++){let n=this.handleReference(),a=new gl;a.text=this._textReader.readVariableText(),a.index=this._objectReader.readBitShort(),a.width=this._objectReader.readBitDouble(),e.blockAttributes.push(a),t.BlockAttributeHandles.set(a,n)}return e.textDirectionNegative=this._objectReader.readBit(),e.textAligninIPE=this._objectReader.readBitShort()!==0,e.textAttachmentPoint=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),this.R2010Plus&&(e.textAttachmentDirection=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort(),e.textTopAttachment=this._objectReader.readBitShort()),this.R2013Plus&&(e.extendedToText=this._objectReader.readBit()),t}readMultiLeaderAnnotContext(){let e=new Dr,t=new ai(e);return this.readAnnotScaleObjectContextData(t),this.readMultiLeaderAnnotContextData(e,t),t}readMultiLeaderAnnotContextData(e,t){let i=this._objectReader.readBitLong();if(i===0){let s=this._objectReader.readBit(),n=this._objectReader.readBit(),a=this._objectReader.readBit(),o=this._objectReader.readBit(),h=this._objectReader.readBit(),f=this._objectReader.readBit(),b=this._objectReader.readBit();i=f?2:1}for(let s=0;s<i;s++)e.leaderRoots.push(this.readLeaderRoot(t));if(e.scaleFactor=this._objectReader.readBitDouble(),e.contentBasePoint=this._objectReader.read3BitDouble(),e.textHeight=this._objectReader.readBitDouble(),e.arrowheadSize=this._objectReader.readBitDouble(),e.landingGap=this._objectReader.readBitDouble(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.blockContentConnection=this._objectReader.readBitShort(),e.hasTextContents=this._objectReader.readBit(),e.hasTextContents){e.textLabel=this._textReader.readVariableText(),e.textNormal=this._objectReader.read3BitDouble(),t.TextStyleHandle=this.handleReference(),e.textLocation=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.textRotation=this._objectReader.readBitDouble(),e.boundaryWidth=this._objectReader.readBitDouble(),e.boundaryHeight=this._objectReader.readBitDouble(),e.lineSpacingFactor=this._objectReader.readBitDouble(),e.lineSpacing=this._objectReader.readBitShort(),e.textColor=this._objectReader.readCmColor(),e.textAttachmentPoint=this._objectReader.readBitShort(),e.flowDirection=this._objectReader.readBitShort(),e.backgroundFillColor=this._objectReader.readCmColor(),e.backgroundScaleFactor=this._objectReader.readBitDouble(),e.backgroundTransparency=this._objectReader.readBitLong(),e.backgroundFillEnabled=this._objectReader.readBit(),e.backgroundMaskFillOn=this._objectReader.readBit(),e.columnType=this._objectReader.readBitShort(),e.textHeightAutomatic=this._objectReader.readBit(),e.columnWidth=this._objectReader.readBitDouble(),e.columnGutter=this._objectReader.readBitDouble(),e.columnFlowReversed=this._objectReader.readBit();let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)e.columnSizes.push(this._objectReader.readBitDouble());e.wordBreak=this._objectReader.readBit(),this._objectReader.readBit()}else if(e.hasContentsBlock=this._objectReader.readBit()){t.BlockRecordHandle=this.handleReference(),e.blockContentNormal=this._objectReader.read3BitDouble(),e.blockContentLocation=this._objectReader.read3BitDouble(),e.blockContentScale=this._objectReader.read3BitDouble(),e.blockContentRotation=this._objectReader.readBitDouble(),e.blockContentColor=this._objectReader.readCmColor();let s=this._objectReader.readBitDouble(),n=this._objectReader.readBitDouble(),a=this._objectReader.readBitDouble(),o=this._objectReader.readBitDouble(),h=this._objectReader.readBitDouble(),f=this._objectReader.readBitDouble(),b=this._objectReader.readBitDouble(),S=this._objectReader.readBitDouble(),N=this._objectReader.readBitDouble(),L=this._objectReader.readBitDouble(),j=this._objectReader.readBitDouble(),we=this._objectReader.readBitDouble(),z=this._objectReader.readBitDouble(),X=this._objectReader.readBitDouble(),qi=this._objectReader.readBitDouble(),_s=this._objectReader.readBitDouble(),_e=it.identity();_e.m00=s,_e.m10=n,_e.m20=a,_e.m30=o,_e.m01=h,_e.m11=f,_e.m21=b,_e.m31=S,_e.m02=N,_e.m12=L,_e.m22=j,_e.m32=we,_e.m03=z,_e.m13=X,_e.m23=qi,_e.m33=_s,e.transformationMatrix=_e}return e.basePoint=this._objectReader.read3BitDouble(),e.baseDirection=this._objectReader.read3BitDouble(),e.baseVertical=this._objectReader.read3BitDouble(),e.normalReversed=this._objectReader.readBit(),this.R2010Plus&&(e.textTopAttachment=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort()),e}readMultiLeaderStyle(){let e=new $e,t=new Yn(e);if(this.readCommonNonEntityData(t),this.R2010Plus){let i=this._objectReader.readBitShort()}return e.contentType=this._objectReader.readBitShort(),e.multiLeaderDrawOrder=this._objectReader.readBitShort(),e.leaderDrawOrder=this._objectReader.readBitShort(),e.maxLeaderSegmentsPoints=this._objectReader.readBitLong(),e.firstSegmentAngleConstraint=this._objectReader.readBitDouble(),e.secondSegmentAngleConstraint=this._objectReader.readBitDouble(),e.pathType=this._objectReader.readBitShort(),e.lineColor=this._mergedReaders.readCmColor(),t.LeaderLineTypeHandle=this.handleReference(),e.leaderLineWeight=this._objectReader.readBitLong(),e.enableLanding=this._objectReader.readBit(),e.landingGap=this._objectReader.readBitDouble(),e.enableDogleg=this._objectReader.readBit(),e.landingDistance=this._objectReader.readBitDouble(),e.description=this._mergedReaders.readVariableText(),t.ArrowheadHandle=this.handleReference(),e.arrowheadSize=this._objectReader.readBitDouble(),e.defaultTextContents=this._mergedReaders.readVariableText(),t.MTextStyleHandle=this.handleReference(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAngle=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.textColor=this._mergedReaders.readCmColor(),e.textHeight=this._objectReader.readBitDouble(),e.textFrame=this._objectReader.readBit(),e.textAlignAlwaysLeft=this._objectReader.readBit(),e.alignSpace=this._objectReader.readBitDouble(),t.BlockContentHandle=this.handleReference(),e.blockContentColor=this._mergedReaders.readCmColor(),e.blockContentScale=this._objectReader.read3BitDouble(),e.enableBlockContentScale=this._objectReader.readBit(),e.blockContentRotation=this._objectReader.readBitDouble(),e.enableBlockContentRotation=this._objectReader.readBit(),e.blockContentConnection=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),e.overwritePropertyValue=this._objectReader.readBit(),e.isAnnotative=this._objectReader.readBit(),e.breakGapSize=this._objectReader.readBitDouble(),this.R2010Plus&&(e.textAttachmentDirection=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort(),e.textTopAttachment=this._objectReader.readBitShort()),this.R2013Plus&&(e.unknownFlag298=this._objectReader.readBit()),t}readMaterial(){let e=new at,t=new Zn(e);if(this.readCommonNonEntityData(t),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.ambientColorMethod=this._mergedReaders.readByte(),e.ambientColorFactor=this._mergedReaders.readBitDouble(),e.ambientColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.ambientColor=new B(s[2],s[1],s[0])}if(e.diffuseColorMethod=this._mergedReaders.readByte(),e.diffuseColorFactor=this._mergedReaders.readBitDouble(),e.diffuseColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.diffuseColor=new B(s[2],s[1],s[0])}switch(e.diffuseMapBlendFactor=this._mergedReaders.readBitDouble(),e.diffuseProjectionMethod=this._mergedReaders.readByte(),e.diffuseTilingMethod=this._mergedReaders.readByte(),e.diffuseAutoTransform=this._mergedReaders.readByte(),e.diffuseMatrix=this.readMatrix4(),e.diffuseMapSource=this._mergedReaders.readByte(),e.diffuseMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.diffuseMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}if(e.specularColorMethod=this._mergedReaders.readByte(),e.specularColorFactor=this._mergedReaders.readBitDouble(),e.specularColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.specularColor=new B(s[2],s[1],s[0])}switch(e.specularMapBlendFactor=this._mergedReaders.readBitDouble(),e.specularProjectionMethod=this._mergedReaders.readByte(),e.specularTilingMethod=this._mergedReaders.readByte(),e.specularAutoTransform=this._mergedReaders.readByte(),e.specularMatrix=this.readMatrix4(),e.specularMapSource=this._mergedReaders.readByte(),e.specularMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.specularMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.specularGlossFactor=this._objectReader.readBitDouble(),e.reflectionMapBlendFactor=this._mergedReaders.readBitDouble(),e.reflectionProjectionMethod=this._mergedReaders.readByte(),e.reflectionTilingMethod=this._mergedReaders.readByte(),e.reflectionAutoTransform=this._mergedReaders.readByte(),e.reflectionMatrix=this.readMatrix4(),e.reflectionMapSource=this._mergedReaders.readByte(),e.reflectionMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.reflectionMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.opacity=this._mergedReaders.readBitDouble(),e.opacityMapBlendFactor=this._mergedReaders.readBitDouble(),e.opacityProjectionMethod=this._mergedReaders.readByte(),e.opacityTilingMethod=this._mergedReaders.readByte(),e.opacityAutoTransform=this._mergedReaders.readByte(),e.opacityMatrix=this.readMatrix4(),e.opacityMapSource=this._mergedReaders.readByte(),e.opacityMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.opacityMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.bumpMapBlendFactor=this._mergedReaders.readBitDouble(),e.bumpProjectionMethod=this._mergedReaders.readByte(),e.bumpTilingMethod=this._mergedReaders.readByte(),e.bumpAutoTransform=this._mergedReaders.readByte(),e.bumpMatrix=this.readMatrix4(),e.bumpMapSource=this._mergedReaders.readByte(),e.bumpMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.bumpMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.refractionIndex=this._mergedReaders.readBitDouble(),e.refractionMapBlendFactor=this._mergedReaders.readBitDouble(),e.refractionProjectionMethod=this._mergedReaders.readByte(),e.refractionTilingMethod=this._mergedReaders.readByte(),e.refractionAutoTransform=this._mergedReaders.readByte(),e.refractionMatrix=this.readMatrix4(),e.refractionMapSource=this._mergedReaders.readByte(),e.refractionMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.refractionMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}return t}readMLine(){let e=new or,t=new Xn(e);this.readCommonEntityData(t),e.scaleFactor=this._objectReader.readBitDouble(),e.justification=this._objectReader.readByte(),e.startPoint=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.flags|=this._objectReader.readBitShort()===3?Bi.Closed:Bi.Has;let i=this._objectReader.readByte(),s=this._objectReader.readBitShort();for(let n=0;n<s;n++){let a=new yn;a.position=this._objectReader.read3BitDouble(),a.direction=this._objectReader.read3BitDouble(),a.miter=this._objectReader.read3BitDouble();for(let o=0;o<i;o++){let h=new Bn,f=this._objectReader.readBitShort();for(let S=0;S<f;S++)h.parameters.push(this._objectReader.readBitDouble());let b=this._objectReader.readBitShort();for(let S=0;S<b;S++)h.areaFillParameters.push(this._objectReader.readBitDouble());a.segments.push(h)}e.vertices.push(a)}return t.MLineStyleHandle=this.handleReference(),t}readMLineStyle(){let e=new wt,t=new Pi(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),e.description=this._textReader.readVariableText();let i=this._objectReader.readBitShort();(i&1)>0&&(e.flags|=ge.DisplayJoints),(i&2)>0&&(e.flags|=ge.FillOn),(i&16)>0&&(e.flags|=ge.StartSquareCap),(i&32)>0&&(e.flags|=ge.StartRoundCap),(i&64)>0&&(e.flags|=ge.StartInnerArcsCap),(i&256)>0&&(e.flags|=ge.EndSquareCap),(i&512)>0&&(e.flags|=ge.EndRoundCap),(i&1024)>0&&(e.flags|=ge.EndInnerArcsCap),e.fillColor=this._mergedReaders.readCmColor(),e.startAngle=this._objectReader.readBitDouble(),e.endAngle=this._objectReader.readBitDouble();let s=this._objectReader.readByte();for(let n=0;n<s;n++){let a=new js,o=new Pi.ElementTemplate(a);a.offset=this._objectReader.readBitDouble(),a.color=this._mergedReaders.readCmColor(),this.R2018Plus?o.LineTypeHandle=this.handleReference():o.LinetypeIndex=this._objectReader.readBitShort(),t.ElementTemplates.push(o),e.addElement(a)}return t}readGeoData(){let e=new Jt,t=new da(e);switch(this.readCommonNonEntityData(t),e.version=this._mergedReaders.readBitLong(),t.HostBlockHandle=this.handleReference(),e.coordinatesType=this._mergedReaders.readBitShort(),e.version){case We.R2009:e.referencePoint=this._mergedReaders.read3BitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.verticalUnits=e.horizontalUnits,e.designPoint=this._mergedReaders.read3BitDouble(),this._mergedReaders.read3BitDouble(),e.upDirection=this._mergedReaders.read3BitDouble();let n=Math.PI/2-this._mergedReaders.readBitDouble();e.northDirection=new C(Math.cos(n),Math.sin(n)),this._mergedReaders.read3BitDouble(),e.coordinateSystemDefinition=this._mergedReaders.readVariableText(),e.geoRssTag=this._mergedReaders.readVariableText(),e.horizontalUnitScale=this._mergedReaders.readBitDouble(),e.verticalUnitScale=e.horizontalUnitScale,this._mergedReaders.readVariableText(),this._mergedReaders.readVariableText();break;case We.R2010:case We.R2013:e.designPoint=this._mergedReaders.read3BitDouble(),e.referencePoint=this._mergedReaders.read3BitDouble(),e.horizontalUnitScale=this._mergedReaders.readBitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.verticalUnitScale=this._mergedReaders.readBitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.upDirection=this._mergedReaders.read3BitDouble(),e.northDirection=this._mergedReaders.read2RawDouble(),e.scaleEstimationMethod=this._mergedReaders.readBitLong(),e.userSpecifiedScaleFactor=this._mergedReaders.readBitDouble(),e.enableSeaLevelCorrection=this._mergedReaders.readBit(),e.seaLevelElevation=this._mergedReaders.readBitDouble(),e.coordinateProjectionRadius=this._mergedReaders.readBitDouble(),e.coordinateSystemDefinition=this._mergedReaders.readVariableText(),e.geoRssTag=this._mergedReaders.readVariableText();break}e.observationFromTag=this._mergedReaders.readVariableText(),e.observationToTag=this._mergedReaders.readVariableText(),e.observationCoverageTag=this._mergedReaders.readVariableText();let i=this._mergedReaders.readBitLong();for(let n=0;n<i;n++){let a=new la;a.source=this._mergedReaders.read2RawDouble(),a.destination=this._mergedReaders.read2RawDouble(),e.points.push(a)}let s=this._mergedReaders.readBitLong();for(let n=0;n<s;n++){let a=new oa;a.index1=this._mergedReaders.readBitLong(),a.index2=this._mergedReaders.readBitLong(),a.index3=this._mergedReaders.readBitLong(),e.faces.push(a)}return t}readTableStyle(){let e=new Ye,t=new pa(e);if(this.readCommonNonEntityData(t),this.R2007Pre)return e.description=this._mergedReaders.readVariableText(),e.flowDirection=this._mergedReaders.readBitShort(),e.flags=this._mergedReaders.readBitShort(),e.horizontalCellMargin=this._mergedReaders.readBitDouble(),e.verticalCellMargin=this._mergedReaders.readBitDouble(),e.suppressTitle=this._mergedReaders.readBit(),e.suppressHeaderRow=this._mergedReaders.readBit(),this.readRowCellStyle(t,e.dataCellStyle),this.readRowCellStyle(t,e.titleCellStyle),this.readRowCellStyle(t,e.headerCellStyle),t;let i=this._mergedReaders.readByte();e.description=this._mergedReaders.readVariableText();let s=this._mergedReaders.readBitLong(),n=this._mergedReaders.readBitLong(),a=this.handleReference(),o=new jt(e.tableCellStyle);this.readCellStyle(o),e.tableCellStyle.id=this._mergedReaders.readBitLong(),e.tableCellStyle.styleClass=this._mergedReaders.readBitLong(),e.tableCellStyle.name=this._mergedReaders.readVariableText();let h=this._mergedReaders.readBitLong();for(let f=0;f<h;f++){let b=new os,S=new jt(b);t.CellStyleTemplates.push(S);let N=this._mergedReaders.readBitLong();this.readCellStyle(S),b.id=this._mergedReaders.readBitLong(),b.styleClass=this._mergedReaders.readBitLong(),b.name=this._mergedReaders.readVariableText()}return t}readVisualStyle(){let e=new di,t=new K(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),e.type=this._objectReader.readBitLong();let i=this._objectReader.readBitShort(),s=this._objectReader.readBit(),n=this._objectReader.readBitLong();return t}readPlotSettingsEntity(){let e=new pt,t=new Vl(e);return this.readCommonNonEntityData(t),this.readPlotSettingsData(e),t}readPlotSettings(){return this.readPlotSettingsEntity()}readPlotSettingsData(e){e.pageName=this._textReader.readVariableText(),e.systemPrinterName=this._textReader.readVariableText(),e.flags=this._objectReader.readBitShort();let t=new un;if(t.left=this._objectReader.readBitDouble(),t.bottom=this._objectReader.readBitDouble(),t.right=this._objectReader.readBitDouble(),t.top=this._objectReader.readBitDouble(),e.unprintableMargin=t,e.paperWidth=this._objectReader.readBitDouble(),e.paperHeight=this._objectReader.readBitDouble(),e.paperSize=this._textReader.readVariableText(),e.plotOriginX=this._objectReader.readBitDouble(),e.plotOriginY=this._objectReader.readBitDouble(),e.paperUnits=this._objectReader.readBitShort(),e.paperRotation=this._objectReader.readBitShort(),e.plotType=this._objectReader.readBitShort(),e.windowLowerLeftX=this._objectReader.readBitDouble(),e.windowLowerLeftY=this._objectReader.readBitDouble(),e.windowUpperLeftX=this._objectReader.readBitDouble(),e.windowUpperLeftY=this._objectReader.readBitDouble(),this._version>=m.AC1012&&this._version<=m.AC1015&&(e.plotViewName=this._textReader.readVariableText()),e.numeratorScale=this._objectReader.readBitDouble(),e.denominatorScale=this._objectReader.readBitDouble(),e.styleSheet=this._textReader.readVariableText(),e.scaledFit=this._objectReader.readBitShort(),e.standardScale=this._objectReader.readBitDouble(),e.paperImageOrigin=this._objectReader.read2BitDouble(),this.R2004Plus){e.shadePlotMode=this._objectReader.readBitShort(),e.shadePlotResolutionMode=this._objectReader.readBitShort(),e.shadePlotDPI=this._objectReader.readBitShort();let i=this.handleReference()}this.R2007Plus&&this.handleReference()}readEvaluationGraph(){let e=new yr,t=new Mi(e);this.readCommonNonEntityData(t),e.value96=this._objectReader.readBitLong(),e.value97=this._objectReader.readBitLong();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++){let a=new Mi.GraphNodeTemplate,o=new xa;t.NodeTemplates.push(a),o.index=this._objectReader.readBitLong(),o.flags=this._objectReader.readBitLong(),o.nextNodeIndex=this._objectReader.readBitLong(),a.ExpressionHandle=this.handleReference(),o.data1=this._objectReader.readBitLong(),o.data2=this._objectReader.readBitLong(),o.data3=this._objectReader.readBitLong(),o.data4=this._objectReader.readBitLong()}let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong();return t}readSpatialFilter(){let e=new qt,t=new K(e);this.readCommonNonEntityData(t);let i=this._mergedReaders.readBitShort();for(let s=0;s<i;s++)e.boundaryPoints.push(this._mergedReaders.read2RawDouble());return e.normal=this._mergedReaders.read3BitDouble(),e.origin=this._mergedReaders.read3BitDouble(),e.displayBoundary=this._mergedReaders.readBitShort()!==0,e.clipFrontPlane=this._mergedReaders.readBitShort()!==0,e.clipFrontPlane&&(e.frontDistance=this._mergedReaders.readBitDouble()),e.clipBackPlane=this._mergedReaders.readBitShort()!==0,e.clipBackPlane&&(e.backDistance=this._mergedReaders.readBitDouble()),e.inverseInsertTransform=this.read4x3Matrix(),e.insertTransform=this.read4x3Matrix(),t}readDimensionAssociation(){let e=new Xe,t=new Ii(e);return this.readCommonNonEntityData(t),t.DimensionHandle=this.handleReference(),e.associativityFlags=this._mergedReaders.readBitLong(),e.isTransSpace=this._mergedReaders.readBit(),e.rotatedDimensionType=this._mergedReaders.readByte(),(e.associativityFlags&he.FirstPointReference)!==0&&(t.FirstPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.SecondPointReference)!==0&&(t.SecondPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.ThirdPointReference)!==0&&(t.ThirdPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.FourthPointReference)!==0&&(t.FourthPointRef=this.readOsnapPointRef()),t}readOsnapPointRef(){let e=new fs,t=new Ii.OsnapPointRefTemplate(e),i=this._mergedReaders.readVariableText();return e.objectOsnapType=this._mergedReaders.readByte(),t.ObjectHandle=this.handleReference(),t}readBlockFlipAction(){let e=new Ql,t=new Wl(e);return this.readBlockAction(t),e.value92=this._mergedReaders.readBitLong(),e.value93=this._mergedReaders.readBitLong(),e.value94=this._mergedReaders.readBitLong(),e.value95=this._mergedReaders.readBitLong(),e.caption301=this._mergedReaders.readVariableText(),e.caption302=this._mergedReaders.readVariableText(),e.caption303=this._mergedReaders.readVariableText(),e.caption304=this._mergedReaders.readVariableText(),t}readBlockFlipParameter(){let e=new ed,t=new Hl(e);return this.readBlock2PtParameter(t),e.caption=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.baseStateName=this._mergedReaders.readVariableText(),e.flippedStateName=this._mergedReaders.readVariableText(),e.captionLocation=this._mergedReaders.read3BitDouble(),e.caption309=this._mergedReaders.readVariableText(),e.value96=this._mergedReaders.readBitLong(),t}readBlockRotationParameter(){let e=new Hs,t=new Ta(e);return this.readBlock2PtParameter(t),e.point=this._mergedReaders.read3BitDouble(),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.nameOffset=this._mergedReaders.readBitDouble(),e.value96=this._mergedReaders.readBitLong(),e.value141=this._mergedReaders.readBitDouble(),e.value142=this._mergedReaders.readBitDouble(),e.value143=this._mergedReaders.readBitDouble(),e.value175=this._mergedReaders.readBitLong(),t}readBlockVisibilityParameter(){let e=new Fs,t=new Wi(e);this.readBlock1PtParameter(t),e.value281=this._mergedReaders.readBit(),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.value91=this._mergedReaders.readBit();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++)t.entityHandles.push(this.handleReference());let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.StateTemplates.push(this.readState());return t}readBlockRotateAction(){let e=new Us,t=new ka(e);return this.readBlockActionBasePt(t),e.value94=this._mergedReaders.readBitLong(),e.value303=this._mergedReaders.readVariableText(),t}readBlockRepresentationData(){let e=new Rr,t=new Pa(e);return this.readCommonNonEntityData(t),e.value70=this._mergedReaders.readBitShort(),t.BlockHandle=this.handleReference(),t}readBlockGripLocationComponent(){let e=new zs,t=new Ma(e);return this.readEvaluationExpression(t),t}readBlockGrip(e){this.readBlockElement(e);let t=e.CadObject;t.value91=this._mergedReaders.readBitLong(),t.value92=this._mergedReaders.readBitLong(),t.location=this._mergedReaders.read3BitDouble(),t.value280=this._mergedReaders.readBitAsShort(),t.value93=this._mergedReaders.readBitLong()}readAecCleanupGroup(){let e=new Gs,t=new K(e);this.readCommonNonEntityData(t);try{this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),e.description=this._mergedReaders.readVariableText();let i=this._mergedReaders.positionInBits(),n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.rawData=this._mergedReaders.readBytes(a))}}catch(i){this._builder.Notify(`Error reading AEC_CLEANUP_GROUP [Handle: ${e.handle.toString(16)}]: ${i.message}`,g.Error,i)}return t}readAecWall(){let e=new xn,t=new zl(e);this.readCommonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),this.handleReference(),t.StyleHandle=this.handleReference(),t.CleanupGroupHandle=this.handleReference();let i=this._objectReader.positionInBits(),n=this._handlesReader.positionInBits()-i;if(n>0){let a=Math.floor(n/8);n%8!==0&&a++;let o=this._objectReader.readBytes(a);t.RawData=o}return t}readAecWallStyle(){let e=new $s,t=new K(e);this.readCommonNonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),e.description=this._mergedReaders.readVariableText();let i=this._mergedReaders.positionInBits(),n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.rawData=this._mergedReaders.readBytes(a))}return t}readBinRecord(){let e=new Ys,t=new K(e);this.readCommonNonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong());let i=this._mergedReaders.positionInBits();this._builder.Notify(`BinRecord: Handle reader at position ${i}, BinRecord Handle: ${e.handle.toString(16)}`,g.None);let n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.binaryData=this._mergedReaders.readBytes(a),this._builder.Notify(`BinRecord: Read ${a} bytes of binary data. Version: ${e.version}, Handle: ${e.handle.toString(16)}`,g.None))}return t}readTableEntity(){let e=new Ti,t=new ua(e);if(this.readInsertCommonData(t),this.readInsertCommonHandles(t),this.R2010Plus){this._mergedReaders.readByte(),t.NullHandle=this.handleReference();let n=this._mergedReaders.readBitLong();if(this.R2013Plus?this._mergedReaders.readBitLong():this._mergedReaders.readBit(),this.readTableContent(e.content,t),this._mergedReaders.readBitShort(),e.horizontalDirection=this._mergedReaders.read3BitDouble(),this._mergedReaders.readBitLong()===1){let h=e.tableBreakData;h.flags=this._mergedReaders.readBitLong(),h.flowDirection=this._mergedReaders.readBitLong(),h.breakSpacing=this._mergedReaders.readBitDouble(),this._mergedReaders.readBitLong(),this._mergedReaders.readBitLong();let f=this._mergedReaders.readBitLong();for(let b=0;b<f;b++){let S=new Bl;S.position=this._mergedReaders.read3BitDouble(),S.height=this._mergedReaders.readBitDouble(),this._mergedReaders.readBitLong(),h.heights.push(S)}}let o=this._mergedReaders.readBitLong();for(let h=0;h<o;h++){let f=new yl;f.position=this._mergedReaders.read3BitDouble(),f.startRowIndex=this._mergedReaders.readBitLong(),f.endRowIndex=this._mergedReaders.readBitLong(),e.breakRowRanges.push(f)}return t}e.valueFlag=this._mergedReaders.readBitShort(),e.horizontalDirection=this._mergedReaders.read3BitDouble();let i=this._mergedReaders.readBitLong(),s=this._mergedReaders.readBitLong();for(let n=0;n<i;n++){let a=new Rs;a.width=this._mergedReaders.readBitDouble(),e.columns.push(a)}for(let n=0;n<s;n++){let a=new Ts;a.height=this._mergedReaders.readBitDouble(),e.rows.push(a)}t.styleHandle=this.handleReference();for(let n=0;n<e.rows.length;n++)for(let a=0;a<e.columns.length;a++){let o=new ys;e.rows[n].cells.push(o);let h=new Uo(o);t.cadTableCellTemplates.push(h),this.readTableCellData(h)}if(this._mergedReaders.readBit()){let n=new Ye;e.content.style=n;let a=this._mergedReaders.readBitLong();(a&de.TitleSuppressed)!==0&&(n.suppressTitle=this._mergedReaders.readBit()),(a&de.FlowDirection)!==0&&this._mergedReaders.readBitShort(),(a&de.HorizontalCellMargin)!==0&&this._mergedReaders.readBitDouble(),(a&de.VerticalCellMargin)!==0&&this._mergedReaders.readBitDouble(),(a&de.TitleRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.HeaderRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.DataRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.TitleRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.HeaderRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.DataRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.TitleRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.HeaderRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.DataRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.TitleRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.HeaderRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.DataRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.TitleTextStyle)!==0&&this.handleReference(),(a&de.HeaderTextStyle)!==0&&this.handleReference(),(a&de.DataTextStyle)!==0&&this.handleReference(),(a&de.TitleRowHeight)!==0&&this._mergedReaders.readBitDouble(),(a&de.HeaderRowHeight)!==0&&this._mergedReaders.readBitDouble(),(a&de.DataRowHeight)!==0&&this._mergedReaders.readBitDouble()}if(this._mergedReaders.readBit()){let n=this._mergedReaders.readBitLong(),a=[[0,$.TitleHorizontalTop],[0,$.TitleHorizontalInsert],[0,$.TitleHorizontalBottom],[0,$.TitleVerticalLeft],[0,$.TitleVerticalInsert],[0,$.TitleVerticalRight],[0,$.HeaderHorizontalTop],[0,$.HeaderHorizontalInsert],[0,$.HeaderHorizontalBottom],[0,$.HeaderVerticalLeft],[0,$.HeaderVerticalInsert],[0,$.HeaderVerticalRight],[0,$.DataHorizontalTop],[0,$.DataHorizontalInsert],[0,$.DataHorizontalBottom],[0,$.DataVerticalLeft],[0,$.DataVerticalInsert],[0,$.DataVerticalRight]];for(let[o,h]of a)(n&h)!==0&&this._mergedReaders.readCmColor(this.R2004Pre)}if(this._mergedReaders.readBit()){let n=this._mergedReaders.readBitLong(),a=[$.TitleHorizontalTop,$.TitleHorizontalInsert,$.TitleHorizontalBottom,$.TitleVerticalLeft,$.TitleVerticalInsert,$.TitleVerticalRight,$.HeaderHorizontalTop,$.HeaderHorizontalInsert,$.HeaderHorizontalBottom,$.HeaderVerticalLeft,$.HeaderVerticalInsert,$.HeaderVerticalRight,$.DataHorizontalTop,$.DataHorizontalInsert,$.DataHorizontalBottom,$.DataVerticalLeft,$.DataVerticalInsert,$.DataVerticalRight];for(let o of a)(n&o)!==0&&this._mergedReaders.readBitShort()}return t}readBlkRefObjectContextData(){let e=new mi,t=new ms(e);return this.readAnnotScaleObjectContextData(t),e.rotation=this._mergedReaders.readBitDouble(),e.insertionPoint=this._mergedReaders.read3BitDouble(),e.xScale=this._mergedReaders.readBitDouble(),e.yScale=this._mergedReaders.readBitDouble(),e.zScale=this._mergedReaders.readBitDouble(),t}readMTextAttributeObjectContextData(){return null}readFieldList(){let e=new pi,t=new Ha(e);this.readCommonNonEntityData(t);let i=this._mergedReaders.readBitLong();this._mergedReaders.readBit();for(let s=0;s<i;s++)t.OwnedObjectsHandlers.add(this.handleReference());return t}readField(){let e=new fi,t=new Wa(e);this.readCommonNonEntityData(t),e.evaluatorId=this._mergedReaders.readVariableText(),e.fieldCode=this._mergedReaders.readVariableText();let i=this._mergedReaders.readBitLong();for(let a=0;a<i;a++)t.ChildrenHandles.push(this.handleReference());let s=this._mergedReaders.readBitLong();for(let a=0;a<s;a++)t.CadObjectsHandles.push(this.handleReference());this._version<m.AC1021&&(e.formatString=this._mergedReaders.readVariableText()),e.evaluationOptionFlags=this._mergedReaders.readBitLong(),e.filingOptionFlags=this._mergedReaders.readBitLong(),e.fieldStateFlags=this._mergedReaders.readBitLong(),e.evaluationStatusFlags=this._mergedReaders.readBitLong(),e.evaluationErrorCode=this._mergedReaders.readBitLong(),e.evaluationErrorMessage=this._mergedReaders.readVariableText(),t.CadValueTemplates.push(this.readCadValue(e.value)),e.formatString=this._mergedReaders.readVariableText(),this._mergedReaders.readBitLong();let n=this._mergedReaders.readBitLong();for(let a=0;a<n;a++){let o=this._mergedReaders.readVariableText(),h=new Ht;t.CadValueTemplates.push(this.readCadValue(h)),e.values.set(o,h)}return t}readMatrix4(){let e=[];for(let t=0;t<16;t++)e.push(this._mergedReaders.readBitDouble());return e}read4x3Matrix(){let e=it.identity();for(let t=0;t<3;t++)for(let i=0;i<4;i++)e.setElement(t,i,this._mergedReaders.readBitDouble());return e}readBorderStyle(e){e.lineWeight=this._mergedReaders.readBitShort(),e.isInvisible=!this._mergedReaders.readBit(),e.color=this._mergedReaders.readCmColor(this.R2004Pre)}readAnnotScaleObjectContextData(e){this.readObjectContextData(e),e.scaleHandle=this.handleReference()}readObjectContextData(e){this.readCommonNonEntityData(e);let t=e.CadObject;t.version=this._objectReader.readBitShort(),t.default=this._objectReader.readBit()}readLeaderLine(e){let t=new zn,i=new ai.LeaderLineTemplate(t);e.leaderLineTemplates.push(i);let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.points.push(this._objectReader.read3BitDouble());if(t.breakInfoCount=this._objectReader.readBitLong(),t.breakInfoCount>0){t.segmentIndex=this._objectReader.readBitLong();let n=this._objectReader.readBitLong();for(let a=0;a<n;a++)t.startEndPoints.push(new Vo(this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble()))}return t.index=this._objectReader.readBitLong(),this.R2010Plus&&(t.pathType=this._objectReader.readBitShort(),t.lineColor=this._objectReader.readCmColor(),i.LineTypeHandle=this.handleReference(),t.lineWeight=this._objectReader.readBitLong(),t.arrowheadSize=this._objectReader.readBitDouble(),i.ArrowSymbolHandle=this.handleReference(),t.overrideFlags=this._objectReader.readBitLong()),t}readLeaderRoot(e){let t=new Gn;t.contentValid=this._objectReader.readBit(),t.unknown=this._objectReader.readBit(),t.connectionPoint=this._objectReader.read3BitDouble(),t.direction=this._objectReader.read3BitDouble();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++)t.breakStartEndPointsPairs.push(new Vo(this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble()));t.leaderIndex=this._objectReader.readBitLong(),t.landingDistance=this._objectReader.readBitDouble();let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.lines.push(this.readLeaderLine(e));return this.R2010Plus&&(t.textAttachmentDirection=this._objectReader.readBitShort()),t}readBlockElement(e){this.readEvaluationExpression(e),e.blockElement.elementName=this._mergedReaders.readVariableText(),e.blockElement.value98=this._mergedReaders.readBitLong(),e.blockElement.value99=this._mergedReaders.readBitLong(),e.blockElement.value1071=this._mergedReaders.readBitLong()}readBlockParameter(e){this.readBlockElement(e),e.blockParameter.value280=this._mergedReaders.readBit(),e.blockParameter.value281=this._mergedReaders.readBit()}readBlock1PtParameter(e){this.readBlockParameter(e),e.block1PtParameter.location=this._mergedReaders.read3BitDouble(),e.block1PtParameter.value170=this._mergedReaders.readBitShort(),e.block1PtParameter.value171=this._mergedReaders.readBitShort(),e.block1PtParameter.value93=this._mergedReaders.readBitLong()}readBlock2PtParameter(e){this.readBlockParameter(e),e.block2PtParameter.firstPoint=this._mergedReaders.read3BitDouble(),e.block2PtParameter.secondPoint=this._mergedReaders.read3BitDouble();for(let i=0;i<4;i++){let s=this._mergedReaders.readBitShort();for(let n=0;n<s;n++){let a=this._mergedReaders.readBitLong(),o=this._mergedReaders.readVariableText()}}for(let i=0;i<4;i++){let s=this._mergedReaders.readBitLong()}let t=this._mergedReaders.readBitShort()}readBlockAction(e){this.readBlockElement(e);let t=e.blockAction;t.actionPoint=this._mergedReaders.read3BitDouble();let i=this._objectReader.readBitShort();for(let s=0;s<i;s++){let n=this.handleReference();e.entityHandles.add(n)}t.value70=this._mergedReaders.readBitShort()}readBlockActionBasePt(e){this.readBlockAction(e);let t=e.CadObject;t.value1011=this._mergedReaders.read3BitDouble(),t.value92=this._mergedReaders.readBitLong(),t.value301=this._mergedReaders.readVariableText(),t.value93=this._mergedReaders.readBitLong(),t.value302=this._mergedReaders.readVariableText(),t.value280=this._mergedReaders.readBit(),t.value1012=this._mergedReaders.read3BitDouble()}readEvaluationExpression(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();e.CadObject.value98=this._objectReader.readBitLong(),e.CadObject.value99=this._objectReader.readBitLong();let i=this._mergedReaders.readBitShort();if(i>0){let s=Be.transformValue(i);switch(s){case _.Double:case _.ExtendedDataDouble:this._mergedReaders.readBitDouble();break;default:throw new Error(`[EvaluationExpression] Code not implemented ${s}`)}}e.CadObject.id=this._objectReader.readBitLong()}readRowCellStyle(e,t){let i=new jt(t);e.CellStyleTemplates.push(i),i.textStyleHandle=this.handleReference(),t.textHeight=this._mergedReaders.readBitDouble(),t.cellAlignment=this._mergedReaders.readBitShort(),t.textColor=this._mergedReaders.readCmColor(this.R2004Pre),t.backgroundColor=this._mergedReaders.readCmColor(this.R2004Pre),t.isFillColorOn=this._mergedReaders.readBit(),this.readBorderStyle(t.topBorder),this.readBorderStyle(t.horizontalInsideBorder),this.readBorderStyle(t.bottomBorder),this.readBorderStyle(t.leftBorder),this.readBorderStyle(t.verticalInsideBorder),this.readBorderStyle(t.rightBorder),this.R2007Plus&&(t.valueDataType=this._mergedReaders.readBitLong(),t.valueUnitType=this._mergedReaders.readBitLong(),t.valueFormatString=this._mergedReaders.readVariableText())}readCellStyle(e){}readTableContent(e,t){}readTableCellData(e){}readCadValue(e){let t=new Fa(e);if(this.R2007Plus&&(e.flags=this._mergedReaders.readBitLong()),e.valueType=this._mergedReaders.readBitLong(),!this.R2007Plus||!e.isEmpty)switch(e.valueType){case W.Unknown:case W.Long:e.setValue(this._mergedReaders.readBitLong());break;case W.Double:e.setValue(this._mergedReaders.readBitDouble());break;case W.General:case W.String:e.setValue(this.readStringCadValue());break;case W.Date:{let i=this.readDateCadValue();i!==null&&e.setValue(i);break}case W.Point2D:e.setValue(this.readValueXY());break;case W.Point3D:e.setValue(this.readValueXYZ());break;case W.Handle:t.ValueHandle=this.handleReference();break;default:throw new Error("CadValue type not implemented")}return this.R2007Plus&&(e.units=this._mergedReaders.readBitLong(),e.format=this._mergedReaders.readVariableText(),e.formattedValue=this._mergedReaders.readVariableText()),t}readStringCadValue(){return this._mergedReaders.readVariableText()}readDateCadValue(){let e=this._mergedReaders.readBitLong(),t=this._mergedReaders.readBitLong(),i=e-2440588;return new Date(i*864e5+t)}readValueXY(){return new C(this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble())}readValueXYZ(){return new c(this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble())}readState(){let e=new Wi.StateTemplate;e.state.name=this._textReader.readVariableText();let t=this._objectReader.readBitLong();for(let s=0;s<t;s++)e.entityHandles.add(this.handleReference());let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.expressionHandles.add(this.handleReference());return e}get SectionName(){return"AcDb:AcDbObjects"}};var rd=class extends Y{get SectionName(){return T.Preview}_startSentinel=T.StartSentinels.get(T.Preview);_endSentinel=T.EndSentinels.get(T.Preview);_reader;_previewAddress;constructor(e,t,i){super(e),this._reader=t,this._previewAddress=i}read(){let e=this._reader.readSentinel();console.assert(Y.CheckSentinel(e,this._startSentinel));let t=this._reader.readRawLong(),i=this._reader.readRawChar()&255,s=null,n=null,a=null,o=null,h=tn.PreviewType.Unknown;for(let N=0;N<i;N++){let L=this._reader.readRawChar()&255;L===1?(s=this._reader.readRawLong(),n=this._reader.readRawLong()):(h=L,a=this._reader.readRawLong(),o=this._reader.readRawLong())}let f=null;f=this._reader.readBytes(n);let b;o!==null?b=this._reader.readBytes(o):b=new Uint8Array(0);let S=this._reader.readSentinel();return console.assert(Y.CheckSentinel(S,this._endSentinel)),new tn(h,f,b)}};var id=class extends Y{get SectionName(){return T.SummaryInfo}_readStringMethod;_reader;constructor(e,t){super(e),this._reader=t,e<m.AC1021?this._readStringMethod=()=>this.readUnicodeString():this._readStringMethod=()=>this._reader.readTextUnicode()}read(){let e=new Or;try{e.title=this._readStringMethod(),e.subject=this._readStringMethod(),e.author=this._readStringMethod(),e.keywords=this._readStringMethod(),e.comments=this._readStringMethod(),e.lastSavedBy=this._readStringMethod(),e.revisionNumber=this._readStringMethod(),e.hyperlinkBase=this._readStringMethod(),this._reader.readInt(),this._reader.readInt(),e.createdDate=this._reader.read8BitJulianDate(),e.modifiedDate=this._reader.read8BitJulianDate();let t=this._reader.readShort();for(let i=0;i<t;i++){let s=this._readStringMethod(),n=this._readStringMethod();try{e.properties.set(s,n)}catch(a){this.notify("[SummaryInfo] An error ocurred while adding a property in the SummaryInfo",g.Error,a instanceof Error?a:void 0)}}this._reader.readInt(),this._reader.readInt()}catch(t){this.notify("An error occurred while reading the Summary Info",g.Error,t instanceof Error?t:void 0)}return e}readUnicodeString(){let e=this._reader.readShort(),t;if(e===0)t="";else{let i=this._reader.readBytes(e);t=new TextDecoder("windows-1252").decode(i).replace(/\0/g,"")}return t}};var Ga=class r{static decompress(e,t,i){let s=new Uint8Array(i);return r.decompressToDest(e,t,s),s}static decompressToDest(e,t,i){let s=t,n=0,a=new Uint8Array(128);if(s>=e.length)return;let o=e[s++];if((o&240)===0){let h=r.literalCount(o,e,{pos:s});s=r._lastSrcPos;let f=r.copy(h+3,e,s,i,n,a);s=f.srcPos,n=f.dstPos,a=f.tempBuf,o=f.nextByte}for(;o!==17;){if(s>=e.length)throw new Error(`LZ77AC18: read past end of source at srcPos=${s}, src.length=${e.length}`);let h=0,f=0;if(o<16||o>=64){f=(o>>4)-1;let z=e[s++];h=(o>>2&3|z<<2)+1}else if(o<32){let z=r.readCompressedBytes(o,7,e,{pos:s});f=z.value,s=z.srcPos,h=(o&8)<<11;let X=r.twoByteOffset(h,16384,e,s);h=X.offset,o=X.firstByte,s=X.srcPos}else if(o>=32){let z=r.readCompressedBytes(o,31,e,{pos:s});f=z.value,s=z.srcPos;let X=r.twoByteOffset(h,1,e,s);h=X.offset,o=X.firstByte,s=X.srcPos}let b=n;a.length<f&&(a=new Uint8Array(f));let S=b-h,N=Math.min(f,h);for(let z=0;z<N;z++)a[z]=i[S+z];let L=f,j=b;for(;L>0;){let z=Math.min(L,h);for(let X=0;X<z;X++)i[j+X]=a[X];j+=z,L-=h}n=b+f;let we=o&3;if(we===0&&(o=e[s++],(o&240)===0)){let z=r.literalCount(o,e,{pos:s});s=r._lastSrcPos,we=z+3}if(we>0){let z=r.copy(we,e,s,i,n,a);s=z.srcPos,n=z.dstPos,a=z.tempBuf,o=z.nextByte}}}static _lastSrcPos=0;static copy(e,t,i,s,n,a){a.length<e&&(a=new Uint8Array(e));for(let h=0;h<e;h++)a[h]=t[i+h],s[n+h]=t[i+h];i+=e,n+=e;let o=t[i++];return{srcPos:i,dstPos:n,tempBuf:a,nextByte:o}}static literalCount(e,t,i){let s=e&15;if(s===0){let n;for(n=t[i.pos++];n===0;)s+=255,n=t[i.pos++];s+=15+n}return r._lastSrcPos=i.pos,s}static readCompressedBytes(e,t,i,s){let n=e&t;if(n===0){let a;for(a=i[s.pos++];a===0;)n+=255,a=i[s.pos++];n+=a+t}return{value:n+2,srcPos:s.pos}}static twoByteOffset(e,t,i,s){let n=i[s++];return e|=n>>2,e|=i[s++]<<6,e+=t,{offset:e,firstByte:n,srcPos:s}}};var $a=class r{static m_sourceOffset=0;static m_length=0;static m_sourceIndex=0;static m_opCode=0;static decompress(e,t,i,s){r.m_sourceOffset=0,r.m_length=0,r.m_sourceIndex=t,r.m_opCode=e[r.m_sourceIndex];let n=0,a=r.m_sourceIndex+i;if(++r.m_sourceIndex,!(r.m_sourceIndex>=a))for((r.m_opCode&240)===32&&(r.m_sourceIndex+=3,r.m_length=e[r.m_sourceIndex-1],r.m_length&=7);r.m_sourceIndex<a&&(n=r.nextIndex(e,s,n),!(r.m_sourceIndex>=a));)n=r.copyDecompressedChunks(e,a,s,n)}static nextIndex(e,t,i){return r.m_length===0&&r.readLiteralLength(e),r.copyRaw(e,r.m_sourceIndex,t,i,r.m_length),r.m_sourceIndex+=r.m_length,i+=r.m_length,i}static copyDecompressedChunks(e,t,i,s){for(r.m_length=0,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.readInstructions(e);r.copyBytes(i,s,r.m_length,r.m_sourceOffset),s+=r.m_length,r.m_length=r.m_opCode&7,!(r.m_length!==0||r.m_sourceIndex>=t||(r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode>>4===0));)r.m_opCode>>4===15&&(r.m_opCode&=15),r.readInstructions(e);return s}static readInstructions(e){switch(r.m_opCode>>4){case 0:r.m_length=(r.m_opCode&15)+19,r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=(r.m_opCode>>3&16)+r.m_length,r.m_sourceOffset=((r.m_opCode&120)<<5)+1+r.m_sourceOffset;break;case 1:r.m_length=(r.m_opCode&15)+3,r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=((r.m_opCode&248)<<5)+1+r.m_sourceOffset;break;case 2:r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=e[r.m_sourceIndex]<<8&65280|r.m_sourceOffset,++r.m_sourceIndex,r.m_length=r.m_opCode&7,(r.m_opCode&8)===0?(r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=(r.m_opCode&248)+r.m_length):(++r.m_sourceOffset,r.m_length=(e[r.m_sourceIndex]<<3)+r.m_length,++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=((r.m_opCode&248)<<8)+r.m_length+256);break;default:r.m_length=r.m_opCode>>4,r.m_sourceOffset=r.m_opCode&15,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=((r.m_opCode&248)<<1)+r.m_sourceOffset+1;break}}static readLiteralLength(e){if(r.m_length=r.m_opCode+8,r.m_length===23){let t=e[r.m_sourceIndex];if(++r.m_sourceIndex,r.m_length+=t,t===255)do t=e[r.m_sourceIndex],++r.m_sourceIndex,t|=e[r.m_sourceIndex]<<8,++r.m_sourceIndex,r.m_length+=t;while(t===65535)}}static copyBytes(e,t,i,s){let n=t-s,a=n+i;for(;n<a;)e[t++]=e[n++]}static copyRaw(e,t,i,s,n){for(;n>=32;n-=32)r.copy4b(e,t+24,i,s),r.copy4b(e,t+28,i,s+4),r.copy4b(e,t+16,i,s+8),r.copy4b(e,t+20,i,s+12),r.copy4b(e,t+8,i,s+16),r.copy4b(e,t+12,i,s+20),r.copy4b(e,t,i,s+24),r.copy4b(e,t+4,i,s+28),t+=32,s+=32;n<=0||r.m_copyMethods[n](e,t,i,s)}static copy1b(e,t,i,s){i[s]=e[t]}static copy2b(e,t,i,s){i[s]=e[t+1],i[s+1]=e[t]}static copy3b(e,t,i,s){i[s]=e[t+2],i[s+1]=e[t+1],i[s+2]=e[t]}static copy4b(e,t,i,s){i[s]=e[t],i[s+1]=e[t+1],i[s+2]=e[t+2],i[s+3]=e[t+3]}static copy8b(e,t,i,s){r.copy4b(e,t,i,s),r.copy4b(e,t+4,i,s+4)}static copy16b(e,t,i,s){r.copy8b(e,t+8,i,s),r.copy8b(e,t,i,s+8)}static m_copyMethods=[null,(e,t,i,s)=>{r.copy1b(e,t,i,s)},(e,t,i,s)=>{r.copy2b(e,t,i,s)},(e,t,i,s)=>{r.copy3b(e,t,i,s)},(e,t,i,s)=>{r.copy4b(e,t,i,s)},(e,t,i,s)=>{r.copy1b(e,t+4,i,s),r.copy4b(e,t,i,s+1)},(e,t,i,s)=>{r.copy1b(e,t+5,i,s),r.copy4b(e,t+1,i,s+1),r.copy1b(e,t,i,s+5)},(e,t,i,s)=>{r.copy2b(e,t+5,i,s),r.copy4b(e,t+1,i,s+2),r.copy1b(e,t,i,s+6)},(e,t,i,s)=>{r.copy8b(e,t,i,s)},(e,t,i,s)=>{r.copy1b(e,t+8,i,s),r.copy8b(e,t,i,s+1)},(e,t,i,s)=>{r.copy1b(e,t+9,i,s),r.copy8b(e,t+1,i,s+1),r.copy1b(e,t,i,s+9)},(e,t,i,s)=>{r.copy2b(e,t+9,i,s),r.copy8b(e,t+1,i,s+2),r.copy1b(e,t,i,s+10)},(e,t,i,s)=>{r.copy4b(e,t+8,i,s),r.copy8b(e,t,i,s+4)},(e,t,i,s)=>{r.copy1b(e,t+12,i,s),r.copy4b(e,t+8,i,s+1),r.copy8b(e,t,i,s+5)},(e,t,i,s)=>{r.copy1b(e,t+13,i,s),r.copy4b(e,t+9,i,s+1),r.copy8b(e,t+1,i,s+5),r.copy1b(e,t,i,s+13)},(e,t,i,s)=>{r.copy2b(e,t+13,i,s),r.copy4b(e,t+9,i,s+2),r.copy8b(e,t+1,i,s+6),r.copy1b(e,t,i,s+14)},(e,t,i,s)=>{r.copy16b(e,t,i,s)},(e,t,i,s)=>{r.copy8b(e,t+9,i,s),r.copy1b(e,t+8,i,s+8),r.copy8b(e,t,i,s+9)},(e,t,i,s)=>{r.copy1b(e,t+17,i,s),r.copy16b(e,t+1,i,s+1),r.copy1b(e,t,i,s+17)},(e,t,i,s)=>{r.copy3b(e,t+16,i,s),r.copy16b(e,t,i,s+3)},(e,t,i,s)=>{r.copy4b(e,t+16,i,s),r.copy8b(e,t+8,i,s+4),r.copy8b(e,t,i,s+12)},(e,t,i,s)=>{r.copy1b(e,t+20,i,s),r.copy4b(e,t+16,i,s+1),r.copy8b(e,t+8,i,s+5),r.copy8b(e,t,i,s+13)},(e,t,i,s)=>{r.copy2b(e,t+20,i,s),r.copy4b(e,t+16,i,s+2),r.copy8b(e,t+8,i,s+6),r.copy8b(e,t,i,s+14)},(e,t,i,s)=>{r.copy3b(e,t+20,i,s),r.copy4b(e,t+16,i,s+3),r.copy8b(e,t+8,i,s+7),r.copy8b(e,t,i,s+15)},(e,t,i,s)=>{r.copy8b(e,t+16,i,s),r.copy16b(e,t,i,s+8)},(e,t,i,s)=>{r.copy8b(e,t+17,i,s),r.copy1b(e,t+16,i,s+8),r.copy16b(e,t,i,s+9)},(e,t,i,s)=>{r.copy1b(e,t+25,i,s),r.copy8b(e,t+17,i,s+1),r.copy1b(e,t+16,i,s+9),r.copy16b(e,t,i,s+10)},(e,t,i,s)=>{r.copy2b(e,t+25,i,s),r.copy8b(e,t+17,i,s+2),r.copy1b(e,t+16,i,s+10),r.copy16b(e,t,i,s+11)},(e,t,i,s)=>{r.copy4b(e,t+24,i,s),r.copy8b(e,t+16,i,s+4),r.copy8b(e,t+8,i,s+12),r.copy8b(e,t,i,s+20)},(e,t,i,s)=>{r.copy1b(e,t+28,i,s),r.copy4b(e,t+24,i,s+1),r.copy8b(e,t+16,i,s+5),r.copy8b(e,t+8,i,s+13),r.copy8b(e,t,i,s+21)},(e,t,i,s)=>{r.copy2b(e,t+28,i,s),r.copy4b(e,t+24,i,s+2),r.copy8b(e,t+16,i,s+6),r.copy8b(e,t+8,i,s+14),r.copy8b(e,t,i,s+22)},(e,t,i,s)=>{r.copy1b(e,t+30,i,s),r.copy4b(e,t+26,i,s+1),r.copy8b(e,t+18,i,s+5),r.copy8b(e,t+10,i,s+13),r.copy8b(e,t+2,i,s+21),r.copy2b(e,t,i,s+29)}]};var Gh=class r extends Ln{_builder;_fileHeader;constructor(e,t=null){super(e,t)}createDefaultConfiguration(){return new Po}static ReadFromStream(e,t=null){return r.ReadFromStreamWithConfig(e,new Po,t)}static ReadFromStreamWithConfig(e,t,i=null){let s=new r(e,i);s.Configuration=t;let n=s.Read();return s.Dispose(),n}Read(){return this._document=new xs,this._fileHeader=this.readFileHeader(),this._builder=new On(this._fileHeader.AcadVersion,this._document,this.Configuration),this._builder.OnNotification=(e,t)=>this.onNotificationEvent(e,t),this._document.summaryInfo=this.ReadSummaryInfo(),this._document.header=this.ReadHeader(),this._document.header.Document=this._document,this._document.classes=this.readClasses(),this.readObjects(),this._builder.BuildDocument(),this._document}ReadSummaryInfo(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.AcadVersion<m.AC1018||!this.Configuration.ReadSummaryInfo)return new Or;let e=this.getSectionStream(T.SummaryInfo);return e?new id(this._fileHeader.AcadVersion,e).read():new Or}ReadPreview(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.PreviewAddress<0)return null;let e=this.getSectionStream(T.Preview);return e||(e=be.getStreamHandler(this._fileHeader.AcadVersion,new Uint8Array(this._fileStream)),e.position=this._fileHeader.PreviewAddress),new rd(this._fileHeader.AcadVersion,e,this._fileHeader.PreviewAddress).read()}ReadHeader(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=new lt;e.codePage=Z.getCodePageName(this._fileHeader.DrawingCodePage);let t=this.getSectionStream(T.Header),i=new Ol(this._fileHeader.AcadVersion,t,e);i.OnNotification=(n,a)=>this.onNotificationEvent(n,a);let s=i.read(this._fileHeader.AcadMaintenanceVersion);return this._builder&&(this._builder.HeaderHandles=s.objectPointers),e}readFileHeader(){let e=new Uint8Array(this._fileStream),t=String.fromCharCode(...e.slice(0,6)),i=Z.getVersionFromName(t),s=Ai.CreateFileHeader(i),n=be.getStreamHandler(s.AcadVersion,e);switch(n.position=6,s.AcadVersion){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(s.AcadVersion);case m.AC1012:case m.AC1014:case m.AC1015:this.readFileHeaderAC15(s,n);break;case m.AC1018:this.readFileHeaderAC18(s,n);break;case m.AC1021:try{this.readFileHeaderAC21(s,n)}catch{n.position=6,this.readFileHeaderAC18(s,n)}break;case m.AC1024:case m.AC1027:case m.AC1032:this.readFileHeaderAC18(s,n);break;default:break}return s}readClasses(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=this.getSectionStream(T.Classes),t=new kl(this._fileHeader.AcadVersion,e,this._fileHeader);return t.OnNotification=(i,s)=>this.onNotificationEvent(i,s),t.read()}readHandles(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=this.getSectionStream(T.Handles),t=new Pl(this._fileHeader.AcadVersion,e);return t.OnNotification=(i,s)=>this.onNotificationEvent(i,s),t.read()}readObjFreeSpace(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.AcadVersion<m.AC1018)return 0;let e=this.getSectionStream(T.ObjFreeSpace);return e.advance(16),e.readUInt()}readObjects(){let e=this.readHandles();this._document.classes=this.readClasses();let t;this._fileHeader.AcadVersion<=m.AC1015?(t=be.getStreamHandler(this._fileHeader.AcadVersion,new Uint8Array(this._fileStream),this._encoding),t.position=0):t=this.getSectionStream(T.AcDbObjects);let i=this._builder.HeaderHandles.GetHandles().filter(n=>n!=null).map(n=>n);new td(this._fileHeader.AcadVersion,this._builder,t,i,e,this._document.classes).read()}getSectionStream(e){let t=null;switch(this._fileHeader.AcadVersion){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(this._fileHeader.AcadVersion);case m.AC1012:case m.AC1014:case m.AC1015:t=this.getSectionBuffer15(this._fileHeader,e);break;case m.AC1018:t=this.getSectionBuffer18(this._fileHeader,e);break;case m.AC1021:this._fileHeader.CompressedMetadata?t=this.getSectionBuffer21(this._fileHeader,e):t=this.getSectionBuffer18(this._fileHeader,e);break;case m.AC1024:case m.AC1027:case m.AC1032:t=this.getSectionBuffer18(this._fileHeader,e);break;default:break}if(!t)return null;let i=be.getStreamHandler(this._fileHeader.AcadVersion,t);return i.encoding=this._encoding,i}readFileHeaderAC15(e,t){t.readBytes(7),e.PreviewAddress=t.readInt(),t.readBytes(2),e.DrawingCodePage=Z.getCodePage(t.readShort()),this._encoding=this.getListedEncoding(e.DrawingCodePage);let i=t.readRawLong();for(let n=0;n<i;++n){let a=new ft;a.Number=t.readByte(),a.Seeker=t.readRawLong(),a.Size=t.readRawLong(),e.Records.set(a.Number,a)}t.resetShift();let s=t.readSentinel();Y.CheckSentinel(s,Ei.EndSentinel)}readFileMetaData(e,t){t.advance(5),e.AcadMaintenanceVersion=t.readByte(),t.advance(1),e.PreviewAddress=t.readRawLong(),e.DwgVersion=t.readByte(),e.AppReleaseVersion=t.readByte(),e.DrawingCodePage=Z.getCodePage(t.readShort()),this._encoding=this.getListedEncoding(e.DrawingCodePage),t.advance(3),e.SecurityType=t.readRawLong(),t.readRawLong(),e.SummaryInfoAddr=t.readRawLong(),e.VbaProjectAddr=t.readRawLong(),t.readRawLong(),t.readRawLong(),t.advance(80)}readFileHeaderAC18(e,t){this.readFileMetaData(e,t);let i=t.readBytes(108),s=new Tl(i,0,!0);t.readBytes(20);let n=new Uint8Array(12);s.Read(n,0,12);let a=String.fromCharCode(...n);a.startsWith("AcFssFcAJMB")||this.triggerNotification(`File validation failed, id should be: AcFssFcAJMB, but is: ${a}`,g.Warning);let o=()=>{let le=new Uint8Array(4);return s.Read(le,0,4),new DataView(le.buffer).getInt32(0,!0)},h=()=>{let le=new Uint8Array(4);return s.Read(le,0,4),new DataView(le.buffer).getUint32(0,!0)},f=()=>{let le=new Uint8Array(8);s.Read(le,0,8);let ue=new DataView(le.buffer),Ks=ue.getUint32(0,!0);return ue.getUint32(4,!0)*4294967296+Ks};o(),o(),o(),e.RootTreeNodeGap=o(),e.LeftGap=o(),e.RigthGap=o(),o(),e.LastPageId=o(),e.LastSectionAddr=f(),e.SecondHeaderAddr=f(),e.GapAmount=h(),e.SectionAmount=h(),o(),o(),o(),e.SectionPageMapId=h(),e.PageMapAddress=f()+256,e.SectionMapId=h(),e.SectionArrayPageSize=h(),e.GapArraySize=h(),e.CRCSeed=h(),t.position=e.PageMapAddress;let b=t.readRawLong(),S=t.readRawLong(),N=t.readRawLong(),L=t.readRawLong(),j=t.readRawLong(),we=Ga.decompress(t.stream,t.position,S),z=256,X=0,qi=new DataView(we.buffer,we.byteOffset,we.byteLength);for(;X<we.length;){let le=new ft;le.Number=qi.getInt32(X,!0),X+=4,le.Size=qi.getInt32(X,!0),X+=4,le.Number>=0?(le.Seeker=z,e.Records.set(le.Number,le)):X+=16,z+=le.Size}t.position=e.Records.get(e.SectionMapId).Seeker;let _s=t.readRawLong(),_e=t.readRawLong(),wi=t.readRawLong(),Qt=t.readRawLong(),Fd=t.readRawLong(),ce=Ga.decompress(t.stream,t.position,_e),Re=0,tl=new DataView(ce.buffer,ce.byteOffset,ce.byteLength),Fe=()=>{let le=tl.getInt32(Re,!0);return Re+=4,le},ve=()=>{let le=tl.getUint32(Re,!0),ue=tl.getUint32(Re+4,!0);return Re+=8,ue*4294967296+le},Ud=le=>{let ue="";for(let Ks=0;Ks<le;Ks++)ue+=String.fromCharCode(ce[Re+Ks]);return Re+=le,ue.split("\0")[0]},Pc=Fe();Fe(),Fe(),Fe(),Fe();for(let le=0;le<Pc;++le){let ue=new _r;ue.CompressedSize=ve(),ue.PageCount=Fe(),ue.DecompressedSize=Fe(),Fe(),ue.CompressedCode=Fe(),ue.SectionId=Fe(),ue.Encrypted=Fe(),ue.Name=Ud(64);for(let ch=0;ch<ue.PageCount;++ch){let pn=new cs;pn.PageNumber=Fe(),pn.CompressedSize=Fe(),pn.Offset=ve(),pn.DecompressedSize=ue.DecompressedSize,pn.Seeker=e.Records.get(pn.PageNumber)?.Seeker??0,ue.LocalSections.push(pn)}let Ks=ue.CompressedSize%ue.DecompressedSize;Ks>0&&ue.LocalSections.length>0&&(ue.LocalSections[ue.LocalSections.length-1].DecompressedSize=Ks),e.Descriptors.set(ue.Name,ue)}}readFileHeaderAC21(e,t){this.readFileMetaData(e,t);let i=t.readBytes(1024),s=new Uint8Array(717);this.reedSolomonDecoding(i,s,3,239);let n=new DataView(s.buffer),a=this.readInt64(n,0),o=this.readInt64(n,8),h=this.readInt64(n,16),f=n.getInt32(24,!0),b=n.getInt32(28,!0),S=new Uint8Array(272);f<0?S.set(s.subarray(32,32+Math.abs(f))):$a.decompress(s,32,f,S);let N=new DataView(S.buffer),L=0,j=()=>{let ce=N.getUint32(L,!0),Re=N.getUint32(L+4,!0);return L+=8,Re*4294967296+ce};e.CompressedMetadata=new El,e.CompressedMetadata.HeaderSize=j(),e.CompressedMetadata.FileSize=j(),e.CompressedMetadata.PagesMapCrcCompressed=j(),e.CompressedMetadata.PagesMapCorrectionFactor=j(),e.CompressedMetadata.PagesMapCrcSeed=j(),e.CompressedMetadata.Map2Offset=j(),e.CompressedMetadata.Map2Id=j(),e.CompressedMetadata.PagesMapOffset=j(),e.CompressedMetadata.PagesMapId=j(),e.CompressedMetadata.Header2offset=j(),e.CompressedMetadata.PagesMapSizeCompressed=j(),e.CompressedMetadata.PagesMapSizeUncompressed=j(),e.CompressedMetadata.PagesAmount=j(),e.CompressedMetadata.PagesMaxId=j(),e.CompressedMetadata.Unknow0x20=j(),e.CompressedMetadata.Unknow0x40=j(),e.CompressedMetadata.PagesMapCrcUncompressed=j(),e.CompressedMetadata.Unknown0xF800=j(),e.CompressedMetadata.Unknown4=j(),e.CompressedMetadata.Unknown1=j(),e.CompressedMetadata.SectionsAmount=j(),e.CompressedMetadata.SectionsMapCrcUncompressed=j(),e.CompressedMetadata.SectionsMapSizeCompressed=j(),e.CompressedMetadata.SectionsMap2Id=j(),e.CompressedMetadata.SectionsMapId=j(),e.CompressedMetadata.SectionsMapSizeUncompressed=j(),e.CompressedMetadata.SectionsMapCrcCompressed=j(),e.CompressedMetadata.SectionsMapCorrectionFactor=j(),e.CompressedMetadata.SectionsMapCrcSeed=j(),e.CompressedMetadata.StreamVersion=j(),e.CompressedMetadata.CrcSeed=j(),e.CompressedMetadata.CrcSeedEncoded=j(),e.CompressedMetadata.RandomSeed=j(),e.CompressedMetadata.HeaderCRC64=j();let we=this.getPageBuffer(e.CompressedMetadata.PagesMapOffset,e.CompressedMetadata.PagesMapSizeCompressed,e.CompressedMetadata.PagesMapSizeUncompressed,e.CompressedMetadata.PagesMapCorrectionFactor,239,new Uint8Array(this._fileStream)),z=new DataView(we.buffer,we.byteOffset,we.byteLength),X=0,qi=0;for(;X<we.length;){let ce=this.readInt64View(z,X);X+=8;let Re=Math.abs(this.readInt64View(z,X));X+=8,e.Records.set(Re,new ft(Re,qi,ce)),qi+=ce}let _s=this.getPageBuffer(e.Records.get(e.CompressedMetadata.SectionsMapId).Seeker,e.CompressedMetadata.SectionsMapSizeCompressed,e.CompressedMetadata.SectionsMapSizeUncompressed,e.CompressedMetadata.SectionsMapCorrectionFactor,239,new Uint8Array(this._fileStream)),_e=new DataView(_s.buffer,_s.byteOffset,_s.byteLength),wi=0,Qt=()=>{let ce=_e.getUint32(wi,!0),Re=_e.getUint32(wi+4,!0);return wi+=8,Re*4294967296+ce},Fd=()=>{let ce=_e.getInt32(wi,!0),Re=_e.getInt32(wi+4,!0);return wi+=8,Re*4294967296+ce};for(;wi<_s.length;){let ce=new _r;ce.CompressedSize=Qt(),ce.DecompressedSize=Qt(),ce.Encrypted=Qt(),ce.HashCode=Qt();let Re=Fd();if(Qt(),ce.Encoding=Qt(),ce.PageCount=Qt(),Re>0){let Fe="";for(let ve=0;ve<Re;ve+=2){let Ud=_s[wi+ve]|_s[wi+ve+1]<<8;Ud!==0&&(Fe+=String.fromCharCode(Ud))}wi+=Re,ce.Name=Fe}let tl=0;for(let Fe=0;Fe<ce.PageCount;++Fe){let ve=new cs;ve.Offset=Qt(),ve.Size=Fd(),ve.PageNumber=Fd(),ve.DecompressedSize=Qt(),ve.CompressedSize=Qt(),ve.Checksum=Qt(),ve.CRC=Qt(),ce.LocalSections.push(ve),tl=ve.Offset+ve.DecompressedSize}Re>0&&e.Descriptors.set(ce.Name,ce)}}getSectionBuffer15(e,t){let i=T.GetSectionLocatorByName(t);if(i===null)return null;let s=e.Records.get(i);return s?new Uint8Array(this._fileStream).subarray(s.Seeker,s.Seeker+s.Size):null}getSectionBuffer18(e,t){let i=e.Descriptors.get(t);if(!i)return null;let s=i.DecompressedSize*i.LocalSections.length,n=new Uint8Array(s),a=0,o=new Uint8Array(this._fileStream);for(let h of i.LocalSections)if(h.IsEmpty)for(let f=0;f<h.DecompressedSize;++f)n[a++]=0;else{let f=be.getStreamHandler(e.AcadVersion,o);if(f.position=h.Seeker,this.decryptDataSection(h,f),i.IsCompressed){let b=Ga.decompress(f.stream,f.position,h.DecompressedSize);n.set(b.subarray(0,h.DecompressedSize),a),a+=h.DecompressedSize}else{let b=f.readBytes(h.CompressedSize);n.set(b,a),a+=h.CompressedSize}}return n.subarray(0,a)}decryptDataSection(e,t){let i=1097093995^t.position,s=t.readRawLong()^i|0,n=t.readRawLong()^i|0;e.CompressedSize=t.readRawLong()^i|0,e.PageSize=t.readRawLong()^i|0;let a=t.readRawLong()^i|0,o=t.readRawLong()^i|0;e.Offset=(o+a|0)>>>0,e.Checksum=(t.readRawLong()^i|0)>>>0;let h=(t.readRawLong()^i|0)>>>0}getSectionBuffer21(e,t){let i=e.Descriptors.get(t);if(!i)return null;let s=0;for(let h of i.LocalSections)s+=h.DecompressedSize;let n=new Uint8Array(s),a=0,o=new Uint8Array(this._fileStream);for(let h of i.LocalSections)if(h.IsEmpty)for(let f=0;f<h.DecompressedSize;++f)n[a++]=0;else{let f=e.Records.get(h.PageNumber);if(!f)continue;let b=f.Seeker+1152,S=o.slice(b,b+f.Size);if(i.Encoding===4){let N=h.CompressedSize+7;N=N&4294967288;let L=Math.floor((N+251-1)/251),j=new Uint8Array(L*251);this.reedSolomonDecoding(S,j,L,251),S=j}if(h.CompressedSize!==h.DecompressedSize){let N=new Uint8Array(h.DecompressedSize);$a.decompress(S,0,h.CompressedSize,N),S=N}n.set(S.subarray(0,h.DecompressedSize),a),a+=h.DecompressedSize}return n.subarray(0,a)}getPageBuffer(e,t,i,s,n,a){let o=t+7;o=o&4294967288;let h=o*s,f=Math.floor((h+n-1)/n),b=f*255,S=new Uint8Array(b),N=1152+e;S.set(a.subarray(N,N+b));let L=new Uint8Array(h);this.reedSolomonDecoding(S,L,f,n);let j=new Uint8Array(i);return $a.decompress(L,0,t,j),j}readInt64(e,t){let i=e.getUint32(t,!0);return e.getInt32(t+4,!0)*4294967296+i}readInt64View(e,t){let i=e.getUint32(t,!0);return e.getInt32(t+4,!0)*4294967296+i}reedSolomonDecoding(e,t,i,s){let n=0,a=0,o=t.length;for(let h=0;h<i;++h){let f=a;if(a<e.length){let b=Math.min(o,s);o-=b;let S=n+b;for(;n<S;)t[n]=e[f],++n,f+=i}++a}}};var $h=class extends Y{get SectionName(){return T.AppInfo}_reader;constructor(e,t){super(e),this._reader=t}read(){this.R2007Plus||this.readR18();let e=this._reader.readInt(),t=this._reader.readTextUnicode(),i=this._reader.readInt(),s=this._reader.readBytes(16),n=this._reader.readTextUnicode(),a=this._reader.readBytes(16);if(!this.R2010Plus)return;let o=this._reader.readTextUnicode(),h=this._reader.readBytes(16),f=this._reader.readTextUnicode()}readR18(){let e=this._reader.readVariableText(),t=this._reader.readInt(),i=this._reader.readVariableText(),s=this._reader.readVariableText(),n=this._reader.readVariableText()}};var w;(function(r){r[r.Undefined=0]="Undefined",r[r.SoftOwnership=2]="SoftOwnership",r[r.HardOwnership=3]="HardOwnership",r[r.SoftPointer=4]="SoftPointer",r[r.HardPointer=5]="HardPointer"})(w||(w={}));var Yh=new Map,kc=new Map;function Ya(r,e){Yh.set(r,e)}function lh(r,e){kc.set(r,e)}var ye=class{get main(){return this}get positionInBits(){return this._position*8+this.bitShift}savedPositionInBits=0;bitShift=0;encoding;get stream(){return this._buffer.buffer}_buffer;_view;_position=0;_lastByte=0;constructor(e,t){this._buffer=e,this._view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.encoding=t}static getStreamWriter(e,t,i){let s;switch(e){case m.Unknown:throw new Error("Unknown version");case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Error(`Dwg version not supported: ${e}`);case m.AC1012:case m.AC1014:s="AC12";break;case m.AC1015:s="AC15";break;case m.AC1018:s="AC18";break;case m.AC1021:s="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:s="AC24";break;default:throw new Error(`Dwg version not supported: ${e}`)}let n=Yh.get(s);if(!n)throw new Error(`DwgStreamWriter factory for ${s} not registered. Import DwgStreamWriterFactory first.`);return new n(t,i)}static getMergedWriter(e,t,i){let s;switch(e){case m.Unknown:throw new Error("Unknown version");case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Error(`Dwg version not supported: ${e}`);case m.AC1012:case m.AC1014:s="AC12";break;case m.AC1015:s="AC15";break;case m.AC1018:s="AC18";break;case m.AC1021:s="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:s="AC24";break;default:throw new Error(`Dwg version not supported: ${e}`)}let n=Yh.get(s);if(!n)throw new Error(`DwgStreamWriter factory for ${s} not registered. Import DwgStreamWriterFactory first.`);let a;switch(e){case m.AC1012:case m.AC1014:case m.AC1015:case m.AC1018:a="MergedAC14";break;default:a="Merged";break}let o=kc.get(a);if(!o)throw new Error(`Merged writer factory for ${a} not registered. Import DwgStreamWriterFactory first.`);return a==="MergedAC14"?new o(t,new n(t,i),new n(new Uint8Array(0),i)):new o(t,new n(t,i),new n(new Uint8Array(0),i),new n(new Uint8Array(0),i))}writeInt(e){this.ensureCapacity(4);let t=new Uint8Array(4);new DataView(t.buffer).setInt32(0,e,!0),this.writeBytes(t)}writeObjectType(e){this.writeBitShort(e)}writeObjectTypeEnum(e){this.writeObjectType(e)}writeRawLong(e){let t=new Uint8Array(4);new DataView(t.buffer).setInt32(0,e,!0),this.writeBytes(t)}writeBytes(e){if(this.bitShift===0){this.ensureCapacity(e.length);for(let i=0;i<e.length;i++)this._buffer[this._position++]=e[i];return}let t=8-this.bitShift;this.ensureCapacity(e.length+1);for(let i of e)this._buffer[this._position++]=(this._lastByte|i>>>this.bitShift)&255,this._lastByte=i<<t&255}writeBytesOffset(e,t,i){if(this.bitShift===0){this.ensureCapacity(i);for(let n=0,a=t;n<i;n++,a++)this._buffer[this._position++]=e[a];return}let s=8-this.bitShift;this.ensureCapacity(i+1);for(let n=0,a=t;n<i;n++,a++){let o=e[a];this._buffer[this._position++]=(this._lastByte|o>>>this.bitShift)&255,this._lastByte=o<<s&255}}writeBitShort(e){e===0?this.write2Bits(2):e>0&&e<256?(this.write2Bits(1),this.writeByte(e)):e===256?this.write2Bits(3):(this.write2Bits(0),this.writeByte(e&255),this.writeByte(e>>>8&255))}writeBitDouble(e){if(e===0){this.write2Bits(2);return}if(e===1){this.write2Bits(1);return}this.write2Bits(0);let t=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.writeBytes(t)}writeBitLong(e){if(e===0){this.write2Bits(2);return}if(e>0&&e<256){this.write2Bits(1),this.writeByte(e);return}this.write2Bits(0),this.writeByte(e&255),this.writeByte(e>>>8&255),this.writeByte(e>>>16&255),this.writeByte(e>>>24&255)}writeBitLongLong(e){let t=0,i=e<0?e+18446744073709552e3:e,s=i;for(;s!==0;)s=Math.floor(s/256),t++;this.write3Bits(t),s=i;for(let n=0;n<t;n++)this.writeByte(s&255),s=Math.floor(s/256)}writeVariableText(e){if(!e||e.length===0){this.writeBitShort(0);return}let i=new TextEncoder().encode(e);this.writeBitShort(i.length),this.writeBytes(i)}writeTextUnicode(e){let t=e??"",s=new TextEncoder().encode(t);this.writeRawShort(s.length+1),this.ensureCapacity(s.length+1);for(let n=0;n<s.length;n++)this._buffer[this._position++]=s[n];this._buffer[this._position++]=0}write2Bits(e){this.bitShift<6?(this._lastByte|=e<<6-this.bitShift&255,this.bitShift+=2):this.bitShift===6?(this._lastByte|=e,this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this.resetShift()):(this._lastByte|=e>>>1&255,this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this._lastByte=e<<7&255,this.bitShift=1)}writeBit(e){if(this.bitShift<7){e&&(this._lastByte|=1<<7-this.bitShift&255),this.bitShift++;return}e&&(this._lastByte|=1),this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this.resetShift()}writeByte(e){if(this.bitShift===0){this.ensureCapacity(1),this._buffer[this._position++]=e&255;return}let t=8-this.bitShift;this.ensureCapacity(1),this._buffer[this._position++]=(this._lastByte|e>>>this.bitShift)&255,this._lastByte=e<<t&255}resetShift(){this.bitShift=0,this._lastByte=0}writeDateTime(e){let{jdate:t,milliseconds:i}=Z.dateToJulian(e);this.writeBitLong(t),this.writeBitLong(i)}writeTimeSpan(e){let t=Math.floor(e/864e5),i=e%864e5;this.writeBitLong(t),this.writeBitLong(i)}write8BitJulianDate(e){let{jdate:t,milliseconds:i}=Z.dateToJulian(e);this.writeRawLong(t),this.writeRawLong(i)}writeCmColor(e){let t=0;e.isTrueColor?t=e.getApproxIndex():t=e.index,this.writeBitShort(t)}writeEnColor(e,t){this.writeCmColor(e)}writeEnColorBook(e,t,i){this.writeCmColor(e)}write2BitDouble(e){this.writeBitDouble(e.X),this.writeBitDouble(e.Y)}write3BitDouble(e){this.writeBitDouble(e.X),this.writeBitDouble(e.Y),this.writeBitDouble(e.Z)}write2RawDouble(e){this.writeRawDouble(e.X),this.writeRawDouble(e.Y)}writeRawShort(e){let t=new Uint8Array(2);new DataView(t.buffer).setInt16(0,e,!0),this.writeBytes(t)}writeRawDouble(e){let t=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.writeBytes(t)}handleReference(e){this.handleReferenceTyped(w.Undefined,e)}handleReferenceTyped(e,t){t==null?this.handleReferenceTypedHandle(e,0):typeof t=="number"?this.handleReferenceTypedHandle(e,t):this.handleReferenceTypedHandle(e,t.handle)}handleReferenceHandle(e){this.handleReferenceTypedHandle(w.Undefined,e)}handleReferenceTypedHandle(e,t){let i=e<<4&255;t===0?this.writeByte(i):t<256?(this.writeByte(i|1),this.writeByte(t)):t<65536?(this.writeByte(i|2),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<16777216?(this.writeByte(i|3),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<4294967296?(this.writeByte(i|4),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<1099511627776?(this.writeByte(i|5),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<281474976710656?(this.writeByte(i|6),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<72057594037927940?(this.writeByte(i|7),this.writeByte(Math.floor(t/281474976710656)&255),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):(this.writeByte(i|8),this.writeByte(Math.floor(t/72057594037927940)&255),this.writeByte(Math.floor(t/281474976710656)&255),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255))}writeSpearShift(){if(this.bitShift>0)for(let e=this.bitShift;e<8;e++)this.writeBit(!1)}writeBitThickness(e){this.writeBitDouble(e)}writeBitExtrusion(e){this.write3BitDouble(e)}write2BitDoubleWithDefault(e,t){this.writeBitDoubleWithDefault(e.X,t.X),this.writeBitDoubleWithDefault(e.Y,t.Y)}write3BitDoubleWithDefault(e,t){this.writeBitDoubleWithDefault(e.X,t.X),this.writeBitDoubleWithDefault(e.Y,t.Y),this.writeBitDoubleWithDefault(e.Z,t.Z)}writeBitDoubleWithDefault(e,t){if(e===t){this.write2Bits(0);return}let i=new Uint8Array(8);new DataView(i.buffer).setFloat64(0,e,!0);let n=new Uint8Array(8);new DataView(n.buffer).setFloat64(0,t,!0);let o=0,h=7;for(;h>=0&&i[h]===n[h];)o++,h--;o>=4?(this.write2Bits(1),this.writeBytesOffset(i,0,4)):o>=2?(this.write2Bits(2),this.writeByte(i[4]),this.writeByte(i[5]),this.writeByte(i[0]),this.writeByte(i[1]),this.writeByte(i[2]),this.writeByte(i[3])):(this.write2Bits(3),this.writeBytes(i))}resetStream(){this._position=0,this.bitShift=0,this._lastByte=0}savePositonForSize(){this.writeRawLong(0)}setPositionByFlag(e){if(e>=32768){if(e>=1073741824){let i=new Uint8Array(2);new DataView(i.buffer).setUint16(0,e>>>30&65535,!0),this.writeBytes(i);let s=new Uint8Array(2);new DataView(s.buffer).setUint16(0,e>>>15&32767|32768,!0),this.writeBytes(s)}else{let i=new Uint8Array(2);new DataView(i.buffer).setUint16(0,e>>>15&65535,!0),this.writeBytes(i)}let t=new Uint8Array(2);new DataView(t.buffer).setUint16(0,e&32767|32768,!0),this.writeBytes(t)}else{let t=new Uint8Array(2);new DataView(t.buffer).setUint16(0,e&65535,!0),this.writeBytes(t)}}setPositionInBits(e){let t=Math.floor(e/8);if(this.bitShift=e%8,this._position=t,this.bitShift>0){if(t>=this._buffer.length)throw new Error("EndOfStreamException");this._lastByte=this._buffer[t]}else this._lastByte=0}writeShiftValue(){if(this.bitShift>0){let e=this._position;if(e<this._buffer.length){let t=this._buffer[e],i=(this._lastByte|t&255>>>this.bitShift)&255;this._buffer[e]=i}}}write3Bits(e){this.writeBit((e&4)!==0),this.writeBit((e&2)!==0),this.writeBit((e&1)!==0)}ensureCapacity(e){let t=this._position+e;if(t>this._buffer.length){let i=Math.max(t,this._buffer.length*2),s=new Uint8Array(i);s.set(this._buffer),this._buffer=s,this._view=new DataView(s.buffer,s.byteOffset,s.byteLength)}}};var sd=class extends Y{get SectionName(){return T.AppInfo}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_writer;_emptyArr=new Uint8Array(16);constructor(e,t){super(e),this._writer=ye.getStreamWriter(e,t,"utf-16le")}write(){let e="1.0.0.0";this._writer.writeInt(3),this._writer.writeTextUnicode("AppInfoDataList"),this._writer.writeInt(3),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode(e),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode("This is a comment from ACadSharp"),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode(`<ProductInformation name ="ACadSharp" build_version="${e}" registry_version="${e}" install_id_string="ACadSharp" registry_localeID="1033"/>`)}};var nd=class extends Y{get SectionName(){return T.AuxHeader}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_stream;_encoding;_header;_writer;constructor(e,t,i){super(i.version),this._stream=e,this._encoding=t,this._header=i,this._writer=ye.getStreamWriter(this._version,this._stream,t)}write(){this._writer.writeByte(255),this._writer.writeByte(119),this._writer.writeByte(1),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawLong(1),this._writer.writeRawLong(-1),this._writer.writeRawShort(1),this._writer.writeRawShort(0),this._writer.writeRawLong(0),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawShort(5),this._writer.writeRawShort(2195),this._writer.writeRawShort(5),this._writer.writeRawShort(2195),this._writer.writeRawShort(0),this._writer.writeRawShort(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.write8BitJulianDate(this._header.createDateTime),this._writer.write8BitJulianDate(this._header.updateDateTime);let e=-1;this._header.handleSeed<=2147483647&&(e=this._header.handleSeed),this._writer.writeRawLong(e),this._writer.writeRawLong(0),this._writer.writeRawShort(0),this._writer.writeRawShort(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this.R2018Plus&&(this._writer.writeRawShort(0),this._writer.writeRawShort(0))}};var ad=class extends Y{get SectionName(){return T.Classes}get bytesWritten(){return Math.ceil(this._startWriter.positionInBits/8)}get startWriterStream(){return this._startWriter.main.stream}_document;_sectionBuffer=[];_startWriter;_writer;_startSentinel=new Uint8Array([141,161,196,184,196,169,248,197,192,220,244,95,231,207,182,138]);_endSentinel=new Uint8Array([114,94,59,71,59,86,7,58,63,35,11,160,24,48,73,117]);constructor(e,t,i){super(t.header.version),this._document=t,this._startWriter=ye.getStreamWriter(this._version,e,i);let s=new Uint8Array(4096);this._writer=ye.getMergedWriter(this._version,s,i)}write(){this.R2007Plus&&this._writer.savePositonForSize();let e=0,t=[...this._document.classes];t.length>0&&(e=Math.max(...t.map(i=>i.classNumber))),this.R2004Plus&&(this.R2007Plus?(this._writer.writeBitLong(e),this._writer.writeBit(!0)):(this._writer.writeBitShort(e),this._writer.writeByte(0),this._writer.writeByte(0),this._writer.writeBit(!0)));for(let i of t)this._writer.writeBitShort(i.classNumber),this._writer.writeBitShort(i.proxyFlags),this._writer.writeVariableText(i.applicationName),this._writer.writeVariableText(i.cppClassName),this._writer.writeVariableText(i.dxfName),this._writer.writeBit(i.wasZombie),this._writer.writeBitShort(i.itemClassId),this.R2004Plus&&(this._writer.writeBitLong(i.instanceCount),this._writer.writeBitLong(i.dwgVersion),this._writer.writeBitLong(i.maintenanceVersion),this._writer.writeBitLong(0),this._writer.writeBitLong(0));this._writer.writeSpearShift(),this.writeSizeAndCrc()}writeSizeAndCrc(){this._startWriter.writeBytes(this._startSentinel);let e=Math.ceil(this._writer.main.positionInBits/8),t=new Uint8Array(this._writer.main.stream).slice(0,e),i=t.length,s=new Uint8Array(4);new DataView(s.buffer).setInt32(0,i,!0);let a=[];for(let h=0;h<4;h++)a.push(s[h]);if(this._document.header.version>=m.AC1024&&this._document.header.maintenanceVersion>3||this._document.header.version>m.AC1027)for(let h=0;h<4;h++)a.push(0);for(let h=0;h<i;h++)a.push(t[h]);let o=wr.GetCRCValue(49345,new Uint8Array(a),0,a.length);this._startWriter.writeBytes(s),(this._document.header.version>=m.AC1024&&this._document.header.maintenanceVersion>3||this._document.header.version>m.AC1027)&&this._startWriter.writeRawLong(0),this._startWriter.writeBytes(t),this._startWriter.writeRawShort(o),this._startWriter.writeBytes(this._endSentinel),this.R2004Plus&&(this._startWriter.writeRawLong(0),this._startWriter.writeRawLong(0))}};var Xa=class{FileHeader;get bytesWritten(){return this._streamPosition}_document;_encoding;_stream;_streamPosition=0;_version;constructor(e,t,i,s){this._document=i,this._stream=e,this._version=i.header.version,this._encoding=t,this.FileHeader=s}applyMagicSequence(e,t){for(let i=0;i<t;i++)e[i]^=rt.MagicSequence[i]}applyMask(e,t,i){let s=1097093995^this._streamPosition,n=new Uint8Array(4);new DataView(n.buffer).setInt32(0,s,!0);let o=t+i;for(;t<o;){for(let h=0;h<4;h++)e[t+h]^=n[h];t+=4}}checkEmptyBytes(e,t,i){let s=!0,n=t+i;for(let a=t;a<n;a++)if(e[a]!==0){s=!1;break}return s}getFileCodePage(){let e=Z.getCodeIndex(Z.getCodePage(this._document.header.codePage));return e<1?30:e}writeMagicNumber(){let e=this._streamPosition%32;for(let t=0;t<e;t++)this._stream[this._streamPosition++]=rt.MagicSequence[t]}writeToStream(e,t=0,i){let s=i??e.length;for(let n=0;n<s;n++)this._stream[this._streamPosition++]=e[t+n]}writeUint32ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,4).setUint32(0,e>>>0,!0),this._streamPosition+=4}writeInt32ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,4).setInt32(0,e,!0),this._streamPosition+=4}writeUint16ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,2).setUint16(0,e&65535,!0),this._streamPosition+=2}writeByteToStream(e){this._stream[this._streamPosition++]=e&255}};var od=class r extends Xa{get FileHeaderSize(){return 97}get HandleSectionOffset(){return this.FileHeaderSize+(this._records.get(T.AuxHeader).Stream?.length??0)+(this._records.get(T.Preview).Stream?.length??0)+(this._records.get(T.Header).Stream?.length??0)+(this._records.get(T.Classes).Stream?.length??0)}static _nRecords=6;_endSentinel=new Uint8Array([149,160,78,40,153,130,26,229,94,65,224,95,157,58,77,0]);_records=new Map;constructor(e,t,i){super(e,t,i,new Ei),this._records.set(T.AuxHeader,new ft(5)),this._records.set(T.Preview,new ft(null)),this._records.set(T.Header,new ft(0)),this._records.set(T.Classes,new ft(1)),this._records.set(T.AcDbObjects,new ft(null)),this._records.set(T.Handles,new ft(2)),this._records.set(T.ObjFreeSpace,new ft(3)),this._records.set(T.Template,new ft(4))}addSection(e,t,i,s=29696){this._records.get(e).Stream=t}writeFile(){this.setSeekers(),this.writeFileHeader(),this.writeRecordStreams()}setSeekers(){let e=this.FileHeaderSize;for(let[,t]of this._records)t.Seeker=e,e+=t.Stream?.length??0}writeFileHeader(){let e=[],t={pos:0,writeByte(h){e.push(h&255)},writeBytes(h,f=0,b){let S=b??h.length;for(let N=0;N<S;N++)e.push(h[f+N])},writeRawLong(h){e.push(h&255),e.push(h>>>8&255),e.push(h>>>16&255),e.push(h>>>24&255)},writeRawShort(h){e.push(h&255),e.push(h>>>8&255)}},i=new TextEncoder().encode(this._document.header.versionString);t.writeBytes(i,0,6),t.writeBytes(new Uint8Array([0,0,0,0,0,15,1])),t.writeRawLong(this._records.get(T.Preview).Seeker),t.writeByte(27),t.writeByte(25),t.writeRawShort(this.getFileCodePage()),t.writeRawLong(r._nRecords),this.writeRecord(t,this._records.get(T.Header)),this.writeRecord(t,this._records.get(T.Classes)),this.writeRecord(t,this._records.get(T.Handles)),this.writeRecord(t,this._records.get(T.ObjFreeSpace)),this.writeRecord(t,this._records.get(T.Template)),this.writeRecord(t,this._records.get(T.AuxHeader)),(8-e.length*8%8)%8>0;let n=new Uint8Array(e),a=wr.GetCRCValue(49345,n,0,n.length);t.writeRawShort(a),t.writeBytes(this._endSentinel,0,this._endSentinel.length);let o=new Uint8Array(e);this.writeToStream(o)}writeRecord(e,t){e.writeByte(t.Number),e.writeRawLong(t.Seeker),e.writeRawLong(t.Stream?.length??0)}writeRecordStreams(){for(let[,e]of this._records)e.Stream!=null&&this.writeToStream(e.Stream)}};var ld=class{_source;_dest;_block=new Int32Array(32768);_initialOffset=0;_currPosition=0;_currOffset=0;_totalOffset=0;constructor(){}compress(e,t,i,s){this.restartBlock(),this._source=e,this._dest=s,this._initialOffset=t,this._totalOffset=this._initialOffset+i,this._currOffset=this._initialOffset,this._currPosition=this._initialOffset+4;let n=0,a=0,o={value:0},h={value:0};for(;this._currPosition<this._totalOffset-19;){if(!this.compressChunk(o,h)){this._currPosition++;continue}let b=this._currPosition-this._currOffset;n!==0&&this.applyMask(a,n,b),this.writeLiteralLength(b),this._currPosition+=o.value,this._currOffset=this._currPosition,n=o.value,a=h.value}let f=this._totalOffset-this._currOffset;n!==0&&this.applyMask(a,n,f),this.writeLiteralLength(f),s.push(17),s.push(0),s.push(0)}restartBlock(){this._block.fill(-1)}writeLen(e){if(e<=0)throw new Error("Invalid length");for(;e>255;)e-=255,this._dest.push(0);this._dest.push(e&255)}writeOpCode(e,t,i){if(t<=0)throw new Error("Invalid compressionOffset");if(i<=0)throw new Error("Invalid value");t<=i?this._dest.push((e|t-2)&255):(this._dest.push(e&255),this.writeLen(t-i))}writeLiteralLength(e){if(e<=0)return;e>3&&this.writeOpCode(0,e-1,17);let t=this._currOffset;for(let i=0;i<e;i++)this._dest.push(this._source[t]),t++}applyMask(e,t,i){let s=0,n=0;t>=15||e>1024?(e<=16384?(e--,this.writeOpCode(32,t,33)):(e-=16384,this.writeOpCode(16|e>>>11&8,t,9)),s=(e&255)<<2,n=e>>>6):(e--,s=t+1<<4|(e&3)<<2,n=e>>>2),i<4&&(s|=i),this._dest.push(s&255),this._dest.push(n&255)}compressChunk(e,t){e.value=0;let a=((this._source[this._currPosition+3]<<6^this._source[this._currPosition+2])<<5^this._source[this._currPosition+1])<<5^this._source[this._currPosition],o=a+(a>>>5)&32767,h=this._block[o];if(t.value=this._currPosition-h,h>=this._initialOffset&&t.value<=49151){if(t.value>1024&&this._source[this._currPosition+3]!==this._source[h+3]&&(o=o&2047^16415,h=this._block[o],t.value=this._currPosition-h,h<this._initialOffset||t.value>49151||t.value>1024&&this._source[this._currPosition+3]!==this._source[h+3]))return this._block[o]=this._currPosition,!1;if(this._source[this._currPosition]===this._source[h]&&this._source[this._currPosition+1]===this._source[h+1]&&this._source[this._currPosition+2]===this._source[h+2]){e.value=3;let f=h+3,b=this._currPosition+3;for(;b<this._totalOffset&&this._source[f++]===this._source[b++];)e.value++}}return this._block[o]=this._currPosition,e.value>=3}};var Xs=class extends Xa{get FileHeaderSize(){return 256}get HandleSectionOffset(){return 0}get compressor(){return new ld}get _descriptors(){return this.FileHeader.Descriptors}_localSectionsMaps=[];constructor(e,t,i){super(e,t,i,new hs);for(let s=0;s<this.FileHeaderSize;s++)this._stream[this._streamPosition++]=0}addSection(e,t,i,s=29696){let n=new _r(e);this.FileHeader.AddSectionDescriptor(n),n.DecompressedSize=s,n.CompressedSize=t.length,n.CompressedCode=i?2:1;let a=Math.floor(t.length/n.DecompressedSize),o=0;for(let f=0;f<a;f++)this.createLocalSection(n,t,n.DecompressedSize,o,n.DecompressedSize,i),o+=n.DecompressedSize;let h=t.length%n.DecompressedSize;h>0&&!this.checkEmptyBytes(t,o,h)&&this.createLocalSection(n,t,n.DecompressedSize,o,h,i)}writeFile(){this.FileHeader.SectionArrayPageSize=this._localSectionsMaps.length+2,this.FileHeader.SectionPageMapId=this.FileHeader.SectionArrayPageSize,this.FileHeader.SectionMapId=this.FileHeader.SectionArrayPageSize-1,this.writeDescriptors(),this.writeRecords(),this.writeFileMetaData()}applyCompression(e,t,i,s,n){if(n){let a=new Uint8Array(t);for(let h=0;h<s;h++)a[h]=e[i+h];let o=[];return this.compressor.compress(a,0,t,o),new Uint8Array(o)}else{let a=new Uint8Array(t);for(let o=0;o<s;o++)a[o]=e[i+o];return a}}createLocalSection(e,t,i,s,n,a){let o=this.applyCompression(t,i,s,n,a);this.writeMagicNumber();let h=this._streamPosition,f=new cs;f.Offset=s,f.Seeker=h,f.PageNumber=this._localSectionsMaps.length+1,f.ODA=rt.Calculate(0,o,0,o.length);let b=rt.CompressionCalculator(o.length);f.CompressedSize=o.length,f.DecompressedSize=n,f.PageSize=f.CompressedSize+32+b,f.Checksum=0;let S=this.buildDataSection(e,f,e.PageType);if(f.Checksum=rt.Calculate(f.ODA,S,0,S.length),S=this.buildDataSection(e,f,e.PageType),this.applyMask(S,0,S.length),this.writeToStream(S),this.writeToStream(o),a)this.writeToStream(rt.MagicSequence,0,b);else if(b!==0)throw new Error("Compression diff should be 0 for uncompressed data");f.PageNumber>0&&e.PageCount++,f.Size=this._streamPosition-h,e.LocalSections.push(f),this._localSectionsMaps.push(f)}writeFileMetaData(){this.FileHeader.SecondHeaderAddr=this._streamPosition;let e=this.buildFileHeader();this.writeToStream(e);let t=this._streamPosition;this._streamPosition=0;let i=new TextEncoder().encode(this._document.header.versionString);this.writeToStream(i,0,6),this.writeToStream(new Uint8Array(5)),this.writeByteToStream(this._document.header.maintenanceVersion),this.writeByteToStream(3);let s=this._descriptors.get(T.Preview);this.writeUint32ToStream(s?.LocalSections?.[0]?s.LocalSections[0].Seeker+32:0),this.writeByteToStream(33),this.writeByteToStream(this._document.header.maintenanceVersion),this.writeUint16ToStream(this.getFileCodePage()),this.writeToStream(new Uint8Array(3)),this.writeInt32ToStream(0),this.writeInt32ToStream(0);let n=this._descriptors.get(T.SummaryInfo);this.writeUint32ToStream(n?.LocalSections?.[0]?n.LocalSections[0].Seeker+32:0),this.writeUint32ToStream(0),this.writeUint32ToStream(128);let a=this._descriptors.get(T.AppInfo);this.writeUint32ToStream(a?.LocalSections?.[0]?a.LocalSections[0].Seeker+32:0),this.writeToStream(new Uint8Array(80)),this.writeToStream(e),this.writeToStream(rt.MagicSequence,236,20),this._streamPosition=t}addSectionMap(e){e.PageNumber=this._localSectionsMaps.length+1,this._localSectionsMaps.push(e)}compressChecksum(e,t){e.DecompressedSize=t.length;let i=[];this.compressor.compress(t,0,t.length,i);let s=new Uint8Array(i);e.CompressedSize=s.length;let n=this.buildPageHeaderData(e);e.Checksum=rt.Calculate(0,n,0,n.length),e.Checksum=rt.Calculate(e.Checksum,s,0,s.length);let a=this.buildPageHeaderData(e);this.writeToStream(a),this.writeToStream(s)}setSeeker(e,t){let i=new cs;return i.SectionMap=e,this.writeMagicNumber(),i.Seeker=this._streamPosition,this.compressChecksum(i,t),i}buildDataSection(e,t,i){let s=new Uint8Array(32),n=new DataView(s.buffer);return n.setInt32(0,i,!0),n.setInt32(4,e.SectionId,!0),n.setInt32(8,t.CompressedSize,!0),n.setInt32(12,t.PageSize,!0),n.setInt32(16,t.Offset&4294967295,!0),n.setInt32(20,0,!0),n.setUint32(24,t.Checksum>>>0,!0),n.setUint32(28,t.ODA>>>0,!0),s}writeDescriptors(){let e=[],t=h=>{e.push(h&255),e.push(h>>>8&255),e.push(h>>>16&255),e.push(h>>>24&255)},i=h=>{t(h),t(0)},s=(h,f=0,b)=>{let S=b??h.length;for(let N=0;N<S;N++)e.push(h[f+N])};t(this._descriptors.size),t(2),t(29696),t(0),t(this._descriptors.size);for(let h of this._descriptors.values()){i(h.CompressedSize),t(h.PageCount),t(h.DecompressedSize),t(1),t(h.CompressedCode),t(h.SectionId),t(h.Encrypted);let f=new Uint8Array(64);if(h.Name){let b=new TextEncoder().encode(h.Name),S=Math.min(b.length,f.length);for(let N=0;N<S;N++)f[N]=b[N]}s(f);for(let b of h.LocalSections)b.PageNumber>0&&(t(b.PageNumber),t(b.CompressedSize),i(b.Offset))}let n=new Uint8Array(e),a=this.setSeeker(1097007163,n),o=rt.CompressionCalculator(this._streamPosition-a.Seeker);this.writeToStream(rt.MagicSequence,0,o),a.Size=this._streamPosition-a.Seeker,this.addSectionMap(a)}buildFileHeader(){let e=new Uint8Array(108),t=0,i=o=>{e[t++]=o&255,e[t++]=o>>>8&255,e[t++]=o>>>16&255,e[t++]=o>>>24&255},s=o=>{i(o),i(0)},n=new TextEncoder().encode("AcFssFcAJMB");for(let o=0;o<11;o++)e[t++]=n[o];e[t++]=0,i(0),i(108),i(4),i(this.FileHeader.RootTreeNodeGap),i(this.FileHeader.LeftGap),i(this.FileHeader.RigthGap),i(1),i(this.FileHeader.LastPageId),s(this.FileHeader.LastSectionAddr),s(this.FileHeader.SecondHeaderAddr),i(this.FileHeader.GapAmount),i(this.FileHeader.SectionAmount),i(32),i(128),i(64),i(this.FileHeader.SectionPageMapId),s(this.FileHeader.PageMapAddress-256),i(this.FileHeader.SectionMapId),i(this.FileHeader.SectionArrayPageSize),i(this.FileHeader.GapArraySize),i(0);let a=4294967295;for(let o=0;o<108;o++)a=(a>>>8^ds.Crc32Table[(a^e[o])&255])>>>0;return a=~a>>>0,e[104]=a&255,e[105]=a>>>8&255,e[106]=a>>>16&255,e[107]=a>>>24&255,this.applyMagicSequence(e,e.length),e}buildPageHeaderData(e){let t=new Uint8Array(20),i=new DataView(t.buffer);return i.setInt32(0,e.SectionMap,!0),i.setInt32(4,e.DecompressedSize,!0),i.setInt32(8,e.CompressedSize,!0),i.setInt32(12,e.Compression,!0),i.setUint32(16,e.Checksum>>>0,!0),t}writeRecords(){this.writeMagicNumber();let e=new cs;e.SectionMap=1097010747,this.addSectionMap(e);let t=this._localSectionsMaps.length*8;e.Seeker=this._streamPosition;let i=t+rt.CompressionCalculator(t);e.Size=i;let s=[];for(let o of this._localSectionsMaps)if(o!=null){s.push(o.PageNumber&255),s.push(o.PageNumber>>>8&255),s.push(o.PageNumber>>>16&255),s.push(o.PageNumber>>>24&255);let h=o.Size;s.push(h&255),s.push(h>>>8&255),s.push(h>>>16&255),s.push(h>>>24&255)}let n=new Uint8Array(s);this.compressChecksum(e,n);let a=this._localSectionsMaps[this._localSectionsMaps.length-1];this.FileHeader.GapAmount=0,this.FileHeader.LastPageId=a.PageNumber,this.FileHeader.LastSectionAddr=a.Seeker+i-256,this.FileHeader.SectionAmount=this._localSectionsMaps.length-1,this.FileHeader.PageMapAddress=e.Seeker}};var dd=class{compress(e,t,i,s){throw new Error("AC1021 DWG compression is not supported yet.")}};var Xh=class extends Xs{get FileHeaderSize(){return 1152}get compressor(){return new dd}constructor(e,t,i){super(e,t,i)}createLocalSection(e,t,i,s,n,a){let o=this.applyCompression(t,i,s,n,a);this.writeMagicNumber()}};var hd=class extends Y{get SectionName(){return T.Handles}_buffer=[];_handleMap;constructor(e,t){super(e),this._handleMap=new Map([...t.entries()].sort((i,s)=>i[0]-s[0]))}write(e=0){let t=new Uint8Array(10),i=new Uint8Array(5),s=0,n=0,a=this._buffer.length;this._buffer.push(0),this._buffer.push(0);for(let[o,h]of this._handleMap){let f=o-s,b=h+e,S=b-n,N=this.modularShortToValue(f,t),L=this.signedModularShortToValue(S,i);if(this._buffer.length-a+(N+L)>2032){if(this.processPosition(a),s=0,n=0,a=this._buffer.length,this._buffer.push(0),this._buffer.push(0),s=0,n=0,f=o-s,f===0)throw new Error("Handle offset is zero");S=b-n,N=this.modularShortToValue(f,t),L=this.signedModularShortToValue(S,i)}for(let j=0;j<N;j++)this._buffer.push(t[j]);for(let j=0;j<L;j++)this._buffer.push(i[j]);s=o,n=b}return this.processPosition(a),a=this._buffer.length,this._buffer.push(0),this._buffer.push(0),this.processPosition(a),new Uint8Array(this._buffer)}modularShortToValue(e,t){let i=0;for(;e>=128;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=e&255,i+1}signedModularShortToValue(e,t){let i=0;if(e<0){for(e=-e;e>=64;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=(e|64)&255,i+1}for(;e>=64;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=e&255,i+1}processPosition(e){let t=this._buffer.length-e;this._buffer[e]=t>>>8&255,this._buffer[e+1]=t&255;let i=new Uint8Array(this._buffer),s=wr.GetCRCValue(49345,i,e,this._buffer.length-e);this._buffer.push(s>>>8&255),this._buffer.push(s&255)}};var cd=class extends Y{get SectionName(){return T.Header}get bytesWritten(){return Math.ceil(this._startWriter.positionInBits/8)}get startWriterStream(){return this._startWriter.main.stream}_msmain;_startWriter;_writer;_document;_header;_encoding;constructor(e,t,i){super(t.header.version),this._document=t,this._header=t.header,this._encoding=i,this._startWriter=ye.getStreamWriter(this._version,e,this._encoding),this._msmain=new Uint8Array(8192),this._writer=ye.getStreamWriter(this._version,this._msmain,this._encoding)}write(){if(this.R2007Plus&&(this._writer=ye.getMergedWriter(this._version,this._msmain,this._encoding),this._writer.savePositonForSize()),this.R2013Plus&&this._writer.writeBitLongLong(0),this._writer.writeBitDouble(412148564080),this._writer.writeBitDouble(1),this._writer.writeBitDouble(1),this._writer.writeBitDouble(1),this._writer.writeVariableText("m"),this._writer.writeVariableText(""),this._writer.writeVariableText(""),this._writer.writeVariableText(""),this._writer.writeBitLong(24),this._writer.writeBitLong(0),this.R13_14Only&&this._writer.writeBitShort(0),this.R2004Pre&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBit(this._header.associatedDimensions),this._writer.writeBit(this._header.updateDimensionsWhileDragging),this.R13_14Only&&this._writer.writeBit(this._header.DIMSAV!==0),this._writer.writeBit(this._header.polylineLineTypeGeneration),this._writer.writeBit(this._header.orthoMode),this._writer.writeBit(this._header.regenerationMode!==0),this._writer.writeBit(this._header.fillMode),this._writer.writeBit(this._header.quickTextMode),this._writer.writeBit(this._header.paperSpaceLineTypeScaling===bi.Normal),this._writer.writeBit(this._header.limitCheckingOn),this.R13_14Only&&this._writer.writeBit(this._header.blipMode),this.R2004Plus&&this._writer.writeBit(!1),this._writer.writeBit(this._header.userTimer),this._writer.writeBit(this._header.sketchPolylineType!==0),this._writer.writeBit(this._header.angularDirection!==0),this._writer.writeBit(this._header.showSplineControlPoints),this.R13_14Only&&(this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.writeBit(this._header.mirrorText),this._writer.writeBit(this._header.worldView),this.R13_14Only&&this._writer.writeBit(!1),this._writer.writeBit(this._header.showModelSpaceInPaperSpace),this._writer.writeBit(this._header.paperSpaceLimitsChecking),this._writer.writeBit(this._header.retainXRefDependentVisibilitySettings),this.R13_14Only&&this._writer.writeBit(!1),this._writer.writeBit(this._header.displaySilhouetteCurves),this._writer.writeBit(this._header.createEllipseAsPolyline),this._writer.writeBitShort(this._header.proxyGraphics?1:0),this.R13_14Only&&this._writer.writeBitShort(0),this._writer.writeBitShort(this._header.spatialIndexMaxTreeDepth),this._writer.writeBitShort(this._header.linearUnitFormat),this._writer.writeBitShort(this._header.linearUnitPrecision),this._writer.writeBitShort(this._header.angularUnit),this._writer.writeBitShort(this._header.angularUnitPrecision),this.R13_14Only&&this._writer.writeBitShort(this._header.objectSnapMode),this._writer.writeBitShort(this._header.attributeVisibility),this.R13_14Only&&this._writer.writeBitShort(0),this._writer.writeBitShort(this._header.pointDisplayMode),this.R13_14Only&&this._writer.writeBitShort(0),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitLong(0)),this._writer.writeBitShort(this._header.userShort1),this._writer.writeBitShort(this._header.userShort2),this._writer.writeBitShort(this._header.userShort3),this._writer.writeBitShort(this._header.userShort4),this._writer.writeBitShort(this._header.userShort5),this._writer.writeBitShort(this._header.numberOfSplineSegments),this._writer.writeBitShort(this._header.surfaceDensityM),this._writer.writeBitShort(this._header.surfaceDensityM),this._writer.writeBitShort(this._header.surfaceType),this._writer.writeBitShort(this._header.surfaceTabulation1),this._writer.writeBitShort(this._header.surfaceTabulation2),this._writer.writeBitShort(this._header.splineType),this._writer.writeBitShort(this._header.shadeEdge),this._writer.writeBitShort(this._header.shadeDiffuseToAmbientPercentage),this._writer.writeBitShort(this._header.unitMode),this._writer.writeBitShort(this._header.maxViewportCount),this._writer.writeBitShort(this._header.surfaceIsolineCount),this._writer.writeBitShort(this._header.currentMultiLineJustification),this._writer.writeBitShort(this._header.textQuality),this._writer.writeBitDouble(this._header.lineTypeScale),this._writer.writeBitDouble(this._header.textHeightDefault),this._writer.writeBitDouble(this._header.traceWidthDefault),this._writer.writeBitDouble(this._header.sketchIncrement),this._writer.writeBitDouble(this._header.filletRadius),this._writer.writeBitDouble(this._header.thicknessDefault),this._writer.writeBitDouble(this._header.angleBase),this._writer.writeBitDouble(this._header.pointDisplaySize),this._writer.writeBitDouble(this._header.polylineWidthDefault),this._writer.writeBitDouble(this._header.userDouble1),this._writer.writeBitDouble(this._header.userDouble2),this._writer.writeBitDouble(this._header.userDouble3),this._writer.writeBitDouble(this._header.userDouble4),this._writer.writeBitDouble(this._header.userDouble5),this._writer.writeBitDouble(this._header.chamferDistance1),this._writer.writeBitDouble(this._header.chamferDistance2),this._writer.writeBitDouble(this._header.chamferLength),this._writer.writeBitDouble(this._header.chamferAngle),this._writer.writeBitDouble(this._header.facetResolution),this._writer.writeBitDouble(this._header.currentMultilineScale),this._writer.writeBitDouble(this._header.currentEntityLinetypeScale),this._writer.writeVariableText(this._header.menuFileName),this._writer.writeDateTime(this._header.createDateTime),this._writer.writeDateTime(this._header.updateDateTime),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitLong(0)),this._writer.writeTimeSpan(this._header.totalEditingTime),this._writer.writeTimeSpan(this._header.userElapsedTimeSpan),this._writer.writeCmColor(this._header.currentEntityColor),this._writer.main.handleReferenceHandle(this._header.handleSeed),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentLayer),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentTextStyle),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentLineType),this.R2007Plus&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentDimensionStyle),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentMLineStyleName),this.R2000Plus&&this._writer.writeBitDouble(this._header.viewportDefaultViewScaleFactor),this._writer.write3BitDouble(this._header.paperSpaceInsertionBase),this._writer.write3BitDouble(this._header.paperSpaceExtMin),this._writer.write3BitDouble(this._header.paperSpaceExtMax),this._writer.write2RawDouble(this._header.paperSpaceLimitsMin),this._writer.write2RawDouble(this._header.paperSpaceLimitsMax),this._writer.writeBitDouble(this._header.paperSpaceElevation),this._writer.write3BitDouble(this._header.paperSpaceUcs),this._writer.write3BitDouble(this._header.paperSpaceXAxis),this._writer.write3BitDouble(this._header.paperSpaceYAxis),this._writer.handleReferenceTyped(w.HardPointer,this._header.paperSpaceUcs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitShort(0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.write3BitDouble(this._header.paperSpaceOrthographicTopDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicBottomDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicLeftDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicRightDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicFrontDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicBackDOrigin)),this._writer.write3BitDouble(this._header.modelSpaceInsertionBase),this._writer.write3BitDouble(this._header.modelSpaceExtMin),this._writer.write3BitDouble(this._header.modelSpaceExtMax),this._writer.write2RawDouble(this._header.modelSpaceLimitsMin),this._writer.write2RawDouble(this._header.modelSpaceLimitsMax),this._writer.writeBitDouble(this._header.elevation),this._writer.write3BitDouble(this._header.modelSpaceOrigin),this._writer.write3BitDouble(this._header.modelSpaceXAxis),this._writer.write3BitDouble(this._header.modelSpaceYAxis),this._writer.handleReferenceTyped(w.HardPointer,this._header.modelSpaceUcs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitShort(0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.write3BitDouble(this._header.modelSpaceOrthographicTopDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicBottomDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicLeftDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicRightDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicFrontDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicBackDOrigin),this._writer.writeVariableText(this._header.dimensionPostFix),this._writer.writeVariableText(this._header.dimensionAlternateDimensioningSuffix)),this.R13_14Only&&(this._writer.writeBit(this._header.dimensionGenerateTolerances),this._writer.writeBit(this._header.dimensionLimitsGeneration),this._writer.writeBit(this._header.dimensionTextInsideHorizontal),this._writer.writeBit(this._header.dimensionTextOutsideHorizontal),this._writer.writeBit(this._header.dimensionSuppressFirstExtensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondExtensionLine),this._writer.writeBit(this._header.dimensionAlternateUnitDimensioning),this._writer.writeBit(this._header.dimensionTextOutsideExtensions),this._writer.writeBit(this._header.dimensionSeparateArrowBlocks),this._writer.writeBit(this._header.dimensionTextInsideExtensions),this._writer.writeBit(this._header.dimensionSuppressOutsideExtensions),this._writer.writeByte(this._header.dimensionAlternateUnitDecimalPlaces),this._writer.writeByte(this._header.dimensionZeroHandling),this._writer.writeBit(this._header.dimensionSuppressFirstDimensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondDimensionLine),this._writer.writeByte(this._header.dimensionToleranceAlignment),this._writer.writeByte(this._header.dimensionTextHorizontalAlignment),this._writer.writeByte(this._header.dimensionFit),this._writer.writeBit(this._header.dimensionCursorUpdate),this._writer.writeByte(this._header.dimensionToleranceZeroHandling),this._writer.writeByte(this._header.dimensionAlternateUnitZeroHandling),this._writer.writeByte(this._header.dimensionAlternateUnitToleranceZeroHandling),this._writer.writeByte(this._header.dimensionTextVerticalAlignment),this._writer.writeBitShort(this._header.dimensionUnit),this._writer.writeBitShort(this._header.dimensionAngularDimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAlternateUnitFormat),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceDecimalPlaces),this._writer.handleReferenceTyped(w.HardPointer,this._header.dimensionTextStyle)),this._writer.writeBitDouble(this._header.dimensionScaleFactor),this._writer.writeBitDouble(this._header.dimensionArrowSize),this._writer.writeBitDouble(this._header.dimensionExtensionLineOffset),this._writer.writeBitDouble(this._header.dimensionLineIncrement),this._writer.writeBitDouble(this._header.dimensionExtensionLineExtension),this._writer.writeBitDouble(this._header.dimensionRounding),this._writer.writeBitDouble(this._header.dimensionLineExtension),this._writer.writeBitDouble(this._header.dimensionPlusTolerance),this._writer.writeBitDouble(this._header.dimensionMinusTolerance),this.R2007Plus&&(this._writer.writeBitDouble(this._header.dimensionFixedExtensionLineLength),this._writer.writeBitDouble(this._header.dimensionJoggedRadiusDimensionTransverseSegmentAngle),this._writer.writeBitShort(this._header.dimensionTextBackgroundFillMode),this._writer.writeCmColor(this._header.dimensionTextBackgroundColor)),this.R2000Plus&&(this._writer.writeBit(this._header.dimensionGenerateTolerances),this._writer.writeBit(this._header.dimensionLimitsGeneration),this._writer.writeBit(this._header.dimensionTextInsideHorizontal),this._writer.writeBit(this._header.dimensionTextOutsideHorizontal),this._writer.writeBit(this._header.dimensionSuppressFirstExtensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondExtensionLine),this._writer.writeBitShort(this._header.dimensionTextVerticalAlignment),this._writer.writeBitShort(this._header.dimensionZeroHandling),this._writer.writeBitShort(this._header.dimensionAngularZeroHandling)),this.R2007Plus&&this._writer.writeBitShort(this._header.dimensionArcLengthSymbolPosition),this._writer.writeBitDouble(this._header.dimensionTextHeight),this._writer.writeBitDouble(this._header.dimensionCenterMarkSize),this._writer.writeBitDouble(this._header.dimensionTickSize),this._writer.writeBitDouble(this._header.dimensionAlternateUnitScaleFactor),this._writer.writeBitDouble(this._header.dimensionLinearScaleFactor),this._writer.writeBitDouble(this._header.dimensionTextVerticalPosition),this._writer.writeBitDouble(this._header.dimensionToleranceScaleFactor),this._writer.writeBitDouble(this._header.dimensionLineGap),this.R13_14Only&&(this._writer.writeVariableText(this._header.dimensionPostFix),this._writer.writeVariableText(this._header.dimensionAlternateDimensioningSuffix),this._writer.writeVariableText(this._header.dimensionBlockName),this._writer.writeVariableText(this._header.dimensionBlockNameFirst),this._writer.writeVariableText(this._header.dimensionBlockNameSecond)),this.R2000Plus&&(this._writer.writeBitDouble(this._header.dimensionAlternateUnitRounding),this._writer.writeBit(this._header.dimensionAlternateUnitDimensioning),this._writer.writeBitShort(this._header.dimensionAlternateUnitDecimalPlaces),this._writer.writeBit(this._header.dimensionTextOutsideExtensions),this._writer.writeBit(this._header.dimensionSeparateArrowBlocks),this._writer.writeBit(this._header.dimensionTextInsideExtensions),this._writer.writeBit(this._header.dimensionSuppressOutsideExtensions)),this._writer.writeCmColor(this._header.dimensionLineColor),this._writer.writeCmColor(this._header.dimensionExtensionLineColor),this._writer.writeCmColor(this._header.dimensionTextColor),this.R2000Plus&&(this._writer.writeBitShort(this._header.dimensionAngularDimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAlternateUnitFormat),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAngularUnit),this._writer.writeBitShort(this._header.dimensionFractionFormat),this._writer.writeBitShort(this._header.dimensionLinearUnitFormat),this._writer.writeBitShort(this._header.dimensionDecimalSeparator.charCodeAt(0)||0),this._writer.writeBitShort(this._header.dimensionTextMovement),this._writer.writeBitShort(this._header.dimensionTextHorizontalAlignment),this._writer.writeBit(this._header.dimensionSuppressFirstDimensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondDimensionLine),this._writer.writeBitShort(this._header.dimensionToleranceAlignment),this._writer.writeBitShort(this._header.dimensionToleranceZeroHandling),this._writer.writeBitShort(this._header.dimensionAlternateUnitZeroHandling),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceZeroHandling),this._writer.writeBit(this._header.dimensionCursorUpdate),this._writer.writeBitShort(this._header.dimensionDimensionTextArrowFit)),this.R2007Plus&&this._writer.writeBit(this._header.dimensionIsExtensionLineLengthFixed),this.R2010Plus&&(this._writer.writeBit(this._header.dimensionTextDirection===1),this._writer.writeBitDouble(this._header.dimensionAltMzf),this._writer.writeVariableText(this._header.dimensionAltMzs),this._writer.writeBitDouble(this._header.dimensionFit),this._writer.writeVariableText(this._header.dimensionMzs)),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,this._header.dimensionTextStyle),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2000Plus&&(this._writer.writeBitShort(this._header.dimensionLineWeight),this._writer.writeBitShort(this._header.extensionLineWeight)),this._writer.handleReferenceTyped(w.HardOwnership,this._document.blockRecords),this._writer.handleReferenceTyped(w.HardOwnership,this._document.layers),this._writer.handleReferenceTyped(w.HardOwnership,this._document.textStyles),this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes),this._writer.handleReferenceTyped(w.HardOwnership,this._document.views),this._writer.handleReferenceTyped(w.HardOwnership,this._document.uCSs),this._writer.handleReferenceTyped(w.HardOwnership,this._document.vPorts),this._writer.handleReferenceTyped(w.HardOwnership,this._document.appIds),this._writer.handleReferenceTyped(w.HardOwnership,this._document.dimensionStyles),this.R13_15Only&&this._writer.handleReferenceTyped(w.HardOwnership,this._document.vEntityControl),this._writer.handleReferenceTyped(w.HardPointer,this._document.groups),this._writer.handleReferenceTyped(w.HardPointer,this._document.mLineStyles),this._writer.handleReferenceTyped(w.HardOwnership,this._document.rootDictionary),this.R2000Plus&&(this._writer.writeBitShort(this._header.stackedTextAlignment),this._writer.writeBitShort(this._header.stackedTextSizePercentage),this._writer.writeVariableText(this._header.hyperLinkBase),this._writer.writeVariableText(this._header.styleSheetName),this._writer.handleReferenceTyped(w.HardPointer,this._document.layouts),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2004Plus&&(this._writer.handleReferenceTyped(w.HardPointer,this._document.materials),this._writer.handleReferenceTyped(w.HardPointer,this._document.colors)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this.R2013Plus&&this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2000Plus){let e=this._header.currentEntityLineWeight&31|this._header.endCaps<<5|this._header.joinStyle<<7;this._header.displayLineWeight||(e|=512),this._header.xEdit||(e|=1024),this._header.extendedNames&&(e|=2048),this._header.plotStyleMode===1&&(e|=8192),this._header.loadOLEObject&&(e|=16384),this._writer.writeBitLong(e),this._writer.writeBitShort(this._header.insUnits),this._writer.writeBitShort(this._header.currentEntityPlotStyle),this._header.currentEntityPlotStyle===Qi.ByObjectId&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeVariableText(this._header.fingerPrintGuid),this._writer.writeVariableText(this._header.versionGuid)}this.R2004Plus&&(this._writer.writeByte(this._header.entitySortingFlags),this._writer.writeByte(this._header.indexCreationFlags),this._writer.writeByte(this._header.hideText),this._writer.writeByte(this._header.externalReferenceClippingBoundaryType),this._writer.writeByte(this._header.dimensionAssociativity),this._writer.writeByte(this._header.haloGapPercentage),this._writer.writeBitShort(this._header.obscuredColor.index),this._writer.writeBitShort(this._header.interfereColor.index),this._writer.writeByte(this._header.obscuredType),this._writer.writeByte(this._header.intersectionDisplay),this._writer.writeVariableText(this._header.projectName)),this._writer.handleReferenceTyped(w.HardPointer,this._document.paperSpace),this._writer.handleReferenceTyped(w.HardPointer,this._document.modelSpace),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("ByLayer")),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("ByBlock")),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("Continuous")),this.R2007Plus&&(this._writer.writeBit(this._header.cameraDisplayObjects),this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitDouble(0),this._writer.writeBitDouble(this._header.stepsPerSecond),this._writer.writeBitDouble(this._header.stepSize),this._writer.writeBitDouble(this._header.dw3DPrecision),this._writer.writeBitDouble(this._header.lensLength),this._writer.writeBitDouble(this._header.cameraHeight),this._writer.writeByte(this._header.solidsRetainHistory?1:0),this._writer.writeByte(this._header.showSolidsHistory?1:0),this._writer.writeBitDouble(this._header.sweptSolidWidth),this._writer.writeBitDouble(this._header.sweptSolidHeight),this._writer.writeBitDouble(this._header.draftAngleFirstCrossSection),this._writer.writeBitDouble(this._header.draftAngleSecondCrossSection),this._writer.writeBitDouble(this._header.draftMagnitudeFirstCrossSection),this._writer.writeBitDouble(this._header.draftMagnitudeSecondCrossSection),this._writer.writeBitShort(this._header.solidLoftedShape),this._writer.writeByte(this._header.loftedObjectNormals.charCodeAt(0)||0),this._writer.writeBitDouble(this._header.latitude),this._writer.writeBitDouble(this._header.longitude),this._writer.writeBitDouble(this._header.northDirection),this._writer.writeBitLong(this._header.timeZone),this._writer.writeByte(this._header.displayLightGlyphs.charCodeAt(0)||0),this._writer.writeByte(48),this._writer.writeByte(this._header.dwgUnderlayFramesVisibility.charCodeAt(0)||0),this._writer.writeByte(this._header.dgnUnderlayFramesVisibility.charCodeAt(0)||0),this._writer.writeBit(!1),this._writer.writeCmColor(this._header.interfereColor),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeByte(this._header.shadowMode),this._writer.writeBitDouble(this._header.shadowPlaneLocation)),this._header.version>=m.AC1014&&(this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBit(!1))),this._writer.writeSpearShift(),this.writeSizeAndCrc()}writeSizeAndCrc(){this._startWriter.writeBytes(T.StartSentinels.get(this.SectionName));let e=Math.ceil(this._writer.main.positionInBits/8),t=new Uint8Array(this._writer.main.stream).slice(0,e),i=t.length,s=new Uint8Array(4);new DataView(s.buffer).setInt32(0,i,!0);let a=[];for(let h=0;h<4;h++)a.push(s[h]);if(this.R2010Plus&&this._header.maintenanceVersion>3||this.R2018Plus)for(let h=0;h<4;h++)a.push(0);for(let h=0;h<i;h++)a.push(t[h]);let o=wr.GetCRCValue(49345,new Uint8Array(a),0,a.length);this._startWriter.writeBytes(s),(this.R2010Plus&&this._header.maintenanceVersion>3||this.R2018Plus)&&this._startWriter.writeRawLong(0),this._startWriter.writeBytes(t),this._startWriter.writeRawShort(o),this._startWriter.writeBytes(T.EndSentinels.get(this.SectionName))}};var Za=class{get encoding(){return this.main.encoding}main;textWriter;handleWriter;stream;savedPositionInBits=0;positionInBits=0;_savedPosition=!1;constructor(e,t,i,s){this.stream=e.buffer,this.main=t,this.textWriter=i,this.handleWriter=s}handleReference(e){this.handleWriter.handleReference(e)}handleReferenceTyped(e,t){this.handleWriter.handleReferenceTyped(e,t)}handleReferenceHandle(e){this.handleWriter.handleReferenceHandle(e)}handleReferenceTypedHandle(e,t){this.handleWriter.handleReferenceTypedHandle(e,t)}resetStream(){this.main.resetStream(),this.textWriter.resetStream(),this.handleWriter.resetStream()}savePositonForSize(){this._savedPosition=!0,this.positionInBits=this.main.positionInBits,this.main.writeRawLong(0)}write2RawDouble(e){this.main.write2RawDouble(e)}write2BitDouble(e){this.main.write2BitDouble(e)}write3BitDouble(e){this.main.write3BitDouble(e)}writeBit(e){this.main.writeBit(e)}write2Bits(e){this.main.write2Bits(e)}writeBitDouble(e){this.main.writeBitDouble(e)}write2BitDoubleWithDefault(e,t){this.main.write2BitDoubleWithDefault(e,t)}write3BitDoubleWithDefault(e,t){this.main.write3BitDoubleWithDefault(e,t)}writeBitDoubleWithDefault(e,t){this.main.writeBitDoubleWithDefault(e,t)}writeBitExtrusion(e){this.main.writeBitExtrusion(e)}writeBitLong(e){this.main.writeBitLong(e)}writeBitLongLong(e){this.main.writeBitLongLong(e)}writeBitShort(e){this.main.writeBitShort(e)}writeBitThickness(e){this.main.writeBitThickness(e)}writeByte(e){this.main.writeByte(e)}writeBytes(e){this.main.writeBytes(e)}writeBytesOffset(e,t,i){this.main.writeBytesOffset(e,t,i)}writeCmColor(e){this.main.writeCmColor(e)}writeEnColor(e,t){this.main.writeEnColor(e,t)}writeEnColorBook(e,t,i){this.main.writeEnColorBook(e,t,i)}writeDateTime(e){this.main.writeDateTime(e)}write8BitJulianDate(e){this.main.write8BitJulianDate(e)}writeInt(e){this.main.writeInt(e)}writeObjectType(e){this.main.writeObjectType(e)}writeObjectTypeEnum(e){this.main.writeObjectTypeEnum(e)}writeRawDouble(e){this.main.writeRawDouble(e)}writeRawLong(e){this.main.writeRawLong(e)}writeRawShort(e){this.main.writeRawShort(e)}writeSpearShift(){let e=this.main.positionInBits,t=this.textWriter.positionInBits;if(this.main.writeSpearShift(),this._savedPosition){let n=e+t+1;t>0&&(n+=16,t>=32768&&(n+=16,t>=1073741824&&(n+=16))),this.main.setPositionInBits(this.positionInBits),this.main.writeRawLong(n),this.main.writeShiftValue()}if(this.main.setPositionInBits(e),t>0){this.textWriter.writeSpearShift();let n=Math.ceil(this.textWriter.positionInBits/8),a=new Uint8Array(this.textWriter.stream).slice(0,n);this.main.writeBytes(a),this.main.writeSpearShift(),this.main.setPositionInBits(e+t),this.main.setPositionByFlag(t),this.main.writeBit(!0)}else this.main.writeBit(!1);this.handleWriter.writeSpearShift(),this.savedPositionInBits=this.main.positionInBits;let i=Math.ceil(this.handleWriter.positionInBits/8),s=new Uint8Array(this.handleWriter.stream).slice(0,i);this.main.writeBytes(s),this.main.writeSpearShift()}writeTimeSpan(e){this.main.writeTimeSpan(e)}writeVariableText(e){this.textWriter.writeVariableText(e)}writeTextUnicode(e){this.textWriter.writeTextUnicode(e)}setPositionInBits(e){this.main.setPositionInBits(e)}setPositionByFlag(e){this.main.setPositionByFlag(e)}writeShiftValue(){this.main.writeShiftValue()}};var ud=class extends Za{constructor(e,t,i){super(e,t,t,i)}writeSpearShift(){let e=this.main.positionInBits;this._savedPosition&&(this.main.writeSpearShift(),this.main.setPositionInBits(this.positionInBits),this.main.writeRawLong(e),this.main.writeShiftValue(),this.main.setPositionInBits(e)),this.handleWriter.writeSpearShift();let t=Math.ceil(this.handleWriter.positionInBits/8),i=new Uint8Array(this.handleWriter.stream).slice(0,t);this.main.writeBytes(i),this.main.writeSpearShift()}};R();kr();wn();D();var ps=class extends Os{alignmentPoint=new c(1,0,0);attachmentPoint=Oe.TopLeft;insertPoint=new c(0,0,0);get objectName(){return d.MTextAttributeObjectContextData}rotation=0;value290=!1};var md=class extends Y{get SectionName(){return T.AcDbObjects}Map=new Map;WriteXRecords;WriteXData;WriteShapes=!0;_dictionaries=new Map;_objects=[];_msmain;_msmainPos=0;_writer;_stream;_streamPos=0;_document;_prev=null;_next=null;constructor(e,t,i,s=!0,n=!0,a=!0){super(t.header.version),this._stream=e.length<65536?new Uint8Array(1048576):e,this._document=t,this._msmain=new Uint8Array(65536),this._writer=ye.getMergedWriter(t.header.version,this._msmain,i),this.WriteXRecords=s,this.WriteXData=n,this.WriteShapes=a}get bytesWritten(){return this._streamPos}getWrittenData(){return this._stream.slice(0,this._streamPos)}ensureStreamCapacity(e){if(e>this._stream.length){let t=Math.max(e,this._stream.length*2),i=new Uint8Array(t);i.set(this._stream.subarray(0,this._streamPos)),this._stream=i}}write(){this.R2004Plus&&(this.ensureStreamCapacity(this._streamPos+4),new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPos).setInt32(0,3530,!0),this._streamPos+=4),this._objects.push(this._document.rootDictionary),this.writeBlockControl(),this.writeTable(this._document.layers),this.writeTable(this._document.textStyles),this.writeLTypeControlObject(),this.writeTable(this._document.views),this.writeTable(this._document.uCSs),this.writeTable(this._document.vPorts),this.writeTable(this._document.appIds),this.writeTable(this._document.dimensionStyles),this.R2004Pre&&this._document.vEntityControl&&this.writeTable(this._document.vEntityControl),this.writeBlockEntities(),this.writeObjects()}writeLTypeControlObject(){this.writeCommonNonEntityData(this._document.lineTypes),this._writer.writeBitLong(this._document.lineTypes.length-2);for(let e of this._document.lineTypes)e.name.toLowerCase()===H.ByBlockName.toLowerCase()||e.name.toLowerCase()===H.ByLayerName.toLowerCase()||this._writer.handleReferenceTyped(w.SoftOwnership,e);this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes.ByBlock),this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes.ByLayer),this.registerObject(this._document.lineTypes),this.writeEntries(this._document.lineTypes)}writeBlockControl(){this.writeCommonNonEntityData(this._document.blockRecords),this._writer.writeBitLong(this._document.blockRecords.length-2);for(let e of this._document.blockRecords)e.name.toLowerCase()===U.ModelSpaceName.toLowerCase()||e.name.toLowerCase()===U.PaperSpaceName.toLowerCase()||this._writer.handleReferenceTyped(w.SoftOwnership,e);this._writer.handleReferenceTyped(w.HardOwnership,this._document.modelSpace),this._writer.handleReferenceTyped(w.HardOwnership,this._document.paperSpace),this.registerObject(this._document.blockRecords),this.writeEntries(this._document.blockRecords)}writeTable(e){this.writeCommonNonEntityData(e),this._writer.writeBitLong(e.count),this.R2000Plus&&e instanceof Wt&&this._writer.writeByte(0);for(let t of e)this._writer.handleReferenceTyped(w.SoftOwnership,t);this.registerObject(e),this.writeEntries(e)}writeEntries(e){for(let t of e)t instanceof gt?this.writeAppId(t):t instanceof U?this.writeBlockRecord(t):t instanceof Se?this.writeLayer(t):t instanceof H?this.writeLineType(t):t instanceof te?this.writeTextStyle(t):t instanceof ot?this.writeUCS(t):t instanceof Vi?this.writeView(t):t instanceof re?this.writeDimensionStyle(t):t instanceof xt?this.writeVPort(t):this.notify(`Table entry not implemented : ${t.constructor.name}`,g.NotImplemented)}writeBlockEntities(){for(let e of this._document.blockRecords){this.writeBlockBegin(e.blockEntity),this._prev=null,this._next=null;let t=this.getCompatibleEntities(e.entities);for(let i=0;i<t.length;i++){this._prev=i>0?t[i-1]:null;let s=t[i];this._next=i<t.length-1?t[i+1]:null,this.writeEntity(s)}this._prev=null,this._next=null,this.writeBlockEnd(e.blockEnd)}}getCompatibleEntities(e){return Array.from(e).filter(t=>this.isEntitySupported(t))}isEntitySupported(e){return e instanceof Lt?!1:e instanceof ur?this.WriteShapes:e instanceof xn||e instanceof Tn||e instanceof Ti||e instanceof ti||e instanceof ts||e instanceof as?(this.notify(`Entity type not implemented ${e.constructor.name}`,g.NotImplemented),!1):!0}writeAppId(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeByte(0),this._writer.handleReferenceTyped(w.HardPointer,0),this.registerObject(e)}writeBlockRecord(e){this.writeBlockHeader(e)}writeBlockHeader(e){let t=this.getCompatibleEntities(e.entities);if(this.writeCommonNonEntityData(e),(e.flags&ne.Anonymous)!==0)this._writer.writeVariableText(e.name.substring(0,2));else if(e.layout!=null){let i=e.name.replace(/[0-9]/g,"");this._writer.writeVariableText(i)}else this._writer.writeVariableText(e.name);if(this.writeXrefDependantBit(e),this._writer.writeBit((e.flags&ne.Anonymous)!==0),this._writer.writeBit(e.hasAttributes),this._writer.writeBit((e.flags&ne.XRef)!==0),this._writer.writeBit((e.flags&ne.XRefOverlay)!==0),this.R2000Plus&&this._writer.writeBit(e.isUnloaded),this.R2004Plus&&(e.flags&ne.XRef)===0&&(e.flags&ne.XRefOverlay)===0&&this._writer.writeBitLong(t.length),this._writer.write3BitDouble(e.blockEntity.basePoint),this._writer.writeVariableText(e.blockEntity.xRefPath),this.R2000Plus){let i=Array.from(this._document.entities).filter(s=>s instanceof Ee&&s.block?.name===e.name);for(let s of i)this._writer.writeByte(1);this._writer.writeByte(0),this._writer.writeVariableText(e.blockEntity.comments),this._writer.writeBitLong(0)}if(this.R2007Plus&&(this._writer.writeBitShort(e.units),this._writer.writeBit(e.isExplodable),this._writer.writeByte(e.canScale?1:0)),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardOwnership,e.blockEntity),this._version>=m.AC1012&&this._version<=m.AC1015&&(e.flags&ne.XRef)===0&&(e.flags&ne.XRefOverlay)===0&&(t.length>0?(this._writer.handleReferenceTyped(w.SoftPointer,t[0]),this._writer.handleReferenceTyped(w.SoftPointer,t[t.length-1])):(this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0))),this.R2004Plus)for(let i of t)this._writer.handleReferenceTyped(w.HardOwnership,i);if(this._writer.handleReferenceTyped(w.HardOwnership,e.blockEnd),this.R2000Plus){let i=Array.from(this._document.entities).filter(s=>s instanceof Ee&&s.block?.name===e.name);for(let s of i)this._writer.handleReferenceTyped(w.SoftPointer,s);this._writer.handleReferenceTyped(w.HardPointer,e.layout)}this.registerObject(e)}writeBlockBegin(e){this.writeCommonEntityData(e),this._writer.writeVariableText(e.name),this.registerObject(e)}writeBlockEnd(e){this.writeCommonEntityData(e),this.registerObject(e)}writeLayer(e){if(this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this.R13_14Only&&(this._writer.writeBit((e.flags&ze.Frozen)!==0),this._writer.writeBit(e.isOn),this._writer.writeBit((e.flags&ze.FrozenNewViewports)!==0),this._writer.writeBit((e.flags&ze.Locked)!==0)),this.R2000Plus){let t=Z.toIndex(e.lineWeight)<<5;(e.flags&ze.Frozen)!==0&&(t|=1),e.isOn||(t|=2),(e.flags&ze.Frozen)!==0&&(t|=4),(e.flags&ze.Locked)!==0&&(t|=8),e.plotFlag&&(t|=16),this._writer.writeBitShort(t)}this._writer.writeCmColor(e.color),this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this.R2007Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.lineType.handle),this.R2013Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this.registerObject(e)}writeLineType(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeVariableText(e.description),this._writer.writeBitDouble(e.patternLength),this._writer.writeByte((e.alignment?.charCodeAt(0)??0)&255),this._writer.writeByte(e.segments.length);let t=!1;for(let n of e.segments)if((n.shapeFlags&Ze.Text)!==0){t=!0;break}let i=null,s=0;this._version<=m.AC1018?(i=new Uint8Array(256),this._version<=m.AC1014&&(s=1)):this.R2007Plus&&t&&(i=new Uint8Array(512));for(let n of e.segments){if((n.shapeFlags&Ze.Text)!==0)if(i==null||!n.text)n.shapeNumber=0;else{let a=this.R2007Plus?this.encodeUtf16LE(n.text):this.encodeText(n.text),o=this.R2007Plus?2:1,h=a.length+o;if(s+h<=i.length){n.shapeNumber=s,i.set(a,s),s+=a.length;for(let f=0;f<o;f++)i[s++]=0}else n.shapeNumber=0}this._writer.writeBitDouble(n.length),this._writer.writeBitShort(n.shapeNumber),this._writer.writeRawDouble(n.offset.x),this._writer.writeRawDouble(n.offset.y),this._writer.writeBitDouble(n.scale),this._writer.writeBitDouble(n.rotation),this._writer.writeBitShort(n.shapeFlags)}if(this._version<=m.AC1018){let n=i??new Uint8Array(256);for(let a=0;a<n.length;a++)this._writer.writeByte(n[a])}if(this.R2007Plus&&t){let n=i??new Uint8Array(512);for(let a=0;a<n.length;a++)this._writer.writeByte(n[a])}this._writer.handleReferenceTyped(w.HardPointer,0);for(let n of e.segments)this._writer.handleReferenceTyped(w.HardPointer,n.style);this.registerObject(e)}writeTextStyle(e){this.writeCommonNonEntityData(e),e.isShapeFile?this._writer.writeVariableText(""):this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBit((e.flags&Nr.IsShape)!==0),this._writer.writeBit((e.flags&Nr.VerticalText)!==0),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.width),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeByte(e.mirrorFlag),this._writer.writeBitDouble(e.lastHeight),this._writer.writeVariableText(e.filename),this._writer.writeVariableText(e.bigFontFilename),this._writer.handleReferenceTyped(w.HardPointer,this._document.textStyles),this.registerObject(e)}writeUCS(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.write3BitDouble(e.origin),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this.R2000Plus&&(this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.orthographicViewType),this._writer.writeBitShort(e.orthographicType)),this._writer.handleReferenceTyped(w.SoftPointer,this._document.uCSs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0)),this.registerObject(e)}writeView(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.width),this._writer.write2RawDouble(e.center),this._writer.write3BitDouble(e.target),this._writer.write3BitDouble(e.direction),this._writer.writeBitDouble(e.angle),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClipping),this._writer.writeBitDouble(e.backClipping),this._writer.writeBit((e.viewMode&se.PerspectiveView)!==0),this._writer.writeBit((e.viewMode&se.FrontClipping)!==0),this._writer.writeBit((e.viewMode&se.BackClipping)!==0),this._writer.writeBit((e.viewMode&se.FrontClippingZ)!==0),this.R2000Plus&&this._writer.writeByte(e.renderMode),this.R2007Plus&&(this._writer.writeBit(!0),this._writer.writeByte(1),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0),this._writer.writeCmColor(new B(250))),this._writer.writeBit((e.flags&1)!==0),this.R2000Plus&&(this._writer.writeBit(e.isUcsAssociated),e.isUcsAssociated&&(this._writer.write3BitDouble(e.ucsOrigin),this._writer.write3BitDouble(e.ucsXAxis),this._writer.write3BitDouble(e.ucsYAxis),this._writer.writeBitDouble(e.ucsElevation),this._writer.writeBitShort(e.ucsOrthographicType))),this._writer.handleReferenceTyped(w.SoftPointer,this._document.views),this.R2007Plus&&(this._writer.writeBit(e.isPlottable),this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardOwnership,0)),this.R2000Plus&&e.isUcsAssociated&&(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0)),this.R2007Plus&&this._writer.handleReferenceTyped(w.SoftPointer,0),this.registerObject(e)}writeDimensionStyle(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this.R13_14Only&&(this._writer.writeBit(e.generateTolerances),this._writer.writeBit(e.limitsGeneration),this._writer.writeBit(e.textOutsideHorizontal),this._writer.writeBit(e.suppressFirstExtensionLine),this._writer.writeBit(e.suppressSecondExtensionLine),this._writer.writeBit(e.textInsideHorizontal),this._writer.writeBit(e.alternateUnitDimensioning),this._writer.writeBit(e.textOutsideExtensions),this._writer.writeBit(e.separateArrowBlocks),this._writer.writeBit(e.textInsideExtensions),this._writer.writeBit(e.suppressOutsideExtensions),this._writer.writeByte(e.alternateUnitDecimalPlaces),this._writer.writeByte(e.zeroHandling),this._writer.writeBit(e.suppressFirstDimensionLine),this._writer.writeBit(e.suppressSecondDimensionLine),this._writer.writeByte(e.toleranceAlignment),this._writer.writeByte(e.textHorizontalAlignment),this._writer.writeByte(e.dimensionFit),this._writer.writeBit(e.cursorUpdate),this._writer.writeByte(e.toleranceZeroHandling),this._writer.writeByte(e.alternateUnitZeroHandling),this._writer.writeByte(e.alternateUnitToleranceZeroHandling),this._writer.writeByte(e.textVerticalAlignment),this._writer.writeBitShort(e.dimensionUnit),this._writer.writeBitShort(e.angularUnit),this._writer.writeBitShort(e.decimalPlaces),this._writer.writeBitShort(e.toleranceDecimalPlaces),this._writer.writeBitShort(e.alternateUnitFormat),this._writer.writeBitShort(e.alternateUnitToleranceDecimalPlaces),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBitDouble(e.arrowSize),this._writer.writeBitDouble(e.extensionLineOffset),this._writer.writeBitDouble(e.dimensionLineIncrement),this._writer.writeBitDouble(e.extensionLineExtension),this._writer.writeBitDouble(e.rounding),this._writer.writeBitDouble(e.dimensionLineExtension),this._writer.writeBitDouble(e.plusTolerance),this._writer.writeBitDouble(e.minusTolerance),this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.centerMarkSize),this._writer.writeBitDouble(e.tickSize),this._writer.writeBitDouble(e.alternateUnitScaleFactor),this._writer.writeBitDouble(e.linearScaleFactor),this._writer.writeBitDouble(e.textVerticalPosition),this._writer.writeBitDouble(e.toleranceScaleFactor),this._writer.writeBitDouble(e.dimensionLineGap),this._writer.writeVariableText(e.postFix),this._writer.writeVariableText(e.alternateDimensioningSuffix),this._writer.writeVariableText(e.arrowBlock?.name??""),this._writer.writeVariableText(e.dimArrow1?.name??""),this._writer.writeVariableText(e.dimArrow2?.name??""),this._writer.writeCmColor(e.dimensionLineColor),this._writer.writeCmColor(e.extensionLineColor),this._writer.writeCmColor(e.textColor)),this.R2000Plus&&(this._writer.writeVariableText(e.postFix),this._writer.writeVariableText(e.alternateDimensioningSuffix),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBitDouble(e.arrowSize),this._writer.writeBitDouble(e.extensionLineOffset),this._writer.writeBitDouble(e.dimensionLineIncrement),this._writer.writeBitDouble(e.extensionLineExtension),this._writer.writeBitDouble(e.rounding),this._writer.writeBitDouble(e.dimensionLineExtension),this._writer.writeBitDouble(e.plusTolerance),this._writer.writeBitDouble(e.minusTolerance)),this.R2007Plus&&(this._writer.writeBitDouble(e.fixedExtensionLineLength),this._writer.writeBitDouble(e.joggedRadiusDimensionTransverseSegmentAngle),this._writer.writeBitShort(e.textBackgroundFillMode),this._writer.writeCmColor(e.textBackgroundColor)),this.R2000Plus&&(this._writer.writeBit(e.generateTolerances),this._writer.writeBit(e.limitsGeneration),this._writer.writeBit(e.textInsideHorizontal),this._writer.writeBit(e.textOutsideHorizontal),this._writer.writeBit(e.suppressFirstExtensionLine),this._writer.writeBit(e.suppressSecondExtensionLine),this._writer.writeBitShort(e.textVerticalAlignment),this._writer.writeBitShort(e.zeroHandling),this._writer.writeBitShort(e.angularZeroHandling)),this.R2007Plus&&this._writer.writeBitShort(e.arcLengthSymbolPosition),this.R2000Plus&&(this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.centerMarkSize),this._writer.writeBitDouble(e.tickSize),this._writer.writeBitDouble(e.alternateUnitScaleFactor),this._writer.writeBitDouble(e.linearScaleFactor),this._writer.writeBitDouble(e.textVerticalPosition),this._writer.writeBitDouble(e.toleranceScaleFactor),this._writer.writeBitDouble(e.dimensionLineGap),this._writer.writeBitDouble(e.alternateUnitRounding),this._writer.writeBit(e.alternateUnitDimensioning),this._writer.writeBitShort(e.alternateUnitDecimalPlaces),this._writer.writeBit(e.textOutsideExtensions),this._writer.writeBit(e.separateArrowBlocks),this._writer.writeBit(e.textInsideExtensions),this._writer.writeBit(e.suppressOutsideExtensions),this._writer.writeCmColor(e.dimensionLineColor),this._writer.writeCmColor(e.extensionLineColor),this._writer.writeCmColor(e.textColor),this._writer.writeBitShort(e.angularDecimalPlaces),this._writer.writeBitShort(e.decimalPlaces),this._writer.writeBitShort(e.toleranceDecimalPlaces),this._writer.writeBitShort(e.alternateUnitFormat),this._writer.writeBitShort(e.alternateUnitToleranceDecimalPlaces),this._writer.writeBitShort(e.angularUnit),this._writer.writeBitShort(e.fractionFormat),this._writer.writeBitShort(e.linearUnitFormat),this._writer.writeBitShort(e.decimalSeparator.charCodeAt(0)),this._writer.writeBitShort(e.textMovement),this._writer.writeBitShort(e.textHorizontalAlignment),this._writer.writeBit(e.suppressFirstDimensionLine),this._writer.writeBit(e.suppressSecondDimensionLine),this._writer.writeBitShort(e.toleranceAlignment),this._writer.writeBitShort(e.toleranceZeroHandling),this._writer.writeBitShort(e.alternateUnitZeroHandling),this._writer.writeBitShort(e.alternateUnitToleranceZeroHandling),this._writer.writeBit(e.cursorUpdate),this._writer.writeBitShort(3)),this.R2007Plus&&this._writer.writeBit(e.isExtensionLineLengthFixed),this.R2010Plus&&(this._writer.writeBit(e.textDirection===_i.RightToLeft),this._writer.writeBitDouble(e.altMzf),this._writer.writeVariableText(e.altMzs),this._writer.writeBitDouble(e.mzf),this._writer.writeVariableText(e.mzs)),this.R2000Plus&&(this._writer.writeBitShort(e.dimensionLineWeight),this._writer.writeBitShort(e.extensionLineWeight)),this._writer.writeBit(!1),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.style),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,e.leaderArrow),this._writer.handleReferenceTyped(w.HardPointer,e.arrowBlock),this._writer.handleReferenceTyped(w.HardPointer,e.dimArrow1),this._writer.handleReferenceTyped(w.HardPointer,e.dimArrow2)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,e.lineType),this._writer.handleReferenceTyped(w.HardPointer,e.lineTypeExt1),this._writer.handleReferenceTyped(w.HardPointer,e.lineTypeExt2)),this.registerObject(e)}writeVPort(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBitDouble(e.viewHeight),this._writer.writeBitDouble(e.aspectRatio*e.viewHeight),this._writer.write2RawDouble(e.center),this._writer.write3BitDouble(e.target),this._writer.write3BitDouble(e.direction),this._writer.writeBitDouble(e.twistAngle),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClippingPlane),this._writer.writeBitDouble(e.backClippingPlane),this._writer.writeBit((e.viewMode&se.PerspectiveView)!==0),this._writer.writeBit((e.viewMode&se.FrontClipping)!==0),this._writer.writeBit((e.viewMode&se.BackClipping)!==0),this._writer.writeBit((e.viewMode&se.FrontClippingZ)!==0),this.R2000Plus&&this._writer.writeByte(e.renderMode),this.R2007Plus&&(this._writer.writeBit(e.useDefaultLighting),this._writer.writeByte(e.defaultLighting),this._writer.writeBitDouble(e.brightness),this._writer.writeBitDouble(e.contrast),this._writer.writeCmColor(e.ambientColor)),this._writer.write2RawDouble(e.bottomLeft),this._writer.write2RawDouble(e.topRight),this._writer.writeBit((e.viewMode&se.Follow)!==0),this._writer.writeBitShort(e.circleZoomPercent),this._writer.writeBit(!0),this._writer.writeBit((e.ucsIconDisplay&vr.OnLower)!==0),this._writer.writeBit((e.ucsIconDisplay&vr.OnOrigin)!==0),this._writer.writeBit(e.showGrid),this._writer.write2RawDouble(e.gridSpacing),this._writer.writeBit(e.snapOn),this._writer.writeBit(e.isometricSnap),this._writer.writeBitShort(e.snapIsoPair),this._writer.writeBitDouble(e.snapRotation),this._writer.write2RawDouble(e.snapBasePoint),this._writer.write2RawDouble(e.snapSpacing),this.R2000Plus&&(this._writer.writeBit(!1),this._writer.writeBit(!0),this._writer.write3BitDouble(e.origin),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.orthographicType)),this.R2007Plus&&(this._writer.writeBitShort(e.gridFlags),this._writer.writeBitShort(e.minorGridLinesPerMajorGridLine)),this._writer.handleReferenceTyped(w.HardPointer,0),this.R2007Plus&&(this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0)),this.R2000Plus&&(e.orthographicType===Mt.None?(this._writer.handleReferenceTyped(w.HardPointer,e.namedUcs),this._writer.handleReferenceTyped(w.HardPointer,0)):(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.baseUcs))),this.registerObject(e)}registerObject(e){this._writer.writeSpearShift(),this._msmainPos=Math.ceil(this._writer.main.positionInBits/8),this.ensureStreamCapacity(this._streamPos+this._msmainPos+64);let t=this._streamPos,i=new wr(this._stream.subarray(this._streamPos),49345),s=this._msmainPos,n=(this._msmainPos<<3)-this._writer.savedPositionInBits;this.writeSize(i,s),this.R2010Plus&&this.writeSizeInBits(i,n),i.Write(new Uint8Array(this._writer.main.stream).subarray(0,this._msmainPos),0,this._msmainPos);let a=new Uint8Array(2);new DataView(a.buffer).setUint16(0,i.Seed,!0),this._stream.set(a,this._streamPos+i.Position),this._streamPos+=i.Position+2,this.Map.set(e.handle,t)}writeSize(e,t){if(t>=32768){let i=new Uint8Array(4);i[0]=t&255,i[1]=t>>8&127|128,i[2]=t>>15&255,i[3]=t>>23&255,e.Write(i,0,4)}else{let i=new Uint8Array(2);i[0]=t&255,i[1]=t>>8&255,e.Write(i,0,2)}}writeSizeInBits(e,t){if(t===0){e.Write(new Uint8Array([0]),0,1);return}let i=t,s=i>>>7;for(;i!==0;){let n=i&127;s!==0&&(n=n|128),e.Write(new Uint8Array([n]),0,1),i=s,s=i>>>7}}writeXrefDependantBit(e){this.R2007Plus?this._writer.writeBitShort((e.flags&Vt.XrefDependent)!==0?256:0):(this._writer.writeBit((e.flags&Vt.Referenced)!==0),this._writer.writeBitShort(0),this._writer.writeBit((e.flags&Vt.XrefDependent)!==0))}writeCommonData(e){switch(this._writer.resetStream(),this._msmainPos=0,e.objectType){case u.LAYOUT:if(this.R2004Pre){if(this._document.classes.tryGetByName(e.objectName)){let t=this._document.classes.getByName(e.objectName);this._writer.writeObjectType(t.ClassNumber)}else{this.notify(`Dxf Class not found for ${e.objectType} fullname: ${e.constructor.name}`,g.Warning);return}break}this._writer.writeObjectType(e.objectType);break;case u.UNLISTED:if(this._document.classes.tryGetByName(e.objectName)){let t=this._document.classes.getByName(e.objectName);this._writer.writeObjectType(t.ClassNumber)}else{this.notify(`Dxf Class not found for ${e.objectType} fullname: ${e.constructor.name}`,g.Warning);return}break;case u.INVALID:case u.UNDEFINED:this.notify(`CadObject type: ${e.objectType} fullname: ${e.constructor.name}`,g.NotImplemented);return;default:this._writer.writeObjectType(e.objectType);break}this._version>=m.AC1015&&this._version<m.AC1024&&this._writer.savePositonForSize(),this._writer.main.handleReference(e),this.writeExtendedData(e.extendedData)}writeCommonNonEntityData(e){this.writeCommonData(e),this.R13_14Only&&this._writer.savePositonForSize(),this._writer.handleReferenceTyped(w.SoftPointer,e.owner.handle),this.writeReactorsAndDictionaryHandle(e)}writeCommonEntityData(e){this.writeCommonData(e),this._writer.writeBit(!1),this._version>=m.AC1012&&this._version<=m.AC1014&&this._writer.savePositonForSize(),this.writeEntityMode(e)}writeEntityMode(e){let t=this.getEntMode(e);if(this._writer.write2Bits(t),t===0&&this._writer.handleReferenceTyped(w.SoftPointer,e.owner),this.writeReactorsAndDictionaryHandle(e),this.R13_14Only){this._writer.handleReferenceTyped(w.HardPointer,e.layer);let i=e.lineType.name===H.ByLayerName;this._writer.writeBit(i),i&&this._writer.handleReferenceTyped(w.HardPointer,e.lineType)}if(!this.R2004Plus){let i=this._prev!=null&&this._prev.handle===e.handle-1&&this._next!=null&&this._next.handle===e.handle+1;this._writer.writeBit(i),i||(this._writer.handleReferenceTyped(w.SoftPointer,this._prev),this._writer.handleReferenceTyped(w.SoftPointer,this._next))}if(this._writer.writeEnColor(e.color,e.transparency),this._version>=m.AC1018&&e.bookColor!=null&&this._writer.handleReferenceTyped(w.HardPointer,e.bookColor),this._writer.writeBitDouble(e.lineTypeScale),!(this._version>=m.AC1015)){this._writer.writeBitShort(e.isInvisible?0:1);return}this._writer.handleReferenceTyped(w.HardPointer,e.layer),e.lineType.name===H.ByLayerName?this._writer.write2Bits(0):e.lineType.name===H.ByBlockName?this._writer.write2Bits(1):e.lineType.name===H.ContinuousName?this._writer.write2Bits(2):(this._writer.write2Bits(3),this._writer.handleReferenceTyped(w.HardPointer,e.lineType)),this.R2007Plus&&(this._writer.write2Bits(0),this._writer.writeByte(0)),this._writer.write2Bits(0),this._version>m.AC1021&&(this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.writeBitShort(e.isInvisible?1:0),this._writer.writeByte(Z.toIndex(e.lineWeight))}writeExtendedData(e){if(this.WriteXData)for(let[t,i]of e)this.writeExtendedDataEntry(t,i);this._writer.writeBitShort(0)}writeExtendedDataEntry(e,t){let i=[];for(let s of t.records)if(i.push(s.code-1e3),s instanceof Fi){i.push(s.value.length);for(let n=0;n<s.value.length;n++)i.push(s.value[n])}else if(s instanceof Pe)i.push(s.value==="}"?1:0);else if(s instanceof Yi){let n=new ArrayBuffer(2);new DataView(n).setInt16(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<2;o++)i.push(a[o])}else if(s instanceof Xi){let n=new ArrayBuffer(4);new DataView(n).setInt32(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<4;o++)i.push(a[o])}else if(s instanceof Zi||s instanceof zi||s instanceof vi){let n=new ArrayBuffer(8);new DataView(n).setFloat64(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<8;o++)i.push(a[o])}else if(s instanceof $i||s instanceof Ui||s instanceof Gi||s instanceof Ki){let n=new ArrayBuffer(24),a=new DataView(n);a.setFloat64(0,s.value.x,!0),a.setFloat64(8,s.value.y,!0),a.setFloat64(16,s.value.z,!0);let o=new Uint8Array(n);for(let h=0;h<24;h++)i.push(o[h])}else if("ResolveReference"in s&&"Value"in s){let n=s,a=n.Value;n.ResolveReference(this._document)==null&&(a=0);let o=new ArrayBuffer(8);new DataView(o).setFloat64(0,a,!1);let h=new Uint8Array(o);for(let f=0;f<8;f++)i.push(h[f])}else if(s instanceof Hi)if(this.R2007Plus){let n=s.value.length+1,a=new ArrayBuffer(2);new DataView(a).setUint16(0,n,!0);let o=new Uint8Array(a);i.push(o[0],o[1]);let h=this.encodeUtf16LE(s.value);for(let f=0;f<h.length;f++)i.push(h[f]);i.push(0,0)}else{let n=Z.getCodeIndex(Z.getCodePage(this._writer.encoding)),a=this.encodeText(s.value||""),o=new ArrayBuffer(2);new DataView(o).setUint16(0,s.value.length,!0);let h=new Uint8Array(o);i.push(h[0],h[1]),i.push(n);for(let f=0;f<a.length;f++)i.push(a[f])}else throw new Error(`ExtendedDataRecord of type ${s.constructor.name} not supported.`);this._writer.writeBitShort(i.length),this._writer.main.handleReferenceTyped(w.HardPointer,e.handle),this._writer.writeBytesOffset(new Uint8Array(i),0,i.length)}writeReactorsAndDictionaryHandle(e){e.cleanReactors(),this._writer.writeBitLong(e.reactors.length);for(let i of e.reactors)this._writer.handleReferenceTyped(w.SoftPointer,i);let t=e.xDictionary==null;this.R2004Plus?(this._writer.writeBit(t),t||this._writer.handleReferenceTyped(w.HardOwnership,e.xDictionary)):this._writer.handleReferenceTyped(w.HardOwnership,e.xDictionary),this.R2013Plus&&this._writer.writeBit(!1),t||(this._dictionaries.set(e.xDictionary.handle,e.xDictionary),this._objects.push(e.xDictionary))}getEntMode(e){return e.owner==null?0:e.owner.handle===this._document.paperSpace.handle?1:e.owner.handle===this._document.modelSpace.handle?2:0}writeEntity(e){let t=[],i=null;if(this.writeCommonEntityData(e),e instanceof Ft)this.writeArc(e);else if(e instanceof dt)this.writeCircle(e);else if(e instanceof me)if(this.writeCommonDimensionData(e),e instanceof Qe)this.writeDimensionLinear(e);else if(e instanceof je)this.writeDimensionAligned(e);else if(e instanceof Rt)this.writeDimensionRadius(e);else if(e instanceof St)this.writeDimensionAngular2Line(e);else if(e instanceof Ct)this.writeDimensionAngular3Pt(e);else if(e instanceof Bt)this.writeDimensionDiameter(e);else if(e instanceof yt)this.writeDimensionOrdinate(e);else throw new Error(`Dimension not implemented : ${e.constructor.name}`);else if(e instanceof Ut)this.writeEllipse(e);else if(e instanceof Ee)this.writeInsert(e),t.push(...e.attributes),i=e.attributes.Seqend;else if(e instanceof Yr)this.writeFace3D(e);else if(e instanceof Tt)this.writeHatch(e);else if(e instanceof nr)this.writeLeader(e);else if(e instanceof zt)this.writeLine(e);else if(e instanceof qr)this.writeLwPolyline(e);else if(e instanceof ar)this.writeMesh(e);else if(e instanceof or)this.writeMLine(e);else if(e instanceof Ne)this.writeMText(e);else if(e instanceof lr)this.writeMultiLeader(e);else if(e instanceof dr)this.writeOle2Frame(e);else if(e instanceof Qr)this.writePdfUnderlay(e);else if(e instanceof Gt)this.writePoint(e);else if(e instanceof ut)this.writePolyfaceMesh(e),t.push(...e.faces,...e.vertices),i=e.vertices.Seqend;else if(e instanceof et)this.writePolyline2D(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof tt)this.writePolyline3D(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof Et)this.writePolygonMesh(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof ei)this.writeRay(e);else if(e instanceof ur)this.writeShape(e);else if(e instanceof $t)this.writeSolid(e);else if(e instanceof ti)this.writeSolid3D(e);else if(e instanceof mr)this.writeSpline(e);else if(e instanceof Ss)this.writeCadImage(e);else if(e instanceof Dt)this.writeAttribute(e);else if(e instanceof es)this.writeAttDefinition(e);else if(e instanceof Je)this.writeTextEntity(e);else if(e instanceof Yt)this.writeTolerance(e);else if(e instanceof Xt)this.writeVertex2D(e);else if(e instanceof Zt)this.writeFaceRecord(e);else if(e instanceof cr||e instanceof ri||e instanceof ss)this.writeVertex(e);else if(e instanceof fr)this.writeViewport(e);else if(e instanceof ii)this.writeXLine(e);else throw new Error(`Entity not implemented : ${e.constructor.name}`);this.registerObject(e),this.writeChildEntities(t,i)}writePdfUnderlay(e){this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.insertPoint),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.xScale),this._writer.writeBitDouble(e.yScale),this._writer.writeBitDouble(e.zScale),this._writer.writeByte(e.flags),this._writer.writeByte(e.contrast),this._writer.writeByte(e.fade),this._writer.handleReferenceTyped(w.HardPointer,e.definition),this._writer.writeBitLong(e.clipBoundaryVertices.length);for(let t of e.clipBoundaryVertices)this._writer.write2RawDouble(t)}writeArc(e){this.writeCircle(e),this._writer.writeBitDouble(e.startAngle),this._writer.writeBitDouble(e.endAngle)}writeAttribute(e){this.writeCommonAttData(e)}writeAttDefinition(e){this.writeCommonAttData(e),this.R2010Plus&&this._writer.writeByte(e.version),this._writer.writeVariableText(e.prompt)}writeCommonAttData(e){this.writeTextEntity(e),this.R2010Plus&&this._writer.writeByte(e.version),this.R2018Plus&&(this._writer.writeByte(e.attributeType),(e.attributeType===Gr.MultiLine||e.attributeType===Gr.ConstantMultiLine)&&(this.writeEntityMode(e.mText),this.writeMText(e.mText),this._writer.writeBitShort(0))),this._writer.writeVariableText(e.tag),this._writer.writeBitShort(0),this._writer.writeByte(e.flags),this.R2007Plus&&this._writer.writeBit(e.isReallyLocked)}writeCircle(e){this._writer.write3BitDouble(e.center),this._writer.writeBitDouble(e.radius),this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal)}writeCommonDimensionData(e){this.R2010Plus&&this._writer.writeByte(e.version),this._writer.write3BitDouble(e.normal),this._writer.write2RawDouble(new C(e.textMiddlePoint.x,e.textMiddlePoint.y)),this._writer.writeBitDouble(e.insertionPoint.z);let t=0;t|=e.isTextUserDefinedLocation?0:1,this._writer.writeByte(t),this._writer.writeVariableText(e.text),this._writer.writeBitDouble(e.textRotation),this._writer.writeBitDouble(e.horizontalDirection),this._writer.write3BitDouble(new c(1,1,1)),this._writer.writeBitDouble(0),this.R2000Plus&&(this._writer.writeBitShort(e.attachmentPoint),this._writer.writeBitShort(e.lineSpacingStyle),this._writer.writeBitDouble(e.lineSpacingFactor),this._writer.writeBitDouble(e.measurement)),this.R2007Plus&&(this._writer.writeBit(!1),this._writer.writeBit(e.flipArrow1),this._writer.writeBit(e.flipArrow2)),this._writer.write2RawDouble(new C(e.insertionPoint.x,e.insertionPoint.y)),this._writer.handleReferenceTyped(w.HardPointer,e.style),this._writer.handleReferenceTyped(w.HardPointer,e.block)}writeDimensionLinear(e){this.writeDimensionAligned(e),this._writer.writeBitDouble(e.rotation)}writeDimensionAligned(e){this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.definitionPoint),this._writer.writeBitDouble(e.extLineRotation)}writeDimensionRadius(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.writeBitDouble(e.leaderLength)}writeDimensionAngular2Line(e){this._writer.write2RawDouble(new C(e.dimensionArc.x,e.dimensionArc.y)),this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.write3BitDouble(e.definitionPoint)}writeDimensionAngular3Pt(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.angleVertex)}writeDimensionDiameter(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.writeBitDouble(e.leaderLength)}writeDimensionOrdinate(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.featureLocation),this._writer.write3BitDouble(e.leaderEndpoint),this._writer.writeByte(e.isOrdinateTypeX?1:0)}writeEllipse(e){this._writer.write3BitDouble(e.center),this._writer.write3BitDouble(e.majorAxisEndPoint),this._writer.write3BitDouble(e.normal),this._writer.writeBitDouble(e.radiusRatio),this._writer.writeBitDouble(e.startParameter),this._writer.writeBitDouble(e.endParameter)}writeInsert(e){if(this._writer.write3BitDouble(e.insertPoint),this.R13_14Only&&(this._writer.writeBitDouble(e.xScale),this._writer.writeBitDouble(e.yScale),this._writer.writeBitDouble(e.zScale)),this.R2000Plus&&(e.xScale===1&&e.yScale===1&&e.zScale===1?this._writer.write2Bits(3):e.xScale===e.yScale&&e.xScale===e.zScale?(this._writer.write2Bits(2),this._writer.writeRawDouble(e.xScale)):e.xScale===1?(this._writer.write2Bits(1),this._writer.writeBitDoubleWithDefault(e.yScale,1),this._writer.writeBitDoubleWithDefault(e.zScale,1)):(this._writer.write2Bits(0),this._writer.writeRawDouble(e.xScale),this._writer.writeBitDoubleWithDefault(e.yScale,e.xScale),this._writer.writeBitDoubleWithDefault(e.zScale,e.xScale))),this._writer.writeBitDouble(e.rotation),this._writer.write3BitDouble(e.normal),this._writer.writeBit(e.hasAttributes),this.R2004Plus&&e.hasAttributes&&this._writer.writeBitLong(e.attributes.length),e.isMultiple&&(this._writer.writeBitShort(e.columnCount),this._writer.writeBitShort(e.rowCount),this._writer.writeBitDouble(e.columnSpacing),this._writer.writeBitDouble(e.rowSpacing)),this._writer.handleReferenceTyped(w.HardPointer,e.block),!!e.hasAttributes){if(this._version>=m.AC1012&&this._version<=m.AC1015)this._writer.handleReferenceTyped(w.SoftPointer,e.attributes[0]),this._writer.handleReferenceTyped(w.SoftPointer,e.attributes[e.attributes.length-1]);else if(this.R2004Plus)for(let t of e.attributes)this._writer.handleReferenceTyped(w.HardOwnership,t);this._writer.handleReferenceTyped(w.HardOwnership,e.attributes.Seqend)}}writeFace3D(e){if(this.R13_14Only&&(this._writer.write3BitDouble(e.firstCorner),this._writer.write3BitDouble(e.secondCorner),this._writer.write3BitDouble(e.thirdCorner),this._writer.write3BitDouble(e.fourthCorner),this._writer.writeBitShort(e.flags)),this.R2000Plus){let t=e.flags===nn.None;this._writer.writeBit(t);let i=e.firstCorner.z===0;this._writer.writeBit(i),this._writer.writeRawDouble(e.firstCorner.x),this._writer.writeRawDouble(e.firstCorner.y),i||this._writer.writeRawDouble(e.firstCorner.z),this._writer.write3BitDoubleWithDefault(e.secondCorner,e.firstCorner),this._writer.write3BitDoubleWithDefault(e.thirdCorner,e.secondCorner),this._writer.write3BitDoubleWithDefault(e.fourthCorner,e.thirdCorner),t||this._writer.writeBitShort(e.flags)}}writeMesh(e){this._writer.writeBitShort(e.version),this._writer.writeBit(e.blendCrease!==0),this._writer.writeBitLong(e.subdivisionLevel),this._writer.writeBitLong(e.vertices.length);for(let i of e.vertices)this._writer.write3BitDouble(i);let t=e.faces.reduce((i,s)=>i+1+s.length,0);this._writer.writeBitLong(t);for(let i of e.faces){this._writer.writeBitLong(i.length);for(let s of i)this._writer.writeBitLong(s)}this._writer.writeBitLong(e.edges.length);for(let i of e.edges)this._writer.writeBitLong(i.start),this._writer.writeBitLong(i.end);this._writer.writeBitLong(e.edges.length);for(let i of e.edges)this._writer.writeBitDouble(i.crease??0);this._writer.writeBitLong(0)}writeMLine(e){this._writer.writeBitDouble(e.scaleFactor),this._writer.writeByte(e.justification),this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.normal),this._writer.writeBitShort((e.flags&Bi.Closed)!==0?3:1);let t=0;e.vertices.length>0&&(t=e.vertices[0].segments.length),this._writer.writeByte(t),this._writer.writeBitShort(e.vertices.length);for(let i of e.vertices){this._writer.write3BitDouble(i.position),this._writer.write3BitDouble(i.direction),this._writer.write3BitDouble(i.miter);for(let s=0;s<t;s++){let n=i.segments[s];this._writer.writeBitShort(n.parameters.length);for(let a of n.parameters)this._writer.writeBitDouble(a);this._writer.writeBitShort(n.areaFillParameters.length);for(let a of n.areaFillParameters)this._writer.writeBitDouble(a)}}this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeLwPolyline(e){let t=!1,i=!1;for(let n of e.vertices)!t&&n.bulge!==0&&(t=!0),!i&&(n.startWidth!==0||n.endWidth!==0)&&(i=!0);let s=0;if((e.flags&At.Plinegen)!==0&&(s|=256),(e.flags&At.Closed)!==0&&(s|=512),e.constantWidth!==0&&(s|=4),e.elevation!==0&&(s|=8),e.thickness!==0&&(s|=2),c.equals(e.normal,c.AxisZ)||(s|=1),t&&(s|=16),i&&(s|=32),this._writer.writeBitShort(s),e.constantWidth!==0&&this._writer.writeBitDouble(e.constantWidth),e.elevation!==0&&this._writer.writeBitDouble(e.elevation),e.thickness!==0&&this._writer.writeBitDouble(e.thickness),c.equals(e.normal,c.AxisZ)||this._writer.write3BitDouble(e.normal),this._writer.writeBitLong(e.vertices.length),t&&this._writer.writeBitLong(e.vertices.length),i&&this._writer.writeBitLong(e.vertices.length),this.R13_14Only)for(let n of e.vertices)this._writer.write2RawDouble(n.location);if(this.R2000Plus&&e.vertices.length>0){let n=e.vertices[0];this._writer.write2RawDouble(n.location);for(let a=1;a<e.vertices.length;a++){let o=e.vertices[a];this._writer.write2BitDoubleWithDefault(o.location,n.location),n=o}}if(t)for(let n of e.vertices)this._writer.writeBitDouble(n.bulge);if(i)for(let n of e.vertices)this._writer.writeBitDouble(n.startWidth),this._writer.writeBitDouble(n.endWidth)}writeHatch(e){if(this.R2004Plus){let i=e.gradientColor;this._writer.writeBitLong(i.enabled?1:0),this._writer.writeBitLong(i.reserved),this._writer.writeBitDouble(i.angle),this._writer.writeBitDouble(i.shift),this._writer.writeBitLong(i.isSingleColorGradient?1:0),this._writer.writeBitDouble(i.colorTint),this._writer.writeBitLong(i.colors.length);for(let s of i.colors)this._writer.writeBitDouble(s.value),this._writer.writeCmColor(s.color);this._writer.writeVariableText(i.name)}this._writer.writeBitDouble(e.elevation),this._writer.write3BitDouble(e.normal),this._writer.writeVariableText(e.pattern.name),this._writer.writeBit(e.isSolid),this._writer.writeBit(e.isAssociative),this._writer.writeBitLong(e.paths.length);let t=!1;for(let i of e.paths){if(this._writer.writeBitLong(i.flags),(i.flags&qe.Derived)!==0&&(t=!0),(i.flags&qe.Polyline)!==0){let s=i.edges[0];this._writer.writeBit(s.hasBulge),this._writer.writeBit(s.isClosed),this._writer.writeBitLong(s.vertices.length);for(let n of s.vertices)this._writer.write2RawDouble(new C(n.X,n.Y)),s.hasBulge&&this._writer.writeBitDouble(n.Z)}else{this._writer.writeBitLong(i.edges.length);for(let s of i.edges)if(this._writer.writeByte(s.type),s instanceof Kr)this._writer.write2RawDouble(s.start),this._writer.write2RawDouble(s.end);else if(s instanceof Xr)this._writer.write2RawDouble(s.center),this._writer.writeBitDouble(s.radius),this._writer.writeBitDouble(s.startAngle),this._writer.writeBitDouble(s.endAngle),this._writer.writeBit(s.counterClockWise);else if(s instanceof Zr)this._writer.write2RawDouble(s.center),this._writer.write2RawDouble(s.majorAxisEndPoint),this._writer.writeBitDouble(s.minorToMajorRatio),this._writer.writeBitDouble(s.startAngle),this._writer.writeBitDouble(s.endAngle),this._writer.writeBit(s.counterClockWise);else if(s instanceof Jr){this._writer.writeBitLong(s.degree),this._writer.writeBit(s.isRational),this._writer.writeBit(s.isPeriodic),this._writer.writeBitLong(s.knots.length),this._writer.writeBitLong(s.controlPoints.length);for(let n of s.knots)this._writer.writeBitDouble(n);for(let n=0;n<s.controlPoints.length;++n)this._writer.write2RawDouble(new C(s.controlPoints[n].X,s.controlPoints[n].Y)),s.isRational&&this._writer.writeBitDouble(s.controlPoints[n].Z);if(this.R2010Plus&&(this._writer.writeBitLong(s.fitPoints.length),s.fitPoints.length>0)){for(let n of s.fitPoints)this._writer.write2RawDouble(n);this._writer.write2RawDouble(s.startTangent),this._writer.write2RawDouble(s.endTangent)}}else throw new Error(`Unrecognized Boundary type: ${s.constructor.name}`)}this._writer.writeBitLong(i.entities.length);for(let s of i.entities)this._writer.handleReferenceTyped(w.SoftPointer,s)}if(this._writer.writeBitShort(e.style),this._writer.writeBitShort(e.patternType),!e.isSolid){let i=e.pattern;this._writer.writeBitDouble(e.patternAngle),this._writer.writeBitDouble(e.patternScale),this._writer.writeBit(e.isDouble),this._writer.writeBitShort(i.lines.length);for(let s of i.lines){this._writer.writeBitDouble(s.angle),this._writer.write2BitDouble(s.basePoint),this._writer.write2BitDouble(s.offset),this._writer.writeBitShort(s.dashLengths.length);for(let n of s.dashLengths)this._writer.writeBitDouble(n)}}t&&this._writer.writeBitDouble(e.pixelSize),this._writer.writeBitLong(e.seedPoints.length);for(let i of e.seedPoints)this._writer.write2RawDouble(i)}writeLeader(e){this._writer.writeBit(!1),this._writer.writeBitShort(e.creationType),this._writer.writeBitShort(e.pathType),this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.write3BitDouble(t);this._writer.write3BitDouble(e.vertices.length>0?e.vertices[0]:c.Zero),this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.horizontalDirection),this._writer.write3BitDouble(e.blockOffset),this._version>=m.AC1014&&this._writer.write3BitDouble(e.annotationOffset),this.R13_14Only&&this._writer.writeBitDouble(e.style.dimensionLineGap),this._version<=m.AC1021&&(this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.textWidth)),this._writer.writeBit(e.hookLineDirection===Di.Same),this._writer.writeBit(e.arrowHeadEnabled),this.R13_14Only&&(this._writer.writeBitShort(0),this._writer.writeBitDouble(e.style.arrowSize*e.style.scaleFactor),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBitShort(0),this._writer.writeBitShort(0),this._writer.writeBit(!1),this._writer.writeBit(!1)),this.R2000Plus&&(this._writer.writeBitShort(0),this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeOle2Frame(e){this._writer.writeBitShort(e.version),this.R2000Plus&&this._writer.writeBitShort(0),this._writer.writeBitLong(e.binaryData.length),this._writer.writeBytes(e.binaryData),this.R2000Plus&&this._writer.writeByte(3)}writeMultiLeader(e){this.R2010Plus&&this._writer.writeBitShort(2),this.writeMultiLeaderAnnotContextSubObject(!0,e.contextData),this._writer.handleReferenceTyped(w.HardPointer,e.style),this._writer.writeBitLong(e.propertyOverrideFlags),this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.leaderLineType),this._writer.writeBitLong(e.leaderLineWeight),this._writer.writeBit(e.enableLanding),this._writer.writeBit(e.enableDogleg),this._writer.writeBitDouble(e.landingDistance),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitDouble(e.arrowheadSize),this._writer.writeBitShort(e.contentType),this._writer.handleReferenceTyped(w.HardPointer,e.textStyle),this._writer.writeBitShort(e.textLeftAttachment),this._writer.writeBitShort(e.textRightAttachment),this._writer.writeBitShort(e.textAngle),this._writer.writeBitShort(e.textAlignment),this._writer.writeCmColor(e.textColor),this._writer.writeBit(e.textFrame),this._writer.handleReferenceTyped(w.HardPointer,e.blockContentId),this._writer.writeCmColor(e.blockContentColor),this._writer.write3BitDouble(e.blockContentScale),this._writer.writeBitDouble(e.blockContentRotation),this._writer.writeBitShort(e.blockContentConnection),this._writer.writeBit(e.enableAnnotationScale);let t=e.blockAttributes.length;this._writer.writeBitLong(t);for(let i=0;i<t;i++){let s=e.blockAttributes[i];this._writer.handleReferenceTyped(w.HardPointer,s.attributeDefinition),this._writer.writeVariableText(s.text),this._writer.writeBitShort(s.index),this._writer.writeBitDouble(s.width)}this._writer.writeBit(e.textDirectionNegative),this._writer.writeBitShort(e.textAligninIPE?1:0),this._writer.writeBitShort(e.textAttachmentPoint),this._writer.writeBitDouble(e.scaleFactor),this.R2010Plus&&(this._writer.writeBitShort(e.textAttachmentDirection),this._writer.writeBitShort(e.textBottomAttachment),this._writer.writeBitShort(e.textTopAttachment)),this.R2013Plus&&this._writer.writeBit(e.extendedToText)}writeMultiLeaderAnnotContextSubObject(e,t){let i=t.leaderRoots.length;e?this._writer.writeBitLong(i):(this._writer.writeBitLong(0),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(i===2),this._writer.writeBit(i===1));for(let s=0;s<i;s++)this.writeLeaderRoot(t.leaderRoots[s]);if(this._writer.writeBitDouble(t.scaleFactor),this._writer.write3BitDouble(t.contentBasePoint),this._writer.writeBitDouble(t.textHeight),this._writer.writeBitDouble(t.arrowheadSize),this._writer.writeBitDouble(t.landingGap),this._writer.writeBitShort(t.textLeftAttachment),this._writer.writeBitShort(t.textRightAttachment),this._writer.writeBitShort(t.textAlignment),this._writer.writeBitShort(t.blockContentConnection),this._writer.writeBit(t.hasTextContents),t.hasTextContents){this._writer.writeVariableText(t.textLabel),this._writer.write3BitDouble(t.textNormal),this._writer.handleReferenceTyped(w.HardPointer,t.textStyle),this._writer.write3BitDouble(t.textLocation),this._writer.write3BitDouble(t.direction),this._writer.writeBitDouble(t.textRotation),this._writer.writeBitDouble(t.boundaryWidth),this._writer.writeBitDouble(t.boundaryHeight),this._writer.writeBitDouble(t.lineSpacingFactor),this._writer.writeBitShort(t.lineSpacing),this._writer.writeCmColor(t.textColor),this._writer.writeBitShort(t.textAttachmentPoint),this._writer.writeBitShort(t.flowDirection),this._writer.writeCmColor(t.backgroundFillColor),this._writer.writeBitDouble(t.backgroundScaleFactor),this._writer.writeBitLong(t.backgroundTransparency),this._writer.writeBit(t.backgroundFillEnabled),this._writer.writeBit(t.backgroundMaskFillOn),this._writer.writeBitShort(t.columnType),this._writer.writeBit(t.textHeightAutomatic),this._writer.writeBitDouble(t.columnWidth),this._writer.writeBitDouble(t.columnGutter),this._writer.writeBit(t.columnFlowReversed);let s=t.columnSizes.length;this._writer.writeBitLong(s);for(let n=0;n<s;n++)this._writer.writeBitDouble(t.columnSizes[n]);this._writer.writeBit(t.wordBreak),this._writer.writeBit(!1)}else if(t.hasContentsBlock){this._writer.writeBit(t.hasContentsBlock),this._writer.handleReferenceTyped(w.SoftPointer,t.blockContent),this._writer.write3BitDouble(t.blockContentNormal),this._writer.write3BitDouble(t.blockContentLocation),this._writer.write3BitDouble(t.blockContentScale),this._writer.writeBitDouble(t.blockContentRotation),this._writer.writeCmColor(t.blockContentColor);let s=t.transformationMatrix;this._writer.writeBitDouble(s.M00),this._writer.writeBitDouble(s.M10),this._writer.writeBitDouble(s.M20),this._writer.writeBitDouble(s.M30),this._writer.writeBitDouble(s.M01),this._writer.writeBitDouble(s.M11),this._writer.writeBitDouble(s.M21),this._writer.writeBitDouble(s.M31),this._writer.writeBitDouble(s.M02),this._writer.writeBitDouble(s.M12),this._writer.writeBitDouble(s.M22),this._writer.writeBitDouble(s.M32),this._writer.writeBitDouble(s.M03),this._writer.writeBitDouble(s.M13),this._writer.writeBitDouble(s.M23),this._writer.writeBitDouble(s.M33)}this._writer.write3BitDouble(t.basePoint),this._writer.write3BitDouble(t.baseDirection),this._writer.write3BitDouble(t.baseVertical),this._writer.writeBit(t.normalReversed),this.R2010Plus&&(this._writer.writeBitShort(t.textTopAttachment),this._writer.writeBitShort(t.textBottomAttachment))}writeLeaderRoot(e){this._writer.writeBit(e.contentValid),this._writer.writeBit(!0),this._writer.write3BitDouble(e.connectionPoint),this._writer.write3BitDouble(e.direction),this._writer.writeBitLong(e.breakStartEndPointsPairs.length);for(let t of e.breakStartEndPointsPairs)this._writer.write3BitDouble(t.startPoint),this._writer.write3BitDouble(t.endPoint);this._writer.writeBitLong(e.leaderIndex),this._writer.writeBitDouble(e.landingDistance),this._writer.writeBitLong(e.lines.length);for(let t of e.lines)this.writeLeaderLine(t);this.R2010Plus&&this._writer.writeBitShort(e.textAttachmentDirection)}writeLeaderLine(e){this._writer.writeBitLong(e.points.length);for(let t of e.points)this._writer.write3BitDouble(t);if(this._writer.writeBitLong(e.breakInfoCount),e.breakInfoCount>0){this._writer.writeBitLong(e.segmentIndex),this._writer.writeBitLong(e.startEndPoints.length);for(let t of e.startEndPoints)this._writer.write3BitDouble(t.startPoint),this._writer.write3BitDouble(t.endPoint)}this._writer.writeBitLong(e.index),this.R2010Plus&&(this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.lineType),this._writer.writeBitLong(e.lineWeight),this._writer.writeBitDouble(e.arrowheadSize),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitLong(e.overrideFlags))}writeLine(e){if(this.R13_14Only&&(this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.endPoint)),this.R2000Plus){let t=e.startPoint.z===0&&e.endPoint.z===0;this._writer.writeBit(t),this._writer.writeRawDouble(e.startPoint.x),this._writer.writeBitDoubleWithDefault(e.endPoint.x,e.startPoint.x),this._writer.writeRawDouble(e.startPoint.y),this._writer.writeBitDoubleWithDefault(e.endPoint.y,e.startPoint.y),t||(this._writer.writeRawDouble(e.startPoint.z),this._writer.writeBitDoubleWithDefault(e.endPoint.z,e.startPoint.z))}this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal)}writePoint(e){this._writer.write3BitDouble(e.location),this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal),this._writer.writeBitDouble(e.rotation)}writePolyfaceMesh(e){if(this._writer.writeBitShort(e.vertices.length),this._writer.writeBitShort(e.faces.length),this.R2004Plus){this._writer.writeBitLong(e.vertices.length+e.faces.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.SoftPointer,t);for(let t of e.faces)this._writer.handleReferenceTyped(w.SoftPointer,t)}if(this.R13_15Only){let t=[...e.vertices,...e.faces];this._writer.handleReferenceTyped(w.SoftPointer,t.length>0?t[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,t.length>0?t[t.length-1]:null)}this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.Seqend)}writePolyline2D(e){if(this._writer.writeBitShort(e.flags),this._writer.writeBitShort(e.smoothSurface),this._writer.writeBitDouble(e.startWidth),this._writer.writeBitDouble(e.endWidth),this._writer.writeBitThickness(e.thickness),this._writer.writeBitDouble(e.elevation),this._writer.writeBitExtrusion(e.normal),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writePolyline3D(e){if(this._writer.writeByte(0),this._writer.writeByte((e.flags&Ve.ClosedPolylineOrClosedPolygonMeshInM)!==0?1:0),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writePolygonMesh(e){if(this._writer.writeBitShort(e.flags),this._writer.writeBitShort(e.smoothSurface),this._writer.writeBitShort(e.mVertexCount),this._writer.writeBitShort(e.nVertexCount),this._writer.writeBitShort(e.mSmoothSurfaceDensity),this._writer.writeBitShort(e.nSmoothSurfaceDensity),this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writeSeqend(e){if(e==null)return;let t=this._prev,i=this._next;this._prev=null,this._next=null,this.writeCommonEntityData(e),this.registerObject(e),this._prev=t,this._next=i}writeShape(e){this._writer.write3BitDouble(e.insertionPoint),this._writer.writeBitDouble(e.size),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.relativeXScale),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeBitDouble(e.thickness),this._writer.writeBitShort(e.shapeIndex),this._writer.write3BitDouble(e.normal),this._writer.handleReferenceTyped(w.HardPointer,null)}writeSolid(e){this._writer.writeBitThickness(e.thickness),this._writer.writeBitDouble(e.firstCorner.z),this._writer.writeRawDouble(e.firstCorner.x),this._writer.writeRawDouble(e.firstCorner.y),this._writer.writeRawDouble(e.secondCorner.x),this._writer.writeRawDouble(e.secondCorner.y),this._writer.writeRawDouble(e.thirdCorner.x),this._writer.writeRawDouble(e.thirdCorner.y),this._writer.writeRawDouble(e.fourthCorner.x),this._writer.writeRawDouble(e.fourthCorner.y),this._writer.writeBitExtrusion(e.normal)}writeSolid3D(e){}writeCadImage(e){switch(this._writer.writeBitLong(e.classVersion),this._writer.write3BitDouble(e.insertPoint),this._writer.write3BitDouble(e.uVector),this._writer.write3BitDouble(e.vVector),this._writer.write2RawDouble(e.size),this._writer.writeBitShort(e.flags),this._writer.writeBit(e.clippingState),this._writer.writeByte(e.brightness),this._writer.writeByte(e.contrast),this._writer.writeByte(e.fade),this.R2010Plus&&this._writer.writeBit(e.clipMode===xi.Inside),this._writer.writeBitShort(e.clipType),e.clipType){case $r.Rectangular:this._writer.write2RawDouble(e.clipBoundaryVertices[0]),this._writer.write2RawDouble(e.clipBoundaryVertices[1]);break;case $r.Polygonal:this._writer.writeBitLong(e.clipBoundaryVertices.length);for(let t=0;t<e.clipBoundaryVertices.length;t++)this._writer.write2RawDouble(e.clipBoundaryVertices[t]);break}this._writer.handleReferenceTyped(w.HardPointer,e.definition),this._writer.handleReference(e.definitionReactor),e.definitionReactor!=null&&this._objects.push(e.definitionReactor)}writeSpline(e){let t;this.R2013Plus?(e.knotParametrization===Si.Custom||e.fitPoints.length===0?(t=1,e.flags1&=~mt.UseKnotParameter):(t=2,e.flags1|=mt.MethodFitPoints|mt.UseKnotParameter),this._writer.writeBitLong(t),this._writer.writeBitLong(e.flags1),this._writer.writeBitLong(e.knotParametrization)):(t=e.fitPoints.length<=0?1:2,t===2&&e.knotParametrization!==0&&(t=1),this._writer.writeBitLong(t)),this._writer.writeBitLong(e.degree);let i=e.weights.length>0;switch(t){case 1:this._writer.writeBit((e.flags&Ie.Rational)!==0),this._writer.writeBit((e.flags&Ie.Closed)!==0),this._writer.writeBit((e.flags&Ie.Periodic)!==0),this._writer.writeBitDouble(e.knotTolerance),this._writer.writeBitDouble(e.controlPointTolerance),this._writer.writeBitLong(e.knots.length),this._writer.writeBitLong(e.controlPoints.length),this._writer.writeBit(i);for(let s of e.knots)this._writer.writeBitDouble(s);for(let s=0;s<e.controlPoints.length;s++)this._writer.write3BitDouble(e.controlPoints[s]),i&&this._writer.writeBitDouble(e.weights[s]);break;case 2:this._writer.writeBitDouble(e.fitTolerance),this._writer.write3BitDouble(e.startTangent),this._writer.write3BitDouble(e.endTangent),this._writer.writeBitLong(e.fitPoints.length);for(let s of e.fitPoints)this._writer.write3BitDouble(s);break}}writeRay(e){this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.direction)}writeTextEntity(e){if(this.R13_14Only)this._writer.writeBitDouble(e.insertPoint.z),this._writer.writeRawDouble(e.insertPoint.x),this._writer.writeRawDouble(e.insertPoint.y),this._writer.writeRawDouble(e.alignmentPoint.x),this._writer.writeRawDouble(e.alignmentPoint.y),this._writer.write3BitDouble(e.normal),this._writer.writeBitDouble(e.thickness),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.widthFactor),this._writer.writeVariableText(e.value),this._writer.writeBitShort(e.mirror),this._writer.writeBitShort(e.horizontalAlignment),this._writer.writeBitShort(e.verticalAlignment);else{let t=0;e.insertPoint.z===0&&(t|=1),c.equals(e.alignmentPoint,c.Zero)&&(t|=2),e.obliqueAngle===0&&(t|=4),e.rotation===0&&(t|=8),e.widthFactor===1&&(t|=16),e.mirror===rn.None&&(t|=32),e.horizontalAlignment===ht.Left&&(t|=64),e.verticalAlignment===ct.Baseline&&(t|=128),this._writer.writeByte(t),(t&1)===0&&this._writer.writeRawDouble(e.insertPoint.z),this._writer.writeRawDouble(e.insertPoint.x),this._writer.writeRawDouble(e.insertPoint.y),(t&2)===0&&(this._writer.writeBitDoubleWithDefault(e.alignmentPoint.x,e.insertPoint.x),this._writer.writeBitDoubleWithDefault(e.alignmentPoint.y,e.insertPoint.y)),this._writer.writeBitExtrusion(e.normal),this._writer.writeBitThickness(e.thickness),(t&4)===0&&this._writer.writeRawDouble(e.obliqueAngle),(t&8)===0&&this._writer.writeRawDouble(e.rotation),this._writer.writeRawDouble(e.height),(t&16)===0&&this._writer.writeRawDouble(e.widthFactor),this._writer.writeVariableText(e.value),(t&32)===0&&this._writer.writeBitShort(e.mirror),(t&64)===0&&this._writer.writeBitShort(e.horizontalAlignment),(t&128)===0&&this._writer.writeBitShort(e.verticalAlignment)}this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeMText(e){this._writer.write3BitDouble(e.insertPoint),this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.alignmentPoint),this._writer.writeBitDouble(e.rectangleWidth),this.R2007Plus&&this._writer.writeBitDouble(e.rectangleHeight),this._writer.writeBitDouble(e.height),this._writer.writeBitShort(e.attachmentPoint),this._writer.writeBitShort(e.drawingDirection),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0),this._writer.writeVariableText(e.value),this._writer.handleReferenceTyped(w.HardPointer,e.style),this.R2000Plus&&(this._writer.writeBitShort(e.lineSpacingStyle),this._writer.writeBitDouble(e.lineSpacing),this._writer.writeBit(!1)),this.R2004Plus&&(this._writer.writeBitLong(e.backgroundFillFlags),((e.backgroundFillFlags&rr.UseBackgroundFillColor)!==rr.None||this._version>m.AC1027&&(e.backgroundFillFlags&rr.TextFrame)>0)&&(this._writer.writeBitDouble(e.backgroundScale),this._writer.writeCmColor(e.backgroundColor),this._writer.writeBitLong(e.backgroundTransparency))),this.R2018Plus&&(this._writer.writeBit(!e.isAnnotative),!e.isAnnotative&&(this._writer.writeBitShort(4),this._writer.writeBit(!0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitLong(e.attachmentPoint),this._writer.write3BitDouble(e.alignmentPoint),this._writer.write3BitDouble(e.insertPoint),this._writer.writeBitDouble(e.rectangleWidth),this._writer.writeBitDouble(e.rectangleHeight),this._writer.writeBitDouble(e.horizontalWidth),this._writer.writeBitDouble(e.verticalHeight)))}writeFaceRecord(e){this._writer.writeBitShort(e.index1),this._writer.writeBitShort(e.index2),this._writer.writeBitShort(e.index3),this._writer.writeBitShort(e.index4)}writeVertex2D(e){this._writer.writeByte(e.flags),this._writer.writeBitDouble(e.location.x),this._writer.writeBitDouble(e.location.y),this._writer.writeBitDouble(0),e.startWidth!==0&&e.endWidth===e.startWidth?this._writer.writeBitDouble(0-e.startWidth):(this._writer.writeBitDouble(e.startWidth),this._writer.writeBitDouble(e.endWidth)),this._writer.writeBitDouble(e.bulge),this.R2010Plus&&this._writer.writeBitLong(e.id),this._writer.writeBitDouble(e.curveTangent)}writeVertex(e){this._writer.writeByte(e.flags),this._writer.write3BitDouble(e.location)}writeTolerance(e){this.R13_14Only&&(this._writer.writeBitShort(0),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0)),this._writer.write3BitDouble(e.insertionPoint),this._writer.write3BitDouble(e.direction),this._writer.write3BitDouble(e.normal),this._writer.writeVariableText(e.text),this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeViewport(e){if(this._writer.write3BitDouble(e.center),this._writer.writeBitDouble(e.width),this._writer.writeBitDouble(e.height),this.R2000Plus&&(this._writer.write3BitDouble(e.viewTarget),this._writer.write3BitDouble(e.viewDirection),this._writer.writeBitDouble(e.twistAngle),this._writer.writeBitDouble(e.viewHeight),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClipPlane),this._writer.writeBitDouble(e.backClipPlane),this._writer.writeBitDouble(e.snapAngle),this._writer.write2RawDouble(e.viewCenter),this._writer.write2RawDouble(e.snapBase),this._writer.write2RawDouble(e.snapSpacing),this._writer.write2RawDouble(e.gridSpacing),this._writer.writeBitShort(e.circleZoomPercent)),this.R2007Plus&&this._writer.writeBitShort(e.majorGridLineFrequency),this.R2000Plus&&(this._writer.writeBitLong(e.frozenLayers.length),this._writer.writeBitLong(e.status),this._writer.writeVariableText(""),this._writer.writeByte(e.renderMode),this._writer.writeBit(e.displayUcsIcon),this._writer.writeBit(e.ucsPerViewport),this._writer.write3BitDouble(e.ucsOrigin),this._writer.write3BitDouble(e.ucsXAxis),this._writer.write3BitDouble(e.ucsYAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.ucsOrthographicType)),this.R2004Plus&&this._writer.writeBitShort(e.shadePlotMode),this.R2007Plus&&(this._writer.writeBit(e.useDefaultLighting),this._writer.writeByte(e.defaultLightingType),this._writer.writeBitDouble(e.brightness),this._writer.writeBitDouble(e.contrast),this._writer.writeCmColor(e.ambientLightColor)),this.R13_14Only&&this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus){for(let t of e.frozenLayers)this.R2004Plus?this._writer.handleReferenceTyped(w.SoftPointer,t):this._writer.handleReferenceTyped(w.HardPointer,t);this._writer.handleReferenceTyped(w.HardPointer,e.boundary)}this._version===m.AC1015&&this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.SoftPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.SoftPointer,null),this._writer.handleReferenceTyped(w.HardOwnership,null))}writeXLine(e){this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.direction)}writeChildEntities(e,t){if(e.length===0)return;let i=this._prev,s=this._next;this._prev=null,this._next=null;let n=e[0];for(let a=1;a<e.length;a++)this._next=e[a],this.writeEntity(n),this._prev=n,n=this._next;this._next=null,this.writeEntity(n),this._prev=i,this._next=s,t!=null&&this.writeSeqend(t)}addEntriesToWriter(e){for(let t of e)this._objects.push(t)}skipEntry(e){return e instanceof _t&&!this.WriteXRecords?{skip:!0,notify:!1}:e instanceof $s||e instanceof Gs||e instanceof Ys||e instanceof Xe||e instanceof yr||e instanceof at||e instanceof pr||e instanceof di||e instanceof Ye||e instanceof Er||e instanceof Rr||e instanceof mi||e instanceof ps?{skip:!0,notify:!0}:{skip:!1,notify:!1}}write4x3Matrix(e){for(let t=0;t<3;t++)for(let i=0;i<4;i++)this._writer.writeBitDouble(e.get(t,i))}writeObjects(){for(;this._objects.length>0;){let e=this._objects.shift();this.writeObject(e)}}writeObject(e){let{skip:t,notify:i}=this.skipEntry(e);if(t){i&&this.notify(`Object type not implemented ${e.constructor.name}`,g.NotImplemented);return}if(this.writeCommonNonEntityData(e),e instanceof ci)this.writeAcdbPlaceHolder(e);else if(e instanceof ui)this.writeBookColor(e);else if(e instanceof Cr)this.writeCadDictionaryWithDefault(e);else if(e instanceof xe)this.writeDictionary(e);else if(e instanceof He)this.writeDictionaryVariable(e);else if(e instanceof Xe)this.writeDimensionAssociation(e);else if(e instanceof Jt)this.writeGeoData(e);else if(e instanceof Ot)this.writeGroup(e);else if(e instanceof li)this.writeImageDefinitionReactor(e);else if(e instanceof Tr)this.writeImageDefinition(e);else if(e instanceof nt)this.writeLayout(e);else if(e instanceof wt)this.writeMLineStyle(e);else if(e instanceof $e)this.writeMultiLeaderStyle(e);else if(e instanceof Dr)this.writeObjectContextData(e),this.writeAnnotScaleObjectContextData(e),this.writeMultiLeaderAnnotContext(e);else if(e instanceof hi)this.writePdfDefinition(e);else if(e instanceof pt)this.writePlotSettings(e);else if(e instanceof Ar)this.writeRasterVariables(e);else if(e instanceof Ge)this.writeScale(e);else if(e instanceof Br)this.writeSortEntitiesTable(e);else if(e instanceof qt)this.writeSpatialFilter(e);else if(e instanceof fi)this.writeField(e);else if(e instanceof pi)this.writeFieldList(e);else if(e instanceof _t)this.writeXRecord(e);else throw new Error(`Object not implemented : ${e.constructor.name}`);this.registerObject(e)}writeAcdbPlaceHolder(e){}writeAnnotScaleObjectContextData(e){this._writer.handleReferenceTyped(w.HardPointer,e.scale)}writeObjectContextData(e){this._writer.writeBitShort(e.version),this._writer.writeBit(e.hasFileToExtensionDictionary),this._writer.writeBit(e.default)}writeBookColor(e){if(this._writer.writeBitShort(0),this.R2004Plus){let t=new Uint8Array([e.color.b,e.color.g,e.color.r,194]),i=new DataView(t.buffer).getUint32(0,!0);this._writer.writeBitLong(i);let s=0;e.name&&(s|=1),e.bookName&&(s|=2),this._writer.writeByte(s),e.colorName&&this._writer.writeVariableText(e.colorName),e.bookName&&this._writer.writeVariableText(e.bookName)}}writeCadDictionaryWithDefault(e){this.writeDictionary(e),this._writer.handleReferenceTyped(w.HardPointer,e.defaultEntry)}writeDictionary(e){let t=[];for(let i of e)this.skipEntry(i).skip||t.push(i);this._writer.writeBitLong(t.length),this._version===m.AC1014&&this._writer.writeByte(0),this.R2000Plus&&(this._writer.writeBitShort(e.clonningFlags),this._writer.writeByte(e.hardOwnerFlag?1:0));for(let i of t)this.skipEntry(i).skip||(this._writer.writeVariableText(i.name),this._writer.handleReferenceTyped(w.SoftOwnership,i.handle));this.addEntriesToWriter(e)}writeDictionaryVariable(e){this._writer.writeByte(0),this._writer.writeVariableText(e.value)}writeDimensionAssociation(e){this._writer.handleReferenceTyped(w.SoftPointer,e.dimension),this._writer.writeBitLong(e.associativityFlags),this._writer.writeBit(e.isTransSpace),this._writer.writeByte(e.rotatedDimensionType),(e.associativityFlags&he.FirstPointReference)!==0&&this.writeOsnapPointRef(e.firstPointRef),(e.associativityFlags&he.SecondPointReference)!==0&&this.writeOsnapPointRef(e.secondPointRef),(e.associativityFlags&he.ThirdPointReference)!==0&&this.writeOsnapPointRef(e.thirdPointRef),(e.associativityFlags&he.FourthPointReference)!==0&&this.writeOsnapPointRef(e.fourthPointRef)}writeOsnapPointRef(e){this._writer.writeVariableText(Xe.OsnapPointRefClassName),this._writer.writeByte(e.objectOsnapType),this._writer.handleReferenceTyped(w.Undefined,e.geometry)}writeField(e){this._writer.writeVariableText(e.evaluatorId),this._writer.writeVariableText(e.fieldCode),this._writer.writeBitLong(e.children.length);for(let t of e.children)this._writer.handleReferenceTyped(w.HardOwnership,e);this._writer.writeBitLong(e.cadObjects.length);for(let t of e.cadObjects)this._writer.handleReferenceTyped(w.SoftPointer,t);this._version<m.AC1021&&this._writer.writeVariableText(e.formatString),this._writer.writeBitLong(e.evaluationOptionFlags),this._writer.writeBitLong(e.filingOptionFlags),this._writer.writeBitLong(e.fieldStateFlags),this._writer.writeBitLong(e.evaluationStatusFlags),this._writer.writeBitLong(e.evaluationErrorCode),this._writer.writeVariableText(e.evaluationErrorMessage),this.writeCadValue(e.value),this._writer.writeVariableText(e.formatString),this._writer.writeBitLong(e.formatString.length),this._writer.writeBitLong(e.values.size);for(let[t,i]of e.values)this._writer.writeVariableText(t),this.writeCadValue(i);for(let t of e.children)this._objects.push(t)}writeFieldList(e){this._writer.writeBitLong(e.fields.length),this._writer.writeBit(!0);for(let t of e.fields)this._writer.handleReferenceTyped(w.SoftPointer,t)}writeCadValue(e){if(this.R2007Plus&&this._writer.writeBitLong(e.flags),this._writer.writeBitLong(e.valueType),!this.R2007Plus||!e.isEmpty)switch(e.valueType){case W.Unknown:this._writer.writeBitLong(0);break;case W.Long:this._writer.writeBitLong(e.value);break;case W.Double:this._writer.writeBitDouble(e.value);break;case W.General:case W.String:this.writeStringCadValue(e.value);break;case W.Date:this.writeDateCadValue(e.value);break;case W.Point2D:this.writeCadValueXY(e.value);break;case W.Point3D:this.writeCadValueXYZ(e.value);break;case W.Handle:this._writer.handleReferenceTyped(w.SoftPointer,e.value);break;default:throw new Error("Not implemented")}this.R2007Plus&&(this._writer.writeBitLong(e.units),this._writer.writeVariableText(e.format),this._writer.writeVariableText(e.formattedValue))}writeCadValueXY(e){e!=null?(this._writer.writeBitLong(16),this._writer.write2RawDouble(e)):this._writer.writeBitLong(0)}writeCadValueXYZ(e){e!=null?(this._writer.writeBitLong(24),this._writer.writeRawDouble(e.X),this._writer.writeRawDouble(e.Y),this._writer.writeRawDouble(e.Z)):this._writer.writeBitLong(0)}writeDateCadValue(e){if(e!=null){let t;if(this.R2007Plus){t=new Uint8Array(16);let i=new DataView(t.buffer);i.setInt16(0,e.getFullYear(),!0),i.setInt16(2,e.getMonth()+1,!0),i.setInt16(4,e.getDay(),!0),i.setInt16(6,e.getDate(),!0),i.setInt16(8,e.getHours(),!0),i.setInt16(10,e.getMinutes(),!0),i.setInt16(12,e.getSeconds(),!0),i.setInt16(14,e.getMilliseconds(),!0)}else{let i=Math.floor((e.getTime()-new Date(1970,0,1).getTime())/1e3),s=i>>>32|0,n=i|0;t=new Uint8Array(8);let a=new DataView(t.buffer);a.setInt32(0,s,!1),a.setInt32(4,n,!1)}this._writer.writeBitLong(t.length),this._writer.writeBytes(t)}else this._writer.writeBitLong(0)}writeStringCadValue(e){e||this._writer.writeBitLong(0);let t;this.R2007Plus?(t=this.encodeUtf16LE(e),this._writer.writeBitLong(t.length+2),this._writer.writeBytes(t),this._writer.writeByte(0),this._writer.writeByte(0)):(t=this.encodeText(e),this._writer.writeBitLong(t.length+1),this._writer.writeBytes(t),this._writer.writeByte(0))}writeGeoData(e){switch(this._writer.writeBitLong(e.version),this._writer.handleReferenceTyped(w.SoftPointer,e.hostBlock),this._writer.writeBitShort(e.coordinatesType),e.version){case We.R2009:this._writer.write3BitDouble(e.referencePoint),this._writer.writeBitLong(e.horizontalUnits),this._writer.write3BitDouble(e.designPoint),this._writer.write3BitDouble(c.Zero),this._writer.write3BitDouble(e.upDirection),this._writer.writeBitDouble(Math.PI/2-e.northDirection.getAngle()),this._writer.write3BitDouble(new c(1,1,1)),this._writer.writeVariableText(e.coordinateSystemDefinition),this._writer.writeVariableText(e.geoRssTag),this._writer.writeBitDouble(e.horizontalUnitScale),e.verticalUnitScale=e.horizontalUnitScale,this._writer.writeVariableText(""),this._writer.writeVariableText("");break;case We.R2010:case We.R2013:this._writer.write3BitDouble(e.designPoint),this._writer.write3BitDouble(e.referencePoint),this._writer.writeBitDouble(e.horizontalUnitScale),this._writer.writeBitLong(e.horizontalUnits),this._writer.writeBitDouble(e.verticalUnitScale),this._writer.writeBitLong(e.horizontalUnits),this._writer.write3BitDouble(e.upDirection),this._writer.write2RawDouble(e.northDirection),this._writer.writeBitLong(e.scaleEstimationMethod),this._writer.writeBitDouble(e.userSpecifiedScaleFactor),this._writer.writeBit(e.enableSeaLevelCorrection),this._writer.writeBitDouble(e.seaLevelElevation),this._writer.writeBitDouble(e.coordinateProjectionRadius),this._writer.writeVariableText(e.coordinateSystemDefinition),this._writer.writeVariableText(e.geoRssTag);break}this._writer.writeVariableText(e.observationFromTag),this._writer.writeVariableText(e.observationToTag),this._writer.writeVariableText(e.observationCoverageTag),this._writer.writeBitLong(e.points.length);for(let t of e.points)this._writer.write2RawDouble(t.source),this._writer.write2RawDouble(t.destination);this._writer.writeBitLong(e.faces.length);for(let t of e.faces)this._writer.writeBitLong(t.index1),this._writer.writeBitLong(t.index2),this._writer.writeBitLong(t.index3)}writeGroup(e){this._writer.writeVariableText(e.description),this._writer.writeBitShort(e.isUnnamed?1:0),this._writer.writeBitShort(e.selectable?1:0),this._writer.writeBitLong(e.entities.length);for(let t of e.entities)this._writer.handleReferenceTyped(w.HardPointer,t)}writeImageDefinition(e){this._writer.writeBitLong(e.classVersion),this._writer.write2RawDouble(e.size),this._writer.writeVariableText(e.fileName),this._writer.writeBit(e.isLoaded),this._writer.writeByte(e.units),this._writer.write2RawDouble(e.defaultSize)}writeImageDefinitionReactor(e){this._writer.writeBitLong(e.classVersion)}writeLayout(e){if(this.writePlotSettings(e),this._writer.writeVariableText(e.name),this._writer.writeBitLong(e.tabOrder),this._writer.writeBitShort(e.layoutFlags),this._writer.write3BitDouble(e.origin),this._writer.write2RawDouble(e.minLimits),this._writer.write2RawDouble(e.minLimits),this._writer.write3BitDouble(e.insertionBasePoint),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.ucsOrthographicType),this._writer.write3BitDouble(e.minExtents),this._writer.write3BitDouble(e.maxExtents),this.R2004Plus&&this._writer.writeBitLong(e.viewports.length),this._writer.handleReferenceTyped(w.SoftPointer,e.associatedBlock),this._writer.handleReferenceTyped(w.SoftPointer,e.lastActiveViewport),e.ucsOrthographicType===Mt.None?(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,e.ucs)):(this._writer.handleReferenceTyped(w.HardPointer,e.baseUCS),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2004Plus)for(let t of e.viewports)this._writer.handleReferenceTyped(w.SoftPointer,t)}writeMLineStyle(e){this._writer.writeVariableText(e.name),this._writer.writeVariableText(e.description);let t=0;(e.flags&ge.DisplayJoints)!==0&&(t|=1),(e.flags&ge.FillOn)!==0&&(t|=2),(e.flags&ge.StartSquareCap)!==0&&(t|=16),(e.flags&ge.StartRoundCap)!==0&&(t|=32),(e.flags&ge.StartInnerArcsCap)!==0&&(t|=64),(e.flags&ge.EndSquareCap)!==0&&(t|=256),(e.flags&ge.EndRoundCap)!==0&&(t|=512),(e.flags&ge.EndInnerArcsCap)!==0&&(t|=1024),this._writer.writeBitShort(t),this._writer.writeCmColor(e.fillColor),this._writer.writeBitDouble(e.startAngle),this._writer.writeBitDouble(e.endAngle),this._writer.writeByte(e.elements.length);for(let i of e.elements)this._writer.writeBitDouble(i.offset),this._writer.writeCmColor(i.color),this.R2018Plus?this._writer.handleReferenceTyped(w.HardPointer,i.lineType):this._writer.writeBitShort(0)}writeMultiLeaderAnnotContext(e){this.writeMultiLeaderAnnotContextSubObject(!1,e)}writeMultiLeaderStyle(e){this.R2010Plus&&this._writer.writeBitShort(2),this._writer.writeBitShort(e.contentType),this._writer.writeBitShort(e.multiLeaderDrawOrder),this._writer.writeBitShort(e.leaderDrawOrder),this._writer.writeBitLong(e.maxLeaderSegmentsPoints),this._writer.writeBitDouble(e.firstSegmentAngleConstraint),this._writer.writeBitDouble(e.secondSegmentAngleConstraint),this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.leaderLineType),this._writer.writeBitLong(e.leaderLineWeight),this._writer.writeBit(e.enableLanding),this._writer.writeBitDouble(e.landingGap),this._writer.writeBit(e.enableDogleg),this._writer.writeBitDouble(e.landingDistance),this._writer.writeVariableText(e.description),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitDouble(e.arrowheadSize),this._writer.writeVariableText(e.defaultTextContents),this._writer.handleReferenceTyped(w.HardPointer,e.textStyle),this._writer.writeBitShort(e.textLeftAttachment),this._writer.writeBitShort(e.textRightAttachment),this._writer.writeBitShort(e.textAngle),this._writer.writeBitShort(e.textAlignment),this._writer.writeCmColor(e.textColor),this._writer.writeBitDouble(e.textHeight),this._writer.writeBit(e.textFrame),this._writer.writeBit(e.textAlignAlwaysLeft),this._writer.writeBitDouble(e.alignSpace),this._writer.handleReferenceTyped(w.HardPointer,e.blockContent),this._writer.writeCmColor(e.blockContentColor),this._writer.write3BitDouble(e.blockContentScale),this._writer.writeBit(e.enableBlockContentScale),this._writer.writeBitDouble(e.blockContentRotation),this._writer.writeBit(e.enableBlockContentRotation),this._writer.writeBitShort(e.blockContentConnection),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBit(e.overwritePropertyValue),this._writer.writeBit(e.isAnnotative),this._writer.writeBitDouble(e.breakGapSize),this.R2010Plus&&(this._writer.writeBitShort(e.textAttachmentDirection),this._writer.writeBitShort(e.textBottomAttachment),this._writer.writeBitShort(e.textTopAttachment)),this.R2013Plus&&this._writer.writeBit(e.unknownFlag298)}writePdfDefinition(e){this._writer.writeVariableText(e.file),this._writer.writeVariableText(e.page)}writePlotSettings(e){this._writer.writeVariableText(e.pageName),this._writer.writeVariableText(e.systemPrinterName),this._writer.writeBitShort(e.flags),this._writer.writeBitDouble(e.unprintableMargin.left),this._writer.writeBitDouble(e.unprintableMargin.bottom),this._writer.writeBitDouble(e.unprintableMargin.right),this._writer.writeBitDouble(e.unprintableMargin.top),this._writer.writeBitDouble(e.paperWidth),this._writer.writeBitDouble(e.paperHeight),this._writer.writeVariableText(e.paperSize),this._writer.writeBitDouble(e.plotOriginX),this._writer.writeBitDouble(e.plotOriginY),this._writer.writeBitShort(e.paperUnits),this._writer.writeBitShort(e.paperRotation),this._writer.writeBitShort(e.plotType),this._writer.writeBitDouble(e.windowLowerLeftX),this._writer.writeBitDouble(e.windowLowerLeftY),this._writer.writeBitDouble(e.windowUpperLeftX),this._writer.writeBitDouble(e.windowUpperLeftY),this._version>=m.AC1012&&this._version<=m.AC1015&&this._writer.writeVariableText(e.plotViewName),this._writer.writeBitDouble(e.numeratorScale),this._writer.writeBitDouble(e.denominatorScale),this._writer.writeVariableText(e.styleSheet),this._writer.writeBitShort(e.scaledFit),this._writer.writeBitDouble(e.standardScale),this._writer.write2BitDouble(e.paperImageOrigin),this.R2004Plus&&(this._writer.writeBitShort(e.shadePlotMode),this._writer.writeBitShort(e.shadePlotResolutionMode),this._writer.writeBitShort(e.shadePlotDPI),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&this._writer.handleReferenceTyped(w.SoftPointer,null)}writeRasterVariables(e){this._writer.writeBitLong(e.classVersion),this._writer.writeBitShort(e.isDisplayFrameShown?1:0),this._writer.writeBitShort(e.displayQuality),this._writer.writeBitShort(e.units)}writeScale(e){this._writer.writeBitShort(0),this._writer.writeVariableText(e.name),this._writer.writeBitDouble(e.paperUnits),this._writer.writeBitDouble(e.drawingUnits),this._writer.writeBit(e.isUnitScale)}writeSortEntitiesTable(e){this._writer.handleReferenceTyped(w.SoftPointer,e.blockOwner);let t=Array.from(e);this._writer.writeBitLong(t.length);for(let i of t)this._writer.main.handleReference(i.sortHandle),this._writer.handleReferenceTyped(w.SoftPointer,i.entity)}writeSpatialFilter(e){this._writer.writeBitShort(e.boundaryPoints.length);for(let t of e.boundaryPoints)this._writer.write2RawDouble(t);this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.origin),this._writer.writeBitShort(e.displayBoundary?1:0),this._writer.writeBitShort(e.clipFrontPlane?1:0),e.clipFrontPlane&&this._writer.writeBitDouble(e.frontDistance),this._writer.writeBitShort(e.clipBackPlane?1:0),e.clipBackPlane&&this._writer.writeBitDouble(e.backDistance),this.write4x3Matrix(e.inverseInsertTransform),this.write4x3Matrix(e.insertTransform)}writeXRecord(e){let t=[],i=o=>{t.push(o&255,o>>8&255)},s=o=>{t.push(o&255,o>>8&255,o>>16&255,o>>24&255)},n=o=>{let h=new ArrayBuffer(8);new DataView(h).setFloat64(0,o,!0);let b=new Uint8Array(h);for(let S=0;S<8;S++)t.push(b[S])},a=o=>{let h=new ArrayBuffer(8);new DataView(h).setFloat64(0,o,!0);let f=new Uint8Array(h);for(let b=0;b<8;b++)t.push(f[b])};for(let o of e.entries){if(o.value==null)continue;switch(i(o.code),Be.transformValue(o.code)){case _.Byte:case _.Bool:t.push(Number(o.value)&255);break;case _.Int16:case _.ExtendedDataInt16:i(Number(o.value));break;case _.Int32:case _.ExtendedDataInt32:s(Number(o.value));break;case _.Int64:n(Number(o.value));break;case _.Double:case _.ExtendedDataDouble:a(Number(o.value));break;case _.Point3D:{let f=o.value;a(f.X),a(f.Y),a(f.Z);break}case _.Chunk:case _.ExtendedDataChunk:{let f=o.value;t.push(f.length&255);for(let b=0;b<f.length;b++)t.push(f[b]);break}case _.Handle:{let f=o.getReference(),b=f==null?"":f.handle.toString(16).toUpperCase();this.writeStringInChunks(t,b);break}case _.String:case _.ExtendedDataString:this.writeStringInChunks(t,o.value);break;case _.ObjectId:case _.ExtendedDataHandle:{let f=o.getReference(),b=f==null?0:f.handle;n(b);break}default:throw new Error("Not supported")}}this._writer.writeBitLong(t.length),this._writer.writeBytesOffset(new Uint8Array(t),0,t.length),this.R2000Plus&&this._writer.writeBitShort(e.cloningFlags)}writeStringInChunks(e,t){if(this.R2007Plus){if(!t){e.push(0,0);return}let i=t.length;e.push(i&255,i>>8&255);let s=this.encodeUtf16LE(t);for(let n=0;n<s.length;n++)e.push(s[n])}else if(t){let i=t.length;e.push(i&255,i>>8&255);let s=Z.getCodeIndex(Z.getCodePage(this._writer.encoding));e.push(s);let n=this.encodeText(t);for(let a=0;a<n.length;a++)e.push(n[a])}else{e.push(0,0);let i=Z.getCodeIndex(Z.getCodePage(this._writer.encoding));e.push(i)}}encodeUtf16LE(e){let t=new Uint8Array(e.length*2);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t[i*2]=s&255,t[i*2+1]=s>>8&255}return t}encodeText(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i)&255;return t}};var fd=class extends Y{get SectionName(){return T.Preview}get bytesWritten(){return Math.ceil(this._swriter.positionInBits/8)}get writerStream(){return this._swriter.main.stream}_swriter;_startSentinel=T.StartSentinels.get(T.Preview);_endSentinel=T.EndSentinels.get(T.Preview);constructor(e,t){super(e),this._swriter=ye.getStreamWriter(e,t,"windows-1252")}write(){this._swriter.writeBytes(this._startSentinel),this._swriter.writeRawLong(1),this._swriter.writeByte(0),this._swriter.writeBytes(this._endSentinel)}writePreview(e,t){let i=e.rawHeader.length+e.rawImage.length+19;this._swriter.writeBytes(this._startSentinel),this._swriter.writeRawLong(i),this._swriter.writeByte(2),this._swriter.writeByte(1);let s=t+12+5+32;this._swriter.writeRawLong(s),this._swriter.writeRawLong(e.rawHeader.length),this._swriter.writeByte(e.code);let n=s+e.rawHeader.length;this._swriter.writeRawLong(n),this._swriter.writeRawLong(e.rawImage.length),this._swriter.writeBytes(e.rawHeader),this._swriter.writeBytes(e.rawImage),this._swriter.writeBytes(this._endSentinel)}};var Ka=class extends ye{constructor(e,t){super(e,t)}};var Ja=class extends Ka{constructor(e,t){super(e,t)}writeBitExtrusion(e){if(e.X===0&&e.Y===0&&e.Z===1){super.writeBit(!0);return}super.writeBit(!1),super.write3BitDouble(e)}writeBitThickness(e){if(e===0){super.writeBit(!0);return}super.writeBit(!1),super.writeBitDouble(e)}};var qa=class extends Ja{constructor(e,t){super(e,t)}writeCmColor(e){this.writeBitShort(0);let t=new Uint8Array(4);e.isTrueColor?(t[2]=e.r,t[1]=e.g,t[0]=e.b,t[3]=194):e.isByLayer?t[3]=192:(t[3]=195,t[0]=e.index&255);let i=new DataView(t.buffer);this.writeBitLong(i.getInt32(0,!0)),this.writeByte(0)}writeEnColor(e,t){let i=0;if(e.isByBlock&&t.isByLayer){super.writeBitShort(0);return}if(t.isByLayer||(i=i|8192),e.isTrueColor?i=i|32768:i=i|e.index&65535,super.writeBitShort(i&65535),e.isTrueColor){let s=new Uint8Array([e.b,e.g,e.r,194]),a=new DataView(s.buffer).getUint32(0,!0);super.writeBitLong(a|0)}t.isByLayer||super.writeBitLong(Ke.toAlphaValue(t))}writeEnColorBook(e,t,i){let s=0;if(e.isByBlock&&t.isByLayer&&!i){super.writeBitShort(0);return}if(t.isByLayer||(s=s|8192),i?(s=s|16384,s=s|32768):e.isTrueColor?s=s|32768:s=s|e.index&65535,super.writeBitShort(s&65535),e.isTrueColor){let n=new Uint8Array([e.b,e.g,e.r,194]),o=new DataView(n.buffer).getUint32(0,!0);super.writeBitLong(o|0)}t.isByLayer||super.writeBitLong(Ke.toAlphaValue(t))}};var Qa=class extends qa{constructor(e,t){super(e,t)}writeVariableText(e){if(!e||e.length===0){super.writeBitShort(0);return}super.writeBitShort(e.length);let t=new TextEncoder,i=new Uint8Array(e.length*2);for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);i[s*2]=n&255,i[s*2+1]=n>>>8&255}super.writeBytes(i)}writeTextUnicode(e){this.writeRawShort(e.length+1);let t=new Uint8Array(e.length*2);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t[i*2]=s&255,t[i*2+1]=s>>>8&255}this.writeBytes(t),this.writeByte(0),this.writeByte(0)}};var pd=class extends Qa{constructor(e,t){super(e,t)}writeObjectType(e){if(e<=255)this.write2Bits(0),this.writeByte(e&255);else if(e>=496&&e<=751)this.write2Bits(1),this.writeByte(e-496&255);else{this.write2Bits(2);let t=new Uint8Array(2);new DataView(t.buffer).setInt16(0,e,!0),this.writeBytes(t)}}};var wd=class extends Y{get SectionName(){return T.SummaryInfo}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_writer;_writeStringMethod;constructor(e,t){super(e),this._version=e,this._writer=ye.getStreamWriter(e,t,"utf-16le"),e<m.AC1021?this._writeStringMethod=i=>this.writeUnicodeString(i):this._writeStringMethod=i=>this._writer.writeTextUnicode(i)}write(e){this._writeStringMethod(e.title??""),this._writeStringMethod(e.subject??""),this._writeStringMethod(e.author??""),this._writeStringMethod(e.keywords??""),this._writeStringMethod(e.comments??""),this._writeStringMethod(e.lastSavedBy??""),this._writeStringMethod(e.revisionNumber??""),this._writeStringMethod(e.hyperlinkBase??""),this._writer.writeInt(0),this._writer.writeInt(0),this._writer.write8BitJulianDate(e.createdDate??new Date),this._writer.write8BitJulianDate(e.modifiedDate??new Date);let t=e.properties?.size??0;if(this._writer.writeRawShort(t),e.properties)for(let[i,s]of e.properties)this._writeStringMethod(i),this._writeStringMethod(s);this._writer.writeInt(0),this._writer.writeInt(0)}writeUnicodeString(e){if(!e||e.length===0){this._writer.writeRawShort(0);return}let i=new TextEncoder().encode(e);this._writer.writeRawShort(i.length),this._writer.writeBytes(i)}};var _d=class extends Ls{};Ya("AC12",Ka);Ya("AC15",Ja);Ya("AC18",qa);Ya("AC21",Qa);Ya("AC24",pd);lh("MergedAC14",ud);lh("Merged",Za);var Zh=class r extends Es{Preview=null;get _version(){return this._document.header.version}_fileHeader;_fileHeaderWriter;_handlesMap=new Map;get bytesWritten(){return this._fileHeaderWriter?.bytesWritten??0}constructor(e,t){super(e,t),this._fileHeader=Ai.CreateFileHeader(this._version)}createDefaultConfiguration(){return new _d}Write(){super.Write(),this.getFileHeaderWriter(),this.writeHeader(),this.writeClasses(),this.writeSummaryInfo(),this.writePreview(),this.writeAppInfo(),this.writeFileDepList(),this.writeRevHistory(),this.writeAuxHeader(),this.writeObjects(),this.writeObjFreeSpace(),this.writeTemplate(),this.writeHandles(),this._fileHeaderWriter.writeFile()}Dispose(){}static WriteToStream(e,t,i=null,s=null){let n=new r(e,t);i&&(n.Configuration=i),n.OnNotification=s,n.Write(),n.Dispose()}getFileHeaderWriter(){switch(this._document.header.version){case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:case m.AC1012:throw new Me(this._document.header.version);case m.AC1014:case m.AC1015:this._fileHeaderWriter=new od(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1018:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1021:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1024:case m.AC1027:case m.AC1032:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;default:throw new Me}}writeHeader(){let e=new Uint8Array(0),t=new cd(e,this._document,this._encoding);t.OnNotification=(s,n)=>this.triggerNotification(s,n),t.write();let i=new Uint8Array(t.startWriterStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Header,i,!0)}writeClasses(){let e=new Uint8Array(0),t=new ad(e,this._document,this._encoding);t.write();let i=new Uint8Array(t.startWriterStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Classes,i,!0)}writeSummaryInfo(){if(!(this._fileHeader.AcadVersion<m.AC1018))if(this._document.summaryInfo){let e=new Uint8Array(8192),t=new wd(this._version,e);t.write(this._document.summaryInfo);let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.SummaryInfo,i,!1,256)}else this._fileHeaderWriter.addSection(T.SummaryInfo,new Uint8Array(0),!1,256)}writePreview(){let e=new Uint8Array(4096),t=new fd(this._version,e);this.Preview&&this.Preview.code!==0?t.writePreview(this.Preview,0):t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Preview,i,!1,1024)}writeAppInfo(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(4096),t=new sd(this._version,e);t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.AppInfo,i,!1,128)}writeFileDepList(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(8),t=new DataView(e.buffer);t.setUint32(0,0,!0),t.setUint32(4,0,!0),this._fileHeaderWriter.addSection(T.FileDepList,e,!1,128)}writeRevHistory(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(12),t=new DataView(e.buffer);t.setUint32(0,0,!0),t.setUint32(4,0,!0),t.setUint32(8,0,!0),this._fileHeaderWriter.addSection(T.RevHistory,e,!0)}writeObjects(){let e=new Uint8Array(0),t=new md(e,this._document,this._encoding,this.Configuration.WriteXRecords,this.Configuration.WriteXData,this.Configuration.WriteShapes);t.OnNotification=(i,s)=>this.triggerNotification(i,s),t.write(),this._handlesMap=t.Map,this._fileHeaderWriter.addSection(T.AcDbObjects,t.getWrittenData(),!0)}writeObjFreeSpace(){let e=new Uint8Array(37),t=new DataView(e.buffer),i=0;t.setInt32(i,0,!0),i+=4,t.setUint32(i,this._handlesMap.size,!0),i+=4;let s=this._version>=m.AC1015?this._document.header.universalUpdateDateTime:this._document.header.updateDateTime,{jdate:n,milliseconds:a}=Z.dateToJulian(s);t.setInt32(i,n,!0),i+=4,t.setInt32(i,a,!0),i+=4,t.setUint32(i,0,!0),i+=4,e[i]=4,i+=1,t.setUint32(i,50,!0),i+=4,t.setUint32(i,0,!0),i+=4,t.setUint32(i,100,!0),i+=4,t.setUint32(i,0,!0),i+=4,this._fileHeaderWriter.addSection(T.ObjFreeSpace,e,!0)}writeTemplate(){let e=new Uint8Array(4),t=new DataView(e.buffer);t.setInt16(0,0,!0),t.setUint16(2,this._document.header.measurementUnits,!0),this._fileHeaderWriter.addSection(T.Template,e,!0)}writeHandles(){let t=new hd(this._version,this._handlesMap).write(this._fileHeaderWriter.HandleSectionOffset);this._fileHeaderWriter.addSection(T.Handles,t,!0)}writeAuxHeader(){let e=new Uint8Array(4096),t=new nd(e,this._encoding,this._document.header);t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.AuxHeader,i,!0)}};var Kh;(function(r){r[r.AcDb_Unknown=0]="AcDb_Unknown",r[r.AcDb_Security=1241646314]="AcDb_Security",r[r.AcDb_FileDepList=1816266186]="AcDb_FileDepList",r[r.AcDb_VBAProject=1483605316]="AcDb_VBAProject",r[r.AcDb_AppInfo=1067451454]="AcDb_AppInfo",r[r.AcDb_Preview=1084884083]="AcDb_Preview",r[r.AcDb_SummaryInfo=1903822351]="AcDb_SummaryInfo",r[r.AcDb_RevHistory=1621231027]="AcDb_RevHistory",r[r.AcDb_AcDbObjects=1733035433]="AcDb_AcDbObjects",r[r.AcDb_ObjFreeSpace=2011301407]="AcDb_ObjFreeSpace",r[r.AcDb_Template=1242825934]="AcDb_Template",r[r.AcDb_Handles=1064174672]="AcDb_Handles",r[r.AcDb_Classes=1062470751]="AcDb_Classes",r[r.AcDb_AuxHeader=1425016074]="AcDb_AuxHeader",r[r.AcDb_Header=850920409]="AcDb_Header",r[r.AcDb_Signature=-1]="AcDb_Signature"})(Kh||(Kh={}));var bd=class{Entities=[];Objects=[]};kr();var eo=class extends En{Configuration;get KeepUnknownEntities(){return this.Configuration.KeepUnknownEntities}get KeepUnknownNonGraphicalObjects(){return this.Configuration.KeepUnknownNonGraphicalObjects}ModelSpaceEntities=new Set;ModelSpaceTemplate=null;OrphanTemplates=[];constructor(e,t,i){super(e,t),this.Configuration=i}BuildDocument(){if(this.ModelSpaceTemplate===null){let e=U.ModelSpace;this.BlockRecords.add(e),this.ModelSpaceTemplate=new br(e),this.AddTemplate(this.ModelSpaceTemplate)}this.createMissingHandles();for(let e of this.ModelSpaceEntities)this.ModelSpaceTemplate.OwnedObjectsHandlers.add(e.handle);this.RegisterTables(),this.BuildTables(),this.buildDictionaries();for(let e of this.OrphanTemplates)this.assignOwner(e);super.BuildDocument(),this.Configuration.CreateDefaults&&this.DocumentToBuild.createDefaults()}BuildEntities(){let e=[];for(let t of this.cadObjectsTemplates.values())t instanceof k&&(t.Build(this),t.SetUnlinkedReferences());for(let t of this.cadObjectsTemplates.values())t instanceof k&&t.CadObject.owner===null&&(t.CadObject.handle=0,e.push(t.CadObject));return e}assignOwner(e){if(e.CadObject.owner!==null||e.CadObject instanceof xe||!e.OwnerHandle)return;let t=this.TryGetObjectTemplate(e.OwnerHandle);if(t){let i=t;i instanceof br&&e.CadObject instanceof A||(i instanceof Kt&&e.CadObject instanceof Ue?i.OwnedObjectsHandlers.add(e.CadObject.handle):i instanceof Kt&&e.CadObject instanceof Le?i.SeqendHandle=e.CadObject.handle:i instanceof xr&&e.CadObject instanceof Dt?i.OwnedObjectsHandlers.add(e.CadObject.handle):i instanceof xr&&e.CadObject instanceof Le?i.SeqendHandle=e.CadObject.handle:this.Notify(`Owner ${i.constructor.name} with handle ${e.OwnerHandle} assignation not implemented for ${e.CadObject.constructor.name} with handle ${e.CadObject.handle}`,g.Warning))}else this.Notify(`Owner ${e.OwnerHandle} not found for ${e.constructor.name} with handle ${e.CadObject.handle}`,g.Warning)}};var gd=class extends kn{ClearCache=!0;CreateDefaults=!1};q();D();var to=class{DxfCode=p.Invalid;GroupCodeValue=_.None;get Code(){return this.DxfCode}Value="";Position=0;ValueRaw="";get ValueAsString(){return String(this.Value).replace(/\^J/g,`
1
+ var uh=Object.defineProperty;var Pc=Object.getOwnPropertyDescriptor;var Oc=Object.getOwnPropertyNames;var jc=Object.prototype.hasOwnProperty;var er=(r,e)=>()=>(r&&(e=r(r=0)),e);var Nc=(r,e)=>{for(var t in e)uh(r,t,{get:e[t],enumerable:!0})},Vc=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Oc(e))!jc.call(r,s)&&s!==t&&uh(r,s,{get:()=>e[s],enumerable:!(i=Pc(e,s))||i.enumerable});return r};var Ic=r=>Vc(uh({},"__esModule",{value:!0}),r);var d,D=er(()=>{d=class{static BeginSection="SECTION";static BlkRefObjectContextData="ACDB_BLKREFOBJECTCONTEXTDATA_CLASS";static BlkRefToken="{BLKREFS";static Block="BLOCK";static BlocksSection="BLOCKS";static ClassEntry="CLASS";static ClassesSection="CLASSES";static CustomData="CUSTOMDATA";static DictionaryToken="{ACAD_XDICTIONARY";static EndBlock="ENDBLK";static EndOfFile="EOF";static EndSection="ENDSEC";static EndSequence="SEQEND";static EndTable="ENDTAB";static EntitiesSection="ENTITIES";static Entity3DFace="3DFACE";static Entity3DSolid="3DSOLID";static EntityAecWall="AEC_WALL";static EntityArc="ARC";static EntityAttribute="ATTRIB";static EntityAttributeDefinition="ATTDEF";static EntityBody="BODY";static EntityCircle="CIRCLE";static EntityCoordinationModel="COORDINATION MODEL";static EntityDimension="DIMENSION";static EntityEllipse="ELLIPSE";static EntityHatch="HATCH";static EntityHelix="HELIX";static EntityImage="IMAGE";static EntityInsert="INSERT";static EntityLeader="LEADER";static EntityLight="LIGHT";static EntityLine="LINE";static EntityLwPolyline="LWPOLYLINE";static EntityMesh="MESH";static EntityMLine="MLINE";static EntityMText="MTEXT";static EntityMultiLeader="MULTILEADER";static EntityOle2Frame="OLE2FRAME";static EntityOleFrame="OLEFRAME";static EntityPdfUnderlay="PDFUNDERLAY";static EntityPoint="POINT";static EntityPolyFaceMesh="PFACE";static EntityPolyline="POLYLINE";static EntityProxyEntity="ACAD_PROXY_ENTITY";static EntityRay="RAY";static EntityRegion="REGION";static EntitySection="SECTION";static EntitySeqend="SEQEND";static EntityShape="SHAPE";static EntitySolid="SOLID";static EntitySpline="SPLINE";static EntitySun="SUN";static EntitySurface="SURFACE";static EntityTable="ACAD_TABLE";static EntityText="TEXT";static EntityTolerance="TOLERANCE";static EntityTrace="TRACE";static EntityUnderlay="UNDERLAY";static EntityVertex="VERTEX";static EntityViewport="VIEWPORT";static EntityWipeout="WIPEOUT";static EntityXline="XLINE";static FormattedTableDataColumn_BEGIN="FORMATTEDTABLEDATACOLUMN_BEGIN";static FormattedTableDataColumn_END="FORMATTEDTABLEDATACOLUMN_END";static FormattedTableDataRow_BEGIN="FORMATTEDTABLEDATAROW_BEGIN";static FormattedTableDataRow_END="FORMATTEDTABLEDATAROW_END";static HeaderSection="HEADER";static LinkedTableDataCell_BEGIN="LINKEDTABLEDATACELL_BEGIN";static LinkedTableDataCell_END="LINKEDTABLEDATACELL_END";static LinkedTableDataColumn_BEGIN="LINKEDTABLEDATACOLUMN_BEGIN";static LinkedTableDataColumn_END="LINKEDTABLEDATACOLUMN_END";static LinkedTableDataRow_BEGIN="LINKEDTABLEDATAROW_BEGIN";static LinkedTableDataRow_END="LINKEDTABLEDATAROW_END";static MTextAttributeObjectContextData="ACDB_MTEXTATTRIBUTEOBJECTCONTEXTDATA_CLASS";static ObjectAecCleanupGroupDef="AEC_CLEANUP_GROUP_DEF";static ObjectAecWallStyle="AEC_WALL_STYLE";static ObjectBinRecord="BINRECORD";static ObjectBlockBasePointParameter="BLOCKBASEPOINTPARAMETER";static ObjectBlockFlipAction="BLOCKFLIPACTION";static ObjectBlockFlipParameter="BLOCKFLIPPARAMETER";static ObjectBlockGripLocationComponent="BLOCKGRIPLOCATIONCOMPONENT";static ObjectBlockLinearParameter="BLOCKLINEARPARAMETER";static ObjectBlockPointParameter="BLOCKPOINTPARAMETER";static ObjectBlockRepresentationData="ACDB_BLOCKREPRESENTATION_DATA";static ObjectBlockRotateAction="BLOCKROTATEACTION";static ObjectBlockRotationGrip="BLOCKROTATIONGRIP";static ObjectBlockRotationParameter="BLOCKROTATIONPARAMETER";static ObjectBlockVisibilityGrip="BLOCKVISIBILITYGRIP";static ObjectBlockVisibilityParameter="BLOCKVISIBILITYPARAMETER";static ObjectCell="CELL";static ObjectCellStyleMap="CELLSTYLEMAP";static ObjectDBColor="DBCOLOR";static ObjectDictionary="DICTIONARY";static ObjectDictionaryVar="DICTIONARYVAR";static ObjectDictionaryWithDefault="ACDBDICTIONARYWDFLT";static ObjectDimensionAssociation="DIMASSOC";static ObjectEvalGraph="ACAD_EVALUATION_GRAPH";static ObjectField="FIELD";static ObjectFieldList="FIELDLIST";static ObjectGeoData="GEODATA";static ObjectGroup="GROUP";static ObjectImageDefinition="IMAGEDEF";static ObjectImageDefinitionReactor="IMAGEDEF_REACTOR";static ObjectLayout="LAYOUT";static ObjectMaterial="MATERIAL";static ObjectMLeaderContextData="ACDB_MLEADEROBJECTCONTEXTDATA_CLASS";static ObjectMLeaderStyle="MLEADERSTYLE";static ObjectMLineStyle="MLINESTYLE";static ObjectPdfDefinition="PDFDEFINITION";static ObjectPlaceholder="ACDBPLACEHOLDER";static ObjectPlotSettings="PLOTSETTINGS";static ObjectProxyObject="ACAD_PROXY_OBJECT";static ObjectRasterVariables="RASTERVARIABLES";static ObjectScale="SCALE";static ObjectSortEntsTable="SORTENTSTABLE";static ObjectSpatialFilter="SPATIAL_FILTER";static ObjectsSection="OBJECTS";static ObjectTableColumn="COLUMN";static ObjectTableColumnBegin="TABLECOLUMN_BEGIN";static ObjectTableColumnEnd="TABLECOLUMN_END";static ObjectTableContent="TABLECONTENT";static ObjectTableRow="ROW";static ObjectTableRowBegin="TABLEROW_BEGIN";static ObjectTableRowEnd="TABLEOW_END";static ObjectTableStyle="TABLESTYLE";static ObjectVisualStyle="VISUALSTYLE";static ObjectXRecord="XRECORD";static ReactorsToken="{ACAD_REACTORS";static TableAppId="APPID";static TableBlockRecord="BLOCK_RECORD";static TableDimstyle="DIMSTYLE";static TableEntry="TABLE";static TableGroup="GROUP";static TableLayer="LAYER";static TableLinetype="LTYPE";static TablesSection="TABLES";static TableStyle="STYLE";static TableUcs="UCS";static TableView="VIEW";static TableVport="VPORT"}});var l,x=er(()=>{l=class{static AecWall="AecDbWall";static AecDbWallStyle="AecDbWallStyle";static AecDbCleanupGroupDef="AecDbCleanupGroupDef";static BinRecord="BinRecord";static ApplicationId="AcDbRegAppTableRecord";static AcDbPlaceHolder="AcDbPlaceHolder";static AlignedDimension="AcDbAlignedDimension";static Angular2LineDimension="AcDb2LineAngularDimension";static Angular3PointDimension="AcDb3PointAngularDimension";static AnnotScaleObjectContextData="AcDbAnnotScaleObjectContextData";static Arc="AcDbArc";static Attribute="AcDbAttribute";static AttributeDefinition="AcDbAttributeDefinition";static BlkRefObjectContextData="AcDbBlkRefObjectContextData";static Block1PtParameter="AcDbBlock1PtParameter";static Block2PtParameter="AcDbBlock2PtParameter";static BlockAction="AcDbBlockAction";static BlockActionBasePt="AcDbBlockActionWithBasePt";static BlockBasePointParameter="AcDbBlockBasePointParameter";static BlockBegin="AcDbBlockBegin";static BlockElement="AcDbBlockElement";static BlockEnd="AcDbBlockEnd";static BlockFlipAction="AcDbBlockFlipAction";static BlockFlipGrip="AcDbBlockFlipGrip";static BlockFlipParameter="AcDbBlockFlipParameter";static BlockGrip="AcDbBlockGrip";static BlockGripExpression="AcDbBlockGripExpr";static BlockLinearParameter="AcDbBlockLinearParameter";static BlockParameter="AcDbBlockParameter";static BlockRecord="AcDbBlockTableRecord";static BlockRepresentationData="AcDbBlockRepresentationData";static BlockRotationAction="AcDbBlockRotationAction";static BlockRotationGrip="AcDbBlockRotationGrip";static BlockRotationParameter="AcDbBlockRotationParameter";static BlockVisibilityGrip="AcDbBlockVisibilityGrip";static BlockVisibilityParameter="AcDbBlockVisibilityParameter";static CellStyleMap="AcDbCellStyleMap";static Circle="AcDbCircle";static DbColor="AcDbColor";static DiametricDimension="AcDbDiametricDimension";static Dictionary="AcDbDictionary";static DictionaryVar="AcDbDictionaryVar";static DictionaryVariables="DictionaryVariables";static DictionaryWithDefault="AcDbDictionaryWithDefault";static Dimension="AcDbDimension";static DimensionStyle="AcDbDimStyleTableRecord";static DimensionStyleTable="AcDbDimStyleTable";static DimensionAssociation="AcDbDimAssoc";static Ellipse="AcDbEllipse";static Entity="AcDbEntity";static EvalGraph="AcDbEvalGraph";static EvalGraphExpr="AcDbEvalExpr";static Face3d="AcDbFace";static Field="AcDbField";static FieldList="AcDbFieldList";static Filter="AcDbFilter";static FormattedTableData="AcDbFormattedTableData";static GeoData="AcDbGeoData";static Group="AcDbGroup";static Hatch="AcDbHatch";static Helix="AcDbHelix";static IdSet="AcDbIdSet";static Insert="AcDbBlockReference";static Layer="AcDbLayerTableRecord";static Layout="AcDbLayout";static Leader="AcDbLeader";static Line="AcDbLine";static LinearDimension="AcDbRotatedDimension";static Linetype="AcDbLinetypeTableRecord";static LinkedData="AcDbLinkedData";static LinkedTableData="AcDbLinkedTableData";static LwPolyline="AcDbPolyline";static Material="AcDbMaterial";static Mesh="AcDbSubDMesh";static MInsert="AcDbMInsertBlock";static MLeaderStyle="AcDbMLeaderStyle";static MLine="AcDbMline";static MLineStyle="AcDbMlineStyle";static ModelerGeometry="AcDbModelerGeometry";static MText="AcDbMText";static MTextAttributeObjectContextData="AcDbMTextAttributeObjectContextData";static MultiLeader="AcDbMLeader";static MultiLeaderObjectContextData="AcDbMLeaderObjectContextData";static ObjectContextData="AcDbObjectContextData";static Ole2Frame="AcDbOle2Frame";static OrdinateDimension="AcDbOrdinateDimension";static PdfDefinition="AcDbPdfDefinition";static PdfReference="AcDbPdfReference";static PlotSettings="AcDbPlotSettings";static Point="AcDbPoint";static PolyfaceMesh="AcDbPolyFaceMesh";static PolyfaceMeshFace="AcDbFaceRecord";static PolyfaceMeshVertex="AcDbPolyFaceMeshVertex";static PolygonMesh="AcDbPolygonMesh";static PolygonMeshVertex="AcDbPolygonMeshVertex";static Polyline="AcDb2dPolyline";static Polyline3d="AcDb3dPolyline";static Polyline3dVertex="AcDb3dPolylineVertex";static PolylineVertex="AcDb2dVertex";static ProxyEntity="AcDbProxyEntity";static ProxyObject="AcDbProxyObject";static RadialDimension="AcDbRadialDimension";static RasterImage="AcDbRasterImage";static RasterImageDef="AcDbRasterImageDef";static RasterImageDefReactor="AcDbRasterImageDefReactor";static RasterVariables="AcDbRasterVariables";static Ray="AcDbRay";static Scale="AcDbScale";static Shape="AcDbShape";static Solid="AcDbTrace";static Solid3D="AcDb3dSolid";static SortentsTable="AcDbSortentsTable";static SpatialFilter="AcDbSpatialFilter";static Spline="AcDbSpline";static Table="AcDbSymbolTable";static TableContent="AcDbTableContent";static TableEntity="AcDbTable";static TableRecord="AcDbSymbolTableRecord";static TableStyle="AcDbTableStyle";static Text="AcDbText";static TextStyle="AcDbTextStyleTableRecord";static Tolerance="AcDbFcf";static Trace="AcDbTrace";static Ucs="AcDbUCSTableRecord";static Underlay="AcDbUnderlayReference";static UnderlayDefinition="AcDbUnderlayDefinition";static Vertex="AcDbVertex";static View="AcDbViewTableRecord";static Viewport="AcDbViewport";static VisualStyle="AcDbVisualStyle";static VPort="AcDbViewportTableRecord";static Wipeout="AcDbWipeout";static XLine="AcDbXline";static XRecord="AcDbXrecord"}});var u,R=er(()=>{(function(r){r[r.UNLISTED=-999]="UNLISTED",r[r.INVALID=-1]="INVALID",r[r.UNDEFINED=0]="UNDEFINED",r[r.TEXT=1]="TEXT",r[r.ATTRIB=2]="ATTRIB",r[r.ATTDEF=3]="ATTDEF",r[r.BLOCK=4]="BLOCK",r[r.ENDBLK=5]="ENDBLK",r[r.SEQEND=6]="SEQEND",r[r.INSERT=7]="INSERT",r[r.MINSERT=8]="MINSERT",r[r.UNKNOW_9=9]="UNKNOW_9",r[r.VERTEX_2D=10]="VERTEX_2D",r[r.VERTEX_3D=11]="VERTEX_3D",r[r.VERTEX_MESH=12]="VERTEX_MESH",r[r.VERTEX_PFACE=13]="VERTEX_PFACE",r[r.VERTEX_PFACE_FACE=14]="VERTEX_PFACE_FACE",r[r.POLYLINE_2D=15]="POLYLINE_2D",r[r.POLYLINE_3D=16]="POLYLINE_3D",r[r.ARC=17]="ARC",r[r.CIRCLE=18]="CIRCLE",r[r.LINE=19]="LINE",r[r.DIMENSION_ORDINATE=20]="DIMENSION_ORDINATE",r[r.DIMENSION_LINEAR=21]="DIMENSION_LINEAR",r[r.DIMENSION_ALIGNED=22]="DIMENSION_ALIGNED",r[r.DIMENSION_ANG_3_Pt=23]="DIMENSION_ANG_3_Pt",r[r.DIMENSION_ANG_2_Ln=24]="DIMENSION_ANG_2_Ln",r[r.DIMENSION_RADIUS=25]="DIMENSION_RADIUS",r[r.DIMENSION_DIAMETER=26]="DIMENSION_DIAMETER",r[r.POINT=27]="POINT",r[r.FACE3D=28]="FACE3D",r[r.POLYLINE_PFACE=29]="POLYLINE_PFACE",r[r.POLYLINE_MESH=30]="POLYLINE_MESH",r[r.SOLID=31]="SOLID",r[r.TRACE=32]="TRACE",r[r.SHAPE=33]="SHAPE",r[r.VIEWPORT=34]="VIEWPORT",r[r.ELLIPSE=35]="ELLIPSE",r[r.SPLINE=36]="SPLINE",r[r.REGION=37]="REGION",r[r.SOLID3D=38]="SOLID3D",r[r.BODY=39]="BODY",r[r.RAY=40]="RAY",r[r.XLINE=41]="XLINE",r[r.DICTIONARY=42]="DICTIONARY",r[r.OLEFRAME=43]="OLEFRAME",r[r.MTEXT=44]="MTEXT",r[r.LEADER=45]="LEADER",r[r.TOLERANCE=46]="TOLERANCE",r[r.MLINE=47]="MLINE",r[r.BLOCK_CONTROL_OBJ=48]="BLOCK_CONTROL_OBJ",r[r.BLOCK_HEADER=49]="BLOCK_HEADER",r[r.LAYER_CONTROL_OBJ=50]="LAYER_CONTROL_OBJ",r[r.LAYER=51]="LAYER",r[r.STYLE_CONTROL_OBJ=52]="STYLE_CONTROL_OBJ",r[r.STYLE=53]="STYLE",r[r.UNKNOW_36=54]="UNKNOW_36",r[r.UNKNOW_37=55]="UNKNOW_37",r[r.LTYPE_CONTROL_OBJ=56]="LTYPE_CONTROL_OBJ",r[r.LTYPE=57]="LTYPE",r[r.UNKNOW_3A=58]="UNKNOW_3A",r[r.UNKNOW_3B=59]="UNKNOW_3B",r[r.VIEW_CONTROL_OBJ=60]="VIEW_CONTROL_OBJ",r[r.VIEW=61]="VIEW",r[r.UCS_CONTROL_OBJ=62]="UCS_CONTROL_OBJ",r[r.UCS=63]="UCS",r[r.VPORT_CONTROL_OBJ=64]="VPORT_CONTROL_OBJ",r[r.VPORT=65]="VPORT",r[r.APPID_CONTROL_OBJ=66]="APPID_CONTROL_OBJ",r[r.APPID=67]="APPID",r[r.DIMSTYLE_CONTROL_OBJ=68]="DIMSTYLE_CONTROL_OBJ",r[r.DIMSTYLE=69]="DIMSTYLE",r[r.VP_ENT_HDR_CTRL_OBJ=70]="VP_ENT_HDR_CTRL_OBJ",r[r.VP_ENT_HDR=71]="VP_ENT_HDR",r[r.GROUP=72]="GROUP",r[r.MLINESTYLE=73]="MLINESTYLE",r[r.OLE2FRAME=74]="OLE2FRAME",r[r.DUMMY=75]="DUMMY",r[r.LONG_TRANSACTION=76]="LONG_TRANSACTION",r[r.LWPOLYLINE=77]="LWPOLYLINE",r[r.HATCH=78]="HATCH",r[r.XRECORD=79]="XRECORD",r[r.ACDBPLACEHOLDER=80]="ACDBPLACEHOLDER",r[r.VBA_PROJECT=81]="VBA_PROJECT",r[r.LAYOUT=82]="LAYOUT",r[r.ACAD_PROXY_ENTITY=498]="ACAD_PROXY_ENTITY",r[r.ACAD_PROXY_OBJECT=499]="ACAD_PROXY_OBJECT"})(u||(u={}))});var p,q=er(()=>{(function(r){r[r.Invalid=-9999]="Invalid",r[r.XDictionary=-6]="XDictionary",r[r.PReactors=-5]="PReactors",r[r.Operator=-4]="Operator",r[r.XDataStart=-3]="XDataStart",r[r.HeaderId=-2]="HeaderId",r[r.FirstEntityId=-2]="FirstEntityId",r[r.End=-1]="End",r[r.Start=0]="Start",r[r.Text=1]="Text",r[r.XRefPath=1]="XRefPath",r[r.ShapeName=2]="ShapeName",r[r.BlockName=2]="BlockName",r[r.AttributeTag=2]="AttributeTag",r[r.SymbolTableName=2]="SymbolTableName",r[r.MlineStyleName=2]="MlineStyleName",r[r.SymbolTableRecordName=2]="SymbolTableRecordName",r[r.AttributePrompt=3]="AttributePrompt",r[r.DimStyleName=3]="DimStyleName",r[r.LinetypeProse=3]="LinetypeProse",r[r.TextFontFile=3]="TextFontFile",r[r.Description=3]="Description",r[r.DimPostString=3]="DimPostString",r[r.TextBigFontFile=4]="TextBigFontFile",r[r.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",r[r.CLShapeName=4]="CLShapeName",r[r.SymbolTableRecordComments=4]="SymbolTableRecordComments",r[r.Handle=5]="Handle",r[r.DimensionBlock=5]="DimensionBlock",r[r.DimBlk1=6]="DimBlk1",r[r.LinetypeName=6]="LinetypeName",r[r.DimBlk2=7]="DimBlk2",r[r.TextStyleName=7]="TextStyleName",r[r.LayerName=8]="LayerName",r[r.CLShapeText=9]="CLShapeText",r[r.XCoordinate=10]="XCoordinate",r[r.YCoordinate=20]="YCoordinate",r[r.ZCoordinate=30]="ZCoordinate",r[r.Elevation=38]="Elevation",r[r.Thickness=39]="Thickness",r[r.Real=40]="Real",r[r.ViewportHeight=40]="ViewportHeight",r[r.TxtSize=40]="TxtSize",r[r.TxtStyleXScale=41]="TxtStyleXScale",r[r.ViewWidth=41]="ViewWidth",r[r.ViewportAspect=41]="ViewportAspect",r[r.TxtStylePSize=42]="TxtStylePSize",r[r.ViewLensLength=42]="ViewLensLength",r[r.ViewFrontClip=43]="ViewFrontClip",r[r.ViewBackClip=44]="ViewBackClip",r[r.ShapeXOffset=44]="ShapeXOffset",r[r.ShapeYOffset=45]="ShapeYOffset",r[r.ViewHeight=45]="ViewHeight",r[r.ShapeScale=46]="ShapeScale",r[r.PixelScale=47]="PixelScale",r[r.LinetypeScale=48]="LinetypeScale",r[r.DashLength=49]="DashLength",r[r.MlineOffset=49]="MlineOffset",r[r.LinetypeElement=49]="LinetypeElement",r[r.Angle=50]="Angle",r[r.ViewportSnapAngle=50]="ViewportSnapAngle",r[r.ViewportTwist=51]="ViewportTwist",r[r.Visibility=60]="Visibility",r[r.LayerLinetype=61]="LayerLinetype",r[r.Color=62]="Color",r[r.HasSubentities=66]="HasSubentities",r[r.ViewportVisibility=67]="ViewportVisibility",r[r.ViewportActive=68]="ViewportActive",r[r.ViewportNumber=69]="ViewportNumber",r[r.Int16=70]="Int16",r[r.ViewMode=71]="ViewMode",r[r.CircleSides=72]="CircleSides",r[r.ViewportZoom=73]="ViewportZoom",r[r.ViewportIcon=74]="ViewportIcon",r[r.ViewportSnap=75]="ViewportSnap",r[r.ViewportGrid=76]="ViewportGrid",r[r.ViewportSnapStyle=77]="ViewportSnapStyle",r[r.ViewportSnapPair=78]="ViewportSnapPair",r[r.RegAppFlags=71]="RegAppFlags",r[r.TxtStyleFlags=71]="TxtStyleFlags",r[r.LinetypeAlign=72]="LinetypeAlign",r[r.LinetypePdc=73]="LinetypePdc",r[r.Int32=90]="Int32",r[r.Subclass=100]="Subclass",r[r.EmbeddedObjectStart=101]="EmbeddedObjectStart",r[r.ControlString=102]="ControlString",r[r.DimVarHandle=105]="DimVarHandle",r[r.UcsOrg=110]="UcsOrg",r[r.UcsOrientationX=111]="UcsOrientationX",r[r.UcsOrientationY=112]="UcsOrientationY",r[r.XReal=140]="XReal",r[r.ViewBrightness=141]="ViewBrightness",r[r.ViewContrast=142]="ViewContrast",r[r.Int64=160]="Int64",r[r.XInt16=170]="XInt16",r[r.NormalX=210]="NormalX",r[r.NormalY=220]="NormalY",r[r.NormalZ=230]="NormalZ",r[r.XXInt16=270]="XXInt16",r[r.Int8=280]="Int8",r[r.RenderMode=281]="RenderMode",r[r.Bool=290]="Bool",r[r.XTextString=300]="XTextString",r[r.BinaryChunk=310]="BinaryChunk",r[r.ArbitraryHandle=320]="ArbitraryHandle",r[r.SoftPointerId=330]="SoftPointerId",r[r.HardPointerId=340]="HardPointerId",r[r.SoftOwnershipId=350]="SoftOwnershipId",r[r.HardOwnershipId=360]="HardOwnershipId",r[r.LineWeight=370]="LineWeight",r[r.PlotStyleNameType=380]="PlotStyleNameType",r[r.PlotStyleNameId=390]="PlotStyleNameId",r[r.ExtendedInt16=400]="ExtendedInt16",r[r.LayoutName=410]="LayoutName",r[r.ColorRgb=420]="ColorRgb",r[r.ColorName=430]="ColorName",r[r.Alpha=440]="Alpha",r[r.GradientObjType=450]="GradientObjType",r[r.GradientPatType=451]="GradientPatType",r[r.GradientTintType=452]="GradientTintType",r[r.GradientColCount=453]="GradientColCount",r[r.GradientAngle=460]="GradientAngle",r[r.GradientShift=461]="GradientShift",r[r.GradientTintVal=462]="GradientTintVal",r[r.GradientColVal=463]="GradientColVal",r[r.GradientName=470]="GradientName",r[r.Comment=999]="Comment",r[r.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",r[r.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",r[r.ExtendedDataControlString=1002]="ExtendedDataControlString",r[r.ExtendedDataLayerName=1003]="ExtendedDataLayerName",r[r.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",r[r.ExtendedDataHandle=1005]="ExtendedDataHandle",r[r.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",r[r.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",r[r.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",r[r.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",r[r.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",r[r.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",r[r.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",r[r.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",r[r.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",r[r.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",r[r.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",r[r.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",r[r.ExtendedDataReal=1040]="ExtendedDataReal",r[r.ExtendedDataDist=1041]="ExtendedDataDist",r[r.ExtendedDataScale=1042]="ExtendedDataScale",r[r.ExtendedDataInteger16=1070]="ExtendedDataInteger16",r[r.ExtendedDataInteger32=1071]="ExtendedDataInteger32"})(p||(p={}))});var io,ae,bt=er(()=>{io=class{get code(){return this._code}get rawValue(){return this._value}_code;_value;constructor(e,t){this._code=e,this._value=t}toString(){return`${this.code}:${this._value}`}static create(e,t){throw new Error("ExtendedDataRecord factory not initialized")}},ae=class extends io{get value(){return this._value}set value(e){this._value=e}constructor(e,t){super(e,t)}}});var Pe,wn=er(()=>{q();bt();Pe=class r extends io{static get open(){return new r(!1)}static get close(){return new r(!0)}isClosing;get value(){return this.isClosing?"}":"{"}constructor(e){super(p.ExtendedDataControlString,e?"}":"{"),this.isClosing=e}}});var so,mh=er(()=>{wn();so=class{records=[];constructor(e){e&&this.records.push(...e)}addControlStrings(){if(this.records.length===0){this.records.push(Pe.open),this.records.push(Pe.close);return}let e=this.records[0];e instanceof Pe?e.isClosing&&this.records.unshift(Pe.open):this.records.unshift(Pe.open);let t=this.records[this.records.length-1];t instanceof Pe?t.isClosing||this.records.push(Pe.close):this.records.push(Pe.close)}}});var no,fh=er(()=>{mh();no=class{get document(){return this.owner?.document??null}owner;_data=new Map;constructor(e){this.owner=e}addByAppId(e,t){t===void 0&&(t=new so),this.document!=null?this._data.set(e,t):this._data.set(e,t)}addByName(e,t){this.addByAppId({name:e},t)}addWithRecords(e,t){this._data.set(e,new so(t))}clear(){this._data.clear()}containsKey(e){return this._data.has(e)}containsKeyName(e){for(let t of this._data.keys())if(t.name===e)return!0;return!1}getByName(e){let i=this.getExtendedDataByName().get(e.toUpperCase());if(!i)throw new Error(`AppId '${e}' not found`);return i}get(e){let t=this._data.get(e);if(!t)throw new Error("AppId not found");return t}get size(){return this._data.size}entries(){return this._data.entries()}add(e,t){this._data.set(e,t)}set(e,t){this._data.set(e,t)}[Symbol.iterator](){return this._data.entries()}getExtendedDataByName(){let e=new Map;for(let[t,i]of this._data)e.set(t.name.toUpperCase(),i);return e}tryAdd(e,t){let i=this.tryGetByName(e);return i.found?i.value:(this.addByName(e,t),t)}tryGet(e){let t=this._data.get(e);return t?{value:t,found:!0}:{value:null,found:!1}}tryGetByName(e){let i=this.getExtendedDataByName().get(e.toUpperCase());return i?{value:i,found:!0}:{value:null,found:!1}}}});var O,J=er(()=>{Te();R();O=class extends I{onNameChanged=null;get name(){return this._name}set name(e){this.onNameChanged?.call(this,this,{oldName:this._name,newName:e}),this._name=e}get objectType(){return u.UNLISTED}_name="";constructor(e){super(),e&&(this.name=e)}clone(){let e=super.clone();return e.onNameChanged=null,e}toString(){return this._name?`${this.objectName}:${this._name}:${this.handle}`:`${this.objectName}:${this.handle}`}}});var tr,rl=er(()=>{tr=class{item;constructor(e){this.item=e}}});var bs,il=er(()=>{(function(r){r[r.NotApplicable=0]="NotApplicable",r[r.KeepExisting=1]="KeepExisting",r[r.UseClone=2]="UseClone",r[r.XrefName=3]="XrefName",r[r.Name=4]="Name",r[r.UnmangleName=5]="UnmangleName"})(bs||(bs={}))});var Rc={};Nc(Rc,{CadDictionary:()=>xe,DictionaryCloningFlags:()=>bs});var xe,kr=er(()=>{J();rl();D();x();R();il();il();xe=class r extends O{onAdd=null;onRemove=null;clonningFlags=bs.NotApplicable;get entryHandles(){return[...this._entries.values()].map(e=>e.handle)}get entryNames(){return[...this._entries.keys()]}hardOwnerFlag=!1;get objectName(){return d.ObjectDictionary}get objectType(){return u.DICTIONARY}get subclassMarker(){return l.Dictionary}static AcadColor="ACAD_COLOR";static AcadFieldList="ACAD_FIELDLIST";static AcadGroup="ACAD_GROUP";static AcadImageDict="ACAD_IMAGE_DICT";static AcadLayout="ACAD_LAYOUT";static AcadMaterial="ACAD_MATERIAL";static AcadMLeaderStyle="ACAD_MLEADERSTYLE";static AcadMLineStyle="ACAD_MLINESTYLE";static AcadPdfDefinitions="ACAD_PDFDEFINITIONS";static AcadPlotSettings="ACAD_PLOTSETTINGS";static AcadPlotStyleName="ACAD_PLOTSTYLENAME";static AcadScaleList="ACAD_SCALELIST";static AcadSortEnts="ACAD_SORTENTS";static AcadTableStyle="ACAD_TABLESTYLE";static AcadVisualStyle="ACAD_VISUALSTYLE";static GeographicData="ACAD_GEOGRAPHICDATA";static Root="ROOT";static VariableDictionary="AcDbVariableDictionary";_entries=new Map;constructor(e){super(e)}static createDefaultEntries(e){e.tryAdd(new r(r.AcadColor)),e.tryAdd(new r(r.AcadGroup)),e.tryAdd(new r(r.AcadLayout)),e.tryAdd(new r(r.AcadMaterial)),e.tryAdd(new r(r.AcadSortEnts)),e.tryAdd(new r(r.AcadMLeaderStyle)),e.tryAdd(new r(r.AcadMLineStyle)),e.tryAdd(new r(r.AcadTableStyle)),e.tryAdd(new r(r.AcadPlotSettings)),e.tryAdd(new r(r.VariableDictionary)),e.tryAdd(new r(r.AcadScaleList)),e.tryAdd(new r(r.AcadVisualStyle)),e.tryAdd(new r(r.AcadFieldList)),e.tryAdd(new r(r.AcadImageDict))}static createRoot(){let e=new r(r.Root);return r.createDefaultEntries(e),e}addByKey(e,t){if(!e)throw new Error("NonGraphicalObject must have a name");this._entries.set(e.toLowerCase(),t),t.owner=this,this.onAdd?.call(this,this,new tr(t))}add(e){this.addByKey(e.name,e)}clear(){for(let[e]of this._entries)this.remove(e)}clone(){let e=super.clone();e.onAdd=null,e.onRemove=null,e._entries=new Map;for(let t of this._entries.values())e.add(t.clone());return e}containsKey(e){return this._entries.has(e.toLowerCase())}getEntry(e){return this._entries.get(e.toLowerCase())??null}remove(e){let t=this._entries.get(e.toLowerCase());return t?(this._entries.delete(e.toLowerCase()),t.owner=null,this.onRemove?.call(this,this,new tr(t)),!0):!1}tryAdd(e){return this._entries.has(e.name.toLowerCase())?!1:(this.add(e),!0)}get(e){return this._entries.get(e.toLowerCase())}[Symbol.iterator](){return this._entries.values()}}});var I,Te=er(()=>{fh();I=class r{document=null;extendedData;handle=0;get hasDynamicSubclass(){return!1}get objectName(){return""}owner=null;get reactors(){return this._reactors}get xDictionary(){return this._xdictionary}set xDictionary(e){e!=null&&(this._xdictionary=e,this._xdictionary.owner=this,this.document!=null&&this.document.registerCollection(this._xdictionary))}_reactors=[];_xdictionary=null;constructor(){this.extendedData=new no(this)}addReactor(e){this._reactors.push(e)}cleanReactors(){let e=[...this._reactors];for(let t of e)if(t.document!==this.document){let i=this._reactors.indexOf(t);i>=0&&this._reactors.splice(i,1)}}clone(){let e=Object.create(Object.getPrototypeOf(this));return Object.assign(e,this),e.handle=0,e.document=null,e.owner=null,e._reactors=[],e.extendedData=new no(e),e.xDictionary=this._xdictionary?.clone()??null,e}createExtendedDictionary(){if(this._xdictionary==null){let{CadDictionary:e}=(kr(),Ic(Rc));this.xDictionary=new e}return this._xdictionary}removeReactor(e){let t=this._reactors.indexOf(e);return t>=0?(this._reactors.splice(t,1),!0):!1}toString(){return`${this.objectName}:${this.handle}`}assignDocument(e){if(this.document=e,this.xDictionary!=null&&e.registerCollection(this.xDictionary),this.extendedData.size>0){let t=[...this.extendedData.entries()];this.extendedData.clear();for(let[i,s]of t)this.extendedData.add(i,s)}}unassignDocument(){if(this.xDictionary!=null&&this.document?.unregisterCollection(this.xDictionary),this.handle=0,this.document=null,this.extendedData.size>0){let e=[...this.extendedData.entries()];this.extendedData.clear();for(let[t,i]of e)this.extendedData.add(t,i)}this._reactors=[]}static updateCollection(e,t){return t==null||e==null?e:t.tryAdd(e)}static updateCollectionStatic(e,t){return r.updateCollection(e,t)}updateCollection(e,t){return r.updateCollection(e,t)}}});var m;(function(r){r[r.Unknown=-1]="Unknown",r[r.MC0_0=0]="MC0_0",r[r.AC1_2=1]="AC1_2",r[r.AC1_4=2]="AC1_4",r[r.AC1_50=3]="AC1_50",r[r.AC2_10=4]="AC2_10",r[r.AC1002=5]="AC1002",r[r.AC1003=6]="AC1003",r[r.AC1004=7]="AC1004",r[r.AC1006=8]="AC1006",r[r.AC1009=9]="AC1009",r[r.AC1012=19]="AC1012",r[r.AC1014=21]="AC1014",r[r.AC1015=23]="AC1015",r[r.AC1018=25]="AC1018",r[r.AC1021=27]="AC1021",r[r.AC1024=29]="AC1024",r[r.AC1027=31]="AC1027",r[r.AC1032=33]="AC1032"})(m||(m={}));D();x();R();var ne;(function(r){r[r.None=0]="None",r[r.Anonymous=1]="Anonymous",r[r.NonConstantAttributeDefinitions=2]="NonConstantAttributeDefinitions",r[r.XRef=4]="XRef",r[r.XRefOverlay=8]="XRefOverlay",r[r.XRefDependent=16]="XRefDependent",r[r.XRefResolved=32]="XRefResolved",r[r.Referenced=64]="Referenced"})(ne||(ne={}));Te();var B=class r{static get Black(){return new r(250)}static get Blue(){return new r(5)}static get ByBlock(){return r.fromIndex(0)}static get ByEntity(){return r.fromIndex(257)}static get ByLayer(){return r.fromIndex(256)}static get Cyan(){return new r(4)}static get DarkGray(){return new r(8)}static get Default(){return new r(7)}static get Green(){return new r(3)}static get LightGray(){return new r(9)}static get Magenta(){return new r(6)}static get Red(){return new r(1)}static get Yellow(){return new r(2)}get b(){return this.getRgb()[2]}get g(){return this.getRgb()[1]}get r(){return this.getRgb()[0]}get index(){return this.isTrueColor?-1:this._color}get isByBlock(){return this.index===0}get isByLayer(){return this.index===256}get isTrueColor(){return this._color>257||this._color<0}get trueColor(){return this.isTrueColor?this._color^1<<30:-1}static _maxTrueColor=16777216;static _trueColorFlag=1073741824;static _indexRgb=[[0,0,0],[255,0,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[255,0,255],[255,255,255],[128,128,128],[192,192,192],[255,0,0],[255,127,127],[165,0,0],[165,82,82],[127,0,0],[127,63,63],[76,0,0],[76,38,38],[38,0,0],[38,19,19],[255,63,0],[255,159,127],[165,41,0],[165,103,82],[127,31,0],[127,79,63],[76,19,0],[76,47,38],[38,9,0],[38,28,19],[255,127,0],[255,191,127],[165,82,0],[165,124,82],[127,63,0],[127,95,63],[76,38,0],[76,57,38],[38,19,0],[38,28,19],[255,191,0],[255,223,127],[165,124,0],[165,145,82],[127,95,0],[127,111,63],[76,57,0],[76,66,38],[38,28,0],[38,33,19],[255,255,0],[255,255,127],[165,165,0],[165,165,82],[127,127,0],[127,127,63],[76,76,0],[76,76,38],[38,38,0],[38,38,19],[191,255,0],[223,255,127],[124,165,0],[145,165,82],[95,127,0],[111,127,63],[57,76,0],[66,76,38],[28,38,0],[33,38,19],[127,255,0],[191,255,127],[82,165,0],[124,165,82],[63,127,0],[95,127,63],[38,76,0],[57,76,38],[19,38,0],[28,38,19],[63,255,0],[159,255,127],[41,165,0],[103,165,82],[31,127,0],[79,127,63],[19,76,0],[47,76,38],[9,38,0],[23,38,19],[0,255,0],[125,255,127],[0,165,0],[82,165,82],[0,127,0],[63,127,63],[0,76,0],[38,76,38],[0,38,0],[19,38,19],[0,255,63],[127,255,159],[0,165,41],[82,165,103],[0,127,31],[63,127,79],[0,76,19],[38,76,47],[0,38,9],[19,88,23],[0,255,127],[127,255,191],[0,165,82],[82,165,124],[0,127,63],[63,127,95],[0,76,38],[38,76,57],[0,38,19],[19,88,28],[0,255,191],[127,255,223],[0,165,124],[82,165,145],[0,127,95],[63,127,111],[0,76,57],[38,76,66],[0,38,28],[19,88,88],[0,255,255],[127,255,255],[0,165,165],[82,165,165],[0,127,127],[63,127,127],[0,76,76],[38,76,76],[0,38,38],[19,88,88],[0,191,255],[127,223,255],[0,124,165],[82,145,165],[0,95,127],[63,111,217],[0,57,76],[38,66,126],[0,28,38],[19,88,88],[0,127,255],[127,191,255],[0,82,165],[82,124,165],[0,63,127],[63,95,127],[0,38,76],[38,57,126],[0,19,38],[19,28,88],[0,63,255],[127,159,255],[0,41,165],[82,103,165],[0,31,127],[63,79,127],[0,19,76],[38,47,126],[0,9,38],[19,23,88],[0,0,255],[127,127,255],[0,0,165],[82,82,165],[0,0,127],[63,63,127],[0,0,76],[38,38,126],[0,0,38],[19,19,88],[63,0,255],[159,127,255],[41,0,165],[103,82,165],[31,0,127],[79,63,127],[19,0,76],[47,38,126],[9,0,38],[23,19,88],[127,0,255],[191,127,255],[165,0,82],[124,82,165],[63,0,127],[95,63,127],[38,0,76],[57,38,126],[19,0,38],[28,19,88],[191,0,255],[223,127,255],[124,0,165],[142,82,165],[95,0,127],[111,63,127],[57,0,76],[66,38,76],[28,0,38],[88,19,88],[255,0,255],[255,127,255],[165,0,165],[165,82,165],[127,0,127],[127,63,127],[76,0,76],[76,38,76],[38,0,38],[88,19,88],[255,0,191],[255,127,223],[165,0,124],[165,82,145],[127,0,95],[127,63,111],[76,0,57],[76,38,66],[38,0,28],[88,19,88],[255,0,127],[255,127,191],[165,0,82],[165,82,124],[127,0,63],[127,63,95],[76,0,38],[76,38,57],[38,0,19],[88,19,28],[255,0,63],[255,127,159],[165,0,41],[165,82,103],[127,0,31],[127,63,79],[76,0,19],[76,38,47],[38,0,9],[88,19,23],[0,0,0],[101,101,101],[102,102,102],[153,153,153],[204,204,204],[255,255,255]];_color;constructor(e,t,i){if(t!==void 0&&i!==void 0){let s=r._getInt24([e,t,i]);this._color=(s|r._trueColorFlag)>>>0}else{let s=e;s<0||s>257?this._color=256:this._color=s}}static fromIndex(e){let t=new r(0);return t._color=e,t}static fromTrueColor(e){let t=new r(0);return t._color=(e|r._trueColorFlag)>>>0,t}static getIndexRGB(e){return r._indexRgb[e]}static approxIndex(e,t,i){let s=-1;for(let n=0;n<r._indexRgb.length;n++){let a=e-r._indexRgb[n][0]+(t-r._indexRgb[n][1])+(i-r._indexRgb[n][2]);if(a===0)return n;if(a<s)return s=a,n}return 0}equals(e){return this._color===e._color}getApproxIndex(){return this.isTrueColor?r.approxIndex(this.r,this.g,this.b):this.index}getRgb(){return this.isTrueColor?this.getTrueColorRgb():r.getIndexRGB(this._color)}getTrueColorRgb(){return this.isTrueColor?r._getRGBfromTrueColor(this._color):[0,0,0]}toString(){if(this._color===0)return"ByBlock";if(this._color===256)return"ByLayer";if(this.isTrueColor){let e=this.getTrueColorRgb();return`True Color RGB:${e[0]},${e[1]},${e[2]}`}return`Indexed Color:${this.index}`}static _getInt24(e){return e[0]|e[1]<<8|e[2]<<16}static _getRGBfromTrueColor(e){return[e&255,e>>8&255,e>>16&255]}};D();x();R();var M;(function(r){r[r.ByDIPs=-4]="ByDIPs",r[r.Default=-3]="Default",r[r.ByBlock=-2]="ByBlock",r[r.ByLayer=-1]="ByLayer",r[r.W0=0]="W0",r[r.W5=5]="W5",r[r.W9=9]="W9",r[r.W13=13]="W13",r[r.W15=15]="W15",r[r.W18=18]="W18",r[r.W20=20]="W20",r[r.W25=25]="W25",r[r.W30=30]="W30",r[r.W35=35]="W35",r[r.W40=40]="W40",r[r.W50=50]="W50",r[r.W53=53]="W53",r[r.W60=60]="W60",r[r.W70=70]="W70",r[r.W80=80]="W80",r[r.W90=90]="W90",r[r.W100=100]="W100",r[r.W106=106]="W106",r[r.W120=120]="W120",r[r.W140=140]="W140",r[r.W158=158]="W158",r[r.W200=200]="W200",r[r.W211=211]="W211"})(M||(M={}));Te();Te();x();var Vt;(function(r){r[r.None=0]="None",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Vt||(Vt={}));var sl=class{oldName;newName;constructor(e,t){this.oldName=e,this.newName=t}};var De=class extends I{onNameChanged=null;flags=Vt.None;get name(){return this._name}set name(e){if(!e||!e.trim())throw new Error(`Table entry [${this.constructor.name}] must have a name`);this.onNameChanged&&this.onNameChanged(this,new sl(this._name,e)),this._name=e}get subclassMarker(){return l.TableRecord}_name="";constructor(e){if(super(),e!==void 0){if(!e)throw new Error(`${this.constructor.name} must have a name.`);this.name=e}}clone(){let e=super.clone();return e.onNameChanged=null,e}toString(){return`${this.objectName}:${this.name}`}};D();x();R();var Ze;(function(r){r[r.None=0]="None",r[r.RotationIsAbsolute=1]="RotationIsAbsolute",r[r.Text=2]="Text",r[r.Shape=4]="Shape"})(Ze||(Ze={}));var nl=class r{length=0;shapeFlags=Ze.None;shapeNumber=0;offset={x:0,y:0};rotation=0;scale=0;text="";style=null;owner=null;get isShape(){return(this.shapeFlags&Ze.Shape)!==0}clone(){let e=new r;return e.length=this.length,e.shapeFlags=this.shapeFlags,e.shapeNumber=this.shapeNumber,e.offset={...this.offset},e.rotation=this.rotation,e.scale=this.scale,e.text=this.text,e.style=this.style,e.owner=null,e}},H=class r extends De{static get ByBlock(){return new r("ByBlock")}static get ByLayer(){return new r("ByLayer")}static get Continuous(){return new r("Continuous")}alignment="A";description=null;get hasShapes(){return this._segments.some(e=>e.isShape)}get isComplex(){return this._segments.length>0}get objectName(){return d.TableLinetype}get objectType(){return u.LTYPE}get patternLength(){return this._segments.reduce((e,t)=>e+Math.abs(t.length),0)}get segments(){return this._segments}get subclassMarker(){return l.Linetype}static ByBlockName="ByBlock";static ByLayerName="ByLayer";static ContinuousName="Continuous";_segments=[];constructor(e){super(e)}addSegment(e){if(e.owner!=null)throw new Error(`Segment already assigned to a LineType: ${e.owner.name}`);e.owner=this,this._segments.push(e)}clone(){let e=super.clone();e._segments=[];for(let t of this._segments)e.addSegment(t.clone());return e}};var ze;(function(r){r[r.None=0]="None",r[r.Frozen=1]="Frozen",r[r.FrozenNewViewports=2]="FrozenNewViewports",r[r.Locked=4]="Locked",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(ze||(ze={}));var Se=class r extends De{static get Default(){return new r(r.DefaultName)}static get Defpoints(){let e=new r(r.DefpointsName);return e.plotFlag=!1,e}get color(){return this._color}set color(e){if(e.isByLayer||e.isByBlock)throw new Error("The layer color cannot be ByLayer or ByBlock");this._color=e}get layerFlags(){return this.flags}set layerFlags(e){this.flags=e}isOn=!0;lineType=null;lineWeight=M.Default;material=null;get objectName(){return d.TableLayer}get objectType(){return u.LAYER}get plotFlag(){return this._name.toLowerCase()===r.DefpointsName.toLowerCase()?!1:this._plotFlag}set plotFlag(e){this._plotFlag=e}plotStyleName=0;get subclassMarker(){return l.Layer}static DefaultName="0";static DefpointsName="defpoints";_color=new B(7);_plotFlag=!0;constructor(e){super(e)}clone(){return super.clone()}assignDocument(e){super.assignDocument(e),this.lineType=I.updateCollection(this.lineType??H.Continuous,e.lineTypes)}unassignDocument(){super.unassignDocument(),this.lineType=this.lineType?.clone?.()??H.Continuous}};var Ke=class r{static get ByLayer(){return new r(-1)}static get ByBlock(){return new r(100)}static get Opaque(){return new r(0)}get isByLayer(){return this._value===-1}get isByBlock(){return this._value===100}get value(){return this._value}set value(e){if(e===-1){this._value=e;return}if(e===100){this._value=e;return}if(e<0||e>90)throw new RangeError("Transparency must be in range from 0 to 90.");this._value=e}_value;constructor(e){this._value=-1,this.value=e}static toAlphaValue(e){let t=Math.round(255*(100-e.value)/100);return e.isByBlock?16777216:2<<24|t}static fromAlphaValue(e){let t=e&255,i=Math.round(100-t/255*100);return i===-1?r.ByLayer:i===100?r.ByBlock:i<0?new r(0):i>90?new r(90):new r(i)}};x();var C=class r{x;y;get dimension(){return 2}get 0(){return this.x}set 0(e){this.x=e}get 1(){return this.y}set 1(e){this.y=e}get X(){return this.x}set X(e){this.x=e}get Y(){return this.y}set Y(e){this.y=e}constructor(e=0,t=0){this.x=e,this.y=t}static Zero=new r(0,0);static AxisX=new r(1,0);static AxisY=new r(0,1);getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){let e=this.getLength();return e===0?new r:new r(this.x/e,this.y/e)}getAngle(){return Math.atan2(this.y,this.x)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}static Cross(e,t){return e.x*t.y-e.y*t.x}static Polar(e,t,i){return new r(e.x+i*Math.cos(t),e.y+i*Math.sin(t))}static Rotate(e,t){let i=Math.cos(t),s=Math.sin(t);return new r(e.x*i-e.y*s,e.x*s+e.y*i)}equals(e){return this.x===e.x&&this.y===e.y}};function ph(r){return r!=null&&typeof r=="object"&&"blockEntity"in r}var A=class extends I{bookColor=null;color=B.ByLayer;isInvisible=!1;get layer(){return this._layer}set layer(e){if(e==null)throw new Error("value cannot be null");this._layer=I.updateCollection(e,this.document?.layers??null)}get lineType(){return this._lineType}set lineType(e){if(e==null)throw new Error("value cannot be null");this._lineType=I.updateCollection(e,this.document?.lineTypes??null)}lineTypeScale=1;lineWeight=M.ByLayer;material=null;get subclassMarker(){return l.Entity}transparency=Ke.ByLayer;_bookColor=null;_layer=Se.Default;_lineType=H.ByLayer;constructor(){super()}applyRotation(e,t){}applyScaling(e,t){}applyTranslation(e){}clone(){let e=super.clone();return e._layer=this.layer.clone(),e._lineType=this.lineType.clone(),e.material=this.material?.clone?.()??null,e}getActiveColor(){let e;return this.color.isByLayer?e=this.layer.color:this.color.isByBlock&&ph(this.owner)?e=this.owner.blockEntity.color:e=this.color,e}getActiveLineType(){return this.lineType.name.toUpperCase()===H.ByLayerName.toUpperCase()?this.layer.lineType:this.lineType.name.toUpperCase()===H.ByBlockName.toUpperCase()&&ph(this.owner)?this.owner.blockEntity.lineType:this.lineType}getActiveLineWeightType(){switch(this.lineWeight){case M.ByLayer:return this.layer.lineWeight;case M.ByBlock:return ph(this.owner)?this.owner.blockEntity.getActiveLineWeightType():this.lineWeight;default:return this.lineWeight}}matchProperties(e){if(e==null)throw new Error("entity cannot be null");e.handle===0||this.document!==e.document?(this.layer=e.layer.clone(),this.lineType=e.lineType.clone(),this.material=e.material?.clone?.()??null):(this.layer=e.layer,this.lineType=e.lineType,this.material=e.material),this.color=e.color,this.lineWeight=e.lineWeight,this.lineTypeScale=e.lineTypeScale,this.isInvisible=e.isInvisible,this.transparency=e.transparency}assignDocument(e){super.assignDocument(e),this._layer=I.updateCollection(this.layer,e.layers),this._lineType=I.updateCollection(this.lineType,e.lineTypes),e.layers.onRemove=this._tableOnRemove.bind(this),e.lineTypes.onRemove=this._tableOnRemove.bind(this)}unassignDocument(){super.unassignDocument(),this._layer=this.layer.clone(),this._lineType=this.lineType.clone()}applyRotationToPoints(e,t){if(e==null)throw new Error("points cannot be null");if(Math.abs(t)<1e-12)return[...e];let i=Math.sin(t),s=Math.cos(t),n=[];for(let a of e)n.push(new C(a.x*s-a.y*i,a.x*i+a.y*s));return n}applyWorldMatrix(e,t,i,s){return e}getWorldMatrix(e,t,i){return{matrix:null,transOW:null,transWO:null}}_tableOnRemove(e,t){t.item===this.layer&&(this.layer=this.document.layers.get(Se.DefaultName)),t.item===this.lineType&&(this.lineType=this.document.lineTypes.get(H.ByLayerName))}transformNormal(e,t){return t}};var c=class r{x;y;z;get dimension(){return 3}get 0(){return this.x}set 0(e){this.x=e}get 1(){return this.y}set 1(e){this.y=e}get 2(){return this.z}set 2(e){this.z=e}get X(){return this.x}set X(e){this.x=e}get Y(){return this.y}set Y(e){this.y=e}get Z(){return this.z}set Z(e){this.z=e}constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}static Zero=new r(0,0,0);static AxisX=new r(1,0,0);static AxisY=new r(0,1,0);static AxisZ=new r(0,0,1);static NaN=new r(Number.NaN,Number.NaN,Number.NaN);getLength(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){let e=this.getLength();return e===0?new r:new r(this.x/e,this.y/e,this.z/e)}getAngle(){return Math.atan2(this.y,this.x)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new r(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}static Cross(e,t){return new r(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)}static equals(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}};var Tc=new c(0,0,0),Pr=class extends A{basePoint=Tc;get blockOwner(){return this.owner}comments=null;flags=ne.None;isUnloaded=!1;get name(){return this.blockOwner?.name??""}set name(e){this.blockOwner&&(this.blockOwner.name=e)}get objectName(){return d.Block}get objectType(){return u.BLOCK}get subclassMarker(){return l.BlockBegin}xRefPath=null;constructor(e){super(),e&&(this.owner=e)}clone(){return super.clone()}applyTransform(e){}getBoundingBox(){return null}};D();x();R();var gs=class extends A{get objectName(){return d.EndBlock}get objectType(){return u.ENDBLK}get subclassMarker(){return l.BlockEnd}constructor(e){super(),e&&(this.owner=e)}clone(){return super.clone()}applyTransform(e){}getBoundingBox(){return null}};Te();var Or=class{title="";subject="";author="";keywords="";comments="";lastSavedBy="";revisionNumber="";hyperlinkBase="";createdDate=new Date;modifiedDate=new Date;properties=new Map};var y;(function(r){r[r.Unknown=0]="Unknown",r[r.Usascii=20127]="Usascii",r[r.Iso88591=28591]="Iso88591",r[r.Iso88592=28592]="Iso88592",r[r.Iso88593=28593]="Iso88593",r[r.Iso88594=28594]="Iso88594",r[r.Iso88595=28595]="Iso88595",r[r.Iso88596=28596]="Iso88596",r[r.Iso88597=28597]="Iso88597",r[r.Iso88598=28598]="Iso88598",r[r.Iso88599=28599]="Iso88599",r[r.Iso885910=28600]="Iso885910",r[r.Iso885913=28603]="Iso885913",r[r.Iso885915=28605]="Iso885915",r[r.Ibm437=437]="Ibm437",r[r.Ibm737=737]="Ibm737",r[r.Ibm775=775]="Ibm775",r[r.Ibm850=850]="Ibm850",r[r.Ibm852=852]="Ibm852",r[r.Ibm855=855]="Ibm855",r[r.Ibm857=857]="Ibm857",r[r.Ibm860=860]="Ibm860",r[r.Ibm861=861]="Ibm861",r[r.Ibm863=863]="Ibm863",r[r.Ibm864=864]="Ibm864",r[r.Ibm865=865]="Ibm865",r[r.Ibm869=869]="Ibm869",r[r.Dos720=720]="Dos720",r[r.Cp866=866]="Cp866",r[r.Shift_jis=932]="Shift_jis",r[r.Gb2312=936]="Gb2312",r[r.Ksc5601=949]="Ksc5601",r[r.big5=950]="big5",r[r.Johab=1361]="Johab",r[r.Macintosh=1e4]="Macintosh",r[r.Xmacromanian=10010]="Xmacromanian",r[r.Windows874=874]="Windows874",r[r.Windows1250=1250]="Windows1250",r[r.Windows1251=1251]="Windows1251",r[r.Windows1252=1252]="Windows1252",r[r.Windows1253=1253]="Windows1253",r[r.Windows1254=1254]="Windows1254",r[r.Windows1255=1255]="Windows1255",r[r.Windows1256=1256]="Windows1256",r[r.Windows1257=1257]="Windows1257",r[r.Windows1258=1258]="Windows1258",r[r.Utf16=1200]="Utf16"})(y||(y={}));var Z=class r{static _dxfEncodingMap=new Map([["gb2312",y.Gb2312],["kcs5601",y.Ksc5601],["ascii",y.Usascii],["big5",y.big5],["johab",y.Johab],["mac-roman",y.Xmacromanian],["dos437",y.Ibm437],["dos850",y.Ibm850],["dos852",y.Ibm852],["dos737",y.Ibm737],["dos866",y.Cp866],["dos855",y.Ibm855],["dos857",y.Ibm857],["dos860",y.Ibm860],["dos861",y.Ibm861],["dos863",y.Ibm863],["dos864",y.Ibm864],["dos865",y.Ibm865],["dos869",y.Ibm869],["dos720",y.Dos720],["dos775",y.Ibm775],["dos932",y.Shift_jis],["dos950",y.big5],["ansi_874",y.Windows874],["ansi_932",y.Shift_jis],["ansi_936",y.Gb2312],["ansi_950",y.big5],["ansi_1250",y.Windows1250],["ansi1250",y.Windows1250],["ansi_1251",y.Windows1251],["ansi1251",y.Windows1251],["ansi_1252",y.Windows1252],["ansi1252",y.Windows1252],["ansi_1253",y.Windows1253],["ansi1253",y.Windows1253],["ansi_1254",y.Windows1254],["ansi1254",y.Windows1254],["ansi_1255",y.Windows1255],["ansi1255",y.Windows1255],["ansi_1256",y.Windows1256],["ansi1256",y.Windows1256],["ansi_1257",y.Windows1257],["ansi1257",y.Windows1257],["iso8859-1",y.Iso88591],["iso88591",y.Iso88591],["iso8859-2",y.Iso88592],["iso88592",y.Iso88592],["iso8859-3",y.Iso88593],["iso88593",y.Iso88593],["iso8859-4",y.Iso88594],["iso88594",y.Iso88594],["iso8859-5",y.Iso88595],["iso88595",y.Iso88595],["iso8859-6",y.Iso88596],["iso88596",y.Iso88596],["iso8859-7",y.Iso88597],["iso88597",y.Iso88597],["iso8859-8",y.Iso88598],["iso88598",y.Iso88598],["iso8859-9",y.Iso88599],["iso88599",y.Iso88599],["iso8859-10",y.Iso885910],["iso885910",y.Iso885910],["iso8859-13",y.Iso885913],["iso885913",y.Iso885913],["iso885915",y.Iso885915],["iso8859-15",y.Iso885915]]);static _indexedValue=[M.W0,M.W5,M.W9,M.W13,M.W15,M.W18,M.W20,M.W25,M.W30,M.W35,M.W40,M.W50,M.W53,M.W60,M.W70,M.W80,M.W90,M.W100,M.W106,M.W120,M.W140,M.W158,M.W200,M.W211];static _pageCodes=[y.Unknown,y.Usascii,y.Iso88591,y.Iso88592,y.Iso88593,y.Iso88594,y.Iso88595,y.Iso88596,y.Iso88597,y.Iso88598,y.Iso88599,y.Ibm437,y.Ibm850,y.Ibm852,y.Ibm855,y.Ibm857,y.Ibm860,y.Ibm861,y.Ibm863,y.Ibm864,y.Ibm865,y.Ibm869,y.Shift_jis,y.Macintosh,y.big5,y.Ksc5601,y.Johab,y.Cp866,y.Windows1250,y.Windows1251,y.Windows1252,y.Gb2312,y.Windows1253,y.Windows1254,y.Windows1255,y.Windows1256,y.Windows1257,y.Windows874,y.Shift_jis,y.Gb2312,y.Ksc5601,y.big5,y.Johab,y.Utf16,y.Windows1258];static toValue(e){switch(e){case 28:case 29:return M.ByLayer;case 30:return M.ByBlock;case 31:return M.Default;default:return e<0||e>=r._indexedValue.length?M.Default:r._indexedValue[e]}}static toIndex(e){let t=0;switch(e){case M.Default:t=31;break;case M.ByBlock:t=30;break;case M.ByLayer:t=29;break;default:t=r._indexedValue.indexOf(e),t<0&&(t=31);break}return t}static getCodePage(e){return typeof e=="string"?r._dxfEncodingMap.get(e.toLowerCase())??y.Unknown:r._pageCodes[e]??y.Unknown}static getCodePageName(e){for(let[t,i]of r._dxfEncodingMap)if(i===e)return t}static getCodeIndex(e){return r._pageCodes.indexOf(e)}static getVersionFromName(e){let t=e.replace(/\./g,"_").toUpperCase(),i=m[t];return i!==void 0?i:m.Unknown}static getNameFromVersion(e){return m[e]?.replace(/_/g,".")??"Unknown"}static toJulianCalendar(e){let t=e.getFullYear(),i=e.getMonth()+1,s=e.getDate(),n=e.getHours(),a=e.getMinutes(),o=e.getSeconds(),h=e.getMilliseconds(),f=s+n/24+a/1440+(o+h/1e3)/86400;i<3&&(t-=1,i+=12);let b=Math.floor(t/100),S=2-b+Math.floor(b/4),N;t<0?N=Math.floor(365.25*t-.75):N=Math.floor(365.25*t);let L=Math.floor(30.6001*(i+1));return S+N+L+1720995+f}static fromJulianCalendar(e){if(e<1721426||e>5373484)throw new RangeError("The valid values range from 1721426 and 5373484.");let t=Math.floor(e),i=e-t,s=Math.floor((t-186721625e-2)/36524.25),a=t+1+s-Math.floor(s/4)+1524,o=Math.floor((a-122.1)/365.25),h=Math.floor(365.25*o),f=Math.floor((a-h)/30.6001),b=f<14?f-1:f-13,S=b>2?o-4716:o-4715,N=a-h-Math.floor(30.6001*f),L=Math.floor(i*24);i-=L/24;let j=Math.floor(i*1440);i-=j/1440;let we=i*86400,z=Math.floor(we),X=Math.floor((we-z)*1e3);return new Date(S,b-1,N,L,j,z,X)}static editingTime(e){let t=Math.floor(e),i=e-t,s=Math.floor(i*24);i-=s/24;let n=Math.floor(i*1440);i-=n/1440;let a=i*86400,o=Math.floor(a),h=Math.floor((a-o)*1e3);return{days:t,hours:s,minutes:n,seconds:o,milliseconds:h}}static dateToJulian(e){let t=new Date(1,0,1,12,0,0);if(e<t)return{jdate:0,milliseconds:0};let i=new Date(e.getTime()-12*36e5),s=i.getMonth()+1,n=Math.floor((14-s)/12),a=i.getFullYear()+4800-n,o=i.getDate()+Math.floor((153*(s+12*n-3)+2)/5)+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)-32045,h=i.getMilliseconds()+i.getSeconds()*1e3+i.getMinutes()*6e4+i.getHours()*36e5;return{jdate:o,milliseconds:h}}};var al;(function(r){r[r.CounterClockWise=0]="CounterClockWise",r[r.ClockWise=1]="ClockWise"})(al||(al={}));var _n;(function(r){r[r.DecimalDegrees=0]="DecimalDegrees",r[r.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",r[r.Gradians=2]="Gradians",r[r.Radians=3]="Radians",r[r.SurveyorsUnits=4]="SurveyorsUnits"})(_n||(_n={}));var Js;(function(r){r[r.None=0]="None",r[r.Scientific=1]="Scientific",r[r.Decimal=2]="Decimal",r[r.Engineering=3]="Engineering",r[r.Architectural=4]="Architectural",r[r.Fractional=5]="Fractional",r[r.WindowsDesktop=6]="WindowsDesktop"})(Js||(Js={}));var ie;(function(r){r[r.Unitless=0]="Unitless",r[r.Inches=1]="Inches",r[r.Feet=2]="Feet",r[r.Miles=3]="Miles",r[r.Millimeters=4]="Millimeters",r[r.Centimeters=5]="Centimeters",r[r.Meters=6]="Meters",r[r.Kilometers=7]="Kilometers",r[r.Microinches=8]="Microinches",r[r.Mils=9]="Mils",r[r.Yards=10]="Yards",r[r.Angstroms=11]="Angstroms",r[r.Nanometers=12]="Nanometers",r[r.Microns=13]="Microns",r[r.Decimeters=14]="Decimeters",r[r.Decameters=15]="Decameters",r[r.Hectometers=16]="Hectometers",r[r.Gigameters=17]="Gigameters",r[r.AstronomicalUnits=18]="AstronomicalUnits",r[r.LightYears=19]="LightYears",r[r.Parsecs=20]="Parsecs",r[r.USSurveyFeet=21]="USSurveyFeet",r[r.USSurveyInches=22]="USSurveyInches",r[r.USSurveyYards=23]="USSurveyYards"})(ie||(ie={}));D();x();R();var oe;(function(r){r[r.SuppressZeroFeetAndInches=0]="SuppressZeroFeetAndInches",r[r.ShowZeroFeetAndInches=1]="ShowZeroFeetAndInches",r[r.ShowZeroFeetSuppressZeroInches=2]="ShowZeroFeetSuppressZeroInches",r[r.SuppressZeroFeetShowZeroInches=3]="SuppressZeroFeetShowZeroInches",r[r.SuppressDecimalLeadingZeroes=4]="SuppressDecimalLeadingZeroes",r[r.SuppressDecimalTrailingZeroes=8]="SuppressDecimalTrailingZeroes",r[r.SuppressDecimalLeadingAndTrailingZeroes=12]="SuppressDecimalLeadingAndTrailingZeroes"})(oe||(oe={}));var jr;(function(r){r[r.DisplayAll=0]="DisplayAll",r[r.SuppressLeadingZeroes=1]="SuppressLeadingZeroes",r[r.SupressTrailingZeroes=2]="SupressTrailingZeroes",r[r.SupressAll=3]="SupressAll"})(jr||(jr={}));var It;(function(r){r[r.Horizontal=0]="Horizontal",r[r.Diagonal=1]="Diagonal",r[r.None=2]="None"})(It||(It={}));var ao=class r{get angularDecimalPlaces(){return this._angularDecimalPlaces}set angularDecimalPlaces(e){if(e<0)throw new RangeError("The number of decimal places must be equals or greater than zero.");this._angularDecimalPlaces=e}angularZeroHandling=jr.DisplayAll;decimalSeparator;degreesSymbol;feetInchesSeparator;feetSymbol;get fractionHeightScale(){return this._fractionHeightScale}set fractionHeightScale(e){if(e<=0)throw new RangeError("The fraction height scale must be greater than zero.");this._fractionHeightScale=e}fractionType;gradiansSymbol;inchesSymbol;get linearDecimalPlaces(){return this._linearDecimalPlaces}set linearDecimalPlaces(e){if(e<0)throw new RangeError("The number of decimal places must be equals or greater than zero.");this._linearDecimalPlaces=e}linearZeroHandling=oe.SuppressDecimalTrailingZeroes;minutesSymbol;radiansSymbol;secondsSymbol;get suppressAngularLeadingZeros(){return this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressAngularTrailingZeros(){return this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressLinearLeadingZeros(){return this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressLinearTrailingZeros(){return this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes}get suppressZeroFeet(){return this.linearZeroHandling===oe.SuppressZeroFeetAndInches||this.linearZeroHandling===oe.SuppressZeroFeetShowZeroInches}get suppressZeroInches(){return this.linearZeroHandling===oe.SuppressZeroFeetAndInches||this.linearZeroHandling===oe.ShowZeroFeetSuppressZeroInches}_angularDecimalPlaces;_fractionHeightScale;_linearDecimalPlaces;constructor(){this._linearDecimalPlaces=2,this._angularDecimalPlaces=0,this.decimalSeparator=".",this.feetInchesSeparator="-",this.degreesSymbol="\xB0",this.minutesSymbol="'",this.secondsSymbol='"',this.radiansSymbol="r",this.gradiansSymbol="g",this.feetSymbol="'",this.inchesSymbol='"',this._fractionHeightScale=1,this.fractionType=It.Horizontal}getZeroHandlingFormat(e=!1){let t,i,s;e?(t=this.angularDecimalPlaces,i=this.angularZeroHandling===jr.SuppressLeadingZeroes||this.angularZeroHandling===jr.SupressAll?"#":"0",s=this.angularZeroHandling===jr.SupressTrailingZeroes||this.angularZeroHandling===jr.SupressAll?"#":"0"):(t=this.linearDecimalPlaces,i=this.linearZeroHandling===oe.SuppressDecimalLeadingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes?"#":"0",s=this.linearZeroHandling===oe.SuppressDecimalTrailingZeroes||this.linearZeroHandling===oe.SuppressDecimalLeadingAndTrailingZeroes?"#":"0");let n=i+".";for(let a=0;a<t;a++)n+=s;return n}toArchitectural(e){let t=Math.trunc(e/12),i=e-12*t,s=Math.trunc(i);if(Math.abs(i)<1e-12)return t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`;let{numerator:n,denominator:a}=r.getFraction(i,Math.pow(2,this.linearDecimalPlaces));if(n===0)return s===0?t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:t===0?this.suppressZeroFeet?`${s}${this.inchesSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`;let o;this.suppressZeroFeet&&t===0?o="":o=t+this.feetSymbol+this.feetInchesSeparator;let h="";switch(this.fractionType){case It.Diagonal:h=`\\A1;${o}${s}{\\H${this.fractionHeightScale}x;\\S${n}#${a};}${this.inchesSymbol}`;break;case It.Horizontal:h=`\\A1;${o}${s}{\\H${this.fractionHeightScale}x;\\S${n}/${a};}${this.inchesSymbol}`;break;case It.None:h=`${o}${s} ${n}/${a}${this.inchesSymbol}`;break}return h}toDecimal(e,t=!1){return r.formatNumber(e,this.getZeroHandlingFormat(t),this.decimalSeparator)}toDegrees(e){let t=e*(180/Math.PI);return r.formatNumber(t,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.degreesSymbol}toDegreesMinutesSeconds(e){let t=e*(180/Math.PI),i=(t-Math.trunc(t))*60,s=(i-Math.trunc(i))*60;if(this.angularDecimalPlaces===0)return`${Math.round(t)}${this.degreesSymbol}`;if(this.angularDecimalPlaces===1||this.angularDecimalPlaces===2)return`${Math.trunc(t)}${this.degreesSymbol}${Math.round(i)}${this.minutesSymbol}`;if(this.angularDecimalPlaces===3||this.angularDecimalPlaces===4)return`${Math.trunc(t)}${this.degreesSymbol}${Math.trunc(i)}${this.minutesSymbol}${Math.round(s)}${this.secondsSymbol}`;let n="0."+"0".repeat(this.angularDecimalPlaces-4);return`${Math.trunc(t)}${this.degreesSymbol}${Math.trunc(i)}${this.minutesSymbol}${r.formatNumber(s,n,this.decimalSeparator)}${this.secondsSymbol}`}toEngineering(e){let t=Math.trunc(e/12),i=e-12*t;if(Math.abs(i)<1e-12)return t===0?this.suppressZeroFeet?`0${this.inchesSymbol}`:this.suppressZeroInches?`0${this.feetSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`:this.suppressZeroInches?`${t}${this.feetSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}0${this.inchesSymbol}`;let s=r.formatNumber(i,this.getZeroHandlingFormat(),this.decimalSeparator);return t===0?this.suppressZeroFeet?`${i}${this.inchesSymbol}`:`0${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`:`${t}${this.feetSymbol}${this.feetInchesSeparator}${s}${this.inchesSymbol}`}toFractional(e){let t=Math.trunc(e),{numerator:i,denominator:s}=r.getFraction(e,Math.pow(2,this.linearDecimalPlaces));if(i===0)return`${Math.trunc(e)}`;let n="";switch(this.fractionType){case It.Diagonal:n=`\\A1;${t}{\\H${this.fractionHeightScale}x;\\S${i}#${s};}`;break;case It.Horizontal:n=`\\A1;${t}{\\H${this.fractionHeightScale}x;\\S${i}/${s};}`;break;case It.None:{n=`${t===0?"":`${t} `}${i}/${s}`;break}}return n}toGradians(e){let t=e*(200/Math.PI);return r.formatNumber(t,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.gradiansSymbol}toRadians(e){return r.formatNumber(e,this.getZeroHandlingFormat(!0),this.decimalSeparator)+this.radiansSymbol}toScientific(e){return e.toExponential(this.linearDecimalPlaces).toUpperCase()}static getFraction(e,t){let i=Math.round((e-Math.trunc(e))*t),s=r.getGCD(i,t);s<=0&&(s=1),i=Math.trunc(i/s);let n=Math.trunc(t/s);return{numerator:i,denominator:n}}static getGCD(e,t){let i=e,s=t;for(;s!==0;){let n=i%s;i=s,s=n}return i}static formatNumber(e,t,i){let s=t.split("."),n=s[0]||"0",a=s[1]||"",o=a.length,h=n==="#",f=a.length>0&&a[0]==="#",b=e.toFixed(o);if(i!=="."&&(b=b.replace(".",i)),f&&b.includes(i)){for(;b.endsWith("0");)b=b.slice(0,-1);b.endsWith(i)&&(b=b.slice(0,-1))}return h&&(b.startsWith("0"+i)?b=b.slice(1):b.startsWith("-0"+i)&&(b="-"+b.slice(2))),b}};var qs;(function(r){r[r.BeforeDimensionText=0]="BeforeDimensionText",r[r.AboveDimensionText=1]="AboveDimensionText",r[r.None=2]="None"})(qs||(qs={}));var oo;(function(r){r[r.NoBackground=0]="NoBackground",r[r.DrawingBackgroundColor=1]="DrawingBackgroundColor",r[r.DimensionTextBackgroundColor=2]="DimensionTextBackgroundColor"})(oo||(oo={}));var lo;(function(r){r[r.Centered=0]="Centered",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.OverFirstExtLine=3]="OverFirstExtLine",r[r.OverSecondExtLine=4]="OverSecondExtLine"})(lo||(lo={}));var ho;(function(r){r[r.Centered=0]="Centered",r[r.Above=1]="Above",r[r.Outside=2]="Outside",r[r.JIS=3]="JIS",r[r.Below=4]="Below"})(ho||(ho={}));var ol;(function(r){r[r.Both=0]="Both",r[r.ArrowsFirst=1]="ArrowsFirst",r[r.TextFirst=2]="TextFirst",r[r.BestFit=3]="BestFit"})(ol||(ol={}));var _i;(function(r){r[r.LeftToRight=0]="LeftToRight",r[r.RightToLeft=1]="RightToLeft"})(_i||(_i={}));var co;(function(r){r[r.MoveLineWithText=0]="MoveLineWithText",r[r.AddLeaderWhenTextMoved=1]="AddLeaderWhenTextMoved",r[r.FreeTextPosition=2]="FreeTextPosition"})(co||(co={}));D();x();R();var Nr;(function(r){r[r.None=0]="None",r[r.IsShape=1]="IsShape",r[r.VerticalText=4]="VerticalText",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Nr||(Nr={}));var Qs;(function(r){r[r.Regular=0]="Regular",r[r.Italic=1]="Italic",r[r.Bold=2]="Bold"})(Qs||(Qs={}));var wh;(function(r){r[r.None=0]="None",r[r.FlipX=2]="FlipX",r[r.FlipY=4]="FlipY"})(wh||(wh={}));var te=class r extends De{static DefaultName="Standard";get objectType(){return u.STYLE}get objectName(){return d.TableStyle}get subclassMarker(){return l.TextStyle}static get Default(){return new r(r.DefaultName)}get styleFlags(){return this.flags}set styleFlags(e){this.flags=e}filename="";bigFontFilename=null;height=0;width=1;lastHeight=0;obliqueAngle=0;mirrorFlag=wh.None;trueType=Qs.Regular;get isShapeFile(){return(this.styleFlags&Nr.IsShape)!==0}constructor(e){super(e)}};var uo;(function(r){r[r.Bottom=0]="Bottom",r[r.Middle=1]="Middle",r[r.Top=2]="Top"})(uo||(uo={}));var re=class r extends De{static get Default(){return new r(r.DefaultName)}alternateDimensioningSuffix="[]";alternateUnitDecimalPlaces=3;alternateUnitDimensioning=!1;alternateUnitFormat=Js.Decimal;alternateUnitRounding=0;alternateUnitScaleFactor=25.4;alternateUnitToleranceDecimalPlaces=3;alternateUnitToleranceZeroHandling=oe.SuppressZeroFeetAndInches;alternateUnitZeroHandling=oe.SuppressZeroFeetAndInches;angularDecimalPlaces=0;angularUnit=_n.DecimalDegrees;angularZeroHandling=jr.DisplayAll;arcLengthSymbolPosition=qs.BeforeDimensionText;get arrowBlock(){return this._dimArrowBlock}set arrowBlock(e){this._dimArrowBlock=e}get arrowSize(){return this._arrowSize}set arrowSize(e){if(e<0)throw new Error("The arrowSize must be equals or greater than zero.");this._arrowSize=e}centerMarkSize=.09;cursorUpdate=!1;decimalPlaces=2;decimalSeparator=".";get dimArrow1(){return this._dimArrow1}set dimArrow1(e){this._dimArrow1=e}get dimArrow2(){return this._dimArrow2}set dimArrow2(e){this._dimArrow2=e}dimensionFit=0;dimensionLineColor=B.ByBlock;dimensionLineExtension=0;dimensionLineGap=.625;dimensionLineIncrement=3.75;dimensionLineWeight=M.ByBlock;dimensionTextArrowFit=ol.BestFit;dimensionUnit=2;extensionLineColor=B.ByBlock;extensionLineExtension=1.25;extensionLineOffset=.625;extensionLineWeight=M.ByBlock;fixedExtensionLineLength=1;fractionFormat=It.Horizontal;generateTolerances=!1;isExtensionLineLengthFixed=!1;get joggedRadiusDimensionTransverseSegmentAngle(){return this._joggedRadiusDimensionTransverseSegmentAngle}set joggedRadiusDimensionTransverseSegmentAngle(e){let t=Math.round(e*1e6)/1e6,i=5*Math.PI/180,s=Math.PI/2;if(t<=i||t>=s)throw new Error("The joggedRadiusDimensionTransverseSegmentAngle must be in range of 5 to 90 degrees.");this._joggedRadiusDimensionTransverseSegmentAngle=e}get leaderArrow(){return this._leaderArrow}set leaderArrow(e){this._leaderArrow=e}limitsGeneration=!1;linearScaleFactor=1;linearUnitFormat=Js.Decimal;get lineType(){return this._lineType}set lineType(e){this._lineType=e}get lineTypeExt1(){return this._lineTypeExt1}set lineTypeExt1(e){this._lineTypeExt1=e}get lineTypeExt2(){return this._lineTypeExt2}set lineTypeExt2(e){this._lineTypeExt2=e}minusTolerance=0;get objectName(){return d.TableDimstyle}get objectType(){return u.DIMSTYLE}plusTolerance=0;postFix="<>";get prefix(){let{prefix:e}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");return e}set prefix(e){let{suffix:t}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");this.postFix=`${e}${this.postFix}${t}`}rounding=0;get scaleFactor(){return this._scaleFactor}set scaleFactor(e){if(e<0)throw new Error("The scaleFactor must be equals or greater than zero.");this._scaleFactor=e}separateArrowBlocks=!0;get style(){return this._style}set style(e){if(e==null)throw new Error("Style cannot be null.");this._style=e}get subclassMarker(){return l.DimensionStyle}get suffix(){let{suffix:e}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");return e}set suffix(e){let{prefix:t}=this.getDimStylePrefixAndSuffix(this.postFix,"<",">");this.postFix=`${t}${this.postFix}${e}`}suppressFirstDimensionLine=!1;suppressFirstExtensionLine=!1;suppressOutsideExtensions=!1;suppressSecondDimensionLine=!1;suppressSecondExtensionLine=!1;textBackgroundColor=B.ByBlock;textBackgroundFillMode=oo.NoBackground;textColor=B.ByBlock;textDirection=_i.LeftToRight;get textHeight(){return this._textHeight}set textHeight(e){if(e<=0)throw new Error("The textHeight must be greater than zero.");this._textHeight=e}textHorizontalAlignment=lo.Centered;textInsideExtensions=!1;textInsideHorizontal=!1;textMovement=co.MoveLineWithText;textOutsideExtensions=!1;textOutsideHorizontal=!1;textVerticalAlignment=ho.Above;textVerticalPosition=0;tickSize=0;toleranceAlignment=uo.Bottom;toleranceDecimalPlaces=2;toleranceScaleFactor=1;toleranceZeroHandling=oe.SuppressDecimalTrailingZeroes;zeroHandling=oe.SuppressDecimalTrailingZeroes;static DefaultName="Standard";static StyleOverrideEntryName="DSTYLE";_arrowSize=.18;_dimArrow1=null;_dimArrow2=null;_dimArrowBlock=null;_joggedRadiusDimensionTransverseSegmentAngle=Math.PI/4;_leaderArrow=null;_lineType=null;_lineTypeExt1=null;_lineTypeExt2=null;_scaleFactor=1;_style=te.Default;_textHeight=.18;constructor(e){super(e)}applyRounding(e,t=!1){let i=t?this.alternateUnitRounding:this.rounding;return i!==0&&(e=i*Math.round(e/i)),e}clone(){let e=super.clone();return e.style=this.style?.clone(),e.leaderArrow=this.leaderArrow?.clone()??null,e.arrowBlock=this.arrowBlock?.clone()??null,e.dimArrow1=this.dimArrow1?.clone()??null,e.dimArrow2=this.dimArrow2?.clone()??null,e.lineType=this.lineType?.clone()??null,e.lineTypeExt1=this.lineTypeExt1?.clone()??null,e.lineTypeExt2=this.lineTypeExt2?.clone()??null,e}getAlternateUnitStyleFormat(){let e=new ao;return e.linearDecimalPlaces=this.alternateUnitDecimalPlaces,e.angularDecimalPlaces=this.alternateUnitDecimalPlaces,e.decimalSeparator=this.decimalSeparator,e.fractionHeightScale=this.toleranceScaleFactor,e.fractionType=this.fractionFormat,e.linearZeroHandling=this.alternateUnitZeroHandling,e.angularZeroHandling=this.angularZeroHandling,e}getUnitStyleFormat(){let e=new ao;return e.linearDecimalPlaces=this.decimalPlaces,e.angularDecimalPlaces=this.angularDecimalPlaces===-1?this.decimalPlaces:this.angularDecimalPlaces,e.decimalSeparator=this.decimalSeparator,e.fractionHeightScale=this.toleranceScaleFactor,e.fractionType=this.fractionFormat,e.linearZeroHandling=this.zeroHandling,e.angularZeroHandling=this.angularZeroHandling,e}getDimStylePrefixAndSuffix(e,t,i){let s=-1;for(let n=0;n<e.length;n++)if(e[n]===t&&n+1<e.length&&e[n+1]===i){s=n;break}return s<0?{prefix:"",suffix:e}:{prefix:e.substring(0,s),suffix:e.substring(s+2)}}altMzf=0;altMzs="";mzf=0;mzs=""};D();x();R();var Mt;(function(r){r[r.None=0]="None",r[r.Top=1]="Top",r[r.Bottom=2]="Bottom",r[r.Front=3]="Front",r[r.Back=4]="Back",r[r.Left=5]="Left",r[r.Right=6]="Right"})(Mt||(Mt={}));var ot=class extends De{get objectType(){return u.UCS}get objectName(){return d.TableUcs}get subclassMarker(){return l.Ucs}origin=new c(0,0,0);xAxis=new c(1,0,0);yAxis=new c(0,1,0);orthographicType=Mt.None;orthographicViewType=Mt.None;elevation=0;constructor(e){super(e)}};var ll;(function(r){r[r.None=0]="None",r[r.Normal=1]="Normal",r[r.All=2]="All"})(ll||(ll={}));var dl;(function(r){r[r.CreateExplodedDimensions=0]="CreateExplodedDimensions",r[r.CreateNonAssociativeDimensions=1]="CreateNonAssociativeDimensions",r[r.CreateAssociativeDimensions=2]="CreateAssociativeDimensions"})(dl||(dl={}));var Qi;(function(r){r[r.ByLayer=0]="ByLayer",r[r.ByBlock=1]="ByBlock",r[r.ByDictionaryDefault=2]="ByDictionaryDefault",r[r.ByObjectId=3]="ByObjectId"})(Qi||(Qi={}));var hl;(function(r){r[r.NoIndex=0]="NoIndex",r[r.LayerIndex=1]="LayerIndex",r[r.SpatialIndex=2]="SpatialIndex",r[r.LayerAndSpatialIndex=3]="LayerAndSpatialIndex"})(hl||(hl={}));var cl;(function(r){r[r.English=0]="English",r[r.Metric=1]="Metric"})(cl||(cl={}));var ul;(function(r){r[r.Disabled=0]="Disabled",r[r.Selection=1]="Selection",r[r.Snap=2]="Snap",r[r.Redraw=4]="Redraw",r[r.Slide=8]="Slide",r[r.Regen=16]="Regen",r[r.Plotting=32]="Plotting",r[r.Postscript=64]="Postscript",r[r.All=127]="All"})(ul||(ul={}));var bi;(function(r){r[r.Viewport=0]="Viewport",r[r.Normal=1]="Normal"})(bi||(bi={}));var ml;(function(r){r[r.None=0]="None",r[r.QuadraticBSpline=5]="QuadraticBSpline",r[r.CubicBSpline=6]="CubicBSpline",r[r.Bezier=8]="Bezier"})(ml||(ml={}));var fl;(function(r){r[r.None=0]="None",r[r.DisplayAndPlot=1]="DisplayAndPlot",r[r.DisplayNotPlot=2]="DisplayNotPlot"})(fl||(fl={}));var _h;(function(r){r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom"})(_h||(_h={}));var lt=class{angleBase=0;angularDirection=al.ClockWise;angularUnit=_n.DecimalDegrees;get angularUnitPrecision(){return this._angularUnitPrecision}set angularUnitPrecision(e){if(e<0||e>8)throw new Error("AUPREC valid values are from 0 to 8");this._angularUnitPrecision=e}arrowBlockName="";associatedDimensions=!0;attributeVisibility=ll.Normal;blipMode=!1;cameraDisplayObjects=!1;cameraHeight=0;chamferAngle=0;chamferDistance1=0;chamferDistance2=0;chamferLength=0;codePage="ANSI_1252";createDateTime=new Date;createEllipseAsPolyline=!1;currentEntityColor=B.ByLayer;currentEntityLinetypeScale=1;currentEntityLineWeight=M.ByLayer;currentEntityPlotStyle=Qi.ByLayer;get currentLayer(){return this.document==null?this._currentLayer:this.document.layers.get(this.currentLayerName)}get currentLayerName(){return this._currentLayer.name}set currentLayerName(e){this.document!=null?this._currentLayer=this.document.layers.get(e):this._currentLayer=new Se(e)}get currentLineType(){return this.document==null?this._currentLineType:this.document.lineTypes.get(this.currentLineTypeName)}get currentLineTypeName(){return this._currentLineType.name}set currentLineTypeName(e){this.document!=null?this._currentLineType=this.document.lineTypes.get(e):this._currentLineType=new H(e)}currentMultiLineJustification=_h.Top;currentMultilineScale=20;currentMLineStyleName="Standard";get currentTextStyle(){return this.document==null?this._currentTextStyle:this.document.textStyles.get(this.currentTextStyleName)}get currentTextStyleName(){return this._currentTextStyle.name}set currentTextStyleName(e){this.document!=null?this._currentTextStyle=this.document.textStyles.get(e):this._currentTextStyle=new te(e)}dgnUnderlayFramesVisibility="";get dimensionAlternateDimensioningSuffix(){return this._dimensionStyleOverrides.alternateDimensioningSuffix}set dimensionAlternateDimensioningSuffix(e){this._dimensionStyleOverrides.alternateDimensioningSuffix=e}get dimensionAlternateUnitDecimalPlaces(){return this._dimensionStyleOverrides.alternateUnitDecimalPlaces}set dimensionAlternateUnitDecimalPlaces(e){this._dimensionStyleOverrides.alternateUnitDecimalPlaces=e}get dimensionAlternateUnitDimensioning(){return this._dimensionStyleOverrides.alternateUnitDimensioning}set dimensionAlternateUnitDimensioning(e){this._dimensionStyleOverrides.alternateUnitDimensioning=e}get dimensionAlternateUnitFormat(){return this._dimensionStyleOverrides.alternateUnitFormat}set dimensionAlternateUnitFormat(e){this._dimensionStyleOverrides.alternateUnitFormat=e}get dimensionAlternateUnitRounding(){return this._dimensionStyleOverrides.alternateUnitRounding}set dimensionAlternateUnitRounding(e){this._dimensionStyleOverrides.alternateUnitRounding=e}get dimensionAlternateUnitScaleFactor(){return this._dimensionStyleOverrides.alternateUnitScaleFactor}set dimensionAlternateUnitScaleFactor(e){this._dimensionStyleOverrides.alternateUnitScaleFactor=e}get dimensionAlternateUnitToleranceDecimalPlaces(){return this._dimensionStyleOverrides.alternateUnitToleranceDecimalPlaces}set dimensionAlternateUnitToleranceDecimalPlaces(e){this._dimensionStyleOverrides.alternateUnitToleranceDecimalPlaces=e}get dimensionAlternateUnitToleranceZeroHandling(){return this._dimensionStyleOverrides.alternateUnitToleranceZeroHandling}set dimensionAlternateUnitToleranceZeroHandling(e){this._dimensionStyleOverrides.alternateUnitToleranceZeroHandling=e}get dimensionAlternateUnitZeroHandling(){return this._dimensionStyleOverrides.alternateUnitZeroHandling}set dimensionAlternateUnitZeroHandling(e){this._dimensionStyleOverrides.alternateUnitZeroHandling=e}get dimensionAngularDimensionDecimalPlaces(){return this._dimensionStyleOverrides.angularDecimalPlaces}set dimensionAngularDimensionDecimalPlaces(e){this._dimensionStyleOverrides.angularDecimalPlaces=e}get dimensionAngularUnit(){return this._dimensionStyleOverrides.angularUnit}set dimensionAngularUnit(e){this._dimensionStyleOverrides.angularUnit=e}get dimensionAngularZeroHandling(){return this._dimensionStyleOverrides.angularZeroHandling}set dimensionAngularZeroHandling(e){this._dimensionStyleOverrides.angularZeroHandling=e}get dimensionArcLengthSymbolPosition(){return this._dimensionStyleOverrides.arcLengthSymbolPosition}set dimensionArcLengthSymbolPosition(e){this._dimensionStyleOverrides.arcLengthSymbolPosition=e}get dimensionArrowSize(){return this._dimensionStyleOverrides.arrowSize}set dimensionArrowSize(e){this._dimensionStyleOverrides.arrowSize=e}dimensionAssociativity=dl.CreateAssociativeDimensions;dimensionBlockName="";dimensionBlockNameFirst=null;dimensionBlockNameSecond=null;get dimensionCenterMarkSize(){return this._dimensionStyleOverrides.centerMarkSize}set dimensionCenterMarkSize(e){this._dimensionStyleOverrides.centerMarkSize=e}get dimensionCursorUpdate(){return this._dimensionStyleOverrides.cursorUpdate}set dimensionCursorUpdate(e){this._dimensionStyleOverrides.cursorUpdate=e}get dimensionDecimalPlaces(){return this._dimensionStyleOverrides.decimalPlaces}set dimensionDecimalPlaces(e){this._dimensionStyleOverrides.decimalPlaces=e}get dimensionDecimalSeparator(){return this._dimensionStyleOverrides.decimalSeparator}set dimensionDecimalSeparator(e){this._dimensionStyleOverrides.decimalSeparator=e}get dimensionDimensionTextArrowFit(){return this._dimensionStyleOverrides.dimensionTextArrowFit}set dimensionDimensionTextArrowFit(e){this._dimensionStyleOverrides.dimensionTextArrowFit=e}get dimensionExtensionLineColor(){return this._dimensionStyleOverrides.extensionLineColor}set dimensionExtensionLineColor(e){this._dimensionStyleOverrides.extensionLineColor=e}get dimensionExtensionLineExtension(){return this._dimensionStyleOverrides.extensionLineExtension}set dimensionExtensionLineExtension(e){this._dimensionStyleOverrides.extensionLineExtension=e}get dimensionExtensionLineOffset(){return this._dimensionStyleOverrides.extensionLineOffset}set dimensionExtensionLineOffset(e){this._dimensionStyleOverrides.extensionLineOffset=e}get dimensionFit(){return this._dimensionStyleOverrides.dimensionFit}set dimensionFit(e){this._dimensionStyleOverrides.dimensionFit=e}get dimensionFixedExtensionLineLength(){return this._dimensionStyleOverrides.fixedExtensionLineLength}set dimensionFixedExtensionLineLength(e){this._dimensionStyleOverrides.fixedExtensionLineLength=e}get dimensionFractionFormat(){return this._dimensionStyleOverrides.fractionFormat}set dimensionFractionFormat(e){this._dimensionStyleOverrides.fractionFormat=e}get dimensionGenerateTolerances(){return this._dimensionStyleOverrides.generateTolerances}set dimensionGenerateTolerances(e){this._dimensionStyleOverrides.generateTolerances=e}get dimensionIsExtensionLineLengthFixed(){return this._dimensionStyleOverrides.isExtensionLineLengthFixed}set dimensionIsExtensionLineLengthFixed(e){this._dimensionStyleOverrides.isExtensionLineLengthFixed=e}get dimensionJoggedRadiusDimensionTransverseSegmentAngle(){return this._dimensionStyleOverrides.joggedRadiusDimensionTransverseSegmentAngle}set dimensionJoggedRadiusDimensionTransverseSegmentAngle(e){this._dimensionStyleOverrides.joggedRadiusDimensionTransverseSegmentAngle=e}get dimensionLimitsGeneration(){return this._dimensionStyleOverrides.limitsGeneration}set dimensionLimitsGeneration(e){this._dimensionStyleOverrides.limitsGeneration=e}get dimensionLinearScaleFactor(){return this._dimensionStyleOverrides.linearScaleFactor}set dimensionLinearScaleFactor(e){this._dimensionStyleOverrides.linearScaleFactor=e}get dimensionLinearUnitFormat(){return this._dimensionStyleOverrides.linearUnitFormat}set dimensionLinearUnitFormat(e){this._dimensionStyleOverrides.linearUnitFormat=e}get dimensionLineColor(){return this._dimensionStyleOverrides.dimensionLineColor}set dimensionLineColor(e){this._dimensionStyleOverrides.dimensionLineColor=e}get dimensionLineExtension(){return this._dimensionStyleOverrides.dimensionLineExtension}set dimensionLineExtension(e){this._dimensionStyleOverrides.dimensionLineExtension=e}get dimensionLineGap(){return this._dimensionStyleOverrides.dimensionLineGap}set dimensionLineGap(e){this._dimensionStyleOverrides.dimensionLineGap=e}get dimensionLineIncrement(){return this._dimensionStyleOverrides.dimensionLineIncrement}set dimensionLineIncrement(e){this._dimensionStyleOverrides.dimensionLineIncrement=e}dimensionLineType="ByBlock";get dimensionLineWeight(){return this._dimensionStyleOverrides.dimensionLineWeight}set dimensionLineWeight(e){this._dimensionStyleOverrides.dimensionLineWeight=e}get dimensionMinusTolerance(){return this._dimensionStyleOverrides.minusTolerance}set dimensionMinusTolerance(e){this._dimensionStyleOverrides.minusTolerance=e}get dimensionPlusTolerance(){return this._dimensionStyleOverrides.plusTolerance}set dimensionPlusTolerance(e){this._dimensionStyleOverrides.plusTolerance=e}get dimensionPostFix(){return this._dimensionStyleOverrides.postFix}set dimensionPostFix(e){this._dimensionStyleOverrides.postFix=e}get dimensionRounding(){return this._dimensionStyleOverrides.rounding}set dimensionRounding(e){this._dimensionStyleOverrides.rounding=e}get dimensionScaleFactor(){return this._dimensionStyleOverrides.scaleFactor}set dimensionScaleFactor(e){this._dimensionStyleOverrides.scaleFactor=e}get dimensionSeparateArrowBlocks(){return this._dimensionStyleOverrides.separateArrowBlocks}set dimensionSeparateArrowBlocks(e){this._dimensionStyleOverrides.separateArrowBlocks=e}get currentDimensionStyle(){return this.document==null?this._currentDimensionStyle:this.document.dimensionStyles.get(this.currentDimensionStyleName)}get currentDimensionStyleName(){return this._currentDimensionStyle.name}set currentDimensionStyleName(e){this.document!=null?this._currentDimensionStyle=this.document.dimensionStyles.get(e):this._currentDimensionStyle=new re(e)}get dimensionSuppressFirstDimensionLine(){return this._dimensionStyleOverrides.suppressFirstDimensionLine}set dimensionSuppressFirstDimensionLine(e){this._dimensionStyleOverrides.suppressFirstDimensionLine=e}get dimensionSuppressFirstExtensionLine(){return this._dimensionStyleOverrides.suppressFirstExtensionLine}set dimensionSuppressFirstExtensionLine(e){this._dimensionStyleOverrides.suppressFirstExtensionLine=e}get dimensionSuppressOutsideExtensions(){return this._dimensionStyleOverrides.suppressOutsideExtensions}set dimensionSuppressOutsideExtensions(e){this._dimensionStyleOverrides.suppressOutsideExtensions=e}get dimensionSuppressSecondDimensionLine(){return this._dimensionStyleOverrides.suppressSecondDimensionLine}set dimensionSuppressSecondDimensionLine(e){this._dimensionStyleOverrides.suppressSecondDimensionLine=e}get dimensionSuppressSecondExtensionLine(){return this._dimensionStyleOverrides.suppressSecondExtensionLine}set dimensionSuppressSecondExtensionLine(e){this._dimensionStyleOverrides.suppressSecondExtensionLine=e}dimensionTex1="ByBlock";dimensionTex2="ByBlock";get dimensionTextBackgroundColor(){return this._dimensionStyleOverrides.textBackgroundColor}set dimensionTextBackgroundColor(e){this._dimensionStyleOverrides.textBackgroundColor=e}get dimensionTextBackgroundFillMode(){return this._dimensionStyleOverrides.textBackgroundFillMode}set dimensionTextBackgroundFillMode(e){this._dimensionStyleOverrides.textBackgroundFillMode=e}get dimensionTextColor(){return this._dimensionStyleOverrides.textColor}set dimensionTextColor(e){this._dimensionStyleOverrides.textColor=e}get dimensionTextDirection(){return this._dimensionStyleOverrides.textDirection}set dimensionTextDirection(e){this._dimensionStyleOverrides.textDirection=e}get dimensionTextHeight(){return this._dimensionStyleOverrides.textHeight}set dimensionTextHeight(e){this._dimensionStyleOverrides.textHeight=e}get dimensionTextHorizontalAlignment(){return this._dimensionStyleOverrides.textHorizontalAlignment}set dimensionTextHorizontalAlignment(e){this._dimensionStyleOverrides.textHorizontalAlignment=e}get dimensionTextInsideExtensions(){return this._dimensionStyleOverrides.textInsideExtensions}set dimensionTextInsideExtensions(e){this._dimensionStyleOverrides.textInsideExtensions=e}get dimensionTextInsideHorizontal(){return this._dimensionStyleOverrides.textInsideHorizontal}set dimensionTextInsideHorizontal(e){this._dimensionStyleOverrides.textInsideHorizontal=e}get dimensionTextMovement(){return this._dimensionStyleOverrides.textMovement}set dimensionTextMovement(e){this._dimensionStyleOverrides.textMovement=e}get dimensionTextOutsideExtensions(){return this._dimensionStyleOverrides.textOutsideExtensions}set dimensionTextOutsideExtensions(e){this._dimensionStyleOverrides.textOutsideExtensions=e}get dimensionTextOutsideHorizontal(){return this._dimensionStyleOverrides.textOutsideHorizontal}set dimensionTextOutsideHorizontal(e){this._dimensionStyleOverrides.textOutsideHorizontal=e}get dimensionTextStyle(){return this.document==null?this._dimensionTextStyle:this.document.textStyles.get(this.dimensionTextStyleName)}get dimensionTextStyleName(){return this._dimensionTextStyle.name}set dimensionTextStyleName(e){this.document!=null?this._dimensionTextStyle=this.document.textStyles.get(e):this._dimensionTextStyle=new te(e)}get dimensionTextVerticalAlignment(){return this._dimensionStyleOverrides.textVerticalAlignment}set dimensionTextVerticalAlignment(e){this._dimensionStyleOverrides.textVerticalAlignment=e}get dimensionTextVerticalPosition(){return this._dimensionStyleOverrides.textVerticalPosition}set dimensionTextVerticalPosition(e){this._dimensionStyleOverrides.textVerticalPosition=e}get dimensionTickSize(){return this._dimensionStyleOverrides.tickSize}set dimensionTickSize(e){this._dimensionStyleOverrides.tickSize=e}get dimensionToleranceAlignment(){return this._dimensionStyleOverrides.toleranceAlignment}set dimensionToleranceAlignment(e){this._dimensionStyleOverrides.toleranceAlignment=e}get dimensionToleranceDecimalPlaces(){return this._dimensionStyleOverrides.toleranceDecimalPlaces}set dimensionToleranceDecimalPlaces(e){this._dimensionStyleOverrides.toleranceDecimalPlaces=e}get dimensionToleranceScaleFactor(){return this._dimensionStyleOverrides.toleranceScaleFactor}set dimensionToleranceScaleFactor(e){this._dimensionStyleOverrides.toleranceScaleFactor=e}get dimensionToleranceZeroHandling(){return this._dimensionStyleOverrides.toleranceZeroHandling}set dimensionToleranceZeroHandling(e){this._dimensionStyleOverrides.toleranceZeroHandling=e}get dimensionUnit(){return this._dimensionStyleOverrides.dimensionUnit}set dimensionUnit(e){this._dimensionStyleOverrides.dimensionUnit=e}get dimensionZeroHandling(){return this._dimensionStyleOverrides.zeroHandling}set dimensionZeroHandling(e){this._dimensionStyleOverrides.zeroHandling=e}get dimensionstyleOverrides(){return this._dimensionStyleOverrides}displayLightGlyphs="";displayLineWeight=!1;displaySilhouetteCurves=!1;document=null;draftAngleFirstCrossSection=0;draftAngleSecondCrossSection=0;draftMagnitudeFirstCrossSection=0;draftMagnitudeSecondCrossSection=0;dw3DPrecision=0;dwgUnderlayFramesVisibility="";get elevation(){return this.modelSpaceUcs.elevation}set elevation(e){this.modelSpaceUcs.elevation=e}endCaps=0;entitySortingFlags=ul.Disabled;extendedNames=!0;get extensionLineWeight(){return this._dimensionStyleOverrides.extensionLineWeight}set extensionLineWeight(e){this._dimensionStyleOverrides.extensionLineWeight=e}externalReferenceClippingBoundaryType=fl.DisplayNotPlot;get facetResolution(){return this._facetResolution}set facetResolution(e){if(e<.01||e>10)throw new Error("FACETRES valid values are from 0.01 to 10.0");this._facetResolution=e}filletRadius=0;fillMode=!0;fingerPrintGuid=crypto.randomUUID?.()??"";haloGapPercentage=0;handleSeed=1;hideText=0;hyperLinkBase=null;indexCreationFlags=hl.NoIndex;insUnits=ie.Unitless;interfereColor=new B(1);intersectionDisplay=0;joinStyle=0;lastSavedBy="ACadSharp";latitude=37.795;lensLength=0;limitCheckingOn=!1;linearUnitFormat=Js.Decimal;get linearUnitPrecision(){return this._linearUnitPrecision}set linearUnitPrecision(e){if(e<0||e>8)throw new Error("LUPREC valid values are from 0 to 8");this._linearUnitPrecision=e}lineTypeScale=1;loadOLEObject=!1;loftedObjectNormals="";longitude=-122.394;maintenanceVersion=0;maxViewportCount=64;measurementUnits=cl.Metric;menuFileName=".";mirrorText=!1;modelSpaceExtMax=new c(0,0,0);modelSpaceExtMin=new c(0,0,0);modelSpaceInsertionBase=new c(0,0,0);modelSpaceLimitsMax=new C(0,0);modelSpaceLimitsMin=new C(0,0);get modelSpaceOrigin(){return this.modelSpaceUcs.origin}set modelSpaceOrigin(e){this.modelSpaceUcs.origin=e}modelSpaceOrthographicBackDOrigin=new c(0,0,0);modelSpaceOrthographicBottomDOrigin=new c(0,0,0);modelSpaceOrthographicFrontDOrigin=new c(0,0,0);modelSpaceOrthographicLeftDOrigin=new c(0,0,0);modelSpaceOrthographicRightDOrigin=new c(0,0,0);modelSpaceOrthographicTopDOrigin=new c(0,0,0);modelSpaceUcs=new ot;modelSpaceUcsBase=new ot;get modelSpaceXAxis(){return this.modelSpaceUcs.xAxis}set modelSpaceXAxis(e){this.modelSpaceUcs.xAxis=e}get modelSpaceYAxis(){return this.modelSpaceUcs.yAxis}set modelSpaceYAxis(e){this.modelSpaceUcs.yAxis=e}northDirection=0;numberOfSplineSegments=8;objectSnapMode=4133;obscuredColor=new B(0);obscuredType=0;orthoMode=!1;get paperSpaceBaseName(){return this.paperSpaceUcsBase.name}set paperSpaceBaseName(e){this.paperSpaceUcsBase.name=e}get paperSpaceElevation(){return this.paperSpaceUcs.elevation}set paperSpaceElevation(e){this.paperSpaceUcs.elevation=e}paperSpaceExtMax=new c(0,0,0);paperSpaceExtMin=new c(0,0,0);paperSpaceInsertionBase=new c(0,0,0);paperSpaceLimitsChecking=!1;paperSpaceLimitsMax=new C(0,0);paperSpaceLimitsMin=new C(0,0);paperSpaceLineTypeScaling=bi.Normal;get paperSpaceName(){return this.paperSpaceUcs.name}set paperSpaceName(e){this.paperSpaceUcs.name=e}paperSpaceOrthographicBackDOrigin=new c(0,0,0);paperSpaceOrthographicBottomDOrigin=new c(0,0,0);paperSpaceOrthographicFrontDOrigin=new c(0,0,0);paperSpaceOrthographicLeftDOrigin=new c(0,0,0);paperSpaceOrthographicRightDOrigin=new c(0,0,0);paperSpaceOrthographicTopDOrigin=new c(0,0,0);paperSpaceUcs=new ot;paperSpaceUcsBase=new ot;get paperSpaceXAxis(){return this.paperSpaceUcs.xAxis}set paperSpaceXAxis(e){this.paperSpaceUcs.xAxis=e}get paperSpaceYAxis(){return this.paperSpaceUcs.yAxis}set paperSpaceYAxis(e){this.paperSpaceUcs.yAxis=e}peditType=0;pickStyle=1;pointDisplayMode=0;pointDisplaySize=0;proxyGraphics=!0;regenMode=!0;get shadeEdge(){return this._shadeEdge}set shadeEdge(e){this._shadeEdge=e}shadeDiffuse=70;showModelSpaceInPaperSpace=!1;sketchIncrement=.1;sketchPolylineType=ml.None;solidVisualStyleObjectType=0;splineDegreeCurves=3;stackedTextAlignment=1;stackedTextSizePercentage=70;get stepsPerSecond(){return this._stepsPerSecond}set stepsPerSecond(e){this._stepsPerSecond=e}get surfaceIsolineCount(){return this._surfaceIsolineCount}set surfaceIsolineCount(e){this._surfaceIsolineCount=e}surfaceDensityM=6;surfaceDensityN=6;surfaceType=6;surfaceTabulation1=6;surfaceTabulation2=6;get textQuality(){return this._textQuality}set textQuality(e){this._textQuality=e}textSize=2.5;thickness=0;tileModeEnabled=!0;timeZone=0;totalEditingTime=0;traceWidthDefault=0;get ucsBaseName(){return this.modelSpaceUcsBase.name}set ucsBaseName(e){this.modelSpaceUcsBase.name=e}get ucsName(){return this.modelSpaceUcs.name}set ucsName(e){this.modelSpaceUcs.name=e}unitMode=0;universalCreateDateTime=new Date;universalUpdateDateTime=new Date;updateDateTime=new Date;updateDimensionsWhileDragging=!0;userDouble1=0;userDouble2=0;userDouble3=0;userDouble4=0;userDouble5=0;userElapsedTimeSpan=0;userShort1=0;userShort2=0;userShort3=0;userShort4=0;userShort5=0;userTimer=!1;get version(){return this._version}set version(e){switch(this._version=e,e){case m.AC1015:this.maintenanceVersion=20;break;case m.AC1018:this.maintenanceVersion=104;break;case m.AC1021:this.maintenanceVersion=50;break;case m.AC1024:this.maintenanceVersion=226;break;case m.AC1027:this.maintenanceVersion=125;break;case m.AC1032:this.maintenanceVersion=228;break;default:this.maintenanceVersion=0;break}}versionGuid=crypto.randomUUID?.()??"";get versionString(){return Z.getNameFromVersion(this.version)}set versionString(e){this.version=Z.getVersionFromName(e)}viewportDefaultViewScaleFactor=0;worldView=!0;xEdit=!1;_angularUnitPrecision=0;_currentLayer=Se.Default;_currentLineType=H.ByLayer;_currentTextStyle=te.Default;_dimensionStyleOverrides=new re("override");_currentDimensionStyle=re.Default;_dimensionTextStyle=te.Default;_facetResolution=.5;_linearUnitPrecision=4;_stepsPerSecond=2;_surfaceIsolineCount=4;_textQuality=50;_version=m.AC1032;_shadeEdge=0;constructor(e){typeof e=="number"?this.version=e:e&&typeof e=="object"?(this.version=m.AC1032,this.document=e):this.version=m.AC1032}requiredVersions=0;DIMSAV=0;polylineLineTypeGeneration=!1;regenerationMode=0;quickTextMode=!1;showSplineControlPoints=!1;showModelSpace=!1;retainXRefDependentVisibilitySettings=!1;spatialIndexMaxTreeDepth=0;splineType=0;shadeDiffuseToAmbientPercentage=70;textHeightDefault=.2;thicknessDefault=0;polylineWidthDefault=0;dimensionAltMzf=0;dimensionAltMzs="";dimensionMzs="";styleSheetName="";plotStyleMode=0;projectName="";stepSize=0;solidsRetainHistory=!1;showSolidsHistory=!1;sweptSolidWidth=0;sweptSolidHeight=0;solidLoftedShape=0;shadowMode=0;shadowPlaneLocation=0;dimensionMzf=0;static GetHeaderMap(){return new Map}SetValue(e,t){}toString(){return`${this.version}`}};kr();R();D();D();x();R();var gt=class r extends De{static get Default(){return new r(r.DefaultName)}get objectName(){return d.TableAppId}get objectType(){return u.APPID}get subclassMarker(){return l.ApplicationId}static BlockRepBTag="AcDbBlockRepBTag";static BlockRepETag="AcDbBlockRepETag";static DefaultName="ACAD";constructor(e){if(super(e),e!==void 0&&!e)throw new Error("Application id must have a name.")}};Te();rl();D();x();var Ce=class extends I{onAdd=null;onRemove=null;get count(){return this.entries.size}get objectName(){return d.TableEntry}get subclassMarker(){return l.Table}entries=new Map;constructor(){super()}add(e){(!e.name||!e.name.trim())&&(e.name=this.createName("unnamed")),this.addEntry(e.name,e)}addRange(e){for(let t of e)this.add(t)}tryAdd(e){let t=this.tryGetValue(e.name);return t!==void 0?t:(this.add(e),e)}contains(e){return this.entries.has(e.toUpperCase())}createDefaultEntries(){for(let e of this.defaultEntries)this.contains(e)}[Symbol.iterator](){return this.entries.values()[Symbol.iterator]()}remove(e){if(this.defaultEntries.some(s=>s.toUpperCase()===e.toUpperCase()))return null;let t=e.toUpperCase(),i=this.entries.get(t);return i?(this.entries.delete(t),i.owner=null,this.onRemove?.(this,new tr(i)),i.onNameChanged=null,i):null}tryGetValue(e){return this.entries.get(e.toUpperCase())}addEntry(e,t){this.entries.set(e.toUpperCase(),t),t.owner=this,t.onNameChanged=(i,s)=>{this.onEntryNameChanged(i,s)},this.onAdd?.(this,new tr(t))}addHandlePrefix(e){e.owner=this,e.onNameChanged=(i,s)=>{this.onEntryNameChanged(i,s)},this.onAdd?.(this,new tr(e));let t=`${e.handle}:${e.name}`;this.entries.set(t.toUpperCase(),e)}createName(e){let t=0;for(;this.entries.has(`${e}${t}`.toUpperCase());)t++;return`${e}${t}`}onEntryNameChanged(e,t){if(this.defaultEntries.some(s=>s.toUpperCase()===t.oldName.toUpperCase()))throw new Error(`The name ${t.oldName} belongs to a default entry.`);let i=this.entries.get(t.oldName.toUpperCase());i&&(this.entries.set(t.newName.toUpperCase(),i),this.entries.delete(t.oldName.toUpperCase()))}get(e){let t=this.entries.get(e.toUpperCase());if(t===void 0)throw new Error(`Entry '${e}' not found in table.`);return t}};var Vr=class extends Ce{get objectType(){return u.APPID_CONTROL_OBJ}get objectName(){return d.TableAppId}get defaultEntries(){return[gt.DefaultName]}createDefaultEntries(){this.contains(gt.DefaultName)||this.add(gt.Default)}constructor(){super()}};R();D();rl();var mo=class{onAdd=null;onRemove=null;owner;get count(){return this._entries.size}_entries=new Set;constructor(e){this.owner=e}getAt(e){let t=0;for(let i of this._entries){if(t===e)return i;t++}}add(e){if(e==null)throw new Error("item is null");if(e.owner!=null)throw new Error("Item already has an owner");if(this._entries.has(e))throw new Error("Item is already in the collection");this._entries.add(e),e.owner=this.owner,this.onAdd?.(this,new tr(e))}addRange(e){for(let t of e)this.add(t)}clear(){let e=[...this._entries];for(let t of e)this.remove(t)}remove(e){return this._entries.delete(e)?(e.owner=null,this.onRemove?.(this,new tr(e)),e):null}[Symbol.iterator](){return this._entries[Symbol.iterator]()}};D();x();R();var U=class r extends De{static get ModelSpace(){return new r(r.ModelSpaceName)}static get PaperSpace(){return new r(r.PaperSpaceName)}get attributeDefinitions(){return Array.from(this.entities).filter(e=>e.constructor?.name==="AttributeDefinition")}get blockEnd(){return this._blockEnd}set blockEnd(e){this._blockEnd=e,this._blockEnd.owner=this}get blockEntity(){return this._blockEntity}set blockEntity(e){this._blockEntity=e,this._blockEntity.owner=this}canScale=!0;entities;get evaluationGraph(){return null}get blockFlags(){return this.blockEntity.flags}set blockFlags(e){this.blockEntity.flags=e}get hasAttributes(){return this.attributeDefinitions.length>0}get isAnonymous(){return(this.blockFlags&ne.Anonymous)!==0}set isAnonymous(e){e?this.blockFlags|=ne.Anonymous:this.blockFlags&=~ne.Anonymous}get isDynamic(){return this.evaluationGraph!=null}isExplodable=!1;get isUnloaded(){return this.blockEntity.isUnloaded}set isUnloaded(e){this.blockEntity.isUnloaded=e}get layout(){return this._layout}set layout(e){this._layout=e}get objectName(){return d.TableBlockRecord}get objectType(){return u.BLOCK_HEADER}preview=null;get sortEntitiesTable(){return null}get source(){return null}get subclassMarker(){return l.BlockRecord}units=ie.Unitless;get viewports(){return Array.from(this.entities).filter(e=>e.constructor?.name==="Viewport")}static AnonymousPrefix="*A";static ModelSpaceName="*Model_Space";static PaperSpaceName="*Paper_Space";_blockEnd;_blockEntity;_layout=null;constructor(e){super(e),this._blockEntity=new Pr(this),this._blockEnd=new gs(this),this.entities=new mo(this)}clone(){let e=super.clone();e._layout=null,e.entities=new mo(e);for(let t of this.entities){let i=t.clone();e.entities.add(i)}return e.blockEntity=this.blockEntity.clone(),e.blockEntity.owner=e,e.blockEnd=this.blockEnd.clone(),e.blockEnd.owner=e,e}};var Ir=class extends Ce{get objectType(){return u.BLOCK_CONTROL_OBJ}get objectName(){return d.TableBlockRecord}get defaultEntries(){return[U.ModelSpaceName,U.PaperSpaceName]}constructor(){super()}createDefaultEntries(){this.contains(U.ModelSpaceName)||this.add(U.ModelSpace),this.contains(U.PaperSpaceName)||this.add(U.PaperSpace)}add(e){if(e.isAnonymous&&this.contains(e.name)){let t=this.tryGetValue(e.name);if(t&&t===e)throw new Error(`The BlockRecord with name ${e.name} has already been added.`);e.name=this.createName(U.AnonymousPrefix)}super.add(e)}};R();D();var Wt=class extends Ce{get objectType(){return u.DIMSTYLE_CONTROL_OBJ}get objectName(){return d.TableDimstyle}get defaultEntries(){return[re.DefaultName]}createDefaultEntries(){this.contains(re.DefaultName)||this.add(re.Default)}constructor(){super()}};R();D();var Mr=class extends Ce{get objectType(){return u.LAYER_CONTROL_OBJ}get objectName(){return d.TableLayer}get defaultEntries(){return[Se.DefaultName]}constructor(){super()}createDefaultEntries(){if(!this.contains(Se.DefaultName)){let e=Se.Default;e.lineType=H.Continuous,this.add(e)}}};R();D();var Wr=class extends Ce{get objectType(){return u.LTYPE_CONTROL_OBJ}get objectName(){return d.TableLinetype}get byLayer(){return this.get(H.ByLayerName)}get byBlock(){return this.get(H.ByBlockName)}get continuous(){return this.get(H.ContinuousName)}get defaultEntries(){return[H.ByLayerName,H.ByBlockName,H.ContinuousName]}constructor(){super()}createDefaultEntries(){this.contains(H.ByLayerName)||this.add(H.ByLayer),this.contains(H.ByBlockName)||this.add(H.ByBlock),this.contains(H.ContinuousName)||this.add(H.Continuous)}};R();D();var Hr=class extends Ce{get objectType(){return u.STYLE_CONTROL_OBJ}get objectName(){return d.TableStyle}get defaultEntries(){return[te.DefaultName]}createDefaultEntries(){this.contains(te.DefaultName)||this.add(te.Default)}constructor(){super()}};R();D();var Fr=class extends Ce{get objectType(){return u.UCS_CONTROL_OBJ}get objectName(){return d.TableUcs}get defaultEntries(){return[]}constructor(){super()}};R();D();var Ur=class extends Ce{get objectType(){return u.VIEW_CONTROL_OBJ}get objectName(){return d.TableView}get defaultEntries(){return[]}constructor(){super()}};R();D();D();x();R();var en;(function(r){r[r.Optimized2D=0]="Optimized2D",r[r.Wireframe=1]="Wireframe",r[r.HiddenLine=2]="HiddenLine",r[r.FlatShaded=3]="FlatShaded",r[r.GouraudShaded=4]="GouraudShaded",r[r.FlatShadedWithWireframe=5]="FlatShadedWithWireframe",r[r.GouraudShadedWithWireframe=6]="GouraudShadedWithWireframe"})(en||(en={}));var fo;(function(r){r[r.OneDistantLight=0]="OneDistantLight",r[r.TwoDistantLights=1]="TwoDistantLights"})(fo||(fo={}));var bn;(function(r){r[r._0=0]="_0",r[r._1=1]="_1",r[r._2=2]="_2",r[r._3=4]="_3",r[r._4=8]="_4"})(bn||(bn={}));var vr;(function(r){r[r.Off=0]="Off",r[r.OnLower=1]="OnLower",r[r.OffOrigin=2]="OffOrigin",r[r.OnOrigin=3]="OnOrigin"})(vr||(vr={}));var se;(function(r){r[r.Off=0]="Off",r[r.PerspectiveView=1]="PerspectiveView",r[r.FrontClipping=2]="FrontClipping",r[r.BackClipping=4]="BackClipping",r[r.Follow=8]="Follow",r[r.FrontClippingZ=16]="FrontClippingZ"})(se||(se={}));function Mc(r){let e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?new c(0,0,0):new c(r.x/e,r.y/e,r.z/e)}var xt=class r extends De{static DefaultName="*Active";get objectType(){return u.VPORT}get objectName(){return d.TableVport}get subclassMarker(){return l.VPort}static get Default(){return new r(r.DefaultName)}bottomLeft=new C(0,0);topRight=new C(1,1);center=new C(0,0);snapBasePoint=new C(0,0);snapSpacing=new C(.5,.5);gridSpacing=new C(10,10);get direction(){return this._direction}set direction(e){this._direction=Mc(e)}target=new c(0,0,0);viewHeight=10;aspectRatio=1;lensLength=50;frontClippingPlane=0;backClippingPlane=0;snapRotation=0;twistAngle=0;circleZoomPercent=1e3;renderMode=en.Optimized2D;viewMode=se.FrontClippingZ;ucsIconDisplay=vr.OnOrigin;snapOn=!1;showGrid=!0;isometricSnap=!1;snapIsoPair=0;origin=new c(0,0,0);xAxis=new c(1,0,0);yAxis=new c(0,1,0);namedUcs=null;baseUcs=null;orthographicType=Mt.None;elevation=0;gridFlags=bn._1|bn._2;minorGridLinesPerMajorGridLine=5;visualStyle=null;useDefaultLighting=!0;defaultLighting=fo.TwoDistantLights;brightness=0;contrast=0;ambientColor=new B(0);_direction=new c(0,0,1);constructor(e){super(e)}clone(){let e=super.clone();return e.baseUcs=this.baseUcs?this.baseUcs.clone():null,e.namedUcs=this.namedUcs?this.namedUcs.clone():null,e}};var zr=class extends Ce{get objectType(){return u.VPORT_CONTROL_OBJ}get objectName(){return d.TableVport}get defaultEntries(){return[xt.DefaultName]}createDefaultEntries(){this.contains(xt.DefaultName)||this.add(xt.Default)}constructor(){super()}add(e){this.contains(e.name)?this.addHandlePrefix(e):this.addEntry(e.name,e)}};var E;(function(r){r[r.None=0]="None",r[r.EraseAllowed=1]="EraseAllowed",r[r.TransformAllowed=2]="TransformAllowed",r[r.ColorChangeAllowed=4]="ColorChangeAllowed",r[r.LayerChangeAllowed=8]="LayerChangeAllowed",r[r.LinetypeChangeAllowed=16]="LinetypeChangeAllowed",r[r.LinetypeScaleChangeAllowed=32]="LinetypeScaleChangeAllowed",r[r.VisibilityChangeAllowed=64]="VisibilityChangeAllowed",r[r.CloningAllowed=128]="CloningAllowed",r[r.LineweightChangeAllowed=256]="LineweightChangeAllowed",r[r.PlotStyleNameChangeAllowed=512]="PlotStyleNameChangeAllowed",r[r.AllOperationsExceptCloningAllowed=895]="AllOperationsExceptCloningAllowed",r[r.AllOperationsAllowed=1023]="AllOperationsAllowed",r[r.DisablesProxyWarningDialog=1024]="DisablesProxyWarningDialog",r[r.R13FormatProxy=32768]="R13FormatProxy"})(E||(E={}));var F=class{applicationName="ObjectDBX Classes";classNumber=0;cppClassName="";dwgVersion=0;dxfName="";instanceCount=0;get isAnEntity(){return this._isAnEntity}set isAnEntity(e){e?this._itemClassId=498:this._itemClassId=499,this._isAnEntity=e}get itemClassId(){return this._itemClassId}set itemClassId(e){e===498?this._isAnEntity=!0:this._isAnEntity=!1,this._itemClassId=e}proxyFlags=E.None;wasZombie=!1;maintenanceVersion=0;_isAnEntity=!1;_itemClassId=0;toString(){return`${this.dxfName}:${this.classNumber}`}};x();D();var gi=class{get count(){return this._entries.size}get isReadOnly(){return!1}_entries=new Map;static updateDxfClasses(e){e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DictionaryWithDefault,classNumber:500+e.classes.count,dwgVersion:22,dxfName:d.ObjectDictionaryWithDefault,itemClassId:499,maintenanceVersion:42,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.AcDbPlaceHolder,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectPlaceholder,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Layout,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectLayout,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DictionaryVar,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectDictionaryVar,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectTableStyle,itemClassId:499,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Material,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.ObjectMaterial,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.VisualStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectVisualStyle,itemClassId:499,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Scale,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectScale,itemClassId:499,maintenanceVersion:1,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MLeaderStyle,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectMLeaderStyle,itemClassId:499,maintenanceVersion:25,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.CellStyleMap,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectCellStyleMap,itemClassId:499,maintenanceVersion:25,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"ExAcXREFPanelObject",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"EXACXREFPANELOBJECT",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbImpNonPersistentObjectsCollection",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"NPOCOLLECTION",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbLayerIndex",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"LAYER_INDEX",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbSpatialIndex",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"SPATIAL_INDEX",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbIdBuffer",classNumber:500+e.classes.count,dwgVersion:m.AC1014,dxfName:"IDBUFFER",itemClassId:499,maintenanceVersion:0,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbSectionViewStyle",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDBSECTIONVIEWSTYLE",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbDetailViewStyle",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDBDETAILVIEWSTYLE",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Mesh,classNumber:500+e.classes.count,dwgVersion:0,dxfName:d.EntityMesh,itemClassId:498,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.SortentsTable,classNumber:500+e.classes.count,dwgVersion:m.AC1014,dxfName:d.ObjectSortEntsTable,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbTextObjectContextData",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"ACDB_TEXTOBJECTCONTEXTDATA_CLASS",itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"WipeOut",cppClassName:l.Wipeout,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.EntityWipeout,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.TransformAllowed|E.ColorChangeAllowed|E.LayerChangeAllowed|E.LinetypeChangeAllowed|E.LinetypeScaleChangeAllowed|E.VisibilityChangeAllowed|E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"WipeOut",cppClassName:"AcDbWipeoutVariables",classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:"WIPEOUTVARIABLES",itemClassId:499,maintenanceVersion:0,proxyFlags:E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"AcDbDimAssoc",cppClassName:"AcDbDimAssoc",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"DIMASSOC",itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableEntity,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.EntityTable,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.TableContent,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectTableContent,itemClassId:499,maintenanceVersion:21,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:"AcDbTableGeometry",classNumber:500+e.classes.count,dwgVersion:0,dxfName:"TABLEGEOMETRY",itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImage,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.EntityImage,itemClassId:498,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.TransformAllowed|E.ColorChangeAllowed|E.LayerChangeAllowed|E.LinetypeChangeAllowed|E.LinetypeScaleChangeAllowed|E.VisibilityChangeAllowed|E.R13FormatProxy,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImageDef,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectImageDefinition,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterImageDefReactor,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectImageDefinitionReactor,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.DbColor,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.ObjectDBColor,itemClassId:499,maintenanceVersion:14,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.GeoData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.ObjectGeoData,itemClassId:499,maintenanceVersion:45,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MultiLeader,classNumber:500+e.classes.count,dwgVersion:m.MC0_0,dxfName:d.EntityMultiLeader,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PdfReference,classNumber:500+e.classes.count,dwgVersion:26,dxfName:d.EntityPdfUnderlay,itemClassId:498,maintenanceVersion:0,proxyFlags:4095,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PdfDefinition,classNumber:500+e.classes.count,dwgVersion:26,dxfName:d.ObjectPdfDefinition,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{applicationName:"ISM",cppClassName:l.RasterVariables,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectRasterVariables,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.SpatialFilter,classNumber:500+e.classes.count,dwgVersion:20,dxfName:d.ObjectSpatialFilter,itemClassId:499,maintenanceVersion:0,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MultiLeaderObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.MC0_0,dxfName:d.ObjectMLeaderContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.PlotSettings,classNumber:500+e.classes.count,dwgVersion:m.AC1015,dxfName:d.ObjectPlotSettings,itemClassId:499,maintenanceVersion:42,proxyFlags:E.None,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.Field,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectField,itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.FieldList,classNumber:500+e.classes.count,dwgVersion:m.AC1018,dxfName:d.ObjectFieldList,itemClassId:499,maintenanceVersion:0,proxyFlags:E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.MTextAttributeObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.MTextAttributeObjectContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1})),e.classes.addOrUpdate(Object.assign(new F,{cppClassName:l.BlkRefObjectContextData,classNumber:500+e.classes.count,dwgVersion:m.AC1021,dxfName:d.BlkRefObjectContextData,itemClassId:499,maintenanceVersion:0,proxyFlags:E.EraseAllowed|E.CloningAllowed|E.DisablesProxyWarningDialog,wasZombie:!1}))}add(e){this._entries.set(e.dxfName.toUpperCase(),e)}addOrUpdate(e){let t=e.dxfName.toUpperCase(),i=this._entries.get(t);i?i.instanceCount=e.instanceCount:this._entries.set(t,e)}clear(){this._entries.clear()}containsByName(e){return this._entries.has(e.toUpperCase())}contains(e){for(let t of this._entries.values())if(t===e)return!0;return!1}copyTo(e,t){let i=t;for(let s of this._entries.values())e[i++]=s}getByClassNumber(e){for(let t of this._entries.values())if(t.classNumber===e)return t;return null}getByName(e){return this._entries.get(e.toUpperCase())??null}[Symbol.iterator](){return this._entries.values()}remove(e){return this._entries.delete(e.dxfName.toUpperCase())}tryGetByClassNumber(e){for(let t of this._entries.values())if(t.classNumber===e)return{result:t,found:!0};return{result:null,found:!1}}tryGetByName(e){let t=this._entries.get(e.toUpperCase());return t?{result:t,found:!0}:{result:null,found:!1}}};var xs=class{appIds=null;blockRecords=null;classes=null;colors=null;dictionaryVariables=null;dimensionStyles=null;get entities(){return this.modelSpace?.entities}groups=null;get handle(){return 0}header=null;imageDefinitions=null;layers=null;layouts=null;lineTypes=null;materials=null;mLeaderStyles=null;mLineStyles=null;get modelSpace(){return this.blockRecords?.tryGetValue("*Model_Space")}get paperSpace(){return this.blockRecords?.tryGetValue("*Paper_Space")}pdfDefinitions=null;get rootDictionary(){return this._rootDictionary}set rootDictionary(e){this._rootDictionary=e,this._rootDictionary.owner=this,this.registerCollection(this._rootDictionary)}scales=null;summaryInfo=null;tableStyles=null;textStyles=null;uCSs=null;views=null;vPorts=null;vEntityControl=null;_cadObjects=new Map;_rootDictionary=null;constructor(e){this._cadObjects.set(this.handle,this),this.createDefaults(),e!==void 0&&this.header!=null&&(this.header.version=e)}createDefaults(){this.header==null&&(this.header=new lt(this)),this.summaryInfo=new Or,this.classes==null&&(this.classes=new gi),gi.updateDxfClasses(this),this.rootDictionary==null&&(this.rootDictionary=xe.createRoot()),this.appIds==null&&this.registerCollection(new Vr),this.blockRecords==null&&this.registerCollection(new Ir),this.dimensionStyles==null&&this.registerCollection(new Wt),this.layers==null&&this.registerCollection(new Mr),this.lineTypes==null&&this.registerCollection(new Wr),this.textStyles==null&&this.registerCollection(new Hr),this.uCSs==null&&this.registerCollection(new Fr),this.views==null&&this.registerCollection(new Ur),this.vPorts==null&&this.registerCollection(new zr),this.lineTypes&&typeof this.lineTypes.createDefaultEntries=="function"&&this.lineTypes.createDefaultEntries(),this.layers&&typeof this.layers.createDefaultEntries=="function"&&this.layers.createDefaultEntries(),this.blockRecords&&typeof this.blockRecords.createDefaultEntries=="function"&&this.blockRecords.createDefaultEntries(),this.textStyles&&typeof this.textStyles.createDefaultEntries=="function"&&this.textStyles.createDefaultEntries(),this.dimensionStyles&&typeof this.dimensionStyles.createDefaultEntries=="function"&&this.dimensionStyles.createDefaultEntries(),this.appIds&&typeof this.appIds.createDefaultEntries=="function"&&this.appIds.createDefaultEntries(),this.vPorts&&typeof this.vPorts.createDefaultEntries=="function"&&this.vPorts.createDefaultEntries()}getCadObject(e){return this._cadObjects.get(e)??null}tryGetCadObject(e){if(e===this.handle)return{found:!1,cadObject:null};let t=this._cadObjects.get(e);return t?{found:!0,cadObject:t}:{found:!1,cadObject:null}}restoreHandles(){let e=[...this._cadObjects.values()];this._cadObjects.clear();let t=1;this._cadObjects.set(0,this);for(let i=1;i<e.length;i++){let s=e[i];s.handle=t,t++,this._cadObjects.set(s.handle,s)}}toString(){return`${this.header?.toString()??"CadDocument"}`}updateCollections(e,t){}updateDxfClasses(e){e&&this.classes&&this.classes.clear(),gi.updateDxfClasses(this)}updateImageReactors(){}registerCollection(e){e!=null&&(e instanceof I&&(e.owner=this,this.addCadObject(e)),"onAdd"in e&&(e.onAdd=this.onAdd.bind(this)),"onRemove"in e&&(e.onRemove=this.onRemove.bind(this)),e instanceof Vr?this.appIds=e:e instanceof Ir?this.blockRecords=e:e instanceof Wt?this.dimensionStyles=e:e instanceof Mr?this.layers=e:e instanceof Wr?this.lineTypes=e:e instanceof Hr?this.textStyles=e:e instanceof Fr?this.uCSs=e:e instanceof Ur?this.views=e:e instanceof zr&&(this.vPorts=e))}unregisterCollection(e){}addCadObject(e){if(e.document!=null)throw new Error(`The item with handle ${e.handle} is already assigned to a document`);if(e.handle===0||this._cadObjects.has(e.handle)){let t=this._cadObjects.size;e.handle=t}this._cadObjects.set(e.handle,e),e.assignDocument(this)}onAdd(e,t){if(this.addCadObject(t.item),this.registerBlockMarkers(t.item),t.item&&"entities"in t.item&&t.item.entities){let i=t.item.entities;"onAdd"in i&&(i.onAdd=this.onAdd.bind(this)),"onRemove"in i&&(i.onRemove=this.onRemove.bind(this))}}onRemove(e,t){this.unregisterBlockMarkers(t.item),this.removeCadObject(t.item)}registerBlockMarkers(e){if(!(!e||!("blockEntity"in e)||!("blockEnd"in e)))for(let t of[e.blockEntity,e.blockEnd])t instanceof I&&t.document==null&&this.addCadObject(t)}unregisterBlockMarkers(e){if(!(!e||!("blockEntity"in e)||!("blockEnd"in e)))for(let t of[e.blockEntity,e.blockEnd])t instanceof I&&t.document===this&&this.removeCadObject(t)}removeCadObject(e){!this.tryGetCadObject(e.handle).found||!this._cadObjects.delete(e.handle)||e.unassignDocument()}updateCollectionDict(e,t){return{success:!1,dictionary:null}}};Te();var bh=class{name;DxfCodes=[];_propertyName;_referenceType=0;get referenceType(){return this._referenceType}set referenceType(e){this._referenceType=e}constructor(e,t){this._propertyName=e,this.name=t}getSystemValue(e,t){return t&&this._propertyName?t[this._propertyName]:null}getValue(e){return e&&this._propertyName?e[this._propertyName]:null}};var W;(function(r){r[r.Unknown=0]="Unknown",r[r.Long=1]="Long",r[r.Double=2]="Double",r[r.String=4]="String",r[r.Date=8]="Date",r[r.Point2D=16]="Point2D",r[r.Point3D=32]="Point3D",r[r.Handle=64]="Handle",r[r.Buffer=128]="Buffer",r[r.ResultBuffer=256]="ResultBuffer",r[r.General=512]="General"})(W||(W={}));var po;(function(r){r[r.NoUnits=0]="NoUnits",r[r.Distance=1]="Distance",r[r.Angle=2]="Angle",r[r.Area=4]="Area",r[r.Volume=8]="Volume",r[r.Currency=16]="Currency",r[r.Percentage=32]="Percentage"})(po||(po={}));var Ht=class{flags=0;format="";formattedValue="";get isEmpty(){return(this.flags&1)!==0}set isEmpty(e){e?this.flags|=1:this.flags&=-2}units=po.NoUnits;value=null;valueType=W.Unknown;setValue(e,t){switch(t!==void 0&&(this.valueType=t),this.valueType){case W.Point2D:case W.Point3D:case W.Long:case W.Double:case W.Date:case W.Handle:case W.String:case W.General:this.value=e;break;case W.Unknown:case W.Buffer:case W.ResultBuffer:default:throw new Error("Invalid operation for value type")}}toString(){return`${this.valueType}:${this.value}`}};rl();var tn=class r{code;rawHeader;rawImage;constructor(e,t,i){this.code=e??r.PreviewType.Unknown,this.rawHeader=t??new Uint8Array(0),this.rawImage=i??new Uint8Array(0)}toBytes(){let e=!1;switch(this.code){case r.PreviewType.Bmp:case r.PreviewType.Wmf:case r.PreviewType.Png:e=!1;break;case r.PreviewType.Unknown:default:throw new Error(`Preview with code ${this.code} not supported.`)}if(e&&this.rawHeader.length>0){let t=new Uint8Array(this.rawHeader.length+this.rawImage.length);return t.set(this.rawHeader),t.set(this.rawImage,this.rawHeader.length),t}return this.rawImage.slice()}};(function(r){let e;(function(t){t[t.Unknown=0]="Unknown",t[t.Bmp=2]="Bmp",t[t.Wmf=3]="Wmf",t[t.Png=6]="Png"})(e=r.PreviewType||(r.PreviewType={}))})(tn||(tn={}));var gn=class{name="";dxfProperties=new Map;static addClassProperties(e,t,i){}static*cadObjectMapDxf(e){}};var V=class r extends gn{static _cache=new Map;constructor(e){if(super(),e instanceof r){this.name=e.name;for(let[t,i]of e.dxfProperties)this.dxfProperties.set(t,i)}else typeof e=="string"&&(this.name=e)}static createFromType(e,t){if(r._cache.has(e))return new r(r._cache.get(e));let i=new r;return i.name=t??e,r._cache.set(e,i),new r(i)}static Create(e,t){let i=typeof e=="string"?e:e.name;return r.createFromType(i,t)}clearCache(){r._cache.clear()}toString(){return`DxfClassMap:${this.name}`}};q();D();var Ae=class r extends gn{static _cache=new Map;subClasses=new Map;static create(e,t){let i=typeof e=="string"?e:e.name;if(r._cache.has(i)){let n=r._cache.get(i),a=new r;a.name=n.name;for(let[o,h]of n.dxfProperties)a.dxfProperties.set(o,h);for(let[o,h]of n.subClasses)a.subClasses.set(o,h);return a}let s=new r;return s.name=t??"",r._cache.set(i,s),s}static clearCache(){r._cache.clear()}toString(){return`DxfMap:${this.name}`}};q();var _;(function(r){r[r.None=0]="None",r[r.String=1]="String",r[r.Point3D=2]="Point3D",r[r.Double=3]="Double",r[r.Byte=4]="Byte",r[r.Int16=5]="Int16",r[r.Int32=6]="Int32",r[r.Int64=7]="Int64",r[r.Handle=8]="Handle",r[r.ObjectId=9]="ObjectId",r[r.Bool=10]="Bool",r[r.Chunk=11]="Chunk",r[r.Comment=12]="Comment",r[r.ExtendedDataString=13]="ExtendedDataString",r[r.ExtendedDataChunk=14]="ExtendedDataChunk",r[r.ExtendedDataHandle=15]="ExtendedDataHandle",r[r.ExtendedDataDouble=16]="ExtendedDataDouble",r[r.ExtendedDataInt16=17]="ExtendedDataInt16",r[r.ExtendedDataInt32=18]="ExtendedDataInt32"})(_||(_={}));var Be=class r{static isValidCode(e,t){return r.isValidGroupCode(r.transformValue(e),t)}static isValidGroupCode(e,t){switch(e){case _.String:case _.ExtendedDataString:case _.Comment:return typeof t=="string";case _.Point3D:return t!=null&&typeof t=="object";case _.Double:case _.ExtendedDataDouble:return typeof t=="number";case _.Byte:return typeof t=="number";case _.Int16:case _.ExtendedDataInt16:return typeof t=="number";case _.Int32:case _.ExtendedDataInt32:return typeof t=="number";case _.Int64:return typeof t=="number"||typeof t=="bigint";case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:return typeof t=="number";case _.Bool:return typeof t=="boolean";case _.Chunk:case _.ExtendedDataChunk:return t instanceof Uint8Array||Array.isArray(t);case _.None:default:return!1}}static transformValue(e){return e>=0&&e<=4?_.String:e===5?_.Handle:e>=6&&e<=9?_.String:e>=10&&e<=39?_.Point3D:e>=40&&e<=59?_.Double:e>=60&&e<=79?_.Int16:e>=90&&e<=99?_.Int32:e===100?_.String:e===101?_.String:e===102?_.String:e===105?_.Handle:e>=110&&e<=119?_.Double:e>=120&&e<=129?_.Double:e>=130&&e<=139?_.Double:e>=140&&e<=149?_.Double:e>=160&&e<=169?_.Int64:e>=170&&e<=179?_.Int16:e>=210&&e<=239?_.Double:e>=270&&e<=279?_.Int16:e>=280&&e<=289?_.Byte:e>=290&&e<=299?_.Bool:e>=300&&e<=309?_.String:e>=310&&e<=319?_.Chunk:e>=320&&e<=329?_.Handle:e>=330&&e<=369?_.ObjectId:e>=370&&e<=379?_.Int16:e>=380&&e<=389?_.Int16:e>=390&&e<=399?_.ObjectId:e>=400&&e<=409?_.Int16:e>=410&&e<=419?_.String:e>=420&&e<=429?_.Int32:e>=430&&e<=439?_.String:e>=440&&e<=449?_.Int32:e>=450&&e<=459?_.Int32:e>=460&&e<=469?_.Double:e>=470&&e<=479?_.String:e>=480&&e<=481?_.Handle:e===999?_.Comment:e>=1e3&&e<=1003?_.ExtendedDataString:e===1004?_.ExtendedDataChunk:e>=1005&&e<=1009?_.ExtendedDataHandle:e>=1010&&e<=1059?_.ExtendedDataDouble:e>=1060&&e<=1070?_.ExtendedDataInt16:e===1071?_.ExtendedDataInt32:_.None}};var pl=class{get assignedCode(){return this._assignedCode!==null?this._assignedCode:this.dxfCodes.length===1?this.dxfCodes[0]:p.Invalid}dxfCodes=[];referenceType=0;storedValue=null;get groupCode(){let e=this.dxfCodes[0];return Be.transformValue(e)}_assignedCode=null;_propertyName="";constructor(e,t){this._propertyName=e,this.dxfCodes=t}setValue(e,t,i){t&&this._propertyName&&(t[this._propertyName]=i)}getRawValue(e){return e&&this._propertyName?e[this._propertyName]:null}};var gh=class extends pl{constructor(e,t,i){typeof e=="string"?super(e,t):(super(t,i??[e]),this._assignedCode=e)}getCollectionCodes(){return null}getValue(e){return this.getRawValue(e)}toString(){let e="";for(let t of this.dxfCodes)e+=`${t}:`;return e+=this._propertyName,e}};x();R();D();x();var vd;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r[r.Baseline=3]="Baseline"})(vd||(vd={}));var xn=class extends A{baseHeight=0;binRecord=null;binRecordHandle=0;cleanupGroup=null;cleanupGroupHandle=0;endPoint=new c;height=0;justification=vd.Baseline;length=0;normal=new c(0,0,1);rawData=null;startPoint=new c;style=null;version=0;width=0;get objectName(){return d.EntityAecWall}get objectType(){return u.UNLISTED}get subclassMarker(){return l.AecWall}getBoundingBox(){throw new Error("Not implemented")}applyTransform(e){}};D();x();R();var dt=class extends A{center=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityCircle}get objectType(){return u.CIRCLE}get radius(){return this._radius}set radius(e){if(e<=0)throw new Error("The radius must be greater than 0.");this._radius=e}get radiusRatio(){return 1}get subclassMarker(){return l.Circle}thickness=0;_radius=1;constructor(){super()}applyTransform(e){}getBoundingBox(){let e=new c(this.center.x-this._radius,this.center.y-this._radius,this.center.z),t=new c(this.center.x+this._radius,this.center.y+this._radius,this.center.z);return{min:e,max:t}}polarCoordinateRelativeToCenter(e){return new c(0,0,0)}polygonalVertexes(e){if(e<2)throw new Error("The arc precision must be equal or greater than two.");return[]}};D();x();R();var Ft=class r extends dt{endAngle=Math.PI;get objectName(){return d.EntityArc}get objectType(){return u.ARC}startAngle=0;get subclassMarker(){return l.Arc}get sweep(){let e=this.startAngle,t=this.endAngle;return t<e&&(t+=Math.PI*2),e-t}constructor(e,t,i,s){super(),e!==void 0&&(this.center=e),t!==void 0&&(this.radius=t),i!==void 0&&(this.startAngle=i),s!==void 0&&(this.endAngle=s)}static createFromBulge(e,t,i){let{center:s,radius:n}=r.getCenter(e,t,i),a,o;i<0?(a=Math.atan2(t.y-s.y,t.x-s.x),o=Math.atan2(e.y-s.y,e.x-s.x)):(a=Math.atan2(e.y-s.y,e.x-s.x),o=Math.atan2(t.y-s.y,t.x-s.x));let h=new r;return h.center=new c(s.x,s.y,0),h.radius=n,h.startAngle=a,h.endAngle=o,h}static getBulge(e,t,i,s){let n=t.x-e.x,a=t.y-e.y,o=-a,h=n,f=i.x-e.x,b=i.y-e.y,S=Math.atan2(n*f+a*b,o*f+h*b);return s?S>0&&(S-=Math.PI*2):S<0&&(S+=Math.PI*2),Math.tan(S/4)}static getBulgeFromAngle(e){return Math.tan(e/4)}static getCenter(e,t,i){let s=4*Math.atan(Math.abs(i)),n=t.x-e.x,a=t.y-e.y,h=Math.sqrt(n*n+a*a)/2/Math.sin(s/2),f=(Math.PI-s)/2,b=Math.atan2(a,n)+Math.sign(i)*f;return{center:new C(e.x+h*Math.cos(b),e.y+h*Math.sin(b)),radius:h}}applyTransform(e){}getBoundingBox(){return null}getEndVertices(){let e=new c(this.center.x+this.radius*Math.cos(this.startAngle),this.center.y+this.radius*Math.sin(this.startAngle),0),t=new c(this.center.x+this.radius*Math.cos(this.endAngle),this.center.y+this.radius*Math.sin(this.endAngle),0);return{start:e,end:t}}polygonalVertexes(e){if(e<2)throw new Error("The arc precision must be equal or greater than two.");return[]}};var Oe;(function(r){r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight"})(Oe||(Oe={}));Te();D();x();R();var ht;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r[r.Aligned=3]="Aligned",r[r.Middle=4]="Middle",r[r.Fit=5]="Fit"})(ht||(ht={}));var ct;(function(r){r[r.Baseline=0]="Baseline",r[r.Bottom=1]="Bottom",r[r.Middle=2]="Middle",r[r.Top=3]="Top"})(ct||(ct={}));var rn;(function(r){r[r.None=0]="None",r[r.Backward=2]="Backward",r[r.UpsideDown=4]="UpsideDown"})(rn||(rn={}));var Je=class extends A{alignmentPoint=new c(0,0,0);get height(){return this._height}set height(e){if(e<=0)throw new Error("The Text height must be greater than zero.");this._height=e}horizontalAlignment=ht.Left;insertPoint=new c(0,0,0);get mirror(){return this._mirror}set mirror(e){this._mirror=e}normal=new c(0,0,1);get objectName(){return d.EntityText}get objectType(){return u.TEXT}obliqueAngle=0;rotation=0;get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}get subclassMarker(){return l.Text}thickness=0;get value(){return this._value}set value(e){if(e.length>256)throw new Error(`Text length cannot be superior to 256, current: ${e.length}`);this._value=e}verticalAlignment=ct.Baseline;widthFactor=1;_height=1;_mirror=rn.None;_style=te.Default;_value="";constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.textStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.textStyles.get(te.DefaultName))}};var Gr;(function(r){r[r.SingleLine=1]="SingleLine",r[r.MultiLine=2]="MultiLine",r[r.ConstantMultiLine=4]="ConstantMultiLine"})(Gr||(Gr={}));var wo;(function(r){r[r.None=0]="None",r[r.Hidden=1]="Hidden",r[r.Constant=2]="Constant",r[r.Verify=4]="Verify",r[r.Preset=8]="Preset"})(wo||(wo={}));var Dn=class extends Je{attributeType=Gr.SingleLine;flags=wo.None;isReallyLocked=!1;mText=null;get tag(){return this._tag}set tag(e){this._tag=e}version=0;verticalAlignment=ct.Baseline;_tag="";constructor(){super()}matchAttributeProperties(e){this.matchProperties(e),this.thickness=e.thickness,this.insertPoint=e.insertPoint,this.height=e.height,this.value=e.value,this.rotation=e.rotation,this.widthFactor=e.widthFactor,this.obliqueAngle=e.obliqueAngle,this.style.document!==e.style.document?this.style=e.style.clone():this.style=e.style,this.mirror=e.mirror,this.horizontalAlignment=e.horizontalAlignment,this.alignmentPoint=e.alignmentPoint,this.normal=e.normal,this.verticalAlignment=e.verticalAlignment,this.version=e.version,this.tag=e.tag,this.flags=e.flags,this.attributeType=e.attributeType,this.isReallyLocked=e.isReallyLocked,this.insertPoint=e.insertPoint}};D();x();R();var es=class extends Dn{get objectType(){return u.ATTDEF}get objectName(){return d.EntityAttributeDefinition}get subclassMarker(){return l.AttributeDefinition}prompt="";constructor(e){super(),e&&this.matchAttributeProperties(e)}};D();x();R();var Dt=class extends Dn{get objectName(){return d.EntityAttribute}get objectType(){return u.ATTRIB}get subclassMarker(){return l.Attribute}constructor(e){super(),e&&this.matchAttributeProperties(e)}};var rr;(function(r){r[r.None=0]="None",r[r.UseBackgroundFillColor=1]="UseBackgroundFillColor",r[r.UseDrawingWindowColor=2]="UseDrawingWindowColor",r[r.TextFrame=16]="TextFrame"})(rr||(rr={}));var qe;(function(r){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",r[r.NotClosed=32]="NotClosed",r[r.SelfIntersecting=64]="SelfIntersecting",r[r.TextIsland=128]="TextIsland",r[r.Duplicate=256]="Duplicate",r[r.IsAnnotative=512]="IsAnnotative",r[r.DoesNotSupportScale=1024]="DoesNotSupportScale",r[r.ForceAnnoAllVisible=2048]="ForceAnnoAllVisible",r[r.OrientToPaper=4096]="OrientToPaper",r[r.IsAnnotativeBlock=8192]="IsAnnotativeBlock"})(qe||(qe={}));x();var _o=class{acisIndex=0;applyTransformPresent=!1;color=B.ByLayer;hasRotation=!1;hasShear=!1;points=[];scale=0;selectionMarker=0;translation=new c(0,0,0);type=0;xAxis=new c(0,0,0);yAxis=new c(0,0,0);zAxis=new c(0,0,0);hasReflection=!1},wl=class{viewportDirectionFromTarget=new c(0,0,0);viewportId=0;viewportPerspective=!1;viewportTarget=new c(0,0,0);viewportUpDirection=new c(0,0,0);wires=[]},Ds=class extends A{point=new c(0,0,0);silhouettes=[];get subclassMarker(){return l.ModelerGeometry}wires=[];guid="";modelerFormatVersion=0;proprietaryData="";applyTransform(e){}getBoundingBox(){return null}};D();R();var ts=class extends Ds{get objectType(){return u.BODY}get objectName(){return d.EntityBody}};Te();var xi;(function(r){r[r.Outside=0]="Outside",r[r.Inside=1]="Inside"})(xi||(xi={}));var $r;(function(r){r[r.Rectangular=1]="Rectangular",r[r.Polygonal=2]="Polygonal"})($r||($r={}));var ir;(function(r){r[r.None=0]="None",r[r.ShowImage=1]="ShowImage",r[r.ShowNotAlignedImage=2]="ShowNotAlignedImage",r[r.UseClippingBoundary=4]="UseClippingBoundary",r[r.TransparencyIsOn=8]="TransparencyIsOn"})(ir||(ir={}));var Ss=class extends A{get brightness(){return this._brightness}set brightness(e){if(e<0||e>100)throw new Error(`Invalid Brightness value: ${e}, must be in range 0-100`);this._brightness=e}classVersion=0;clipBoundaryVertices=[];clipMode=xi.Outside;clippingState=!1;clipType=$r.Rectangular;get contrast(){return this._contrast}set contrast(e){if(e<0||e>100)throw new Error(`Invalid Contrast value: ${e}, must be in range 0-100`);this._contrast=e}get definition(){return this._definition}set definition(e){this.document!=null?this._definition=I.updateCollection(e,this.document.imageDefinitions):this._definition=e}get fade(){return this._fade}set fade(e){if(e<0||e>100)throw new Error(`Invalid Fade value: ${e}, must be in range 0-100`);this._fade=e}get flags(){return this._flags}set flags(e){this._flags=e}insertPoint=new c(0,0,0);get showImage(){return(this._flags&ir.ShowImage)!==0}set showImage(e){e?this._flags=this._flags|ir.ShowImage:this._flags=this._flags&~ir.ShowImage}size=new C(0,0);uVector=new c(1,0,0);vVector=new c(0,1,0);definitionReactor=null;_brightness=50;_contrast=50;_definition=null;_fade=0;_flags=ir.None;applyTransform(e){}clone(){let e=super.clone();return e._definition=this._definition?.clone?.()??null,e}getBoundingBox(){if(this.clipBoundaryVertices.length===0)return null;let e=1/0,t=1/0,i=-1/0,s=-1/0;for(let o of this.clipBoundaryVertices)o.x<e&&(e=o.x),o.y<t&&(t=o.y),o.x>i&&(i=o.x),o.y>s&&(s=o.y);let n=new c(e+this.insertPoint.x,t+this.insertPoint.y,this.insertPoint.z),a=new c(i+this.insertPoint.x,s+this.insertPoint.y,this.insertPoint.z);return{min:n,max:a}}assignDocument(e){super.assignDocument(e),this._definition=I.updateCollection(this._definition,e.imageDefinitions)}unassignDocument(){super.unassignDocument(),this._definition=this._definition?.clone?.()??null}imageDefinitionsOnRemove(e,t){t.item===this._definition&&(this._definition=null)}};var rs;(function(r){r[r.NoColumns=0]="NoColumns",r[r.StaticColumns=1]="StaticColumns",r[r.DynamicColumns=2]="DynamicColumns"})(rs||(rs={}));Te();x();var v;(function(r){r[r.Linear=0]="Linear",r[r.Aligned=1]="Aligned",r[r.Angular=2]="Angular",r[r.Diameter=3]="Diameter",r[r.Radius=4]="Radius",r[r.Angular3Point=5]="Angular3Point",r[r.Ordinate=6]="Ordinate",r[r.BlockReference=32]="BlockReference",r[r.OrdinateTypeX=64]="OrdinateTypeX",r[r.TextUserDefinedLocation=128]="TextUserDefinedLocation"})(v||(v={}));var sn;(function(r){r[r.None=0]="None",r[r.AtLeast=1]="AtLeast",r[r.Exact=2]="Exact"})(sn||(sn={}));var me=class extends A{attachmentPoint=Oe.TopLeft;get block(){return this._block}set block(e){this.document!=null?this._block=I.updateCollection(e,this.document.blockRecords):this._block=e}definitionPoint=new c(0,0,0);get flags(){return this._flags}set flags(e){this._flags=e}flipArrow1=!1;flipArrow2=!1;get hasStyleOverride(){return!1}horizontalDirection=0;insertionPoint=new c(0,0,0);get isAngular(){return(this._flags&v.Angular3Point)!==0||(this._flags&v.Angular)!==0}get isTextUserDefinedLocation(){return(this._flags&v.TextUserDefinedLocation)!==0}set isTextUserDefinedLocation(e){e?this._flags=this._flags|v.TextUserDefinedLocation:this._flags=this._flags&~v.TextUserDefinedLocation}lineSpacingFactor=0;lineSpacingStyle=sn.AtLeast;normal=new c(0,0,1);get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Dimension}text="";textMiddlePoint=new c(0,0,0);textRotation=0;version=0;_block=null;_flags;_style=re.Default;constructor(e){super(),this._flags=e,this._flags|=v.BlockReference}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),e._block=this._block?.clone()??null,e}getActiveDimensionStyle(){return this.hasStyleOverride?this.style:this.style}getMeasurementText(e){return this.measurement.toString()}getStyleOverrideMap(){return null}setDimensionOverride(e){}setStyleOverrideMap(e){}updateBlock(){this.createBlock()}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.dimensionStyles),this._block=I.updateCollection(this._block,e.blockRecords),this._block!=null&&(this._block.name=this.generateBlockName()),this._block=I.updateCollection(this._block,e.blockRecords)}unassignDocument(){super.unassignDocument(),this._style=this._style?.clone(),this._block=this._block?.clone()??null}createBlock(){this._block==null&&(this._block=new U(this.generateBlockName()),this._block.isAnonymous=!0),this.document!=null&&(this._block=I.updateCollection(this._block,this.document.blockRecords)),this._block.entities?.clear?.()}createDefinitionPoint(e){return null}createTextEntity(e,t){return null}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.dimensionStyles.get(re.DefaultName)),t.item===this._block&&(this._block=null)}generateBlockName(){return`*D${this.handle}`}};D();x();R();function Ac(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}var je=class r extends me{extLineRotation=0;firstPoint=new c(0,0,0);get measurement(){return Ac(this.firstPoint,this.secondPoint)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ALIGNED}get offset(){return Ac(this.secondPoint,this.definitionPoint)}set offset(e){}secondPoint=new c(0,0,0);get subclassMarker(){return l.AlignedDimension}constructor(e,t){super(v.Aligned),e&&(this.firstPoint=e),t&&(this.secondPoint=t)}static createWithType(e){let t=new r;return t._flags=e,t.definitionPoint=t.secondPoint,t}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();var St=class extends me{angleVertex=new c(0,0,0);get center(){return new c(0,0,0)}dimensionArc=new c(0,0,0);firstPoint=new c(0,0,0);get measurement(){return 0}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ANG_2_Ln}get offset(){let e=this.secondPoint.x-this.definitionPoint.x,t=this.secondPoint.y-this.definitionPoint.y,i=this.secondPoint.z-this.definitionPoint.z;return Math.sqrt(e*e+t*t+i*i)}set offset(e){}secondPoint=new c(0,0,0);get subclassMarker(){return l.Angular2LineDimension}constructor(){super(v.Angular)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){}};D();x();R();var Ct=class extends me{angleVertex=new c(0,0,0);firstPoint=new c(0,0,0);get measurement(){return 0}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ANG_3_Pt}secondPoint=new c(0,0,0);get subclassMarker(){return l.Angular3PointDimension}constructor(){super(v.Angular3Point)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.firstPoint.x,this.secondPoint.x),y:Math.min(this.firstPoint.y,this.secondPoint.y),z:Math.min(this.firstPoint.z,this.secondPoint.z)},max:{x:Math.max(this.firstPoint.x,this.secondPoint.x),y:Math.max(this.firstPoint.y,this.secondPoint.y),z:Math.max(this.firstPoint.z,this.secondPoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();function Wc(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}function Hc(r,e){return new c((r.x+e.x)/2,(r.y+e.y)/2,(r.z+e.z)/2)}var Bt=class extends me{angleVertex=new c(0,0,0);get center(){return Hc(this.angleVertex,this.definitionPoint)}leaderLength=0;get measurement(){return Wc(this.definitionPoint,this.angleVertex)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_DIAMETER}get subclassMarker(){return l.DiametricDimension}constructor(){super(v.Diameter)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:new c(this.insertionPoint.x-this.angleVertex.x,this.insertionPoint.y-this.angleVertex.y,this.insertionPoint.z-this.angleVertex.z),max:new c(this.insertionPoint.x+this.angleVertex.x,this.insertionPoint.y+this.angleVertex.y,this.insertionPoint.z+this.angleVertex.z)}}updateBlock(){super.updateBlock()}};D();x();R();var Qe=class extends je{get measurement(){let e=new c(Math.cos(this.rotation),Math.sin(this.rotation),0),t=new c(this.secondPoint.x-this.firstPoint.x,this.secondPoint.y-this.firstPoint.y,this.secondPoint.z-this.firstPoint.z),i=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);if(i===0)return 0;let s=new c(t.x/i,t.y/i,t.z/i),n=Math.abs(e.x*s.x+e.y*s.y+e.z*s.z);return super.measurement*n}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_LINEAR}get offset(){return super.offset}set offset(e){}rotation=0;get subclassMarker(){return l.LinearDimension}constructor(){super(),this._flags=v.Linear|v.BlockReference}updateBlock(){this.createBlock()}};D();x();R();var yt=class extends me{featureLocation=new c(0,0,0);get isOrdinateTypeX(){return(this._flags&v.OrdinateTypeX)!==0}set isOrdinateTypeX(e){e?this._flags=this._flags|v.OrdinateTypeX:this._flags=this._flags&~v.OrdinateTypeX}leaderEndpoint=new c(0,0,0);get measurement(){let e=this.isOrdinateTypeX?new C(0,1):new C(1,0),t=Math.sin(this.horizontalDirection),i=Math.cos(this.horizontalDirection),s=new C(e.x*i-e.y*t,e.x*t+e.y*i),n=new C(this.definitionPoint.x-this.featureLocation.x,this.definitionPoint.y-this.featureLocation.y),a=s.x*n.x+s.y*n.y,o=new C(this.featureLocation.x+a*s.x,this.featureLocation.y+a*s.y),h=new C(this.definitionPoint.x-o.x,this.definitionPoint.y-o.y),f=h.x*h.x+h.y*h.y;return Math.sqrt(f)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_ORDINATE}get subclassMarker(){return l.OrdinateDimension}constructor(){super(v.Ordinate)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:{x:Math.min(this.featureLocation.x,this.leaderEndpoint.x),y:Math.min(this.featureLocation.y,this.leaderEndpoint.y),z:Math.min(this.featureLocation.z,this.leaderEndpoint.z)},max:{x:Math.max(this.featureLocation.x,this.leaderEndpoint.x),y:Math.max(this.featureLocation.y,this.leaderEndpoint.y),z:Math.max(this.featureLocation.z,this.leaderEndpoint.z)}}}updateBlock(){super.updateBlock()}};D();x();R();function Fc(r,e){let t=r.x-e.x,i=r.y-e.y,s=r.z-e.z;return Math.sqrt(t*t+i*i+s*s)}var Rt=class extends me{angleVertex=new c(0,0,0);leaderLength=0;get measurement(){return Fc(this.definitionPoint,this.angleVertex)}get objectName(){return d.EntityDimension}get objectType(){return u.DIMENSION_RADIUS}get subclassMarker(){return l.RadialDimension}constructor(){super(v.Radius)}applyTransform(e){super.applyTransform(e)}getBoundingBox(){return{min:new c(this.insertionPoint.x-this.angleVertex.x,this.insertionPoint.y-this.angleVertex.y,this.insertionPoint.z-this.angleVertex.z),max:new c(this.insertionPoint.x+this.angleVertex.x,this.insertionPoint.y+this.angleVertex.y,this.insertionPoint.z+this.angleVertex.z)}}updateBlock(){super.updateBlock()}};var bo;(function(r){r[r.LeftToRight=1]="LeftToRight",r[r.RightToLeft=2]="RightToLeft",r[r.TopToBottom=3]="TopToBottom",r[r.BottomToTop=4]="BottomToTop",r[r.ByStyle=5]="ByStyle"})(bo||(bo={}));D();x();R();var Ut=class extends A{center=new c(0,0,0);endParameter=Math.PI*2;get isFullEllipse(){return this.startParameter===0&&this.endParameter===Math.PI*2}get majorAxis(){return 2*Math.sqrt(this.majorAxisEndPoint.x**2+this.majorAxisEndPoint.y**2+this.majorAxisEndPoint.z**2)}majorAxisEndPoint=new c(1,0,0);get minorAxis(){return this.majorAxis*this.radiusRatio}get minorAxisEndpoint(){let e=Math.sqrt(this.majorAxisEndPoint.x**2+this.majorAxisEndPoint.y**2+this.majorAxisEndPoint.z**2);if(e===0)return new c(0,0,0);let t=this.majorAxisEndPoint.x/e,i=this.majorAxisEndPoint.y/e,s=this.majorAxisEndPoint.z/e,n=this.normal.y*s-this.normal.z*i,a=this.normal.z*t-this.normal.x*s,o=this.normal.x*i-this.normal.y*t,h=Math.sqrt(n*n+a*a+o*o);if(h===0)return new c(0,0,0);let f=this.radiusRatio*e;return new c(n/h*f,a/h*f,o/h*f)}normal=new c(0,0,1);get objectName(){return d.EntityEllipse}get objectType(){return u.ELLIPSE}get radiusRatio(){return this._radiusRatio}set radiusRatio(e){if(e<=0||e>1)throw new Error("Radius ratio must be a value between 0 (not included) and 1.");this._radiusRatio=e}get rotation(){return Math.atan2(this.majorAxisEndPoint.y,this.majorAxisEndPoint.x)}startParameter=0;get subclassMarker(){return l.Ellipse}thickness=0;_radiusRatio=1;applyTransform(e){}getBoundingBox(){return null}getEndVertices(){let e=this.polarCoordinateRelativeToCenter(this.startParameter),t=this.polarCoordinateRelativeToCenter(this.endParameter);return{start:e,end:t}}polarCoordinateRelativeToCenter(e){return new c(0,0,0)}polygonalVertexes(e){return[]}};D();x();R();var nn;(function(r){r[r.None=0]="None",r[r.First=1]="First",r[r.Second=2]="Second",r[r.Third=4]="Third",r[r.Fourth=8]="Fourth"})(nn||(nn={}));var Yr=class extends A{get objectType(){return u.FACE3D}get objectName(){return d.Entity3DFace}get subclassMarker(){return l.Face3d}firstCorner=new c(0,0,0);secondCorner=new c(0,0,0);thirdCorner=new c(0,0,0);fourthCorner=new c(0,0,0);flags=nn.None;constructor(){super()}getBoundingBox(){return null}applyTransform(e){}};var Sn=class r{value=0;color=B.ByLayer;clone(){let e=new r;return e.value=this.value,e.color=this.color,e}};D();x();R();var go=class r{enabled=!1;reserved=0;angle=0;shift=0;isSingleColorGradient=!1;colorTint=0;colors=[];name="";constructor(e){e&&(this.name=e)}clone(){let e=new r;return e.enabled=this.enabled,e.reserved=this.reserved,e.angle=this.angle,e.shift=this.shift,e.isSingleColorGradient=this.isSingleColorGradient,e.colorTint=this.colorTint,e.name=this.name,e.colors=this.colors.map(t=>t.clone()),e}};var Cn=class r{angle=0;basePoint=new C(0,0);dashLengths=[];get lineOffset(){let e=Math.cos(-this.angle),t=Math.sin(-this.angle);return this.offset.x*t+this.offset.y*e}offset=new C(0,0);get shift(){let e=Math.cos(-this.angle),t=Math.sin(-this.angle);return this.offset.x*e-this.offset.y*t}clone(){let e=new r;return e.angle=this.angle,e.basePoint=new C(this.basePoint.x,this.basePoint.y),e.offset=new C(this.offset.x,this.offset.y),e.dashLengths=[...this.dashLengths],e}},an=class r{static get Solid(){return new r("SOLID")}description="";lines=[];name;constructor(e){this.name=e}clone(){let e=new r(this.name);return e.description=this.description,e.lines=this.lines.map(t=>t.clone()),e}toString(){return this.name}update(e,t,i){for(let s of this.lines)s.angle+=t,s.dashLengths=s.dashLengths.map(n=>n*i)}};var xo;(function(r){r[r.PatternFill=0]="PatternFill",r[r.SolidFill=1]="SolidFill",r[r.Custom=2]="Custom"})(xo||(xo={}));var Do;(function(r){r[r.Normal=0]="Normal",r[r.Outer=1]="Outer",r[r.Ignore=2]="Ignore"})(Do||(Do={}));var sr;(function(r){r[r.Polyline=0]="Polyline",r[r.Line=1]="Line",r[r.CircularArc=2]="CircularArc",r[r.EllipticArc=3]="EllipticArc",r[r.Spline=4]="Spline"})(sr||(sr={}));var on=class{clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}},Xr=class extends on{center=new C(0,0);counterClockWise=!1;endAngle=0;radius=0;startAngle=0;get type(){return sr.CircularArc}applyTransform(e){}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},Zr=class extends on{center=new C(0,0);counterClockWise=!1;endAngle=0;majorAxisEndPoint=new C(0,0);minorToMajorRatio=0;startAngle=0;get type(){return sr.EllipticArc}applyTransform(e){}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},Kr=class extends on{end=new C(0,0);start=new C(0,0);get type(){return sr.Line}applyTransform(e){}getBoundingBox(){return null}toEntity(){return null}},is=class extends on{get bulges(){return this.vertices.map(e=>e.z)}get hasBulge(){return this.bulges.some(e=>e!==0)}isClosed=!1;get type(){return sr.Polyline}vertices=[];applyTransform(e){}clone(){let e=super.clone();return e.vertices=[...this.vertices],e}getBoundingBox(){return null}toEntity(){return null}},Jr=class extends on{controlPoints=[];degree=0;endTangent=new C(0,0);fitPoints=[];knots=[];isPeriodic=!1;isRational=!1;startTangent=new C(0,0);get weights(){return this.controlPoints.map(e=>e.z)}get type(){return sr.Spline}applyTransform(e){}clone(){let e=super.clone();return e.controlPoints=[...this.controlPoints],e.fitPoints=[...this.fitPoints],e.knots=[...this.knots],e}getBoundingBox(){return null}polygonalVertexes(e){return[]}toEntity(){return null}},_l=class r{edges=[];entities=[];get flags(){let e=this._flags;return this.isPolyline?e=e|qe.Polyline:e=e&~qe.Polyline,e}set flags(e){this._flags=e}get isPolyline(){return this.edges.some(e=>e instanceof is)}_flags=0;constructor(e){e&&(this.edges=[...e])}applyTransform(e){for(let t of this.edges)t.applyTransform(e)}clone(){let e=new r;return e._flags=this._flags,e.entities=this.entities.map(t=>t.clone()),e.edges=this.edges.map(t=>t.clone()),e}getBoundingBox(){return null}getPoints(e=256){let t=[];for(let i of this.edges)i instanceof Xr?t.push(...i.polygonalVertexes(e)):i instanceof Zr?t.push(...i.polygonalVertexes(e)):i instanceof Kr?(t.push(new c(i.start.x,i.start.y,0)),t.push(new c(i.end.x,i.end.y,0))):i instanceof Jr&&t.push(...i.polygonalVertexes(e));return t}updateEdges(){this.entities.length!==0&&(this.edges=[])}},Tt=class extends A{elevation=0;gradientColor=new go;isAssociative=!1;isDouble=!1;isSolid=!1;normal=new c(0,0,1);get objectName(){return d.EntityHatch}get objectType(){return u.HATCH}paths=[];pattern=an.Solid;get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this.pattern?.update(new C(0,0),this._patternAngle,1)}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this.pattern?.update(new C(0,0),0,this._patternScale)}patternType=xo.PatternFill;pixelSize=0;seedPoints=[];style=Do.Normal;get subclassMarker(){return l.Hatch}_patternAngle=0;_patternScale=0;applyTransform(e){for(let t of this.paths)t.applyTransform(e)}clone(){let e=super.clone();return e.gradientColor=this.gradientColor?.clone(),e.pattern=this.pattern?.clone(),e.paths=this.paths.map(t=>t.clone()),e}*explode(){for(let e of this.paths)for(let t of e.edges)yield t.toEntity()}getBoundingBox(){return null}};var Di;(function(r){r[r.Opposite=0]="Opposite",r[r.Same=1]="Same"})(Di||(Di={}));var vt=class r extends Array{Seqend=null;constructor(...e){super(...e),Object.setPrototypeOf(this,r.prototype)}};D();x();R();var Ee=class extends A{attributes=new vt;block=null;columnCount=1;columnSpacing=0;get hasAttributes(){return this.attributes.length>0}get hasDynamicSubclass(){return!0}insertPoint=new c(0,0,0);get isMultiple(){return this.rowCount>1||this.columnCount>1}normal=new c(0,0,1);get objectName(){return d.EntityInsert}get objectType(){return this.rowCount>1||this.columnCount>1?u.MINSERT:u.INSERT}rotation=0;rowCount=1;rowSpacing=0;get subclassMarker(){return this.isMultiple?l.MInsert:l.Insert}get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_xscale=1;_yscale=1;_zscale=1;constructor(e){if(super(),e){e.document!=null?this.block=e.clone():this.block=e;let t=e.attributeDefinitions;if(t)for(let i of t)this.attributes.push(new Dt(i))}}applyTransform(e){for(let t of this.attributes)t.applyTransform(e)}clone(){let e=super.clone();e.block=this.block?.clone()??null,e.attributes=new vt;for(let t of this.attributes)e.attributes.push(t.clone());return e}*explode(){}getBoundingBox(){return null}getTransform(){return null}updateAttributes(){if(!this.block)return;let e=this.block.attributeDefinitions??[],t=e.map(n=>n.tag),i=this.attributes.map(n=>n.tag),s=new vt(...this.attributes.filter(n=>t.includes(n.tag)));s.Seqend=this.attributes.Seqend,this.attributes=s;for(let n of e)i.includes(n.tag)||this.attributes.push(new Dt(n))}assignDocument(e){if(super.assignDocument(e),this.block==null)return;let t=e.blockRecords?.get(this.block.name);t?this.block=t:e.blockRecords?.add(this.block)}unassignDocument(){this.block=this.block?.clone()??null,super.unassignDocument()}};var Si;(function(r){r[r.Chord=0]="Chord",r[r.SquareRoot=1]="SquareRoot",r[r.Uniform=2]="Uniform",r[r.Custom=15]="Custom"})(Si||(Si={}));Te();D();x();R();var So;(function(r){r[r.CreatedWithTextAnnotation=0]="CreatedWithTextAnnotation",r[r.CreatedWithToleranceAnnotation=1]="CreatedWithToleranceAnnotation",r[r.CreatedWithBlockReferenceAnnotation=2]="CreatedWithBlockReferenceAnnotation",r[r.CreatedWithoutAnnotation=3]="CreatedWithoutAnnotation"})(So||(So={}));var Co;(function(r){r[r.StraightLineSegments=0]="StraightLineSegments",r[r.Spline=1]="Spline"})(Co||(Co={}));var nr=class extends A{annotationOffset=new c(0,0,0);arrowHeadEnabled=!1;associatedAnnotation=null;blockOffset=new c(0,0,0);creationType=So.CreatedWithoutAnnotation;get hasHookline(){return this.vertices.length<=1,!1}hookLineDirection=Di.Opposite;horizontalDirection=new c(1,0,0);normal=new c(0,0,1);get objectName(){return d.EntityLeader}get objectType(){return u.LEADER}pathType=Co.StraightLineSegments;get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Leader}textHeight=0;textWidth=0;vertices=[];_style=re.Default;applyTransform(e){}clone(){let e=super.clone();return e._style=this._style?.clone(),e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.dimensionStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.dimensionStyles.get(re.DefaultName))}};var bl;(function(r){r[r.OneDistantLight=0]="OneDistantLight",r[r.TwoDistantLights=1]="TwoDistantLights"})(bl||(bl={}));D();x();R();var zt=class extends A{endPoint=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityLine}get objectType(){return u.LINE}startPoint=new c(0,0,0);get subclassMarker(){return l.Line}thickness=0;constructor(e,t){super(),e&&(this.startPoint=e),t&&(this.endPoint=t)}applyTransform(e){}getBoundingBox(){let e=new c(Math.min(this.startPoint.x,this.endPoint.x),Math.min(this.startPoint.y,this.endPoint.y),Math.min(this.startPoint.z,this.endPoint.z)),t=new c(Math.max(this.startPoint.x,this.endPoint.x),Math.max(this.startPoint.y,this.endPoint.y),Math.max(this.startPoint.z,this.endPoint.z));return{min:e,max:t}}};D();x();R();var At;(function(r){r[r.Default=0]="Default",r[r.Closed=1]="Closed",r[r.Plinegen=128]="Plinegen"})(At||(At={}));var Ci=class{location=new C(0,0);startWidth=0;endWidth=0;bulge=0;flags=0;curveTangent=0;id=0;constructor(e){e&&(this.location=new C(e.x,e.y))}getLocation3D(){return new c(this.location.x,this.location.y,0)}},qr=class extends A{constantWidth=0;elevation=0;get flags(){return this._flags}set flags(e){this._flags=e}get isClosed(){return(this._flags&At.Closed)!==0}set isClosed(e){e?this._flags=this._flags|At.Closed:this._flags=this._flags&~At.Closed}normal=new c(0,0,1);get objectName(){return d.EntityLwPolyline}get objectType(){return u.LWPOLYLINE}get subclassMarker(){return l.LwPolyline}thickness=0;vertices=[];_flags=At.Default;constructor(e){super(),e&&e.length>0&&("location"in e[0]?this.vertices=e:this.vertices=e.map(t=>new Ci(t)))}applyTransform(e){}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>{let i=new Ci;return i.location=new C(t.location.x,t.location.y),i.startWidth=t.startWidth,i.endWidth=t.endWidth,i.bulge=t.bulge,i.flags=t.flags,i.curveTangent=t.curveTangent,i.id=t.id,i}),e}getBoundingBox(){return null}};D();x();R();var ln=class{start;end;crease=null;constructor(e,t){this.start=e,this.end=t}toString(){return`${this.start}|${this.end}|${this.crease??""}`}},ar=class extends A{blendCrease=0;edges=[];faces=[];get objectName(){return d.EntityMesh}get objectType(){return u.UNLISTED}get subclassMarker(){return l.Mesh}subdivisionLevel=0;version=0;vertices=[];applyTransform(e){for(let t=0;t<this.vertices.length;t++);}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>new c(t.x,t.y,t.z)),e.edges=this.edges.map(t=>{let i=new ln(t.start,t.end);return i.crease=t.crease,i}),e.faces=this.faces.map(t=>[...t]),e}getBoundingBox(){return null}};D();x();R();var Bi;(function(r){r[r.Has=1]="Has",r[r.Closed=2]="Closed",r[r.NoStartCaps=4]="NoStartCaps",r[r.NoEndCaps=8]="NoEndCaps"})(Bi||(Bi={}));var Bo;(function(r){r[r.Top=0]="Top",r[r.Zero=1]="Zero",r[r.Bottom=2]="Bottom"})(Bo||(Bo={}));var Bn=class r{parameters=[];areaFillParameters=[];applyScale(e){this.parameters=this.parameters.map(t=>t*e),this.areaFillParameters=this.areaFillParameters.map(t=>t*e)}clone(){let e=new r;return e.parameters=[...this.parameters],e.areaFillParameters=[...this.areaFillParameters],e}},yn=class r{position=new c(0,0,0);direction=new c(0,0,0);miter=new c(0,0,0);segments=[];applyTransform(e){}clone(){let e=new r;return e.position=new c(this.position.x,this.position.y,this.position.z),e.direction=new c(this.direction.x,this.direction.y,this.direction.z),e.miter=new c(this.miter.x,this.miter.y,this.miter.z),e.segments=this.segments.map(t=>t.clone()),e}},or=class extends A{flags=Bi.Has;justification=Bo.Zero;normal=new c(0,0,1);get objectName(){return d.EntityMLine}get objectType(){return u.MLINE}scaleFactor=1;startPoint=new c(0,0,0);get style(){return this._style}set style(e){if(!e)throw new Error("MLine style cannot be null");this._style=e}get subclassMarker(){return l.MLine}vertices=[];_style=null;applyTransform(e){}clone(){let e=super.clone();return e.vertices=this.vertices.map(t=>t.clone()),e}getBoundingBox(){return null}};Te();D();x();R();var xh=class r{columnType=rs.NoColumns;columnCount=0;flowReversed=!1;autoHeight=!1;width=0;gutter=0;heights=[];clone(){let e=new r;return e.columnType=this.columnType,e.columnCount=this.columnCount,e.flowReversed=this.flowReversed,e.autoHeight=this.autoHeight,e.width=this.width,e.gutter=this.gutter,e.heights=[...this.heights],e}},Ne=class extends A{alignmentPoint=new c(0,0,0);attachmentPoint=Oe.TopLeft;backgroundColor=null;backgroundFillFlags=rr.None;backgroundScale=1.5;backgroundTransparency=0;get columnData(){return this._columnData}set columnData(e){this._columnData=e}drawingDirection=bo.LeftToRight;get hasColumns(){return this._columnData!=null&&this._columnData.columnType!==rs.NoColumns}get height(){return this._height}set height(e){if(e<=0)throw new Error("The text height must be greater than zero.");this._height=e}horizontalWidth=0;insertPoint=new c(0,0,0);isAnnotative=!1;lineSpacing=1;lineSpacingStyle=sn.AtLeast;normal=new c(0,0,1);get objectName(){return d.EntityMText}get objectType(){return u.MTEXT}get plainText(){return this._value}rectangleHeight=0;rectangleWidth=0;get rotation(){return Math.atan2(this.alignmentPoint.y,this.alignmentPoint.x)}set rotation(e){this.alignmentPoint=new c(Math.cos(e),Math.sin(e),0)}get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}get subclassMarker(){return l.MText}get value(){return this._value}set value(e){this._value=e}verticalHeight=0;_height=1;_style=te.Default;_value="";_columnData=null;constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e._style=this._style.clone(),this._columnData&&(e._columnData=this._columnData.clone()),e}getBoundingBox(){return null}getPlainTextLines(){return this.plainText.split(/\r\n|\r|\n/)}getTextLines(){return this._value.replace(/\\P/gi,`
2
+ `).split(/\r\n|\r|\n/)}assignDocument(e){super.assignDocument(e),this._style=I.updateCollection(this._style,e.textStyles)}unassignDocument(){super.unassignDocument(),this._style=this._style.clone()}_tableOnRemove(e,t){super._tableOnRemove(e,t),t.item===this._style&&(this._style=this.document.textStyles.get(te.DefaultName))}};D();x();R();var dn;(function(r){r[r.None=0]="None",r[r.Block=1]="Block",r[r.MText=2]="MText",r[r.Tolerance=3]="Tolerance"})(dn||(dn={}));var yo;(function(r){r[r.Invisible=0]="Invisible",r[r.StraightLineSegments=1]="StraightLineSegments",r[r.Spline=2]="Spline"})(yo||(yo={}));var Ro;(function(r){r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right"})(Ro||(Ro={}));var To;(function(r){r[r.Horizontal=0]="Horizontal",r[r.Vertical=1]="Vertical"})(To||(To={}));var Ao;(function(r){r[r.Left=1]="Left",r[r.Center=2]="Center",r[r.Right=3]="Right"})(Ao||(Ao={}));var Cs;(function(r){r[r.TopOfTopLine=0]="TopOfTopLine",r[r.MiddleOfTopLine=1]="MiddleOfTopLine",r[r.MiddleOfText=2]="MiddleOfText",r[r.MiddleOfBottomLine=3]="MiddleOfBottomLine",r[r.BottomOfBottomLine=4]="BottomOfBottomLine",r[r.BottomLine=5]="BottomLine",r[r.BottomOfTopLineUnderlineBottomLine=6]="BottomOfTopLineUnderlineBottomLine",r[r.BottomOfTopLineUnderlineTopLine=7]="BottomOfTopLineUnderlineTopLine",r[r.BottomofTopLineUnderlineAll=8]="BottomofTopLineUnderlineAll",r[r.CenterOfText=9]="CenterOfText",r[r.CenterOfTextOverline=10]="CenterOfTextOverline"})(Cs||(Cs={}));var zd;(function(r){r[r.None=0]="None",r[r.PathType=1]="PathType",r[r.LineColor=2]="LineColor",r[r.LeaderLineType=4]="LeaderLineType",r[r.LeaderLineWeight=8]="LeaderLineWeight",r[r.EnableLanding=16]="EnableLanding",r[r.LandingGap=32]="LandingGap",r[r.EnableDogleg=64]="EnableDogleg",r[r.LandingDistance=128]="LandingDistance",r[r.Arrowhead=256]="Arrowhead",r[r.ArrowheadSize=512]="ArrowheadSize",r[r.ContentType=1024]="ContentType",r[r.TextStyle=2048]="TextStyle",r[r.TextLeftAttachment=4096]="TextLeftAttachment",r[r.TextAngle=8192]="TextAngle",r[r.TextAlignment=16384]="TextAlignment",r[r.TextColor=32768]="TextColor",r[r.TextHeight=65536]="TextHeight",r[r.TextFrame=131072]="TextFrame",r[r.EnableUseDefaultMText=262144]="EnableUseDefaultMText",r[r.BlockContent=524288]="BlockContent",r[r.BlockContentColor=1048576]="BlockContentColor",r[r.BlockContentScale=2097152]="BlockContentScale",r[r.BlockContentRotation=4194304]="BlockContentRotation",r[r.BlockContentConnection=8388608]="BlockContentConnection",r[r.ScaleFactor=16777216]="ScaleFactor",r[r.TextRightAttachment=33554432]="TextRightAttachment",r[r.TextSwitchAlignmentType=67108864]="TextSwitchAlignmentType",r[r.TextAttachmentDirection=134217728]="TextAttachmentDirection",r[r.TextTopAttachment=268435456]="TextTopAttachment",r[r.TextBottomAttachment=536870912]="TextBottomAttachment"})(zd||(zd={}));var gl=class r{attributeDefinition=null;index=0;width=0;text="";clone(){let e=new r;return e.attributeDefinition=this.attributeDefinition,e.index=this.index,e.width=this.width,e.text=this.text,e}},lr=class extends A{arrowhead=null;arrowheadSize=0;blockAttributes=[];blockContentColor=B.ByBlock;blockContentConnection=0;blockContentId=null;blockContentRotation=0;blockContentScale=new c(1,1,1);contentType=dn.MText;contextData=null;enableAnnotationScale=!1;enableDogleg=!0;enableLanding=!0;extendedToText=!1;landingDistance=0;leaderLineType=null;leaderLineWeight=0;lineColor=B.ByBlock;get objectName(){return d.EntityMultiLeader}get objectType(){return u.UNLISTED}pathType=yo.StraightLineSegments;propertyOverrideFlags=0;scaleFactor=1;style=null;get subclassMarker(){return l.MultiLeader}textAlignment=Ro.Left;textAngle=0;textAttachmentDirection=To.Horizontal;textAttachmentPoint=Ao.Center;textBottomAttachment=Cs.CenterOfText;textColor=B.ByBlock;textFrame=!1;textLeftAttachment=Cs.MiddleOfTopLine;textRightAttachment=Cs.MiddleOfTopLine;textStyle=null;textTopAttachment=Cs.CenterOfText;textDirectionNegative=!1;textAligninIPE=!1;applyTransform(e){}clone(){let e=super.clone();return e.contextData=this.contextData,e.blockAttributes=this.blockAttributes.map(t=>t.clone()),e}getBoundingBox(){return null}};D();x();R();var xl;(function(r){r[r.Link=1]="Link",r[r.Embedded=2]="Embedded",r[r.Static=3]="Static"})(xl||(xl={}));var dr=class extends A{binaryData=new Uint8Array(0);isPaperSpace=!1;lowerRightCorner=new c(0,0,0);get objectName(){return d.EntityOle2Frame}get objectType(){return u.OLE2FRAME}oleObjectType=xl.Embedded;sourceApplication="";get subclassMarker(){return l.Ole2Frame}upperLeftCorner=new c(1,1,0);version=2;applyTransform(e){}getBoundingBox(){return null}};x();var Dl;(function(r){r[r.ClippingOn=1]="ClippingOn",r[r.ShowUnderlay=2]="ShowUnderlay",r[r.Monochrome=4]="Monochrome",r[r.AdjustForBackground=8]="AdjustForBackground",r[r.ClipInsideMode=16]="ClipInsideMode",r[r.Default=11]="Default"})(Dl||(Dl={}));var Sl=class extends A{clipBoundaryVertices=[];get contrast(){return this._contrast}set contrast(e){if(e<0||e>100)throw new Error(`Invalid Contrast value: ${e}, must be in range 0-100`);this._contrast=e}definition=null;get fade(){return this._fade}set fade(e){if(e<0||e>100)throw new Error(`Invalid Fade value: ${e}, must be in range 0-100`);this._fade=e}flags=Dl.Default;insertPoint=new c(0,0,0);normal=new c(0,0,1);rotation=0;get subclassMarker(){return l.Underlay}get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_contrast=100;_fade=0;_xscale=1;_yscale=1;_zscale=1;constructor(e){super(),e&&(this.definition=e)}applyTransform(e){}clone(){let e=super.clone();return e.definition=this.definition?.clone?.()??null,e.clipBoundaryVertices=[...this.clipBoundaryVertices],e}getBoundingBox(){return null}assignDocument(e){super.assignDocument(e)}unassignDocument(){super.unassignDocument(),this.definition=this.definition?.clone?.()??null}};D();R();var Qr=class extends Sl{get objectName(){return d.EntityPdfUnderlay}get objectType(){return u.UNLISTED}constructor(e){super(e)}};D();x();R();var Gt=class extends A{location=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityPoint}get objectType(){return u.POINT}rotation=0;get subclassMarker(){return l.Point}thickness=0;constructor(e){super(),e&&(this.location=e)}applyTransform(e){}getBoundingBox(){return null}};var Ve;(function(r){r[r.Default=0]="Default",r[r.ClosedPolylineOrClosedPolygonMeshInM=1]="ClosedPolylineOrClosedPolygonMeshInM",r[r.CurveFit=2]="CurveFit",r[r.SplineFit=4]="SplineFit",r[r.Polyline3D=8]="Polyline3D",r[r.PolygonMesh=16]="PolygonMesh",r[r.ClosedPolygonMeshInN=32]="ClosedPolygonMeshInN",r[r.PolyfaceMesh=64]="PolyfaceMesh",r[r.ContinuousLinetypePattern=128]="ContinuousLinetypePattern"})(Ve||(Ve={}));var Cl;(function(r){r[r.NoSmooth=0]="NoSmooth",r[r.Quadratic=5]="Quadratic",r[r.Cubic=6]="Cubic",r[r.BezierSurface=8]="BezierSurface"})(Cl||(Cl={}));var hr=class r extends A{static matchVerticesEntityProperties=!1;elevation=0;endWidth=0;get flags(){return this._flags}set flags(e){this._flags=e}get isClosed(){return(this._flags&Ve.ClosedPolylineOrClosedPolygonMeshInM)!==0}set isClosed(e){e?this._flags=this._flags|Ve.ClosedPolylineOrClosedPolygonMeshInM:(this._flags=this._flags&~Ve.ClosedPolylineOrClosedPolygonMeshInM,this._flags=this._flags&~Ve.ClosedPolygonMeshInN)}get layer(){return super.layer}set layer(e){if(super.layer=e,r.matchVerticesEntityProperties)for(let t of this.vertices)t instanceof A&&(t.layer=e)}get lineType(){return super.lineType}set lineType(e){if(super.lineType=e,r.matchVerticesEntityProperties)for(let t of this.vertices)t instanceof A&&(t.lineType=e)}normal=new c(0,0,1);smoothSurface=Cl.NoSmooth;startWidth=0;thickness=0;vertices=new vt;_flags=0;constructor(e){super(),e&&(this.vertices=new vt(...e))}applyTransform(e){}clone(){let e=super.clone();return e.vertices=new vt(...this.vertices.map(t=>t.clone())),e}static*explode(e,t){}};D();x();R();var ut=class extends hr{faces=[];get flags(){return super.flags|Ve.PolyfaceMesh}set flags(e){super.flags=e}get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_PFACE}get subclassMarker(){return l.PolyfaceMesh}clone(){let e=super.clone();return e.faces=this.faces.map(t=>t.clone()),e}getBoundingBox(){return null}};D();x();R();var Et=class extends hr{get flags(){return super.flags|Ve.PolygonMesh}set flags(e){super.flags=e}mSmoothSurfaceDensity=0;mVertexCount=0;nSmoothSurfaceDensity=0;nVertexCount=0;get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_MESH}get subclassMarker(){return l.PolygonMesh}getBoundingBox(){return null}};D();var Rn;(function(r){r[r.Default=0]="Default",r[r.CurveFittingExtraVertex=1]="CurveFittingExtraVertex",r[r.CurveFitTangent=2]="CurveFitTangent",r[r.NotUsed=4]="NotUsed",r[r.SplineVertexFromSplineFitting=8]="SplineVertexFromSplineFitting",r[r.SplineFrameControlPoint=16]="SplineFrameControlPoint",r[r.PolylineVertex3D=32]="PolylineVertex3D",r[r.PolygonMesh3D=64]="PolygonMesh3D",r[r.PolyfaceMeshVertex=128]="PolyfaceMeshVertex"})(Rn||(Rn={}));var Ue=class extends A{bulge=0;curveTangent=0;endWidth=0;get flags(){return this._flags}set flags(e){this._flags=e}id=0;location=new c(0,0,0);get objectName(){return d.EntityVertex}startWidth=0;_flags=Rn.Default;constructor(e){super(),e&&(this.location=e)}applyTransform(e){}getBoundingBox(){return null}toString(){return`${this.subclassMarker}|${this.location.x},${this.location.y},${this.location.z}`}};x();R();var ss=class extends Ue{get objectType(){return u.VERTEX_MESH}get subclassMarker(){return l.PolygonMeshVertex}constructor(e){super(e?new c(e.x,e.y,e.z):void 0)}};D();x();R();var et=class extends hr{get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_2D}get subclassMarker(){return l.Polyline}getBoundingBox(){return null}};D();x();R();x();R();var cr=class extends Ue{get objectType(){return u.VERTEX_3D}get subclassMarker(){return l.Polyline3dVertex}constructor(e){super(e)}};var tt=class extends hr{get flags(){return super.flags|Ve.Polyline3D}set flags(e){super.flags=e}get objectName(){return d.EntityPolyline}get objectType(){return u.POLYLINE_3D}get subclassMarker(){return l.Polyline3d}constructor(e){super(),e&&e.length>0&&(e[0]instanceof cr?this.vertices=new vt(...e):this.vertices=new vt(...e.map(t=>new cr(t))))}getBoundingBox(){return null}};D();x();R();var Tn=class extends A{get classId(){return this.dxfClass?.classNumber??0}get drawingFormat(){return this.version|this.maintenanceVersion<<16}dxfClass=null;maintenanceVersion=0;get objectName(){return d.EntityProxyEntity}get objectType(){return u.ACAD_PROXY_ENTITY}originalDataFormatDxf=!1;proxyClassId=498;get subclassMarker(){return l.ProxyEntity}version=m.Unknown;applyTransform(e){}getBoundingBox(){return null}};D();x();R();var ns=class extends Ss{get objectName(){return d.EntityImage}get objectType(){return u.UNLISTED}get subclassMarker(){return l.RasterImage}get definition(){return super.definition}set definition(e){if(e==null)throw new Error("value cannot be null");super.definition=e}constructor(e){super(),e&&(this.definition=e)}};D();x();R();var ei=class extends A{direction=new c(0,0,0);get objectName(){return d.EntityRay}get objectType(){return u.RAY}startPoint=new c(0,0,0);get subclassMarker(){return l.Ray}applyTransform(e){}getBoundingBox(){return null}};D();R();var as=class extends Ds{get objectType(){return u.REGION}get objectName(){return d.EntityRegion}};D();R();var Le=class extends A{get objectType(){return u.SEQEND}get objectName(){return d.EntitySeqend}constructor(e){super(),e&&(this.owner=e)}getBoundingBox(){return null}applyTransform(e){}};var Dh;(function(r){r[r.CastsAndReceivesShadows=0]="CastsAndReceivesShadows",r[r.CastsShadows=1]="CastsShadows",r[r.ReceivesShadows=2]="ReceivesShadows",r[r.IgnoresShadows=3]="IgnoresShadows"})(Dh||(Dh={}));Te();D();x();R();var ur=class extends A{get objectType(){return u.SHAPE}get objectName(){return d.EntityShape}get subclassMarker(){return l.Shape}thickness=0;insertionPoint=new c(0,0,0);size=1;get shapeStyle(){return this._style}set shapeStyle(e){if(e==null||!e.isShapeFile)throw new Error("value cannot be null and must be a shape file");this.document!=null?this._style=I.updateCollection(e,this.document.textStyles):this._style=e}rotation=0;relativeXScale=1;obliqueAngle=0;normal=new c(0,0,1);shapeIndex=0;_style;constructor(e){super(),e&&(this.shapeStyle=e)}clone(){let e=super.clone();return e._style=this._style?.clone(),e}getBoundingBox(){return null}applyTransform(e){}};D();x();R();var $t=class extends A{firstCorner=new c(0,0,0);fourthCorner=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntitySolid}get objectType(){return u.SOLID}secondCorner=new c(0,0,0);get subclassMarker(){return l.Solid}thickness=0;thirdCorner=new c(0,0,0);applyTransform(e){}getBoundingBox(){return null}};D();x();R();var ti=class extends Ds{get objectType(){return u.SOLID3D}get objectName(){return d.Entity3DSolid}get subclassMarker(){return l.Solid3D}};D();x();R();var Ie;(function(r){r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Periodic=2]="Periodic",r[r.Rational=4]="Rational",r[r.Planar=8]="Planar",r[r.Linear=16]="Linear"})(Ie||(Ie={}));var mt;(function(r){r[r.None=0]="None",r[r.MethodFitPoints=1]="MethodFitPoints",r[r.CVFrameShow=2]="CVFrameShow",r[r.Closed=4]="Closed",r[r.UseKnotParameter=8]="UseKnotParameter"})(mt||(mt={}));var mr=class r extends A{controlPoints=[];controlPointTolerance=1e-7;degree=3;endTangent=new c(0,0,0);fitPoints=[];fitTolerance=1e-10;get flags(){return this._flags}set flags(e){this._flags=e}get flags1(){return this._flags1}set flags1(e){this._flags1=e}get hasValidKnotCount(){let e=this.controlPoints.length+(this.isClosed?2:1)*this.degree+1;return this.knots.length===e}get isClosed(){return(this._flags&Ie.Closed)!==0}set isClosed(e){e?(this._flags=this._flags|Ie.Closed,this._flags1=this._flags1|mt.Closed):(this._flags=this._flags&~Ie.Closed,this._flags1=this._flags1&~mt.Closed)}get isPeriodic(){return(this._flags&Ie.Periodic)!==0}set isPeriodic(e){e?this._flags=this._flags|Ie.Periodic:this._flags=this._flags&~Ie.Periodic}knotParametrization=Si.Chord;knots=[];knotTolerance=1e-7;normal=new c(0,0,1);get objectName(){return d.EntitySpline}get objectType(){return u.SPLINE}startTangent=new c(0,0,0);get subclassMarker(){return l.Spline}weights=[];static MaxDegree=10;_flags=Ie.None;_flags1=mt.None;constructor(){super()}applyTransform(e){}clone(){let e=super.clone();return e.controlPoints=[...this.controlPoints],e.fitPoints=[...this.fitPoints],e.weights=[...this.weights],e.knots=[...this.knots],e}getBoundingBox(){return null}pointOnSpline(e){if(e<0||e>1)throw new Error("The parametric position must be a value between 0 and 1.");e===1&&(e-=Number.EPSILON);let{controlPts:t,weights:i,knots:s}=this.prepare(),{uStart:n,uEnd:a}=this.getStartAndEndKnots(s),o=(a-n)*e,h=n+o;return r.c(t,i,s,this.degree,h)}polygonalVertexes(e){if(e<2)throw new Error("The precision must be equal or greater than two.");let t=[],{controlPts:i,weights:s,knots:n}=this.prepare(),{uStart:a,uEnd:o}=this.getStartAndEndKnots(n);!this.isClosed&&!this.isPeriodic&&(e-=1);let h=(o-a)/e;for(let f=0;f<e;f++){let b=a+h*f;t.push(r.c(i,s,n,this.degree,b))}return this.isClosed||this.isPeriodic||t.push(i[i.length-1]),t}tryPointOnSpline(e){try{return{success:!0,point:this.pointOnSpline(e)}}catch{return{success:!1,point:new c(NaN,NaN,NaN)}}}tryPolygonalVertexes(e){try{return{success:!0,points:this.polygonalVertexes(e)}}catch{return{success:!1,points:[]}}}updateFromFitPoints(e=255){return!1}static c(e,t,i,s,n){let a=0,o=0,h=0,f=0;for(let S=0;S<e.length;S++){let N=r.computeNurb(i,S,s,n);f+=N*t[S],a+=t[S]*N*e[S].x,o+=t[S]*N*e[S].y,h+=t[S]*N*e[S].z}if(Math.abs(f)<Number.EPSILON)return new c(0,0,0);let b=1/f;return new c(b*a,b*o,b*h)}static computeNurb(e,t,i,s){if(i<=0)return e[t]<=s&&s<e[t+1]?1:0;let n=0;Math.abs(e[t+i]-e[t])<Number.EPSILON||(n=(s-e[t])/(e[t+i]-e[t]));let a=0;return Math.abs(e[t+i+1]-e[t+1])<Number.EPSILON||(a=(e[t+i+1]-s)/(e[t+i+1]-e[t+1])),n*r.computeNurb(e,t,i-1,s)+a*r.computeNurb(e,t+1,i-1,s)}static createKnotVector(e,t,i){let s;if(i){let n=e+2*t+1;s=new Array(n).fill(0);let a=1/(e-t);for(let o=0;o<n;o++)s[o]=(o-t)*a}else{let n=e+t+1;s=new Array(n).fill(0);let a;for(a=0;a<=t;a++)s[a]=0;for(;a<e;a++)s[a]=a-t;for(;a<n;a++)s[a]=e-t}return s}getStartAndEndKnots(e){return this.isClosed?{uStart:e[0],uEnd:e[e.length-1]}:this.isPeriodic?{uStart:e[this.degree],uEnd:e[e.length-this.degree-1]}:{uStart:e[0],uEnd:e[e.length-1]}}prepare(){let e=[...this.controlPoints],t=[...this.weights],i=[...this.knots],s=e.length;if(s===0)throw new Error("A spline entity with control points is required.");(t.length===0||t.length!==s)&&(t=new Array(s).fill(1)),(i.length===0||!this.hasValidKnotCount)&&(i=r.createKnotVector(s,this.degree,this.isPeriodic));let n,a;if(this.isPeriodic){n=new Array(s+this.degree),a=new Array(s+this.degree);for(let o=0;o<this.degree;o++){let h=s-this.degree+o;n[o]=e[h],a[o]=t[h]}for(let o=0;o<s;o++)n[this.degree+o]=e[o],a[this.degree+o]=t[o]}else n=e,a=t;return{controlPts:n,weights:a,knots:i}}};D();x();R();var Gd;(function(r){r[r.Single=1]="Single",r[r.Double=2]="Double"})(Gd||(Gd={}));var $d;(function(r){r[r.Right=1]="Right",r[r.Vertical=2]="Vertical",r[r.Left=4]="Left"})($d||($d={}));var Yd;(function(r){r[r.None=0]="None",r[r.EnableBreaks=1]="EnableBreaks",r[r.RepeatTopLabels=2]="RepeatTopLabels",r[r.RepeatBottomLabels=4]="RepeatBottomLabels",r[r.AllowManualPositions=8]="AllowManualPositions",r[r.AllowManualHeights=16]="AllowManualHeights"})(Yd||(Yd={}));var Xd;(function(r){r[r.None=0]="None",r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight"})(Xd||(Xd={}));var yi;(function(r){r[r.Unknown=0]="Unknown",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=4]="Bottom",r[r.Left=8]="Left",r[r.InsideVertical=16]="InsideVertical",r[r.InsideHorizontal=32]="InsideHorizontal"})(yi||(yi={}));var Zd;(function(r){r[r.Data=1]="Data",r[r.Label=2]="Label"})(Zd||(Zd={}));var Kd;(function(r){r[r.Unknown=0]="Unknown",r[r.Cell=1]="Cell",r[r.Row=2]="Row",r[r.Column=3]="Column",r[r.FormattedTableData=4]="FormattedTableData",r[r.Table=5]="Table"})(Kd||(Kd={}));var Jd;(function(r){r[r.Text=1]="Text",r[r.Block=2]="Block"})(Jd||(Jd={}));var Sh;(function(r){r[r.None=0]="None",r[r.Override=1]="Override"})(Sh||(Sh={}));var Ch;(function(r){r[r.None=0]="None",r[r.BorderType=1]="BorderType",r[r.LineWeight=2]="LineWeight",r[r.LineType=4]="LineType",r[r.Color=8]="Color",r[r.Invisibility=16]="Invisibility",r[r.DoubleLineSpacing=32]="DoubleLineSpacing",r[r.All=63]="All"})(Ch||(Ch={}));var Bh;(function(r){r[r.None=0]="None",r[r.Flow=1]="Flow",r[r.StackedHorizontal=2]="StackedHorizontal",r[r.StackedVertical=4]="StackedVertical"})(Bh||(Bh={}));var qd;(function(r){r[r.Unknown=0]="Unknown",r[r.Value=1]="Value",r[r.Field=2]="Field",r[r.Block=4]="Block"})(qd||(qd={}));var yh;(function(r){r[r.None=0]="None",r[r.ContentLocked=1]="ContentLocked",r[r.ContentReadOnly=2]="ContentReadOnly",r[r.Linked=4]="Linked",r[r.ContentModifiedAfterUpdate=8]="ContentModifiedAfterUpdate",r[r.FormatLocked=16]="FormatLocked",r[r.FormatReadOnly=32]="FormatReadOnly",r[r.FormatModifiedAfterUpdate=64]="FormatModifiedAfterUpdate"})(yh||(yh={}));var Rh;(function(r){r[r.None=0]="None",r[r.DataType=1]="DataType",r[r.DataFormat=2]="DataFormat",r[r.Rotation=4]="Rotation",r[r.BlockScale=8]="BlockScale",r[r.Alignment=16]="Alignment",r[r.ContentColor=32]="ContentColor",r[r.TextStyle=64]="TextStyle",r[r.TextHeight=128]="TextHeight",r[r.AutoScale=256]="AutoScale",r[r.BackgroundColor=512]="BackgroundColor",r[r.MarginLeft=1024]="MarginLeft",r[r.MarginTop=2048]="MarginTop",r[r.MarginRight=4096]="MarginRight",r[r.MarginBottom=8192]="MarginBottom",r[r.ContentLayout=16384]="ContentLayout",r[r.MarginHorizontalSpacing=131072]="MarginHorizontalSpacing",r[r.MarginVerticalSpacing=262144]="MarginVerticalSpacing",r[r.MergeAll=32768]="MergeAll",r[r.FlowDirectionBottomToTop=65536]="FlowDirectionBottomToTop"})(Rh||(Rh={}));var Th;(function(r){r[r.NoUnits=0]="NoUnits",r[r.Distance=1]="Distance",r[r.Angle=2]="Angle",r[r.Area=4]="Area",r[r.Volume=8]="Volume",r[r.Currency=16]="Currency",r[r.Percentage=32]="Percentage"})(Th||(Th={}));var $;(function(r){r[r.None=0]="None",r[r.TitleHorizontalTop=1]="TitleHorizontalTop",r[r.TitleHorizontalInsert=2]="TitleHorizontalInsert",r[r.TitleHorizontalBottom=4]="TitleHorizontalBottom",r[r.TitleVerticalLeft=8]="TitleVerticalLeft",r[r.TitleVerticalInsert=16]="TitleVerticalInsert",r[r.TitleVerticalRight=32]="TitleVerticalRight",r[r.HeaderHorizontalTop=64]="HeaderHorizontalTop",r[r.HeaderHorizontalInsert=128]="HeaderHorizontalInsert",r[r.HeaderHorizontalBottom=256]="HeaderHorizontalBottom",r[r.HeaderVerticalLeft=512]="HeaderVerticalLeft",r[r.HeaderVerticalInsert=1024]="HeaderVerticalInsert",r[r.HeaderVerticalRight=2048]="HeaderVerticalRight",r[r.DataHorizontalTop=4096]="DataHorizontalTop",r[r.DataHorizontalInsert=8192]="DataHorizontalInsert",r[r.DataHorizontalBottom=16384]="DataHorizontalBottom",r[r.DataVerticalLeft=32768]="DataVerticalLeft",r[r.DataVerticalInsert=65536]="DataVerticalInsert",r[r.DataVerticalRight=131072]="DataVerticalRight"})($||($={}));var de;(function(r){r[r.None=0]="None",r[r.TitleSuppressed=1]="TitleSuppressed",r[r.HeaderSuppressed=2]="HeaderSuppressed",r[r.FlowDirection=4]="FlowDirection",r[r.HorizontalCellMargin=8]="HorizontalCellMargin",r[r.VerticalCellMargin=16]="VerticalCellMargin",r[r.TitleRowColor=32]="TitleRowColor",r[r.HeaderRowColor=64]="HeaderRowColor",r[r.DataRowColor=128]="DataRowColor",r[r.TitleRowFillNone=256]="TitleRowFillNone",r[r.HeaderRowFillNone=512]="HeaderRowFillNone",r[r.DataRowFillNone=1024]="DataRowFillNone",r[r.TitleRowFillColor=2048]="TitleRowFillColor",r[r.HeaderRowFillColor=4096]="HeaderRowFillColor",r[r.DataRowFillColor=8192]="DataRowFillColor",r[r.TitleRowAlign=16384]="TitleRowAlign",r[r.HeaderRowAlign=32768]="HeaderRowAlign",r[r.DataRowAlign=65536]="DataRowAlign",r[r.TitleTextStyle=131072]="TitleTextStyle",r[r.HeaderTextStyle=262144]="HeaderTextStyle",r[r.DataTextStyle=524288]="DataTextStyle",r[r.TitleRowHeight=1048576]="TitleRowHeight",r[r.HeaderRowHeight=2097152]="HeaderRowHeight",r[r.DataRowHeight=4194304]="DataRowHeight"})(de||(de={}));var Ah;(function(r){r[r.None=0]="None",r[r.CellAlignment=1]="CellAlignment",r[r.BackgroundFillNone=2]="BackgroundFillNone",r[r.BackgroundColor=4]="BackgroundColor",r[r.ContentColor=8]="ContentColor",r[r.TextStyle=16]="TextStyle",r[r.TextHeight=32]="TextHeight",r[r.TopGridColor=64]="TopGridColor",r[r.TopGridLineWeight=1024]="TopGridLineWeight",r[r.TopVisibility=16384]="TopVisibility",r[r.RightGridColor=128]="RightGridColor",r[r.RightGridLineWeight=2048]="RightGridLineWeight",r[r.RightVisibility=32768]="RightVisibility",r[r.BottomGridColor=256]="BottomGridColor",r[r.BottomGridLineWeight=4096]="BottomGridLineWeight",r[r.BottomVisibility=65536]="BottomVisibility",r[r.LeftGridColor=512]="LeftGridColor",r[r.LeftGridLineWeight=8192]="LeftGridLineWeight",r[r.LeftVisibility=131072]="LeftVisibility"})(Ah||(Ah={}));var Eh=class{value=""},Lh=class{name="";value=new Ht},kh=class{distanceTopLeft=new c(0,0,0);distanceCenter=new c(0,0,0);contentWidth=0;contentHeight=0;width=0;height=0;flags=0},hn=class{bottomRowIndex=0;leftColumnIndex=0;rightColumnIndex=0;topRowIndex=0},Bs=class{alignment=0;color=B.ByBlock;hasData=!1;propertyFlags=0;propertyOverrideFlags=0;rotation=0;scale=0;textHeight=0;textStyle=null;valueDataType=0;valueFormatString="";valueUnitType=0},Ri=class{color=B.ByBlock;doubleLineSpacing=0;edgeFlags;isInvisible=!1;lineWeight=M.Default;propertyOverrideFlags=0;type=Gd.Single;constructor(e){this.edgeFlags=e}},cn=class{contentType=qd.Unknown;format=new Bs;cadValue=new Ht},os=class extends Bs{backgroundColor=B.ByBlock;bottomBorder=new Ri(yi.Bottom);bottomMargin=0;cellAlignment=Xd.None;contentColor=B.ByBlock;contentLayoutFlags=0;horizontalInsideBorder=new Ri(yi.InsideHorizontal);horizontalMargin=.06;isFillColorOn=!1;leftBorder=new Ri(yi.Left);marginHorizontalSpacing=0;marginOverrideFlags=0;marginVerticalSpacing=0;name="";rightBorder=new Ri(yi.Right);rightMargin=0;styleClass=Zd.Data;tableCellStylePropertyFlags=0;textColor=B.ByBlock;topBorder=new Ri(yi.Right);cellStyleType=Kd.Unknown;verticalInsideBorder=new Ri(yi.InsideVertical);verticalMargin=.06;id=0},ys=class{autoFit=!1;blockScale=0;borderHeight=0;borderWidth=0;get content(){return this.contents==null||this.hasMultipleContent?null:this.contents.length>0?this.contents[0]:null}contents=[];customData=0;customDataCollection=[];edgeFlags=0;geometry=null;hasLinkedData=!1;get hasMultipleContent(){return this.contents!=null&&this.contents.length>1}mergedValue=0;rotation=0;stateFlags=0;styleOverride=new os;toolTip="";type=Jd.Text;virtualEdgeFlag=0},Rs=class{name="";width=0;customData=0;cellStyleOverride=new os;customDataCollection=[]},Ts=class{height=0;customData=0;cellStyleOverride=new os;cells=[];customDataCollection=[]},Bl=class{position=new c(0,0,0);height=0},Qd=class{flags=Yd.None;flowDirection=$d.Right;breakSpacing=0;heights=[]},yl=class{position=new c(0,0,0);startRowIndex=0;endRowIndex=0},Ti=class extends Ee{get columns(){return this._content.columns}horizontalDirection=new c(0,0,0);get objectName(){return d.EntityTable}get objectType(){return u.UNLISTED}overrideBorderColor=!1;overrideBorderLineWeight=!1;overrideBorderVisibility=!1;overrideFlag=!1;get rows(){return this._content.rows}get style(){return this._content.style}set style(e){this._content.style=e}get subclassMarker(){return l.TableEntity}valueFlag=0;version=0;breakRowRanges=[];get content(){return this._content}tableBreakData=new Qd;_content=new eh;clone(){return super.clone()}getBoundingBox(){return null}getCell(e,t){return this.rows[e].cells[t]}},eh=class{columns=[];rows=[];style=null};Te();D();x();R();var Yt=class extends A{direction=new c(0,0,0);insertionPoint=new c(0,0,0);normal=new c(0,0,1);get objectName(){return d.EntityTolerance}get objectType(){return u.TOLERANCE}get style(){return this._style}set style(e){if(e==null)throw new Error("value cannot be null");this.document!=null?this._style=I.updateCollection(e,this.document.dimensionStyles):this._style=e}get subclassMarker(){return l.Tolerance}text="";_style=re.Default;applyTransform(e){}getBoundingBox(){return null}};R();var Lt=class extends A{get objectType(){return u.UNDEFINED}get objectName(){return this._objectName}get subclassMarker(){return this._subclassMarker}_objectName;_subclassMarker;constructor(e){super(),e?(this._objectName=e.dxfName||"",this._subclassMarker=e.cppClassName||""):(this._objectName="",this._subclassMarker="")}applyTransform(e){}getBoundingBox(){return null}};x();R();var Xt=class extends Ue{get objectType(){return u.VERTEX_2D}get subclassMarker(){return l.PolylineVertex}constructor(e){super(e)}};x();R();var ri=class extends Ue{get objectType(){return u.VERTEX_PFACE}get subclassMarker(){return l.PolyfaceMeshVertex}};x();R();var Zt=class extends Ue{get objectType(){return u.VERTEX_PFACE_FACE}get subclassMarker(){return l.PolyfaceMeshFace}index1=0;index2=0;index3=0;index4=0;get flags(){return this._flags|Rn.PolyfaceMeshVertex}set flags(e){this._flags=e}};var Ph;(function(r){r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom"})(Ph||(Ph={}));D();x();R();var th;(function(r){r[r.PerspectiveMode=1]="PerspectiveMode",r[r.FrontClipping=2]="FrontClipping",r[r.BackClipping=4]="BackClipping",r[r.UcsFollow=8]="UcsFollow",r[r.FrontClipNotAtEye=16]="FrontClipNotAtEye",r[r.UcsIconVisibility=32]="UcsIconVisibility",r[r.UcsIconAtOrigin=64]="UcsIconAtOrigin",r[r.FastZoom=128]="FastZoom",r[r.SnapMode=256]="SnapMode",r[r.GridMode=512]="GridMode",r[r.IsometricSnapStyle=1024]="IsometricSnapStyle",r[r.HidePlotMode=2048]="HidePlotMode",r[r.IsoPairTop=4096]="IsoPairTop",r[r.IsoPairRight=8192]="IsoPairRight",r[r.ViewportZoomLocking=16384]="ViewportZoomLocking",r[r.CurrentlyAlwaysEnabled=32768]="CurrentlyAlwaysEnabled",r[r.NonRectangularClipping=65536]="NonRectangularClipping",r[r.ViewportOff=131072]="ViewportOff",r[r.DisplayGridBeyondDrawingLimits=262144]="DisplayGridBeyondDrawingLimits",r[r.AdaptiveGridDisplay=524288]="AdaptiveGridDisplay",r[r.SubdivisionGridBelowSpacing=1048576]="SubdivisionGridBelowSpacing"})(th||(th={}));var fr=class r extends A{ambientLightColor=null;backClipPlane=0;boundary=null;brightness=0;center=new c(0,0,0);circleZoomPercent=0;contrast=0;defaultLightingType=bl.OneDistantLight;displayUcsIcon=!1;elevation=0;frontClipPlane=0;frozenLayers=[];gridSpacing=new C(0,0);height=0;get id(){return 0}lensLength=0;majorGridLineFrequency=0;get objectName(){return d.EntityViewport}get objectType(){return u.VIEWPORT}renderMode=0;get representsPaper(){return this.id===r.PaperViewId}scale=null;get scaleFactor(){return this.height===0?1:1/(this.viewHeight/this.height)}shadePlotMode=0;snapAngle=0;snapBase=new C(0,0);snapSpacing=new C(0,0);status=0;styleSheetName="";get subclassMarker(){return l.Viewport}twistAngle=0;ucsOrigin=new c(0,0,0);ucsOrthographicType=0;ucsPerViewport=!1;ucsXAxis=new c(1,0,0);ucsYAxis=new c(0,1,0);useDefaultLighting=!1;viewCenter=new C(0,0);viewDirection=new c(0,0,1);viewHeight=0;viewTarget=new c(0,0,0);get viewWidth(){return this.height===0?0:this.viewHeight/this.height*this.width}visualStyle=null;width=0;static ASDK_XREC_ANNOTATION_SCALE_INFO="ASDK_XREC_ANNOTATION_SCALE_INFO";static PaperViewId=1;applyTransform(e){this.boundary!=null&&this.boundary.applyTransform(e)}clone(){let e=super.clone();return e.boundary=this.boundary?.clone()??null,e.visualStyle=this.visualStyle?.clone?.()??null,e.scale=this.scale?.clone?.()??null,e.frozenLayers=this.frozenLayers.map(t=>t.clone()),e}getBoundingBox(){return{min:new c(this.center.x-this.width/2,this.center.y-this.height/2,this.center.z),max:new c(this.center.x+this.width/2,this.center.y+this.height/2,this.center.z)}}getModelBoundingBox(){return{min:new c(this.viewCenter.x-this.viewWidth/2,this.viewCenter.y-this.viewHeight/2,0),max:new c(this.viewCenter.x+this.viewWidth/2,this.viewCenter.y+this.viewHeight/2,0)}}selectEntities(e=!0){if(this.document==null)throw new Error("Viewport needs to be assigned to a document.");return[]}assignDocument(e){super.assignDocument(e)}unassignDocument(){super.unassignDocument(),this.scale=this.scale?.clone?.()??null}};D();x();R();var ls=class extends Ss{get objectType(){return u.UNLISTED}get objectName(){return d.EntityWipeout}get subclassMarker(){return l.Wipeout}constructor(){super(),this.flags=ir.ShowImage|ir.ShowNotAlignedImage|ir.UseClippingBoundary}};D();x();R();var ii=class extends A{direction=new c(0,0,0);firstPoint=new c(0,0,0);get objectName(){return d.EntityXline}get objectType(){return u.XLINE}get subclassMarker(){return l.XLine}applyTransform(e){}getBoundingBox(){return null}};var Me=class extends Error{constructor(e){e!==void 0?super(`File version not supported: ${e}`):super("File version not recognized"),this.name="CadNotSupportedException"}};var Eo=class extends Error{innerError;constructor(e,t){super(e),this.name="DwgException",this.innerError=t??null}};var si=class extends Error{constructor(e,t){typeof e=="number"&&t!==void 0?super(`Invalid dxf code with value ${e}, at line ${t}.`):typeof e=="string"&&t!==void 0?super(`${e}, at line ${t}.`):super(e),this.name="DxfException"}};var Oh=class{static cloneTyped(e){return e.clone()}};var jh=class r{static InvalidCharacters=["\\","/",":","*","?",'"',"<",">","|",";",",","=","`"];static isValidDxfName(e,t=m.AC1032){if(!e.name||t<=m.AC1015&&e.name.length>31)return!1;if(e.name.length>255)return!1;for(let i of r.InvalidCharacters)if(e.name.includes(i))return!1;return!0}};var Rl=class{static getLineWeightValue(e){let t=Math.abs(e);return e===M.W0?.001:t/100}};var Nh=class{};var Lo;(function(r){r[r.Inches=0]="Inches",r[r.Millimeters=1]="Millimeters",r[r.Pixels=2]="Pixels"})(Lo||(Lo={}));var An=class{static toUnits(e){switch(e){case Lo.Inches:return ie.Inches;case Lo.Millimeters:return ie.Millimeters;case Lo.Pixels:default:return ie.Unitless}}};var Vh;(function(r){r[r.Horizontal=1]="Horizontal",r[r.Vertical=3]="Vertical",r[r.ByStyle=5]="ByStyle",r[r.ByStyleBadDoc=6]="ByStyleBadDoc"})(Vh||(Vh={}));var Ih;(function(r){r[r.None=0]="None",r[r.EndPoint=1]="EndPoint",r[r.MidPoint=2]="MidPoint",r[r.Center=4]="Center",r[r.Node=8]="Node",r[r.Quadrant=16]="Quadrant",r[r.Intersection=32]="Intersection",r[r.Insertion=64]="Insertion",r[r.Perpendicular=128]="Perpendicular",r[r.Tangent=256]="Tangent",r[r.Nearest=512]="Nearest",r[r.ClearsAllObjectSnaps=1024]="ClearsAllObjectSnaps",r[r.ApparentIntersection=2048]="ApparentIntersection",r[r.Extension=4096]="Extension",r[r.Parallel=8192]="Parallel",r[r.AllModes=16383]="AllModes",r[r.SwitchedOff=16384]="SwitchedOff"})(Ih||(Ih={}));var Mh;(function(r){r[r.FacesShadedEdgesNotHighlighted=0]="FacesShadedEdgesNotHighlighted",r[r.FacesShadedEdgesHighlightedInBlack=1]="FacesShadedEdgesHighlightedInBlack",r[r.FacesNotFilledEdgesInEntityColor=2]="FacesNotFilledEdgesInEntityColor",r[r.FacesInEntityColorEdgesInBlack=3]="FacesInEntityColorEdgesInBlack"})(Mh||(Mh={}));var As=class r{static toUInt16(e,t=0){return e[t]|e[t+1]<<8}static toInt16(e,t=0){let i=r.toUInt16(e,t);return i>32767?i-65536:i}static toUInt32(e,t=0){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}static toInt32(e,t=0){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}static toFloat64(e,t=0){return new DataView(e.buffer,e.byteOffset+t,8).getFloat64(0,!0)}static toFloat32(e,t=0){return new DataView(e.buffer,e.byteOffset+t,4).getFloat32(0,!0)}static getBytes(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24&255,t}static getBytes32(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24&255,t}};kr();J();R();x();var pr=class extends O{get objectType(){return u.UNDEFINED}get objectName(){return this.dxfClass?this.dxfClass.dxfName:"UNKNOWN"}get subclassMarker(){return this.dxfClass?this.dxfClass.cppClassName:l.Entity}dxfClass;constructor(e){super(),this.dxfClass=e}};var g;(function(r){r[r.NotImplemented=-1]="NotImplemented",r[r.None=0]="None",r[r.NotSupported=1]="NotSupported",r[r.Warning=2]="Warning",r[r.Error=3]="Error"})(g||(g={}));var kt=class{message;notificationType;exception;get Message(){return this.message}get NotificationType(){return this.notificationType}get Exception(){return this.exception}constructor(e,t=g.None,i=null){this.message=e,this.notificationType=t,this.exception=i}};var En=class{OnNotification=null;AppIds=new Vr;BlockRecords=new Ir;DimensionStyles=new Wt;DocumentToBuild;InitialHandSeed=0;Layers=new Mr;LineTypesTable=new Wr;TextStyles=new Hr;UCSs=new Fr;Version;Views=new Ur;VPorts=new zr;cadObjects=new Map;cadObjectsTemplates=new Map;dictionaryTemplates=new Map;tableEntryTemplates=new Map;tableTemplates=new Map;templatesMap=new Map;unassignedObjects=[];constructor(e,t){this.Version=e,this.DocumentToBuild=t}AddTemplate(e){this.addToMap(e)&&(this.isDictionaryTemplate(e)?this.dictionaryTemplates.set(e.CadObject.handle,e):this.isTableTemplate(e)?this.tableTemplates.set(e.CadObject.handle,e):this.isTableEntryTemplate(e)?this.tableEntryTemplates.set(e.CadObject.handle,e):this.cadObjectsTemplates.set(e.CadObject.handle,e))}BuildDocument(){for(let e of this.tableEntryTemplates.values())e.Build(this);for(let e of this.cadObjectsTemplates.values())e.Build(this)}BuildTable(e){let t=this.tableTemplates.get(e.handle);t?t.Build(this):this.Notify(`Table ${e.objectName} not found in the document`,g.Warning)}BuildTables(){this.BuildTable(this.AppIds),this.BuildTable(this.TextStyles),this.BuildTable(this.LineTypesTable),this.BuildTable(this.Layers),this.BuildTable(this.UCSs),this.BuildTable(this.Views),this.BuildTable(this.BlockRecords),this.BuildTable(this.DimensionStyles),this.BuildTable(this.VPorts)}GetObjectTemplate(e){let t=this.templatesMap.get(e);return t||null}Notify(e,t=g.None,i=null){this.OnNotification?.(this,new kt(e,t,i))}RegisterTables(){this.DocumentToBuild.registerCollection(this.AppIds),this.DocumentToBuild.registerCollection(this.TextStyles),this.DocumentToBuild.registerCollection(this.LineTypesTable),this.DocumentToBuild.registerCollection(this.Layers),this.DocumentToBuild.registerCollection(this.UCSs),this.DocumentToBuild.registerCollection(this.Views),this.DocumentToBuild.registerCollection(this.BlockRecords),this.DocumentToBuild.registerCollection(this.DimensionStyles),this.DocumentToBuild.registerCollection(this.VPorts)}TryGetCadObject(e){if(e==null||e===0)return null;let t=this.cadObjects.get(e);return t?t instanceof Lt&&!this.KeepUnknownEntities||t instanceof pr&&!this.KeepUnknownNonGraphicalObjects?null:t:null}TryGetObjectTemplate(e){if(e==null||e===0)return null;let t=this.templatesMap.get(e);return t||null}TryGetTableEntry(e){if(!e||e.length===0)return null;let t=null,i=[this.AppIds,this.Layers,this.LineTypesTable,this.UCSs,this.Views,this.DimensionStyles,this.TextStyles,this.VPorts,this.BlockRecords];for(let s of i){let n=s.tryGetValue(e);if(n)return n}return null}buildDictionaries(){for(let e of this.dictionaryTemplates.values())e.Build(this);if(!this.DocumentToBuild.rootDictionary){let e=[];for(let t of this.dictionaryTemplates.values())t.CadObject instanceof xe&&t.CadObject.owner==null&&e.push(t.CadObject);e.length!==1?this.Notify("The root dictionary could not be found.",g.Warning):this.DocumentToBuild.rootDictionary=e[0]}this.DocumentToBuild.updateCollections(!0,!1)}createMissingHandles(){for(let e of this.unassignedObjects)e.CadObject.handle=this.InitialHandSeed+1,this.AddTemplate(e);this.unassignedObjects=[]}registerTable(e,t){e?this.DocumentToBuild.registerCollection(e):this.DocumentToBuild.registerCollection(new t)}addToMap(e){return e.CadObject.handle===0?(this.pushUnassigned(e),!1):this.templatesMap.has(e.CadObject.handle)?(this.Notify(`Repeated handle found ${e.CadObject.handle}.`,g.Warning),e.CadObject.handle=0,this.pushUnassigned(e),!1):(e.CadObject.handle>this.InitialHandSeed&&(this.InitialHandSeed=e.CadObject.handle),this.templatesMap.set(e.CadObject.handle,e),this.cadObjects.set(e.CadObject.handle,e.CadObject),!0)}pushUnassigned(e){Array.isArray(this.unassignedObjects)||(this.unassignedObjects=[]);try{this.unassignedObjects.push(e)}catch(t){if(t instanceof RangeError){this.Notify("Resetting unassigned object queue due to invalid array length.",g.Warning,t),this.unassignedObjects=[e];return}throw t}}isDictionaryTemplate(e){return"CadObject"in e&&e.CadObject instanceof xe}isTableTemplate(e){return"EntryHandles"in e}isTableEntryTemplate(e){return"Type"in e&&"Name"in e&&!("EntryHandles"in e)}};var Ln=class{OnNotification=null;Configuration;_document=new xs;_encoding="utf-8";_fileStream;constructor(e,t=null){t&&(this.OnNotification=t),this._fileStream=e,this.Configuration=this.createDefaultConfiguration()}Dispose(){}getListedEncoding(e){return"utf-8"}triggerNotification(e,t,i=null){this.onNotificationEvent(null,new kt(e,t,i))}onNotificationEvent(e,t){this.OnNotification?.(this,t)}};var kn=class{Failsafe=!0;KeepUnknownEntities=!1;KeepUnknownNonGraphicalObjects=!1};var Es=class{OnNotification=null;Configuration;_document;_encoding="utf-8";_stream;constructor(e,t){this._stream=e,this._document=t,this.Configuration=this.createDefaultConfiguration()}Write(){if(this._document.updateImageReactors(),this._document.updateDxfClasses(this.Configuration.ResetDxfClasses),this.Configuration.UpdateDimensionsInModel&&this.updateDimensions(this._document.modelSpace),this.Configuration.UpdateDimensionsInBlocks)for(let e of this._document.blockRecords)e.Name.toLowerCase()!==U.ModelSpaceName.toLowerCase()&&this.updateDimensions(e);this._encoding=this.getListedEncoding(this._document.header.CodePage)}getListedEncoding(e){let t=Z.getCodePage(e);return"utf-8"}triggerNotification(e,t,i){typeof e=="string"?this.OnNotification?.(this,new kt(e,t,i??null)):this.OnNotification?.(e,t)}updateDimensions(e){for(let t of e.entities)t instanceof me&&t.updateBlock()}};var Ls=class{CloseStream=!0;ResetDxfClasses=!1;UpdateDimensionsInBlocks=!1;UpdateDimensionsInModel=!1;WriteXData=!0;WriteXRecords=!0;WriteShapes=!1};var ko=class{static toUInt64(e,t=0){let i=0;for(let s=0;s<8;s++)i=i*256+e[t+s];return i}static toUInt32(e,t=0){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}static toUInt16(e,t=0){return e[t]<<8|e[t+1]}};var ds=class r{static CrcTable=new Uint16Array([0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448]);static Crc32Table=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);static ApplyCrc8(e,t){let i=e;for(let s=0;s<t.length;++s){let n=(t[s]^i&255)&255;i=i>>8&255^r.CrcTable[n&255]}return i}};var Tl=class r{_data;_position=0;_seed;get Seed(){return~this._seed>>>0}get Length(){return this._data.length}get Position(){return this._position}set Position(e){this._position=e}constructor(e,t,i=!1){if(i){let s=1;for(let n=0;n<e.length;++n){s=s*214013+2531011|0;let a=s>>16&255;e[n]=(e[n]^a)&255}}this._data=e,this._seed=~t>>>0}static fromStream(e,t){return new r(e,t,!1)}Read(e,t,i){let s=t+i,n=Math.min(i,this._data.length-this._position);for(let a=0;a<n;++a)e[t+a]=this._data[this._position+a],this._seed=(this._seed>>>8^ds.Crc32Table[(this._seed^this._data[this._position+a])&255])>>>0;return this._position+=n,n}Write(e,t,i){let s=t+i;for(let n=t;n<s;++n)this._seed=(this._seed>>>8^ds.Crc32Table[(this._seed^e[n])&255])>>>0;for(let n=0;n<i;n++)this._data[this._position+n]=e[t+n];this._position+=i}};var wr=class r{_data;_position=0;Seed;get Length(){return this._data.length}get Position(){return this._position}set Position(e){this._position=e}constructor(e,t){this._data=e,this.Seed=t}Read(e,t,i){let s=Math.min(i,this._data.length-this._position),n=t+s;for(let a=t;a<n;++a)e[a]=this._data[this._position+(a-t)],this.Seed=r.decode(this.Seed,e[a]);return this._position+=s,s}Write(e,t,i){let s=t+i;for(let n=t;n<s;++n)this.Seed=r.decode(this.Seed,e[n]);for(let n=0;n<i;n++)this._data[this._position+n]=e[t+n];this._position+=i}static GetCRCValue(e,t,i,s){let n=e,a=i,o=s;for(;o-- >0;)n=r.decode(n,t[a]),a++;return n}static decode(e,t){let i=t^e&255;return e=(e>>>8^ds.CrcTable[i])&65535,e}};var rt=class{static MagicSequence=(()=>{let e=new Uint8Array(256),t=1;for(let i=0;i<256;i++)t=t*214013+2531011|0,e[i]=t>>16&255;return e})();static CompressionCalculator(e){return 31-(e+32-1)%32}static Calculate(e,t,i,s){let n=e&65535,a=e>>>16&65535,o=i,h=s;for(;h!==0;){let f=Math.min(5552,h);h-=f;for(let b=0;b<f;b++)n+=t[o],a+=n,o++;n%=65521,a%=65521}return(a<<16|n&65535)>>>0}};var Pn=class{_handles=new Map;get CMATERIAL(){return this.GetHandle("CMATERIAL")}set CMATERIAL(e){this.SetHandle("CMATERIAL",e)}get CLAYER(){return this.GetHandle("CLAYER")}set CLAYER(e){this.SetHandle("CLAYER",e)}get TEXTSTYLE(){return this.GetHandle("TEXTSTYLE")}set TEXTSTYLE(e){this.SetHandle("TEXTSTYLE",e)}get CELTYPE(){return this.GetHandle("CELTYPE")}set CELTYPE(e){this.SetHandle("CELTYPE",e)}get DIMSTYLE(){return this.GetHandle("DIMSTYLE")}set DIMSTYLE(e){this.SetHandle("DIMSTYLE",e)}get CMLSTYLE(){return this.GetHandle("CMLSTYLE")}set CMLSTYLE(e){this.SetHandle("CMLSTYLE",e)}get UCSNAME_PSPACE(){return this.GetHandle("UCSNAME_PSPACE")}set UCSNAME_PSPACE(e){this.SetHandle("UCSNAME_PSPACE",e)}get UCSNAME_MSPACE(){return this.GetHandle("UCSNAME_MSPACE")}set UCSNAME_MSPACE(e){this.SetHandle("UCSNAME_MSPACE",e)}get PUCSORTHOREF(){return this.GetHandle("PUCSORTHOREF")}set PUCSORTHOREF(e){this.SetHandle("PUCSORTHOREF",e)}get PUCSBASE(){return this.GetHandle("PUCSBASE")}set PUCSBASE(e){this.SetHandle("PUCSBASE",e)}get UCSORTHOREF(){return this.GetHandle("UCSORTHOREF")}set UCSORTHOREF(e){this.SetHandle("UCSORTHOREF",e)}get DIMTXSTY(){return this.GetHandle("DIMTXSTY")}set DIMTXSTY(e){this.SetHandle("DIMTXSTY",e)}get DIMLDRBLK(){return this.GetHandle("DIMLDRBLK")}set DIMLDRBLK(e){this.SetHandle("DIMLDRBLK",e)}get DIMBLK(){return this.GetHandle("DIMBLK")}set DIMBLK(e){this.SetHandle("DIMBLK",e)}get DIMBLK1(){return this.GetHandle("DIMBLK1")}set DIMBLK1(e){this.SetHandle("DIMBLK1",e)}get DIMBLK2(){return this.GetHandle("DIMBLK2")}set DIMBLK2(e){this.SetHandle("DIMBLK2",e)}get DICTIONARY_LAYOUTS(){return this.GetHandle("DICTIONARY_LAYOUTS")}set DICTIONARY_LAYOUTS(e){this.SetHandle("DICTIONARY_LAYOUTS",e)}get DICTIONARY_PLOTSETTINGS(){return this.GetHandle("DICTIONARY_PLOTSETTINGS")}set DICTIONARY_PLOTSETTINGS(e){this.SetHandle("DICTIONARY_PLOTSETTINGS",e)}get DICTIONARY_PLOTSTYLES(){return this.GetHandle("DICTIONARY_PLOTSTYLES")}set DICTIONARY_PLOTSTYLES(e){this.SetHandle("DICTIONARY_PLOTSTYLES",e)}get CPSNID(){return this.GetHandle("CPSNID")}set CPSNID(e){this.SetHandle("CPSNID",e)}get PAPER_SPACE(){return this.GetHandle("PAPER_SPACE")}set PAPER_SPACE(e){this.SetHandle("PAPER_SPACE",e)}get MODEL_SPACE(){return this.GetHandle("MODEL_SPACE")}set MODEL_SPACE(e){this.SetHandle("MODEL_SPACE",e)}get BYLAYER(){return this.GetHandle("BYLAYER")}set BYLAYER(e){this.SetHandle("BYLAYER",e)}get BYBLOCK(){return this.GetHandle("BYBLOCK")}set BYBLOCK(e){this.SetHandle("BYBLOCK",e)}get CONTINUOUS(){return this.GetHandle("CONTINUOUS")}set CONTINUOUS(e){this.SetHandle("CONTINUOUS",e)}get DIMLTYPE(){return this.GetHandle("DIMLTYPE")}set DIMLTYPE(e){this.SetHandle("DIMLTYPE",e)}get DIMLTEX1(){return this.GetHandle("DIMLTEX1")}set DIMLTEX1(e){this.SetHandle("DIMLTEX1",e)}get DIMLTEX2(){return this.GetHandle("DIMLTEX2")}set DIMLTEX2(e){this.SetHandle("DIMLTEX2",e)}get VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT(){return this.GetHandle("VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT")}set VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT(e){this.SetHandle("VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT",e)}get DICTIONARY_ACAD_GROUP(){return this.GetHandle("DICTIONARY_ACAD_GROUP")}set DICTIONARY_ACAD_GROUP(e){this.SetHandle("DICTIONARY_ACAD_GROUP",e)}get DICTIONARY_ACAD_MLINESTYLE(){return this.GetHandle("DICTIONARY_ACAD_MLINESTYLE")}set DICTIONARY_ACAD_MLINESTYLE(e){this.SetHandle("DICTIONARY_ACAD_MLINESTYLE",e)}get DICTIONARY_NAMED_OBJECTS(){return this.GetHandle("DICTIONARY_NAMED_OBJECTS")}set DICTIONARY_NAMED_OBJECTS(e){this.SetHandle("DICTIONARY_NAMED_OBJECTS",e)}get BLOCK_CONTROL_OBJECT(){return this.GetHandle("BLOCK_CONTROL_OBJECT")}set BLOCK_CONTROL_OBJECT(e){this.SetHandle("BLOCK_CONTROL_OBJECT",e)}get LAYER_CONTROL_OBJECT(){return this.GetHandle("LAYER_CONTROL_OBJECT")}set LAYER_CONTROL_OBJECT(e){this.SetHandle("LAYER_CONTROL_OBJECT",e)}get STYLE_CONTROL_OBJECT(){return this.GetHandle("STYLE_CONTROL_OBJECT")}set STYLE_CONTROL_OBJECT(e){this.SetHandle("STYLE_CONTROL_OBJECT",e)}get LINETYPE_CONTROL_OBJECT(){return this.GetHandle("LINETYPE_CONTROL_OBJECT")}set LINETYPE_CONTROL_OBJECT(e){this.SetHandle("LINETYPE_CONTROL_OBJECT",e)}get VIEW_CONTROL_OBJECT(){return this.GetHandle("VIEW_CONTROL_OBJECT")}set VIEW_CONTROL_OBJECT(e){this.SetHandle("VIEW_CONTROL_OBJECT",e)}get UCS_CONTROL_OBJECT(){return this.GetHandle("UCS_CONTROL_OBJECT")}set UCS_CONTROL_OBJECT(e){this.SetHandle("UCS_CONTROL_OBJECT",e)}get VPORT_CONTROL_OBJECT(){return this.GetHandle("VPORT_CONTROL_OBJECT")}set VPORT_CONTROL_OBJECT(e){this.SetHandle("VPORT_CONTROL_OBJECT",e)}get APPID_CONTROL_OBJECT(){return this.GetHandle("APPID_CONTROL_OBJECT")}set APPID_CONTROL_OBJECT(e){this.SetHandle("APPID_CONTROL_OBJECT",e)}get DIMSTYLE_CONTROL_OBJECT(){return this.GetHandle("DIMSTYLE_CONTROL_OBJECT")}set DIMSTYLE_CONTROL_OBJECT(e){this.SetHandle("DIMSTYLE_CONTROL_OBJECT",e)}get DICTIONARY_MATERIALS(){return this.GetHandle("DICTIONARY_MATERIALS")}set DICTIONARY_MATERIALS(e){this.SetHandle("DICTIONARY_MATERIALS",e)}get DICTIONARY_COLORS(){return this.GetHandle("DICTIONARY_COLORS")}set DICTIONARY_COLORS(e){this.SetHandle("DICTIONARY_COLORS",e)}get DICTIONARY_VISUALSTYLE(){return this.GetHandle("DICTIONARY_VISUALSTYLE")}set DICTIONARY_VISUALSTYLE(e){this.SetHandle("DICTIONARY_VISUALSTYLE",e)}get INTERFEREOBJVS(){return this.GetHandle("INTERFEREOBJVS")}set INTERFEREOBJVS(e){this.SetHandle("INTERFEREOBJVS",e)}get INTERFEREVPVS(){return this.GetHandle("INTERFEREVPVS")}set INTERFEREVPVS(e){this.SetHandle("INTERFEREVPVS",e)}get DRAGVS(){return this.GetHandle("DRAGVS")}set DRAGVS(e){this.SetHandle("DRAGVS",e)}get UCSBASE(){return this.GetHandle("UCSBASE")}set UCSBASE(e){this.SetHandle("UCSBASE",e)}GetHandle(e){return this._handles.get(e)??null}SetHandle(e,t){this._handles.set(e,t)}GetHandles(){return Array.from(this._handles.values())}UpdateHeader(e,t){let i;i=t.TryGetCadObject(this.CLAYER),i&&(e.currentLayerName=i.name),i=t.TryGetCadObject(this.CELTYPE),i&&(e.currentLineTypeName=i.name),i=t.TryGetCadObject(this.CMLSTYLE),i&&(e.currentMLineStyleName=i.name),i=t.TryGetCadObject(this.TEXTSTYLE),i&&(e.currentTextStyleName=i.name),i=t.TryGetCadObject(this.DIMTXSTY),i&&(e.dimensionTextStyleName=i.name),i=t.TryGetCadObject(this.DIMSTYLE),i&&(e.currentDimensionStyleName=i.name);let s;s=t.TryGetCadObject(this.DIMBLK),s&&(e.dimensionBlockName=s.name),s=t.TryGetCadObject(this.DIMLDRBLK),s&&(e.dimensionBlockName=s.name),s=t.TryGetCadObject(this.DIMBLK1),s&&(e.dimensionBlockNameFirst=s.name),s=t.TryGetCadObject(this.DIMBLK2),s&&(e.dimensionBlockNameSecond=s.name)}};var On=class extends En{Configuration;HeaderHandles=new Pn;BlockRecordTemplates=[];PaperSpaceEntities=[];ModelSpaceEntities=[];get KeepUnknownEntities(){return this.Configuration.KeepUnknownEntities}get KeepUnknownNonGraphicalObjects(){return this.Configuration.KeepUnknownNonGraphicalObjects}constructor(e,t,i){super(e,t),this.Configuration=i}BuildDocument(){this.createMissingHandles();for(let e of this.BlockRecordTemplates)e.SetBlockToRecord(this,this.HeaderHandles);this.RegisterTables(),this.BuildTables(),this.buildDictionaries(),super.BuildDocument(),this.ensureDefaultTableEntries(),this.HeaderHandles.UpdateHeader(this.DocumentToBuild.header,this)}ensureDefaultTableEntries(){let e=this.DocumentToBuild;e.lineTypes&&typeof e.lineTypes.createDefaultEntries=="function"&&e.lineTypes.createDefaultEntries(),e.layers&&typeof e.layers.createDefaultEntries=="function"&&e.layers.createDefaultEntries(),e.blockRecords&&typeof e.blockRecords.createDefaultEntries=="function"&&e.blockRecords.createDefaultEntries(),e.textStyles&&typeof e.textStyles.createDefaultEntries=="function"&&e.textStyles.createDefaultEntries(),e.dimensionStyles&&typeof e.dimensionStyles.createDefaultEntries=="function"&&e.dimensionStyles.createDefaultEntries(),e.appIds&&typeof e.appIds.createDefaultEntries=="function"&&e.appIds.createDefaultEntries(),e.vPorts&&typeof e.vPorts.createDefaultEntries=="function"&&e.vPorts.createDefaultEntries()}};var Wh=null,Ai=class{AcadVersion;PreviewAddress=-1;AcadMaintenanceVersion=0;DrawingCodePage=0;constructor(e){this.AcadVersion=e??m.Unknown}static registerFactory(e){Wh=e}static CreateFileHeader(e){if(!Wh)throw new Error("DwgFileHeader factory not registered. Import DwgFileHeaderFactory first.");return Wh(e)}};var T=class r{static AcDbObjects="AcDb:AcDbObjects";static AppInfo="AcDb:AppInfo";static AuxHeader="AcDb:AuxHeader";static Classes="AcDb:Classes";static FileDepList="AcDb:FileDepList";static Handles="AcDb:Handles";static Header="AcDb:Header";static ObjFreeSpace="AcDb:ObjFreeSpace";static Preview="AcDb:Preview";static RevHistory="AcDb:RevHistory";static SummaryInfo="AcDb:SummaryInfo";static Template="AcDb:Template";static EndSentinels=new Map([[r.Header,new Uint8Array([48,132,224,220,2,33,199,86,160,131,151,71,177,146,204,160])],[r.Classes,new Uint8Array([114,94,59,71,59,86,7,58,63,35,11,160,24,48,73,117])],[r.Preview,new Uint8Array([224,218,146,248,43,201,215,215,98,168,53,192,98,187,239,212])]]);static StartSentinels=new Map([[r.Header,new Uint8Array([207,123,31,35,253,222,56,169,95,124,104,184,78,109,51,95])],[r.Classes,new Uint8Array([141,161,196,184,196,169,248,197,192,220,244,95,231,207,182,138])],[r.Preview,new Uint8Array([31,37,109,7,212,54,40,40,157,87,202,63,157,68,16,43])]]);static GetSectionLocatorByName(e){switch(e){case r.Header:return 0;case r.Classes:return 1;case r.Handles:return 2;case r.ObjFreeSpace:return 3;case r.Template:return 4;case r.AuxHeader:return 5;default:return null}}};var _r=class{PageType=1097008187;Name="";CompressedSize=0;PageCount=0;DecompressedSize=29696;_compressed=2;get CompressedCode(){return this._compressed}set CompressedCode(e){if(e===1||e===2)this._compressed=e;else throw new Error("Invalid compressed code")}get IsCompressed(){return this._compressed===2}SectionId=0;Encrypted=0;HashCode=null;Encoding=null;LocalSections=[];constructor(e){e!==void 0&&(this.Name=e)}};var Ei=class extends Ai{static EndSentinel=new Uint8Array([149,160,78,40,153,130,26,229,94,65,224,95,157,58,77,0]);Records=new Map;_descriptors=new Map;constructor(e){super(e)}AddSection(e){this._descriptors.has(e)||this._descriptors.set(e,new _r(e))}GetDescriptor(e){let t=this._descriptors.get(e);if(t)return t;let i=new _r(e),s=T.GetSectionLocatorByName(e);if(s!==null){let n=this.Records.get(s);n&&(i.CompressedSize=n.Size,i.DecompressedSize=n.Size,i.PageCount=1,i.CompressedCode=1)}return this._descriptors.set(e,i),i}};var hs=class extends Ei{DwgVersion=0;AppReleaseVersion=0;SummaryInfoAddr=0;SecurityType=0;VbaProjectAddr=0;RootTreeNodeGap=0;GapArraySize=0;CRCSeed=0;LastPageId=0;LastSectionAddr=0;SecondHeaderAddr=0;GapAmount=0;SectionAmount=0;SectionPageMapId=0;PageMapAddress=0;SectionMapId=0;SectionArrayPageSize=0;RigthGap=0;LeftGap=0;Descriptors=new Map;constructor(e){super(e)}AddSection(e){this.Descriptors.set(e,new _r(e))}AddSectionDescriptor(e){this.Descriptors.set(e.Name,e)}GetDescriptor(e){return this.Descriptors.get(e)}};var Al=class extends hs{CompressedMetadata;constructor(e){super(e)}};Ai.registerFactory(r=>{switch(r){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(r);case m.AC1012:case m.AC1014:case m.AC1015:return new Ei(r);case m.AC1018:return new hs(r);case m.AC1021:return new Al(r);case m.AC1024:case m.AC1027:case m.AC1032:return new hs(r);default:break}return null});var cs=class{Compression=2;IsEmpty=!1;Offset=0;CompressedSize=0;PageNumber=0;DecompressedSize=0;Seeker=0;Size=0;Checksum=0;CRC=0;PageSize=0;ODA=0;SectionMap=0;constructor(e){e!==void 0&&(this.SectionMap=e)}};var ft=class{Number=null;Seeker=0;Size=0;Stream=null;constructor(e,t,i){e!==void 0&&(this.Number=e??null),t!==void 0&&(this.Seeker=t),i!==void 0&&(this.Size=i)}IsInTheRecord(e){return e>=this.Seeker&&e<this.Seeker+this.Size}toString(){return`Number : ${this.Number} | Seeker : ${this.Seeker} | Size : ${this.Size}`}};var El=class{HeaderSize=112;FileSize=0;PagesMapCrcCompressed=0;PagesMapCorrectionFactor=0;PagesMapCrcSeed=0;Map2Offset=0;Map2Id=0;PagesMapOffset=0;Header2offset=0;PagesMapSizeCompressed=0;PagesMapSizeUncompressed=0;PagesAmount=0;PagesMaxId=0;SectionsMap2Id=0;PagesMapId=0;Unknow0x20=32;Unknow0x40=64;PagesMapCrcUncompressed=0;Unknown0xF800=63488;Unknown4=4;Unknown1=1;SectionsAmount=0;SectionsMapCrcUncompressed=0;SectionsMapSizeCompressed=0;SectionsMapId=0;SectionsMapSizeUncompressed=0;SectionsMapCrcCompressed=0;SectionsMapCorrectionFactor=0;SectionsMapCrcSeed=0;StreamVersion=393472;CrcSeed=0;CrcSeedEncoded=0;RandomSeed=0;HeaderCRC64=0};var Po=class extends kn{CrcCheck=!1;ReadSummaryInfo=!0};var Y=class r{OnNotification=null;R13_14Only;R13_15Only;R2000Plus;R2004Pre;R2007Pre;R2004Plus;R2007Plus;R2010Plus;R2013Plus;R2018Plus;_version;constructor(e){this._version=e,this.R13_14Only=e===m.AC1014||e===m.AC1012,this.R13_15Only=e>=m.AC1012&&e<=m.AC1015,this.R2000Plus=e>=m.AC1015,this.R2004Pre=e<m.AC1018,this.R2007Pre=e<=m.AC1021,this.R2004Plus=e>=m.AC1018,this.R2007Plus=e>=m.AC1021,this.R2010Plus=e>=m.AC1024,this.R2013Plus=e>=m.AC1027,this.R2018Plus=e>=m.AC1032}static CheckSentinel(e,t){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(e[i]!==t[i])return!1;return!0}checkSentinel(e,t){let i=e.readSentinel();r.CheckSentinel(i,t)||this.notify(`Invalid section sentinel found in ${this.SectionName}`,g.Warning)}notify(e,t,i=null){this.OnNotification?.(this,new kt(e,t,i))}};var Q=class r{static Epsilon=1e-12;static PI=Math.PI;static HalfPI=Math.PI/2;static TwoPI=Math.PI*2;static DegToRad(e){return e*(Math.PI/180)}static RadToDeg(e){return e*(180/Math.PI)}static RadToGrad(e){return e*(200/Math.PI)}static IsZero(e){return Math.abs(e)<r.Epsilon}static FixZero(e){return r.IsZero(e)?0:e}static Sin(e){return r.FixZero(Math.sin(e))}static Cos(e){return r.FixZero(Math.cos(e))}};var it=class r{m00=1;m01=0;m02=0;m03=0;m10=0;m11=1;m12=0;m13=0;m20=0;m21=0;m22=1;m23=0;m30=0;m31=0;m32=0;m33=1;constructor(e){if(!(!e||e.length===0)){if(e.length!==16)throw new Error("Matrix4 requires 16 values.");[this.m00,this.m01,this.m02,this.m03,this.m10,this.m11,this.m12,this.m13,this.m20,this.m21,this.m22,this.m23,this.m30,this.m31,this.m32,this.m33]=e}}get M00(){return this.m00}set M00(e){this.m00=e}get M01(){return this.m01}set M01(e){this.m01=e}get M02(){return this.m02}set M02(e){this.m02=e}get M03(){return this.m03}set M03(e){this.m03=e}get M10(){return this.m10}set M10(e){this.m10=e}get M11(){return this.m11}set M11(e){this.m11=e}get M12(){return this.m12}set M12(e){this.m12=e}get M13(){return this.m13}set M13(e){this.m13=e}get M20(){return this.m20}set M20(e){this.m20=e}get M21(){return this.m21}set M21(e){this.m21=e}get M22(){return this.m22}set M22(e){this.m22=e}get M23(){return this.m23}set M23(e){this.m23=e}get M30(){return this.m30}set M30(e){this.m30=e}get M31(){return this.m31}set M31(e){this.m31=e}get M32(){return this.m32}set M32(e){this.m32=e}get M33(){return this.m33}set M33(e){this.m33=e}static identity(){return new r}get(e,t){let i=`m${e}${t}`;return this[i]}setElement(e,t,i){let s=`m${e}${t}`;this[s]=i}};var rh=class r{min;max;get Min(){return this.min}set Min(e){this.min=e}get Max(){return this.max}set Max(e){this.max=e}get width(){return this.max.x-this.min.x}get height(){return this.max.y-this.min.y}get Width(){return this.width}get Height(){return this.height}get center(){return new c((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,(this.min.z+this.max.z)/2)}get Center(){return this.center}constructor(e,t){this.min=e??new c(1/0,1/0,1/0),this.max=t??new c(-1/0,-1/0,-1/0)}static Null=new r;static Infinite=new r(new c(-1/0,-1/0,-1/0),new c(1/0,1/0,1/0));static FromPoints(e){if(!e||e.length===0)return r.Null;let t=new r;for(let i of e)t.min=new c(Math.min(t.min.x,i.x),Math.min(t.min.y,i.y),Math.min(t.min.z,i.z)),t.max=new c(Math.max(t.max.x,i.x),Math.max(t.max.y,i.y),Math.max(t.max.z,i.z));return t}};var ih=class r{translation;scale;eulerRotation;get Translation(){return this.translation}set Translation(e){this.translation=e}get Scale(){return this.scale}set Scale(e){this.scale=e}get EulerRotation(){return this.eulerRotation}set EulerRotation(e){this.eulerRotation=e}constructor(e,t,i){this.translation=e??new c(0,0,0),this.scale=t??new c(1,1,1),this.eulerRotation=i??new c(0,0,0)}get matrix(){let e=new it,t=this.scale.x,i=this.scale.y,s=this.scale.z,n=this.eulerRotation.x,a=this.eulerRotation.y,o=this.eulerRotation.z,h=Math.cos(n),f=Math.sin(n),b=Math.cos(a),S=Math.sin(a),N=Math.cos(o),L=Math.sin(o);return e.m00=b*N*t,e.m01=-(b*L)*i,e.m02=S*s,e.m10=(h*L+N*f*S)*t,e.m11=(h*N-f*S*L)*i,e.m12=-(b*f)*s,e.m20=(f*L-h*N*S)*t,e.m21=(N*f+h*S*L)*i,e.m22=h*b*s,e.m03=this.translation.x,e.m13=this.translation.y,e.m23=this.translation.z,e}get Matrix(){return this.matrix}applyTransform(e){let t=this.matrix;return new c(t.m00*e.x+t.m01*e.y+t.m02*e.z+t.m03,t.m10*e.x+t.m11*e.y+t.m12*e.z+t.m13,t.m20*e.x+t.m21*e.y+t.m22*e.z+t.m23)}static CreateTranslation(e){return new r(e)}static CreateScaling(e,t){let i=new r(void 0,e);return t&&(i.translation=new c(t.x*(1-e.x),t.y*(1-e.y),t.z*(1-e.z))),i}static CreateRotation(e,t){let i=new r;return e.z!==0?i.eulerRotation=new c(0,0,t):e.y!==0?i.eulerRotation=new c(0,t,0):i.eulerRotation=new c(t,0,0),i}};var Ec=new Map;function jn(r,e){Ec.set(r,e)}var be=class{bitShift=0;get position(){return this._position}set position(e){this._position=e,this.bitShift=0}isEmpty=!1;encoding="utf-8";get stream(){return this._stream}_stream;_view;_position;_lastByte=0;constructor(e,t){this._stream=e,this._view=new DataView(e.buffer,e.byteOffset,e.byteLength),this._position=0}static getStreamHandler(e,t,i,s=!1){let n,a;switch(e){case m.Unknown:case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(e);case m.AC1012:case m.AC1014:a="AC12";break;case m.AC1015:a="AC15";break;case m.AC1018:a="AC18";break;case m.AC1021:a="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:a="AC24";break;default:throw new Me}let o=Ec.get(a);if(!o)throw new Error(`DwgStreamReader factory for ${a} not registered. Import DwgStreamReaderFactory first.`);return n=new o(t,s),i!==void 0&&(n.encoding=i),n}readByte(){if(this.bitShift===0)return this._lastByte=this._stream[this._position++],this._lastByte;let e=this._lastByte<<this.bitShift&255;return this._lastByte=this._stream[this._position++],(e|this._lastByte>>>8-this.bitShift)&255}readBytes(e){let t=new Uint8Array(e);return this.applyShiftToArr(e,t),t}setPositionByFlag(e){this.setPositionInBits(e);let t=this.readBit(),i=e;if(t){let s=this.applyFlagToPosition(e);i=s.length-s.strDataSize,this.setPositionInBits(i)}else this.isEmpty=!0,this.position=this._stream.length;return i}readBit(){if(this.bitShift===0){this.advanceByte();let t=(this._lastByte&128)===128;return this.bitShift=1,t}let e=(this._lastByte<<this.bitShift&128)===128;return++this.bitShift,this.bitShift&=7,e}readBitAsShort(){return this.readBit()?1:0}read2Bits(){let e;if(this.bitShift===0)this.advanceByte(),e=this._lastByte>>>6,this.bitShift=2;else if(this.bitShift===7){let t=this._lastByte<<1&2;this.advanceByte(),e=t|this._lastByte>>>7,this.bitShift=1}else e=this._lastByte>>>6-this.bitShift&3,++this.bitShift,++this.bitShift,this.bitShift&=7;return e}readBitShort(){let e;switch(this.read2Bits()){case 0:e=this.readShortLittleEndian();break;case 1:if(this.bitShift===0){this.advanceByte(),e=this._lastByte;break}e=this.applyShiftToLastByte();break;case 2:e=0;break;case 3:e=256;break;default:throw this.throwException("ReadBitShort")}return e>32767&&(e-=65536),e}readBitShortAsBool(){return this.readBitShort()!==0}readBitLong(){let e;switch(this.read2Bits()){case 0:e=this.readIntLittleEndian();break;case 1:if(this.bitShift===0){this.advanceByte(),e=this._lastByte;break}e=this.applyShiftToLastByte();break;case 2:e=0;break;default:throw new Error("Failed to read ReadBitLong")}return e}readBitLongLong(){let e=0,t=this.read3bits();for(let i=0;i<t;++i){let s=this.readByte();e+=s<<(i<<3)}return e}readBitDouble(){let e;switch(this.read2Bits()){case 0:e=this.readDoubleLittleEndian();break;case 1:e=1;break;case 2:e=0;break;default:throw this.throwException("ReadBitDouble")}return e}read2BitDouble(){return new C(this.readBitDouble(),this.readBitDouble())}read3BitDouble(){return new c(this.readBitDouble(),this.readBitDouble(),this.readBitDouble())}readRawChar(){return this.readByte()}readRawLong(){return this.readIntLittleEndian()}readRawULong(){return this.readULongLittleEndian()}read2RawDouble(){return new C(this.readDouble(),this.readDouble())}read3RawDouble(){return new c(this.readDouble(),this.readDouble(),this.readDouble())}readModularChar(){let e=0,t=this.readByte(),i=t&127;if((t&128)!==0)for(;;){e+=7;let s=this.readByte();if(i|=(s&127)<<e,(s&128)===0)break}return i}readSignedModularChar(){let e;if(this.bitShift===0)if(this.advanceByte(),(this._lastByte&128)===0)e=this._lastByte&63,(this._lastByte&64)>0&&(e=-e);else{let t=0,i=this._lastByte&127;for(;t+=7,this.advanceByte(),(this._lastByte&128)!==0;)i|=(this._lastByte&127)<<t;e=i|(this._lastByte&63)<<t,(this._lastByte&64)>0&&(e=-e)}else{let t=this.applyShiftToLastByte();if((t&128)===0)e=t&63,(t&64)>0&&(e=-e);else{let i=0,s=t&127,n;for(;i+=7,n=this.applyShiftToLastByte(),(n&128)!==0;)s|=(n&127)<<i;e=s|(n&63)<<i,(n&64)>0&&(e=-e)}}return e}readModularShort(){let e=15,t=this.readByte(),i=this.readByte(),s=(i&128)===0,n=t|(i&127)<<8;for(;!s;)t=this.readByte(),i=this.readByte(),s=(i&128)===0,n|=t<<e,e+=8,n|=(i&127)<<e,e+=7;return n}handleReference(){return this.handleReferenceWithRefAndType(0).handle}handleReferenceWithRef(e){return this.handleReferenceWithRefAndType(e).handle}handleReferenceWithRefAndType(e){let t=this.readByte(),i=t>>>4,s=t&15,n=i&3,a;if(i<=5)a=this.readHandle(s);else if(i===6)a=e+1;else if(i===8)a=e-1;else if(i===10){let o=this.readHandle(s);a=e+o}else if(i===12){let o=this.readHandle(s);a=e-o}else throw new Eo(`[HandleReference] invalid reference code with value: ${i}`);return{handle:a,reference:n}}readHandle(e){let t=new Uint8Array(e),i=new Uint8Array(8);for(let o=0;o<e;o++)t[o]=this._stream[this._position++];if(this.bitShift===0)for(let o=0;o<e;++o)i[e-1-o]=t[o];else{let o=8-this.bitShift;for(let h=0;h<e;++h){let f=this._lastByte<<this.bitShift&255;this._lastByte=t[h];let b=(f|this._lastByte>>>o)&255;i[e-1-h]=b}}for(let o=e;o<8;++o)i[o]=0;let s=new DataView(i.buffer),n=s.getUint32(0,!0),a=s.getUint32(4,!0);return n+a*4294967296}readTextUnicode(){let e=this.readShort(),t=this.readByte(),i;return e===0?i="":i=this.readStringEncoded(e,this.getEncodingFromCodePage(t)),i}readVariableText(){let e=this.readBitShort(),t;return e>0?t=this.readStringEncoded(e,this.encoding).replace(/\0/g,""):t="",t}readSentinel(){return this.readBytes(16)}read2BitDoubleWithDefault(e){return new C(this.readBitDoubleWithDefault(e.x),this.readBitDoubleWithDefault(e.y))}read3BitDoubleWithDefault(e){return new c(this.readBitDoubleWithDefault(e.x),this.readBitDoubleWithDefault(e.y),this.readBitDoubleWithDefault(e.z))}readCmColor(e=!1){let t=this.readBitShort();return new B(t)}readEnColor(){let e=this.readBitShort();return{color:new B(e),transparency:Ke.ByLayer,flag:!1}}readColorByIndex(){return new B(this.readBitShort())}readObjectType(){return this.readBitShort()}readBitExtrusion(){return this.read3BitDouble()}readBitDoubleWithDefault(e){let t=new Uint8Array(8),i=new DataView(new ArrayBuffer(8));i.setFloat64(0,e,!0);for(let s=0;s<8;s++)t[s]=new Uint8Array(i.buffer)[s];switch(this.read2Bits()){case 0:return e;case 1:if(this.bitShift===0)this.advanceByte(),t[0]=this._lastByte,this.advanceByte(),t[1]=this._lastByte,this.advanceByte(),t[2]=this._lastByte,this.advanceByte(),t[3]=this._lastByte;else{let s=8-this.bitShift;t[0]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[0]=(t[0]|this._lastByte>>>s)&255,t[1]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[1]=(t[1]|this._lastByte>>>s)&255,t[2]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[2]=(t[2]|this._lastByte>>>s)&255,t[3]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[3]=(t[3]|this._lastByte>>>s)&255}return new DataView(t.buffer).getFloat64(0,!0);case 2:if(this.bitShift===0)this.advanceByte(),t[4]=this._lastByte,this.advanceByte(),t[5]=this._lastByte,this.advanceByte(),t[0]=this._lastByte,this.advanceByte(),t[1]=this._lastByte,this.advanceByte(),t[2]=this._lastByte,this.advanceByte(),t[3]=this._lastByte;else{let s=8-this.bitShift;t[4]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[4]=(t[4]|this._lastByte>>>s)&255,t[5]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[5]=(t[5]|this._lastByte>>>s)&255,t[0]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[0]=(t[0]|this._lastByte>>>s)&255,t[1]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[1]=(t[1]|this._lastByte>>>s)&255,t[2]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[2]=(t[2]|this._lastByte>>>s)&255,t[3]=this._lastByte<<this.bitShift&255,this.advanceByte(),t[3]=(t[3]|this._lastByte>>>s)&255}return new DataView(t.buffer).getFloat64(0,!0);case 3:return this.readDouble();default:throw this.throwException("ReadBitDoubleWithDefault")}}readBitThickness(){return this.readBitDouble()}read8BitJulianDate(){return this.julianToDate(this.readInt(),this.readInt())}readDateTime(){return this.julianToDate(this.readBitLong(),this.readBitLong())}readTimeSpan(){let e=this.readBitLong(),t=this.readBitLong();return e*36e5+t}positionInBits(){let e=this._position*8;return this.bitShift>0&&(e+=this.bitShift-8),e}setPositionInBits(e){this.position=e>>3,this.bitShift=e&7,!(this.bitShift<=0)&&this.advanceByte()}advanceByte(){this._lastByte=this._stream[this._position++]}advance(e){e>1&&(this._position+=e-1),this.readByte()}resetShift(){this.bitShift>0&&(this.bitShift=0),this.advanceByte();let e=this._lastByte;return this.advanceByte(),(e|this._lastByte<<8)&65535}readShort(){let e=this.readByte(),t=this.readByte(),i=e|t<<8;return i>32767&&(i-=65536),i}readShortLittleEndian(){return this.readShort()}readShortBigEndian(){let e=this.readByte(),t=this.readByte(),i=e<<8|t;return i>32767&&(i-=65536),i}readInt(){let e=this.readByte(),t=this.readByte(),i=this.readByte(),s=this.readByte();return e|t<<8|i<<16|s<<24}readIntLittleEndian(){return this.readInt()}readUInt(){return this.readInt()>>>0}readDouble(){let e=this.readBytes(8);return new DataView(e.buffer,e.byteOffset,8).getFloat64(0,!0)}readDoubleLittleEndian(){return this.readDouble()}readUShort(){let e=this.readByte(),t=this.readByte();return(e|t<<8)&65535}readULongLittleEndian(){let e=this.readByte(),t=this.readByte(),i=this.readByte(),s=this.readByte(),n=this.readByte(),a=this.readByte(),o=this.readByte(),h=this.readByte(),f=(e|t<<8|i<<16|s<<24)>>>0,b=(n|a<<8|o<<16|h<<24)>>>0;return f+b*4294967296}readStringEncoded(e,t){let i=this.readBytes(e);return new TextDecoder(t).decode(i)}applyFlagToPosition(e){let t=e-16;this.setPositionInBits(t);let i=this.readUShort();if((i&32768)>0){t-=16,this.setPositionInBits(t),i&=32767;let s=this.readUShort();i+=(s&65535)<<15}return{length:t,strDataSize:i}}applyShiftToLastByte(){let e=this._lastByte<<this.bitShift&255;return this.advanceByte(),(e|this._lastByte>>>8-this.bitShift)&255}throwException(e){return new Eo(`Failed to read ${e||"unknown"}`)}applyShiftToArr(e,t){for(let s=0;s<e;s++)t[s]=this._stream[this._position++];if(this.bitShift<=0)return;let i=8-this.bitShift;for(let s=0;s<e;++s){let n=this._lastByte<<this.bitShift&255;this._lastByte=t[s];let a=(n|this._lastByte>>>i)&255;t[s]=a}}read3bits(){let e=0;this.readBit()&&(e=1);let t=e<<1&255;this.readBit()&&(t|=1);let i=t<<1&255;return this.readBit()&&(i|=1),i}julianToDate(e,t){let i=(e-24405875e-1)*86400;try{return new Date(i*1e3+t)}catch{return new Date(0)}}getEncodingFromCodePage(e){switch(e){case 0:return"utf-8";case 1:return"ascii";case 28591:return"iso-8859-1";case 1252:return"windows-1252";case 1250:return"windows-1250";case 1251:return"windows-1251";case 1253:return"windows-1253";case 1254:return"windows-1254";case 1255:return"windows-1255";case 1256:return"windows-1256";case 1257:return"windows-1257";case 1258:return"windows-1258";case 932:return"shift_jis";case 936:return"gb2312";case 949:return"euc-kr";case 950:return"big5";case 65001:return"utf-8";default:return"windows-1252"}}};var Nn=class extends be{constructor(e,t){super(e,t)}};var Vn=class extends Nn{constructor(e,t){super(e,t)}readBitExtrusion(){return this.readBit()?c.AxisZ:this.read3BitDouble()}readBitThickness(){return this.readBit()?0:this.readBitDouble()}};var ks=class extends Vn{constructor(e,t){super(e,t)}readCmColor(e=!1){let t=B.ByLayer,i=this.readBitShort(),s=this.readBitLong()>>>0,n=new Uint8Array(4);n[0]=s&255,n[1]=s>>>8&255,n[2]=s>>>16&255,n[3]=s>>>24&255,s===3221225472?t=B.ByLayer:(s&16777216)!==0?t=new B(n[0]):t=B.fromTrueColor(n[2]<<16|n[1]<<8|n[0]);let a=this.readByte(),o="";(a&1)===1&&(o=this.readVariableText());let h="";return(a&2)===2&&(h=this.readVariableText()),t}readEnColor(){let e=new B(0),t=Ke.ByLayer,i=!1,s=this.readBitShort();if(s!==0){let n=s&65280&65535;if((n&16384)>0)e=B.ByBlock,i=!0;else if((n&32768)>0){let a=this.readBitLong()>>>0,o=new Uint8Array(4);o[0]=a&255,o[1]=a>>>8&255,o[2]=a>>>16&255,o[3]=a>>>24&255,e=B.fromTrueColor(o[2]<<16|o[1]<<8|o[0])}else e=new B(s&4095);if((n&8192)>0){let a=this.readBitLong();t=Ke.fromAlphaValue(a)}else t=Ke.ByLayer}else e=B.ByBlock,t=Ke.Opaque;return{color:e,transparency:t,flag:i}}};var In=class extends ks{constructor(e,t){super(e,t)}readTextUnicode(){let e=this.readShortLittleEndian(),t;if(e===0)t="";else{let i=e<<1&65535;t=this.readStringEncoded(i,"utf-16le").replace(/\0/g,"")}return t}readVariableText(){let e=this.readBitShort(),t;if(e===0)t="";else{let i=e<<1&65535;t=this.readStringEncoded(i,"utf-16le").replace(/\0/g,"")}return t}};var Ll=class extends In{constructor(e,t){super(e,t)}readObjectType(){let e=this.read2Bits(),t=0;switch(e){case 0:t=this.readByte();break;case 1:t=496+this.readByte();break;case 2:t=this.readShort();break;case 3:t=this.readShort();break}return t}};jn("AC12",Nn);jn("AC15",Vn);jn("AC18",ks);jn("AC21",In);jn("AC24",Ll);var us=class{get encoding(){return this._mainReader.encoding}set encoding(e){this._mainReader.encoding=e,this._textReader.encoding=e,this._handleReader.encoding=e}get stream(){throw new Error("InvalidOperation")}get bitShift(){throw new Error("InvalidOperation")}set bitShift(e){throw new Error("InvalidOperation")}get position(){return this._mainReader.position}set position(e){throw new Error("InvalidOperation")}isEmpty=!1;_mainReader;_textReader;_handleReader;constructor(e,t,i){this._mainReader=e,this._textReader=t,this._handleReader=i}advance(e){this._mainReader.advance(e)}advanceByte(){throw new Error("InvalidOperation")}handleReference(){return this._handleReader.handleReference()}handleReferenceWithRef(e){return this._handleReader.handleReferenceWithRef(e)}handleReferenceWithRefAndType(e){return this._handleReader.handleReferenceWithRefAndType(e)}positionInBits(){return this._mainReader.positionInBits()}read2Bits(){return this._mainReader.read2Bits()}read2RawDouble(){return this._mainReader.read2RawDouble()}read3RawDouble(){return this._mainReader.read3RawDouble()}read3BitDouble(){return this._mainReader.read3BitDouble()}readBit(){return this._mainReader.readBit()}readBitAsShort(){return this._mainReader.readBitAsShort()}readBitDouble(){return this._mainReader.readBitDouble()}read2BitDouble(){return this._mainReader.read2BitDouble()}readBitLong(){return this._mainReader.readBitLong()}readBitLongLong(){return this._mainReader.readBitLongLong()}readBitShort(){return this._mainReader.readBitShort()}readBitShortAsBool(){return this._mainReader.readBitShortAsBool()}readByte(){return this._mainReader.readByte()}readBytes(e){return this._mainReader.readBytes(e)}read2BitDoubleWithDefault(e){return this._mainReader.read2BitDoubleWithDefault(e)}read3BitDoubleWithDefault(e){return this._mainReader.read3BitDoubleWithDefault(e)}readCmColor(e=!1){if(!(this._mainReader instanceof ks)&&!e)return this._mainReader.readCmColor();let t=this.readBitShort(),i=this.readBitLong()>>>0,s=new Uint8Array(4);s[0]=i&255,s[1]=i>>>8&255,s[2]=i>>>16&255,s[3]=i>>>24&255;let n;i===3221225472?n=B.ByLayer:(i&16777216)!==0?n=new B(s[0]):n=B.fromTrueColor(s[2]<<16|s[1]<<8|s[0]);let a=this.readByte(),o="";(a&1)===1&&(o=this.readVariableText());let h="";return(a&2)===2&&(h=this.readVariableText()),n}readEnColor(){return this._mainReader.readEnColor()}read8BitJulianDate(){return this._mainReader.read8BitJulianDate()}readDateTime(){return this._mainReader.readDateTime()}readDouble(){return this._mainReader.readDouble()}readInt(){return this._mainReader.readInt()}readModularChar(){return this._mainReader.readModularChar()}readSignedModularChar(){return this._mainReader.readSignedModularChar()}readModularShort(){return this._mainReader.readModularShort()}readColorByIndex(){return new B(this.readBitShort())}readObjectType(){return this._mainReader.readObjectType()}readBitExtrusion(){return this._mainReader.readBitExtrusion()}readBitDoubleWithDefault(e){return this._mainReader.readBitDoubleWithDefault(e)}readBitThickness(){return this._mainReader.readBitThickness()}readRawChar(){return this._mainReader.readRawChar()}readRawLong(){return this._mainReader.readRawLong()}readRawULong(){return this._mainReader.readRawULong()}readSentinel(){return this._mainReader.readSentinel()}readShort(){return this._mainReader.readShort()}readShortBigEndian(){return this._mainReader.readShortBigEndian()}readTextUnicode(){return this._textReader.isEmpty?"":this._textReader.readTextUnicode()}readTimeSpan(){return this._mainReader.readTimeSpan()}readUInt(){return this._mainReader.readUInt()}readVariableText(){return this._textReader.isEmpty?"":this._textReader.readVariableText()}resetShift(){return this._mainReader.resetShift()}setPositionInBits(e){this._mainReader.setPositionInBits(e)}setPositionByFlag(e){throw new Error("InvalidOperation")}};var kl=class extends Y{get SectionName(){return T.Classes}_fileHeader;_sreader;constructor(e,t,i){super(e),this._sreader=t,this._fileHeader=i}read(){let e=new gi;this.checkSentinel(this._sreader,T.StartSentinels.get(this.SectionName));let t=this._sreader.readRawLong(),i=this._sreader.position+t;if(this._fileHeader.AcadVersion>=m.AC1024&&this._fileHeader.AcadMaintenanceVersion>3||this._fileHeader.AcadVersion>m.AC1027){let n=this._sreader.readRawLong()}let s=0;if(this.R2007Plus){s=this._sreader.positionInBits()+this._sreader.readRawLong()-1;let n=this._sreader.positionInBits();i=this._sreader.setPositionByFlag(s),this._sreader.setPositionInBits(n);let a=be.getStreamHandler(this._version,this._sreader.stream);a.setPositionInBits(i),this._sreader=new us(this._sreader,a,null),this._sreader.readBitLong(),this._sreader.readBit()}for(this._fileHeader.AcadVersion===m.AC1018&&(this._sreader.readBitShort(),this._sreader.readRawChar(),this._sreader.readRawChar(),this._sreader.readBit());this.getCurrPos(this._sreader)<i;){let n=new F;n.classNumber=this._sreader.readBitShort(),n.proxyFlags=this._sreader.readBitShort(),n.applicationName=this._sreader.readVariableText(),n.cppClassName=this._sreader.readVariableText(),n.dxfName=this._sreader.readVariableText(),n.wasZombie=this._sreader.readBit(),n.itemClassId=this._sreader.readBitShort(),this.R2004Plus&&(n.instanceCount=this._sreader.readBitLong(),n.dwgVersion=this._sreader.readBitLong(),n.maintenanceVersion=this._sreader.readBitLong(),this._sreader.readBitLong(),this._sreader.readBitLong()),e.addOrUpdate(n)}return this.R2007Plus&&this._sreader.setPositionInBits(s+1),this._sreader.resetShift(),this.checkSentinel(this._sreader,T.EndSentinels.get(this.SectionName)),e}getCurrPos(e){return this.R2007Plus?e.positionInBits():e.position}};var Pl=class extends Y{get SectionName(){return T.Handles}_sreader;constructor(e,t){super(e),this._sreader=t}read(){let e=new Map;for(;;){let t=0,i=0,s=this._sreader.readShortBigEndian();if(s===2)break;let n=this._sreader.position,a=s-2;a>2032&&(a=2032);let o=n+a;for(;this._sreader.position<o;){let f=this._sreader.readModularChar();t+=f,i+=this._sreader.readSignedModularChar(),f>0?e.set(t,i):this.notify(`Negative offset: ${f} for the handle: ${t}`,g.Warning)}let h=(this._sreader.readByte()<<8)+this._sreader.readByte()}return e}};var Ol=class extends Y{get SectionName(){return T.Header}_reader;_header;constructor(e,t,i){super(e),this._reader=t,this._header=i,this._header.version=e}read(e){let t=this._reader,i=new Pn;this.checkSentinel(this._reader,T.StartSentinels.get(this.SectionName));let s=this._reader.readRawLong();if(this.R2010Plus&&e>3||this.R2018Plus){let S=this._reader.readRawLong()}let n=this._reader.positionInBits();if(this.R2007Plus){let S=this._reader.readRawLong(),N=n+S-1,L=be.getStreamHandler(this._version,new Uint8Array(this._reader.stream));L.setPositionByFlag(N);let j=be.getStreamHandler(this._version,new Uint8Array(this._reader.stream));j.setPositionInBits(N+1),this._reader=new us(this._reader,L,j)}this.R2013Plus&&(this._header.requiredVersions=this._reader.readBitLongLong()),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readBitDouble(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readVariableText(),this._reader.readBitLong(),this._reader.readBitLong(),this.R13_14Only&&this._reader.readBitShort(),this.R2004Pre&&this._reader.handleReference(),this._header.associatedDimensions=this._reader.readBit(),this._header.updateDimensionsWhileDragging=this._reader.readBit(),this.R13_14Only&&(this._header.DIMSAV=this._reader.readBit()?1:0),this._header.polylineLineTypeGeneration=this._reader.readBit(),this._header.orthoMode=this._reader.readBit(),this._header.regenerationMode=this._reader.readBit()?1:0,this._header.fillMode=this._reader.readBit(),this._header.quickTextMode=this._reader.readBit(),this._header.paperSpaceLineTypeScaling=this._reader.readBit()?bi.Normal:bi.Viewport,this._header.limitCheckingOn=this._reader.readBit(),this.R13_14Only&&(this._header.blipMode=this._reader.readBit()),this.R2004Plus&&this._reader.readBit(),this._header.userTimer=this._reader.readBit(),this._header.sketchPolylineType=this._reader.readBit()?1:0,this._header.angularDirection=this._reader.readBitAsShort(),this._header.showSplineControlPoints=this._reader.readBit(),this.R13_14Only&&(this._reader.readBit(),this._reader.readBit()),this._header.mirrorText=this._reader.readBit(),this._header.worldView=this._reader.readBit(),this.R13_14Only&&this._reader.readBit(),this._header.showModelSpace=this._reader.readBit(),this._header.paperSpaceLimitsChecking=this._reader.readBit(),this._header.retainXRefDependentVisibilitySettings=this._reader.readBit(),this.R13_14Only&&this._reader.readBit(),this._header.displaySilhouetteCurves=this._reader.readBit(),this._header.createEllipseAsPolyline=this._reader.readBit(),this._header.proxyGraphics=this._reader.readBitShortAsBool(),this.R13_14Only&&this._reader.readBitShort(),this._header.spatialIndexMaxTreeDepth=this._reader.readBitShort(),this._header.linearUnitFormat=this._reader.readBitShort();let a=this._reader.readBitShort();a>=0&&a<=8&&(this._header.linearUnitPrecision=a),this._header.angularUnit=this._reader.readBitShort();let o=this._reader.readBitShort();o>=0&&o<=8&&(this._header.angularUnitPrecision=o),this.R13_14Only&&(this._header.objectSnapMode=this._reader.readBitShort()),this._header.attributeVisibility=this._reader.readBitShort(),this.R13_14Only&&this._reader.readBitShort(),this._header.pointDisplayMode=this._reader.readBitShort(),this.R13_14Only&&this._reader.readBitShort(),this.R2004Plus&&(this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitLong()),this._header.userShort1=this._reader.readBitShort(),this._header.userShort2=this._reader.readBitShort(),this._header.userShort3=this._reader.readBitShort(),this._header.userShort4=this._reader.readBitShort(),this._header.userShort5=this._reader.readBitShort(),this._header.numberOfSplineSegments=this._reader.readBitShort(),this._header.surfaceDensityM=this._reader.readBitShort(),this._header.surfaceDensityM=this._reader.readBitShort(),this._header.surfaceType=this._reader.readBitShort(),this._header.surfaceTabulation1=this._reader.readBitShort(),this._header.surfaceTabulation2=this._reader.readBitShort(),this._header.splineType=this._reader.readBitShort(),this._header.shadeEdge=this._reader.readBitShort(),this._header.shadeDiffuseToAmbientPercentage=this._reader.readBitShort(),this._header.unitMode=this._reader.readBitShort(),this._header.maxViewportCount=this._reader.readBitShort();let h=this._reader.readBitShort();h>=0&&h<=2047&&(this._header.surfaceIsolineCount=h),this._header.currentMultiLineJustification=this._reader.readBitShort();let f=this._reader.readBitShort();f>=0&&f<=100&&(this._header.textQuality=f),this._header.lineTypeScale=this._reader.readBitDouble(),this._header.textHeightDefault=this._reader.readBitDouble(),this._header.traceWidthDefault=this._reader.readBitDouble(),this._header.sketchIncrement=this._reader.readBitDouble(),this._header.filletRadius=this._reader.readBitDouble(),this._header.thicknessDefault=this._reader.readBitDouble(),this._header.angleBase=this._reader.readBitDouble(),this._header.pointDisplaySize=this._reader.readBitDouble(),this._header.polylineWidthDefault=this._reader.readBitDouble(),this._header.userDouble1=this._reader.readBitDouble(),this._header.userDouble2=this._reader.readBitDouble(),this._header.userDouble3=this._reader.readBitDouble(),this._header.userDouble4=this._reader.readBitDouble(),this._header.userDouble5=this._reader.readBitDouble(),this._header.chamferDistance1=this._reader.readBitDouble(),this._header.chamferDistance2=this._reader.readBitDouble(),this._header.chamferLength=this._reader.readBitDouble(),this._header.chamferAngle=this._reader.readBitDouble();let b=this._reader.readBitDouble();if(b>0&&b<=10&&(this._header.facetResolution=b),this._header.currentMultilineScale=this._reader.readBitDouble(),this._header.currentEntityLinetypeScale=this._reader.readBitDouble(),this._header.menuFileName=this._reader.readVariableText(),this._header.createDateTime=this._reader.readDateTime(),this._header.updateDateTime=this._reader.readDateTime(),this.R2004Plus&&(this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitLong()),this._header.totalEditingTime=this._reader.readTimeSpan(),this._header.userElapsedTimeSpan=this._reader.readTimeSpan(),this._header.currentEntityColor=this._reader.readCmColor(),this._header.handleSeed=t.handleReference(),i.CLAYER=this._reader.handleReference(),i.TEXTSTYLE=this._reader.handleReference(),i.CELTYPE=this._reader.handleReference(),this.R2007Plus&&(i.CMATERIAL=this._reader.handleReference()),i.DIMSTYLE=this._reader.handleReference(),i.CMLSTYLE=this._reader.handleReference(),this.R2000Plus&&(this._header.viewportDefaultViewScaleFactor=this._reader.readBitDouble()),this._header.paperSpaceInsertionBase=this._reader.read3BitDouble(),this._header.paperSpaceExtMin=this._reader.read3BitDouble(),this._header.paperSpaceExtMax=this._reader.read3BitDouble(),this._header.paperSpaceLimitsMin=this._reader.read2RawDouble(),this._header.paperSpaceLimitsMax=this._reader.read2RawDouble(),this._header.paperSpaceElevation=this._reader.readBitDouble(),this._header.paperSpaceUcs=this._reader.read3BitDouble(),this._header.paperSpaceXAxis=this._reader.read3BitDouble(),this._header.paperSpaceYAxis=this._reader.read3BitDouble(),i.UCSNAME_PSPACE=this._reader.handleReference(),this.R2000Plus&&(i.PUCSORTHOREF=this._reader.handleReference(),this._reader.readBitShort(),i.PUCSBASE=this._reader.handleReference(),this._header.paperSpaceOrthographicTopDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicBottomDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicLeftDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicRightDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicFrontDOrigin=this._reader.read3BitDouble(),this._header.paperSpaceOrthographicBackDOrigin=this._reader.read3BitDouble()),this._header.modelSpaceInsertionBase=this._reader.read3BitDouble(),this._header.modelSpaceExtMin=this._reader.read3BitDouble(),this._header.modelSpaceExtMax=this._reader.read3BitDouble(),this._header.modelSpaceLimitsMin=this._reader.read2RawDouble(),this._header.modelSpaceLimitsMax=this._reader.read2RawDouble(),this._header.elevation=this._reader.readBitDouble(),this._header.modelSpaceOrigin=this._reader.read3BitDouble(),this._header.modelSpaceXAxis=this._reader.read3BitDouble(),this._header.modelSpaceYAxis=this._reader.read3BitDouble(),i.UCSNAME_MSPACE=this._reader.handleReference(),this.R2000Plus&&(i.UCSORTHOREF=this._reader.handleReference(),this._reader.readBitShort(),i.UCSBASE=this._reader.handleReference(),this._header.modelSpaceOrthographicTopDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicBottomDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicLeftDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicRightDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicFrontDOrigin=this._reader.read3BitDouble(),this._header.modelSpaceOrthographicBackDOrigin=this._reader.read3BitDouble(),this._header.dimensionPostFix=this._reader.readVariableText(),this._header.dimensionAlternateDimensioningSuffix=this._reader.readVariableText()),this.R13_14Only&&(this._header.dimensionGenerateTolerances=this._reader.readBit(),this._header.dimensionLimitsGeneration=this._reader.readBit(),this._header.dimensionTextInsideHorizontal=this._reader.readBit(),this._header.dimensionTextOutsideHorizontal=this._reader.readBit(),this._header.dimensionSuppressFirstExtensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondExtensionLine=this._reader.readBit(),this._header.dimensionAlternateUnitDimensioning=this._reader.readBit(),this._header.dimensionTextOutsideExtensions=this._reader.readBit(),this._header.dimensionSeparateArrowBlocks=this._reader.readBit(),this._header.dimensionTextInsideExtensions=this._reader.readBit(),this._header.dimensionSuppressOutsideExtensions=this._reader.readBit(),this._header.dimensionAlternateUnitDecimalPlaces=this._reader.readRawChar(),this._header.dimensionZeroHandling=this._reader.readRawChar(),this._header.dimensionSuppressFirstDimensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondDimensionLine=this._reader.readBit(),this._header.dimensionToleranceAlignment=this._reader.readRawChar(),this._header.dimensionTextHorizontalAlignment=this._reader.readRawChar(),this._header.dimensionFit=this._reader.readRawChar(),this._header.dimensionCursorUpdate=this._reader.readBit(),this._header.dimensionToleranceZeroHandling=this._reader.readRawChar(),this._header.dimensionAlternateUnitZeroHandling=this._reader.readRawChar(),this._header.dimensionAlternateUnitToleranceZeroHandling=this._reader.readRawChar(),this._header.dimensionTextVerticalAlignment=this._reader.readRawChar(),this._header.dimensionUnit=this._reader.readBitShort(),this._header.dimensionAngularDimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAlternateUnitFormat=this._reader.readBitShort(),this._header.dimensionAlternateUnitToleranceDecimalPlaces=this._reader.readBitShort(),i.DIMTXSTY=this._reader.handleReference()),this._header.dimensionScaleFactor=this._reader.readBitDouble(),this._header.dimensionArrowSize=this._reader.readBitDouble(),this._header.dimensionExtensionLineOffset=this._reader.readBitDouble(),this._header.dimensionLineIncrement=this._reader.readBitDouble(),this._header.dimensionExtensionLineExtension=this._reader.readBitDouble(),this._header.dimensionRounding=this._reader.readBitDouble(),this._header.dimensionLineExtension=this._reader.readBitDouble(),this._header.dimensionPlusTolerance=this._reader.readBitDouble(),this._header.dimensionMinusTolerance=this._reader.readBitDouble(),this.R2007Plus){this._header.dimensionFixedExtensionLineLength=this._reader.readBitDouble();let S=this._reader.readBitDouble(),N=Math.round(S*1e6)/1e6,L=5*Math.PI/180;N>L&&N<Math.PI/2&&(this._header.dimensionJoggedRadiusDimensionTransverseSegmentAngle=S),this._header.dimensionTextBackgroundFillMode=this._reader.readBitShort(),this._header.dimensionTextBackgroundColor=this._reader.readCmColor()}if(this.R2000Plus&&(this._header.dimensionGenerateTolerances=this._reader.readBit(),this._header.dimensionLimitsGeneration=this._reader.readBit(),this._header.dimensionTextInsideHorizontal=this._reader.readBit(),this._header.dimensionTextOutsideHorizontal=this._reader.readBit(),this._header.dimensionSuppressFirstExtensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondExtensionLine=this._reader.readBit(),this._header.dimensionTextVerticalAlignment=this._reader.readBitShort(),this._header.dimensionZeroHandling=this._reader.readBitShort(),this._header.dimensionAngularZeroHandling=this._reader.readBitShort()),this.R2007Plus&&(this._header.dimensionArcLengthSymbolPosition=this._reader.readBitShort()),this._header.dimensionTextHeight=this._reader.readBitDouble(),this._header.dimensionCenterMarkSize=this._reader.readBitDouble(),this._header.dimensionTickSize=this._reader.readBitDouble(),this._header.dimensionAlternateUnitScaleFactor=this._reader.readBitDouble(),this._header.dimensionLinearScaleFactor=this._reader.readBitDouble(),this._header.dimensionTextVerticalPosition=this._reader.readBitDouble(),this._header.dimensionToleranceScaleFactor=this._reader.readBitDouble(),this._header.dimensionLineGap=this._reader.readBitDouble(),this.R13_14Only&&(this._header.dimensionPostFix=this._reader.readVariableText(),this._header.dimensionAlternateDimensioningSuffix=this._reader.readVariableText(),this._header.dimensionBlockName=this._reader.readVariableText(),this._header.dimensionBlockNameFirst=this._reader.readVariableText(),this._header.dimensionBlockNameSecond=this._reader.readVariableText()),this.R2000Plus&&(this._header.dimensionAlternateUnitRounding=this._reader.readBitDouble(),this._header.dimensionAlternateUnitDimensioning=this._reader.readBit(),this._header.dimensionAlternateUnitDecimalPlaces=this._reader.readBitShort()&255,this._header.dimensionTextOutsideExtensions=this._reader.readBit(),this._header.dimensionSeparateArrowBlocks=this._reader.readBit(),this._header.dimensionTextInsideExtensions=this._reader.readBit(),this._header.dimensionSuppressOutsideExtensions=this._reader.readBit()),this._header.dimensionLineColor=this._reader.readCmColor(),this._header.dimensionExtensionLineColor=this._reader.readCmColor(),this._header.dimensionTextColor=this._reader.readCmColor(),this.R2000Plus&&(this._header.dimensionAngularDimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionDecimalPlaces=this._reader.readBitShort(),this._header.dimensionToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAlternateUnitFormat=this._reader.readBitShort(),this._header.dimensionAlternateUnitToleranceDecimalPlaces=this._reader.readBitShort(),this._header.dimensionAngularUnit=this._reader.readBitShort(),this._header.dimensionFractionFormat=this._reader.readBitShort(),this._header.dimensionLinearUnitFormat=this._reader.readBitShort(),this._header.dimensionDecimalSeparator=String.fromCharCode(this._reader.readBitShort()),this._header.dimensionTextMovement=this._reader.readBitShort(),this._header.dimensionTextHorizontalAlignment=this._reader.readBitShort()&255,this._header.dimensionSuppressFirstDimensionLine=this._reader.readBit(),this._header.dimensionSuppressSecondDimensionLine=this._reader.readBit(),this._header.dimensionToleranceAlignment=this._reader.readBitShort()&255,this._header.dimensionToleranceZeroHandling=this._reader.readBitShort()&255,this._header.dimensionAlternateUnitZeroHandling=this._reader.readBitShort()&255,this._header.dimensionAlternateUnitToleranceZeroHandling=this._reader.readBitShort()&255,this._header.dimensionCursorUpdate=this._reader.readBit(),this._header.dimensionDimensionTextArrowFit=this._reader.readBitShort()),this.R2007Plus&&(this._header.dimensionIsExtensionLineLengthFixed=this._reader.readBit()),this.R2010Plus&&(this._header.dimensionTextDirection=this._reader.readBit()?1:0,this._header.dimensionAltMzf=this._reader.readBitDouble(),this._header.dimensionAltMzs=this._reader.readVariableText(),this._header.dimensionFit=this._reader.readBitDouble(),this._header.dimensionMzs=this._reader.readVariableText()),this.R2000Plus&&(i.DIMTXSTY=this._reader.handleReference(),i.DIMLDRBLK=this._reader.handleReference(),i.DIMBLK=this._reader.handleReference(),i.DIMBLK1=this._reader.handleReference(),i.DIMBLK2=this._reader.handleReference()),this.R2007Plus&&(i.DIMLTYPE=this._reader.handleReference(),i.DIMLTEX1=this._reader.handleReference(),i.DIMLTEX2=this._reader.handleReference()),this.R2000Plus&&(this._header.dimensionLineWeight=this._reader.readBitShort(),this._header.extensionLineWeight=this._reader.readBitShort()),i.BLOCK_CONTROL_OBJECT=this._reader.handleReference(),i.LAYER_CONTROL_OBJECT=this._reader.handleReference(),i.STYLE_CONTROL_OBJECT=this._reader.handleReference(),i.LINETYPE_CONTROL_OBJECT=this._reader.handleReference(),i.VIEW_CONTROL_OBJECT=this._reader.handleReference(),i.UCS_CONTROL_OBJECT=this._reader.handleReference(),i.VPORT_CONTROL_OBJECT=this._reader.handleReference(),i.APPID_CONTROL_OBJECT=this._reader.handleReference(),i.DIMSTYLE_CONTROL_OBJECT=this._reader.handleReference(),this.R13_15Only&&(i.VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT=this._reader.handleReference()),i.DICTIONARY_ACAD_GROUP=this._reader.handleReference(),i.DICTIONARY_ACAD_MLINESTYLE=this._reader.handleReference(),i.DICTIONARY_NAMED_OBJECTS=this._reader.handleReference(),this.R2000Plus&&(this._header.stackedTextAlignment=this._reader.readBitShort(),this._header.stackedTextSizePercentage=this._reader.readBitShort(),this._header.hyperLinkBase=this._reader.readVariableText(),this._header.styleSheetName=this._reader.readVariableText(),i.DICTIONARY_LAYOUTS=this._reader.handleReference(),i.DICTIONARY_PLOTSETTINGS=this._reader.handleReference(),i.DICTIONARY_PLOTSTYLES=this._reader.handleReference()),this.R2004Plus&&(i.DICTIONARY_MATERIALS=this._reader.handleReference(),i.DICTIONARY_COLORS=this._reader.handleReference()),this.R2007Plus&&(i.DICTIONARY_VISUALSTYLE=this._reader.handleReference(),this.R2013Plus&&(i.DICTIONARY_VISUALSTYLE=this._reader.handleReference())),this.R2000Plus){let S=this._reader.readBitLong();this._header.currentEntityLineWeight=S&31,this._header.endCaps=S&96,this._header.joinStyle=S&384,this._header.displayLineWeight=(S&512)===1,this._header.xEdit=(S&1024)===1,this._header.extendedNames=(S&2048)===1,this._header.plotStyleMode=S&8192,this._header.loadOLEObject=(S&16384)===1,this._header.insUnits=this._reader.readBitShort(),this._header.currentEntityPlotStyle=this._reader.readBitShort(),this._header.currentEntityPlotStyle===Qi.ByObjectId&&(i.CPSNID=this._reader.handleReference()),this._header.fingerPrintGuid=this._reader.readVariableText(),this._header.versionGuid=this._reader.readVariableText()}if(this.R2004Plus&&(this._header.entitySortingFlags=this._reader.readByte(),this._header.indexCreationFlags=this._reader.readByte(),this._header.hideText=this._reader.readByte(),this._header.externalReferenceClippingBoundaryType=this._reader.readByte(),this._header.dimensionAssociativity=this._reader.readByte(),this._header.haloGapPercentage=this._reader.readByte(),this._header.obscuredColor=new B(this._reader.readBitShort()),this._header.interfereColor=new B(this._reader.readBitShort()),this._header.obscuredType=this._reader.readByte(),this._header.intersectionDisplay=this._reader.readByte(),this._header.projectName=this._reader.readVariableText()),i.PAPER_SPACE=this._reader.handleReference(),i.MODEL_SPACE=this._reader.handleReference(),i.BYLAYER=this._reader.handleReference(),i.BYBLOCK=this._reader.handleReference(),i.CONTINUOUS=this._reader.handleReference(),this.R2007Plus){this._header.cameraDisplayObjects=this._reader.readBit(),this._reader.readBitLong(),this._reader.readBitLong(),this._reader.readBitDouble();let S=this._reader.readBitDouble();S>=1&&S<=30&&(this._header.stepsPerSecond=S),this._header.stepSize=this._reader.readBitDouble(),this._header.dw3DPrecision=this._reader.readBitDouble(),this._header.lensLength=this._reader.readBitDouble(),this._header.cameraHeight=this._reader.readBitDouble(),this._header.solidsRetainHistory=this._reader.readRawChar()!==0,this._header.showSolidsHistory=this._reader.readRawChar()!==0,this._header.sweptSolidWidth=this._reader.readBitDouble(),this._header.sweptSolidHeight=this._reader.readBitDouble(),this._header.draftAngleFirstCrossSection=this._reader.readBitDouble(),this._header.draftAngleSecondCrossSection=this._reader.readBitDouble(),this._header.draftMagnitudeFirstCrossSection=this._reader.readBitDouble(),this._header.draftMagnitudeSecondCrossSection=this._reader.readBitDouble(),this._header.solidLoftedShape=this._reader.readBitShort(),this._header.loftedObjectNormals=String.fromCharCode(this._reader.readRawChar()),this._header.latitude=this._reader.readBitDouble(),this._header.longitude=this._reader.readBitDouble(),this._header.northDirection=this._reader.readBitDouble(),this._header.timeZone=this._reader.readBitLong(),this._header.displayLightGlyphs=String.fromCharCode(this._reader.readRawChar()),this._reader.readRawChar(),this._header.dwgUnderlayFramesVisibility=String.fromCharCode(this._reader.readRawChar()),this._header.dgnUnderlayFramesVisibility=String.fromCharCode(this._reader.readRawChar()),this._reader.readBit(),this._header.interfereColor=this._reader.readCmColor(),i.INTERFEREOBJVS=this._reader.handleReference(),i.INTERFEREVPVS=this._reader.handleReference(),i.DRAGVS=this._reader.handleReference(),this._header.shadowMode=this._reader.readByte(),this._header.shadowPlaneLocation=this._reader.readBitDouble()}try{t.setPositionInBits(n+s*8),t.resetShift(),this.checkSentinel(this._reader,T.EndSentinels.get(this.SectionName))}catch(S){this.notify("An error ocurred at the end of the Header reading",g.Error,S instanceof Error?S:void 0)}return{objectPointers:i}}};R();q();D();var Pt=class{CadObject;EDataTemplate=new Map;EDataTemplateByAppName=new Map;HasBeenBuilt=!1;OwnerHandle=null;ReactorsHandles=new Set;XDictHandle=null;constructor(e){this.CadObject=e}Build(e){this.HasBeenBuilt||(this.HasBeenBuilt=!0,this.build(e))}toString(){return`${this.CadObject?.toString()}`}build(e){let t=e.TryGetCadObject(this.XDictHandle);t&&(this.CadObject.xDictionary=t);for(let i of this.ReactorsHandles){let s=e.TryGetCadObject(i);s?this.CadObject.addReactor(s):e.Notify(`Reactor with handle ${i} not found`,g.Warning)}for(let[i,s]of this.EDataTemplate){let n=e.TryGetCadObject(i);n?this.CadObject.extendedData.set(n,s):e.Notify(`AppId in extended data with handle ${i} not found`,g.Warning)}for(let[i,s]of this.EDataTemplateByAppName){let n=e.TryGetTableEntry(i);n?this.CadObject.extendedData.set(n,s):e.Notify(`AppId in extended data with handle ${i} not found`,g.Warning)}}*getEntitiesCollection(e,t,i){let s=e.GetObjectTemplate(t);for(s||(e.Notify(`Leading entity with handle ${t} not found.`,g.Warning),s=e.GetObjectTemplate(i));s&&(yield s.CadObject,s.CadObject.handle!==i);)s.NextEntity!=null?s=e.GetObjectTemplate(s.NextEntity):s=e.GetObjectTemplate(s.CadObject.handle+1)}getTableReference(e,t,i){let s=e.TryGetCadObject(t);if(s)return s;let n=e.TryGetTableEntry(i);return n||((i&&i.length>0||t!=null&&t!==0)&&e.Notify(`Table reference with handle: ${t} | name: ${i} not found for ${this.CadObject.constructor.name} with handle ${this.CadObject.handle}`,g.Warning),null)}};var G=class extends Pt{constructor(e){super(e)}};var k=class extends G{bookColorName=null;ColorHandle=null;EntityMode=0;LayerHandle=null;LayerName=null;LineTypeHandle=null;LineTypeName=null;LtypeFlags=null;MaterialHandle=null;NextEntity=null;PrevEntity=null;constructor(e){super(e)}SetUnlinkedReferences(){this.LayerName&&this.LayerName.length>0&&(this.CadObject.layer=new Se(this.LayerName)),this.LineTypeName&&this.LineTypeName.length>0&&(this.CadObject.lineType=new H(this.LineTypeName))}build(e){super.build(e);let t=this.getTableReference(e,this.LayerHandle,this.LayerName??"");switch(t&&(this.CadObject.layer=t),this.LtypeFlags){case 0:this.LineTypeName=H.ByLayerName;break;case 1:this.LineTypeName=H.ByBlockName;break;case 2:this.LineTypeName=H.ContinuousName;break}let i=this.getTableReference(e,this.LineTypeHandle,this.LineTypeName??"");i&&(this.CadObject.lineType=i);let s=e.TryGetCadObject(this.ColorHandle);if(s)this.CadObject.bookColor=s;else if(this.bookColorName&&this.bookColorName.length>0&&e.DocumentToBuild!=null&&e.DocumentToBuild.colors!=null){let n=e.DocumentToBuild.colors.TryGet(this.bookColorName);n&&(this.CadObject.bookColor=n)}}},ke=class extends k{constructor(e){super(e)}};var K=class extends G{constructor(e){super(e)}};var fe=class extends G{get Type(){return this.CadObject.constructor.name}get Name(){return this.CadObject.name}constructor(e){super(e)}build(e){super.build(e)}};var br=class extends fe{BeginBlockHandle=null;BlockEntityTemplate=null;EndBlockHandle=null;FirstEntityHandle=null;InsertHandles=[];LastEntityHandle=null;LayoutHandle=null;OwnedObjectsHandlers=new Set;ReferenceTemplates=new Set;constructor(e){super(e??new U)}SetBlockToRecord(e,t){let i=e.TryGetCadObject(this.BeginBlockHandle);i&&(i.name&&i.name.length>0&&(this.CadObject.name=i.name),i.flags=this.CadObject.blockEntity.flags,i.basePoint=this.CadObject.blockEntity.basePoint,i.xRefPath=this.CadObject.blockEntity.xRefPath,i.comments=this.CadObject.blockEntity.comments,i.isUnloaded=this.CadObject.blockEntity.isUnloaded,this.CadObject.blockEntity=i);let s=e.TryGetCadObject(this.EndBlockHandle);s&&(this.CadObject.blockEnd=s),this.ensureCorrectNaming(e,t.MODEL_SPACE,U.ModelSpaceName),this.ensureCorrectNaming(e,t.PAPER_SPACE,U.PaperSpaceName)}build(e){super.build(e);let t=e.TryGetCadObject(this.LayoutHandle);if(t&&(this.CadObject.layout=t),this.FirstEntityHandle!=null&&this.FirstEntityHandle!==0)for(let i of this.getEntitiesCollection(e,this.FirstEntityHandle,this.LastEntityHandle))this.addEntity(e,i);else{if(this.BlockEntityTemplate!==null)for(let i of this.BlockEntityTemplate.OwnedObjectsHandlers)this.OwnedObjectsHandlers.add(i);for(let i of this.OwnedObjectsHandlers){let s=e.TryGetCadObject(i);s&&this.addEntity(e,s)}}for(let i of this.ReferenceTemplates)this.addEntity(e,i.CadObject)}addEntity(e,t){!e.KeepUnknownEntities&&t instanceof Lt||this.CadObject.entities.add(t)}ensureCorrectNaming(e,t,i){this.CadObject.handle===t&&this.CadObject.name.toLowerCase()!==i.toLowerCase()&&(e.Notify(`Invalid name for ${this.CadObject.name} changed to ${i}`,g.Warning),this.CadObject.name=i)}};var st=class extends Pt{EntryHandles=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.EntryHandles){let i=e.TryGetCadObject(t);if(i)try{this.CadObject.add(i)}catch(s){e.Notify(`[${this.CadObject.subclassMarker}] error adding entry`,g.Error,s)}}}};var Mn=class extends st{ModelSpaceHandle=null;PaperSpaceHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=e.TryGetCadObject(this.ModelSpaceHandle);t&&this.CadObject.add(t);let i=e.TryGetCadObject(this.PaperSpaceHandle);i&&this.CadObject.add(i)}};R();var gr=class extends k{StyleHandle=null;BlockHandle=null;BlockName=null;StyleName=null;constructor(e){super(e??new Wn)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.StyleHandle,this.StyleName??"");i&&(t.style=i);let s=this.getTableReference(e,this.BlockHandle,this.BlockName??"");s&&(t.block=s)}SetDimensionFlags(e){let t=this.CadObject;t.flags=e}SetDimensionObject(e){e.handle=this.CadObject.handle,e.owner=this.CadObject.owner,e.xDictionary=this.CadObject.xDictionary,e.color=this.CadObject.color,e.lineWeight=this.CadObject.lineWeight,e.lineTypeScale=this.CadObject.lineTypeScale,e.isInvisible=this.CadObject.isInvisible,e.transparency=this.CadObject.transparency;let t=this.CadObject;if(e.version=t.version,e.definitionPoint=t.definitionPoint,e.textMiddlePoint=t.textMiddlePoint,e.insertionPoint=t.insertionPoint,e.normal=t.normal,e.isTextUserDefinedLocation=t.isTextUserDefinedLocation,e.attachmentPoint=t.attachmentPoint,e.lineSpacingStyle=t.lineSpacingStyle,e.lineSpacingFactor=t.lineSpacingFactor,e.text=t.text,e.textRotation=t.textRotation,e.horizontalDirection=t.horizontalDirection,e.flags=t.flags,this.CadObject instanceof je&&e instanceof Qe){let i=this.CadObject,s=e;s.firstPoint=i.firstPoint,s.secondPoint=i.secondPoint,s.extLineRotation=i.extLineRotation}this.CadObject=e}},Wn=class extends me{get objectType(){return u.INVALID}get measurement(){return 0}getBoundingBox(){return null}constructor(){super(v.Linear)}};var Hn=class extends fe{DIMBL_Name=null;DIMBLK=null;DIMBLK1=null;DIMBLK1_Name=null;DIMBLK2=null;DIMBLK2_Name=null;DIMLDRBLK=null;Dimltex1=0;Dimltex2=0;Dimltype=null;TextStyle_Name=null;TextStyleHandle=null;BlockHandle=null;DxfFlagsAssigned=!1;constructor(e){super(e??new re)}build(e){super.build(e);let t=this.getTableReference(e,this.TextStyleHandle,this.TextStyle_Name??"");t&&(this.CadObject.style=t);let i=this.getTableReference(e,this.Dimltype,"");i&&(this.CadObject.lineType=i);let s=this.getTableReference(e,this.Dimltex1,"");s&&(this.CadObject.lineTypeExt1=s);let n=this.getTableReference(e,this.Dimltex2,"");n&&(this.CadObject.lineTypeExt2=n);let a=this.getTableReference(e,this.DIMLDRBLK,this.DIMBL_Name??"");a&&(this.CadObject.leaderArrow=a);let o=this.getTableReference(e,this.DIMBLK1,this.DIMBLK1_Name??"");o&&(this.CadObject.dimArrow1=o);let h=this.getTableReference(e,this.DIMBLK2,this.DIMBLK2_Name??"");h&&(this.CadObject.dimArrow2=h);let f=this.getTableReference(e,this.BlockHandle,"")}};var Li=class extends ke{HatchPatternName=null;PathTemplates=[];constructor(e){super(e??new Tt)}build(e){super.build(e);for(let t of this.PathTemplates)this.CadObject.paths.push(t.Path),t.Build(e)}};(function(r){class e{Path=new _l;Handles=new Set;Build(i){for(let s of this.Handles){let n=i.TryGetCadObject(s);n&&this.Path.entities.push(n)}}}r.CadBoundaryPathTemplate=e})(Li||(Li={}));var xr=class extends k{HasAtts=!1;OwnedObjectsCount=0;BlockHeaderHandle=null;BlockName=null;FirstAttributeHandle=null;EndAttributeHandle=null;SeqendHandle=null;OwnedObjectsHandlers=new Set;constructor(e){super(e??new Ee)}build(e){super.build(e);let t=this.CadObject;if(!(t instanceof Ee))return;let i=this.getTableReference(e,this.BlockHeaderHandle,this.BlockName??"");i?t.block=i:e.Notify(`Block ${this.BlockHeaderHandle} | ${this.BlockName} not found for Insert ${this.CadObject.handle}`,g.Warning);let s=e.TryGetCadObject(this.SeqendHandle);if(s&&(t.attributes.Seqend=s,s.owner=t),this.FirstAttributeHandle!=null){let n=this.getEntitiesCollection(e,this.FirstAttributeHandle,this.EndAttributeHandle);for(let a of n)t.attributes.push(a),a.owner=t}else for(let n of this.OwnedObjectsHandlers){let a=e.TryGetCadObject(n);a&&(t.attributes.push(a),a.owner=t)}}};var Fn=class extends fe{LayerControlHandle=0;PlotStyleHandle=0;MaterialHandle=0;LineTypeHandle=null;LineTypeName=null;TrueColorName=null;constructor(e){super(e??new Se)}build(e){super.build(e);let t=e.TryGetCadObject(this.MaterialHandle),i=this.getTableReference(e,this.LineTypeHandle,this.LineTypeName??"");i?this.CadObject.lineType=i:e.Notify(`Linetype with handle ${this.LineTypeHandle} could not be found for layer ${this.CadObject.name}`,g.Warning)}};J();D();x();R();var Ps;(function(r){r[r.None=0]="None",r[r.PlotViewportBorders=1]="PlotViewportBorders",r[r.ShowPlotStyles=2]="ShowPlotStyles",r[r.PlotCentered=4]="PlotCentered",r[r.PlotHidden=8]="PlotHidden",r[r.UseStandardScale=16]="UseStandardScale",r[r.PlotPlotStyles=32]="PlotPlotStyles",r[r.ScaleLineweights=64]="ScaleLineweights",r[r.PrintLineweights=128]="PrintLineweights",r[r.DrawViewportsFirst=512]="DrawViewportsFirst",r[r.ModelType=1024]="ModelType",r[r.UpdatePaper=2048]="UpdatePaper",r[r.ZoomToPaperOnUpdate=4096]="ZoomToPaperOnUpdate",r[r.Initializing=8192]="Initializing",r[r.PrevPlotInit=16384]="PrevPlotInit"})(Ps||(Ps={}));var jl;(function(r){r[r.Inches=0]="Inches",r[r.Millimeters=1]="Millimeters",r[r.Pixels=2]="Pixels"})(jl||(jl={}));var ni;(function(r){r[r.NoRotation=0]="NoRotation",r[r.Degrees90=1]="Degrees90",r[r.Degrees180=2]="Degrees180",r[r.Degrees270=3]="Degrees270"})(ni||(ni={}));var Oo;(function(r){r[r.AsDisplayed=0]="AsDisplayed",r[r.Wireframe=1]="Wireframe",r[r.Hidden=2]="Hidden",r[r.Rendered=3]="Rendered"})(Oo||(Oo={}));var jo;(function(r){r[r.Draft=0]="Draft",r[r.Preview=1]="Preview",r[r.Normal=2]="Normal",r[r.Presentation=3]="Presentation",r[r.Maximum=4]="Maximum",r[r.Custom=5]="Custom"})(jo||(jo={}));var un=class{left;bottom;right;top;get bottomLeftCorner(){return new C(this.left,this.bottom)}get topCorner(){return new C(this.right,this.top)}constructor(e=0,t=0,i=0,s=0){this.left=e,this.bottom=t,this.right=i,this.top=s}};var sh;(function(r){r[r.DrawingExtents=0]="DrawingExtents",r[r.Limits=1]="Limits",r[r.View=2]="View",r[r.Window=3]="Window",r[r.Layout=4]="Layout",r[r.Display=5]="Display"})(sh||(sh={}));var nh;(function(r){r[r.ScaleToFit=0]="ScaleToFit",r[r.UserDefined=1]="UserDefined"})(nh||(nh={}));var pt=class extends O{_denominatorScale=1;_numeratorScale=1;_shadePlotDPI=300;get denominatorScale(){return this._denominatorScale}set denominatorScale(e){if(e<=0)throw new Error("Value must be greater than zero");this._denominatorScale=e}flags=Ps.DrawViewportsFirst|Ps.PrintLineweights|Ps.PlotPlotStyles|Ps.UseStandardScale;get numeratorScale(){return this._numeratorScale}set numeratorScale(e){if(e<=0)throw new Error("Value must be greater than zero");this._numeratorScale=e}get objectName(){return d.ObjectPlotSettings}get objectType(){return u.UNLISTED}pageName="none_device";paperHeight=0;paperImageOrigin=new C(0,0);paperImageOriginX=0;paperImageOriginY=0;paperRotation=ni.NoRotation;paperSize="ISO_A4_(210.00_x_297.00_MM)";paperUnits=jl.Millimeters;paperWidth=0;plotOriginX=0;plotOriginY=0;plotType=sh.DrawingExtents;plotViewName="";get printScale(){return this.numeratorScale/this.denominatorScale}scaledFit=nh.ScaleToFit;get shadePlotDPI(){return this._shadePlotDPI}set shadePlotDPI(e){if(e<100||e>32767)throw new Error("The valid shade plot DPI values range from 100 to 32767.");this._shadePlotDPI=e}shadePlotIDHandle=0;shadePlotMode=Oo.AsDisplayed;shadePlotResolutionMode=jo.Draft;standardScale=1;styleSheet="";get subclassMarker(){return l.PlotSettings}systemPrinterName="";unprintableMargin=new un;windowLowerLeftX=0;windowLowerLeftY=0;windowUpperLeftX=0;windowUpperLeftY=0;constructor(e){super(e)}};D();x();R();var No;(function(r){r[r.None=0]="None",r[r.PaperSpaceLinetypeScaling=1]="PaperSpaceLinetypeScaling",r[r.LimitsChecking=2]="LimitsChecking"})(No||(No={}));var nt=class r extends pt{_blockRecord=null;_lastViewport=null;get associatedBlock(){return this._blockRecord}set associatedBlock(e){if(e==null)throw new Error("value cannot be null");this._blockRecord=e,this._blockRecord.layout=this}baseUCS=null;elevation=0;insertionBasePoint=new c(0,0,0);get isPaperSpace(){return this.name?.toLowerCase()!==r.ModelLayoutName.toLowerCase()}get lastActiveViewport(){return this._lastViewport}set lastActiveViewport(e){this._lastViewport=e}layoutFlags=No.PaperSpaceLinetypeScaling;maxExtents=new c(231.3,175.5,0);maxLimits=new C(277,202.5);minExtents=new c(25.7,19.5,0);minLimits=new C(-20,-7.5);get objectName(){return d.ObjectLayout}get objectType(){return u.LAYOUT}origin=new c(0,0,0);get subclassMarker(){return l.Layout}tabOrder=0;ucs=null;ucsOrthographicType=0;get viewports(){return this.associatedBlock?.viewports??null}xAxis=new c(1,0,0);yAxis=new c(0,1,0);static ModelLayoutName="Model";static PaperLayoutName="Layout1";constructor(e,t){super(),e!=null&&(this.name=e)}addViewport(e){this.associatedBlock?.entities?.push(e)}clone(){return super.clone()}toString(){return`${this.objectName}:${this.name}`}updatePaperViewport(){!this.isPaperSpace||this.associatedBlock==null}};var Un=class extends G{PaperSpaceBlockHandle=null;ActiveViewportHandle=null;BaseUcsHandle=null;NamesUcsHandle=null;LasActiveViewportHandle=null;ViewportHandles=new Set;constructor(e){super(e??new nt)}build(e){super.build(e);let t=e.TryGetCadObject(this.PaperSpaceBlockHandle);t&&(this.CadObject.associatedBlock=t);let i=e.TryGetCadObject(this.ActiveViewportHandle);i&&(this.CadObject.lastActiveViewport=i);let s=e.TryGetCadObject(this.BaseUcsHandle);s&&(this.CadObject.baseUCS=s);let n=e.TryGetCadObject(this.NamesUcsHandle);n&&(this.CadObject.ucs=n);for(let a of this.ViewportHandles){let o=e.TryGetCadObject(a)}}};var vn=class extends ke{Dimasz=0;DIMSTYLEHandle=0;DIMSTYLEName="";AnnotationHandle=0;constructor(e){super(e??new nr)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.DIMSTYLEHandle,this.DIMSTYLEName);i&&(t.style=i);let s=e.TryGetCadObject(this.AnnotationHandle);s&&(t.associatedAnnotation=s)}};var ki=class extends fe{LtypeControlHandle=null;TotalLen=null;SegmentTemplates=[];constructor(e){super(e??new H)}build(e){super.build(e);for(let t of this.SegmentTemplates)t.Build(e),this.CadObject.addSegment(t.Segment)}};(function(r){class e{StyleHandle=null;Segment=new nl;Build(i){let s=i.TryGetCadObject(this.StyleHandle);s&&(this.Segment.style=s)}}r.SegmentTemplate=e})(ki||(ki={}));J();x();var Nl=class extends O{get subclassMarker(){return l.ObjectContextData}version=3;hasFileToExtensionDictionary=!0;default=!1};J();D();x();R();var Ge=class r extends O{static DefaultName="1:1";static get Default(){let e=new r;return e.name=r.DefaultName,e.paperUnits=1,e.drawingUnits=1,e.isUnitScale=!0,e}get objectType(){return u.UNLISTED}get objectName(){return d.ObjectScale}get subclassMarker(){return l.Scale}paperUnits=0;drawingUnits=0;isUnitScale=!1;get scaleFactor(){return this.paperUnits/this.drawingUnits}constructor(e){super(e)}applyTo(e){return e*this.scaleFactor}};Te();x();var Os=class extends Nl{get scale(){return this._scale}set scale(e){if(!e)throw new Error("value cannot be null");this.document!=null?this._scale=I.updateCollection(e,this.document.scales):this._scale=e}get subclassMarker(){return l.AnnotScaleObjectContextData}_scale=Ge.Default;clone(){let e=super.clone();return e._scale=this._scale?.clone(),e}};D();x();R();var Vo=class r{startPoint;endPoint;constructor(e=new c(0,0,0),t=new c(0,0,0)){this.startPoint=e,this.endPoint=t}clone(){return new r(new c(this.startPoint.x,this.startPoint.y,this.startPoint.z),new c(this.endPoint.x,this.endPoint.y,this.endPoint.z))}},zn=class r{arrowhead=null;arrowheadSize=0;breakInfoCount=0;index=0;lineColor=B.ByLayer;_lineType=null;get lineType(){return this._lineType}set lineType(e){this._lineType=e}lineWeight=0;overrideFlags=0;pathType=0;points=[];segmentIndex=0;startEndPoints=[];document=null;assignDocument(e){this.document=e}clone(){let e=new r;return e.arrowheadSize=this.arrowheadSize,e.breakInfoCount=this.breakInfoCount,e.index=this.index,e.lineColor=this.lineColor,e.lineWeight=this.lineWeight,e.overrideFlags=this.overrideFlags,e.pathType=this.pathType,e.segmentIndex=this.segmentIndex,e.points=this.points.map(t=>new c(t.x,t.y,t.z)),e.startEndPoints=this.startEndPoints.map(t=>t.clone()),e}unassignDocument(){this.document=null}},Gn=class r{breakStartEndPointsPairs=[];connectionPoint=new c(0,0,0);contentValid=!1;direction=new c(0,0,0);landingDistance=0;leaderIndex=0;lines=[];textAttachmentDirection=0;unknown=!1;clone(){let e=new r;return e.connectionPoint=new c(this.connectionPoint.x,this.connectionPoint.y,this.connectionPoint.z),e.contentValid=this.contentValid,e.direction=new c(this.direction.x,this.direction.y,this.direction.z),e.landingDistance=this.landingDistance,e.leaderIndex=this.leaderIndex,e.textAttachmentDirection=this.textAttachmentDirection,e.unknown=this.unknown,e.breakStartEndPointsPairs=this.breakStartEndPointsPairs.map(t=>t.clone()),e.lines=this.lines.map(t=>t.clone()),e}},Dr=class extends Os{arrowheadSize=0;backgroundFillColor=B.ByLayer;backgroundFillEnabled=!1;backgroundMaskFillOn=!1;backgroundScaleFactor=0;backgroundTransparency=0;baseDirection=new c(0,0,0);basePoint=new c(0,0,0);baseVertical=new c(0,0,0);_blockContent=null;get blockContent(){return this._blockContent}set blockContent(e){this._blockContent=e}blockContentColor=B.ByLayer;blockContentConnection=0;blockContentLocation=new c(0,0,0);blockContentNormal=new c(0,0,0);blockContentRotation=0;blockContentScale=new c(1,1,1);boundaryHeight=0;boundaryWidth=0;columnFlowReversed=!1;columnGutter=0;columnSizes=[];columnType=0;columnWidth=0;contentBasePoint=new c(0,0,0);direction=new c(0,0,0);flowDirection=0;hasContentsBlock=!1;hasTextContents=!1;landingGap=0;leaderRoots=[];lineSpacing=0;lineSpacingFactor=0;normalReversed=!1;get objectName(){return d.ObjectMLeaderContextData}get objectType(){return u.UNLISTED}scaleFactor=0;get subclassMarker(){return l.MultiLeaderObjectContextData}textAlignment=0;textAttachmentPoint=0;textBottomAttachment=0;textColor=B.ByLayer;textHeight=0;textHeightAutomatic=!1;textLabel="";textLeftAttachment=0;textLocation=new c(0,0,0);textNormal=new c(0,0,0);textRightAttachment=0;textRotation=0;_textStyle=null;get textStyle(){return this._textStyle}set textStyle(e){if(e==null)throw new Error("value cannot be null");this._textStyle=e}textTopAttachment=0;transformationMatrix=it.identity();wordBreak=!1;clone(){let e=super.clone();return e.leaderRoots=this.leaderRoots.map(t=>t.clone()),e}};var ms=class extends K{scaleHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.scaleHandle);i&&(t.scale=i)}};var ai=class extends ms{BlockRecordHandle=0;leaderLineTemplates=[];TextStyleHandle=0;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.TextStyleHandle);i&&(t.textStyle=i);let s=e.TryGetCadObject(this.BlockRecordHandle);s&&(t.blockContent=s);for(let n of this.leaderLineTemplates)n.Build(e)}};(function(r){class e{ArrowSymbolHandle=null;LeaderLine;LineTypeHandle=null;constructor(i){this.LeaderLine=i??new zn}Build(i){let s=i.TryGetCadObject(this.LineTypeHandle);s&&(this.LeaderLine.lineType=s);let n=i.TryGetCadObject(this.ArrowSymbolHandle);n&&(this.LeaderLine.arrowhead=n)}}r.LeaderLineTemplate=e})(ai||(ai={}));var $n=class extends ke{ArrowheadHandle=0;ArrowheadHandles=new Map;BlockAttributeHandles=new Map;BlockContentHandle=0;CadMLeaderAnnotContextTemplate;LeaderLineTypeHandle=null;LeaderStyleHandle=0;MTextStyleHandle=0;constructor(e){let t=e??new lr;super(t),this.CadMLeaderAnnotContextTemplate=new ai(t.contextData)}build(e){super.build(e),this.CadMLeaderAnnotContextTemplate.Build(e);let t=this.CadObject,i=e.TryGetCadObject(this.LeaderStyleHandle);i&&(t.style=i);let s=e.TryGetCadObject(this.LeaderLineTypeHandle);s&&(t.leaderLineType=s);let n=e.TryGetCadObject(this.MTextStyleHandle);n&&(t.textStyle=n);let a=e.TryGetCadObject(this.BlockContentHandle);a&&(t.blockContentId=a);let o=e.TryGetCadObject(this.ArrowheadHandle);o&&(t.arrowhead=o);for(let[h,f]of this.ArrowheadHandles);for(let h of t.blockAttributes){let f=this.BlockAttributeHandles.get(h);if(f!==void 0){let b=e.TryGetCadObject(f);b&&(h.attributeDefinition=b)}}}};J();D();x();R();var Io;(function(r){r[r.LeaderHeadFirst=0]="LeaderHeadFirst",r[r.LeaderTailFirst=1]="LeaderTailFirst"})(Io||(Io={}));var Mo;(function(r){r[r.ContentFirst=0]="ContentFirst",r[r.LeaderFirst=1]="LeaderFirst"})(Mo||(Mo={}));var $e=class r extends O{static get default_(){return new r(r.DefaultName)}alignSpace=0;_arrowhead=null;get arrowhead(){return this._arrowhead}set arrowhead(e){this._arrowhead=e}arrowheadSize=.18;_blockContent=null;get blockContent(){return this._blockContent}set blockContent(e){this._blockContent=e}blockContentColor=B.ByBlock;blockContentConnection=0;blockContentRotation=0;_blockContentScale=new c(1,1,1);get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentScaleX(){return this._blockContentScale.x}set blockContentScaleX(e){this._blockContentScale.x=e}get blockContentScaleY(){return this._blockContentScale.y}set blockContentScaleY(e){this._blockContentScale.y=e}get blockContentScaleZ(){return this._blockContentScale.z}set blockContentScaleZ(e){this._blockContentScale.z=e}breakGapSize=.125;contentType=dn.MText;defaultTextContents="";description="";enableBlockContentRotation=!1;enableBlockContentScale=!1;enableDogleg=!0;enableLanding=!0;firstSegmentAngleConstraint=0;isAnnotative=!1;landingDistance=.36;landingGap=.09;leaderDrawOrder=Io.LeaderHeadFirst;_leaderLineType=null;get leaderLineType(){return this._leaderLineType}set leaderLineType(e){if(e==null)throw new Error("value cannot be null");this._leaderLineType=e}leaderLineWeight=0;lineColor=B.ByLayer;maxLeaderSegmentsPoints=2;multiLeaderDrawOrder=Mo.ContentFirst;get objectName(){return d.ObjectMLeaderStyle}get objectType(){return u.UNLISTED}overwritePropertyValue=!1;pathType=0;scaleFactor=1;secondSegmentAngleConstraint=0;get subclassMarker(){return l.MLeaderStyle}textAlignAlwaysLeft=!1;textAlignment=0;textAngle=0;textAttachmentDirection=0;textBottomAttachment=0;textColor=B.ByBlock;textFrame=!1;textHeight=.18;textLeftAttachment=0;textRightAttachment=0;_textStyle=null;get textStyle(){return this._textStyle}set textStyle(e){if(e==null)throw new Error("value cannot be null");this._textStyle=e}textTopAttachment=0;unknownFlag298=!1;static DefaultName="Standard";constructor(e=""){super(e)}clone(){return super.clone()}};var Yn=class extends G{ArrowheadHandle=null;BlockContentHandle=null;LeaderLineTypeHandle=null;MTextStyleHandle=null;constructor(e){super(e??new $e)}build(e){super.build(e);let t=e.TryGetCadObject(this.LeaderLineTypeHandle);t&&(this.CadObject.leaderLineType=t);let i=e.TryGetCadObject(this.ArrowheadHandle);i&&(this.CadObject.arrowhead=i);let s=e.TryGetCadObject(this.MTextStyleHandle);s&&(this.CadObject.textStyle=s);let n=e.TryGetCadObject(this.BlockContentHandle);n&&(this.CadObject.blockContent=n)}};var Xn=class extends ke{MLineStyleHandle=null;MLineStyleName=null;NVertex=null;NElements=null;_currVertex=null;_currSegmentElement=null;constructor(e){super(e??new or)}TryReadVertex(e,t){let i=this.CadObject;switch(e){case 11:return this._currVertex=new yn,i.vertices.push(this._currVertex),this._currVertex.position=new c(t,this._currVertex.position.Y,this._currVertex.position.Z),!0;case 21:return this._currVertex&&(this._currVertex.position=new c(this._currVertex.position.X,t,this._currVertex.position.Z)),!0;case 31:return this._currVertex&&(this._currVertex.position=new c(this._currVertex.position.X,this._currVertex.position.Y,t)),!0;case 12:return this._currVertex&&(this._currVertex.direction=new c(t,this._currVertex.direction.Y,this._currVertex.direction.Z)),!0;case 22:return this._currVertex&&(this._currVertex.direction=new c(this._currVertex.direction.X,t,this._currVertex.direction.Z)),!0;case 32:return this._currVertex&&(this._currVertex.direction=new c(this._currVertex.direction.X,this._currVertex.direction.Y,t)),!0;case 13:return this._currVertex&&(this._currVertex.miter=new c(t,this._currVertex.miter.Y,this._currVertex.miter.Z)),!0;case 23:return this._currVertex&&(this._currVertex.miter=new c(this._currVertex.miter.X,t,this._currVertex.miter.Z)),!0;case 33:return this._currVertex&&(this._currVertex.miter=new c(this._currVertex.miter.X,this._currVertex.miter.Y,t)),!0;case 74:return this._currSegmentElement=new Bn,this._currVertex&&this._currVertex.segments.push(this._currSegmentElement),!0;case 41:return this._currSegmentElement?.parameters.push(t),!0;case 42:return this._currSegmentElement?.areaFillParameters.push(t),!0;case 75:return!0;default:return!1}}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.MLineStyleHandle);i&&(t.style=i)}};J();Te();D();x();R();var ge;(function(r){r[r.None=0]="None",r[r.FillOn=1]="FillOn",r[r.DisplayJoints=2]="DisplayJoints",r[r.StartSquareCap=16]="StartSquareCap",r[r.StartInnerArcsCap=32]="StartInnerArcsCap",r[r.StartRoundCap=64]="StartRoundCap",r[r.EndSquareCap=256]="EndSquareCap",r[r.EndInnerArcsCap=512]="EndInnerArcsCap",r[r.EndRoundCap=1024]="EndRoundCap"})(ge||(ge={}));var js=class r{color=B.ByLayer;_lineType=null;get lineType(){return this._lineType}set lineType(e){this._lineType=I.updateCollectionStatic(e,this.owner?.document?.lineTypes)}offset=0;owner=null;clone(){let e=new r;return e.color=this.color,e.offset=this.offset,e.owner=null,e._lineType=this._lineType,e}assignDocument(e){this._lineType=I.updateCollectionStatic(this._lineType,e.lineTypes)}unassignDocument(){}},wt=class r extends O{static get default_(){let e=new r(r.DefaultName);e.startAngle=Math.PI/2,e.endAngle=Math.PI/2;let t=new js;t.offset=.5,e.addElement(t);let i=new js;return i.offset=-.5,e.addElement(i),e}description="";get elements(){return this._elements}endAngle=Math.PI/2;fillColor=B.ByLayer;flags=ge.None;get objectName(){return d.ObjectMLineStyle}get objectType(){return u.MLINESTYLE}startAngle=Math.PI/2;get subclassMarker(){return l.MLineStyle}static DefaultName="Standard";_elements=[];constructor(e){super(e)}addElement(e){if(e.owner!=null)throw new Error(`Element already assigned to a MLineStyle: ${e.owner.name}`);e.lineType=I.updateCollection(e.lineType,this.document?.lineTypes),e.owner=this,this._elements.push(e)}clone(){let e=super.clone();e._elements=[];for(let t of this._elements)e.addElement(t.clone());return e}};var Pi=class extends G{ElementTemplates=[];constructor(e){super(e??new wt)}build(e){super.build(e);for(let t of this.ElementTemplates)t.Build(e)}};(function(r){class e{Element;LineTypeHandle=null;LinetypeIndex=null;LineTypeName=null;constructor(i){this.Element=i}Build(i){let s=i.TryGetCadObject(this.LineTypeHandle);if(s)this.Element.lineType=s;else if(s=i.TryGetTableEntry(this.LineTypeName??""),s)this.Element.lineType=s;else if(this.LinetypeIndex!=null)if(this.LinetypeIndex===32767){let n=i.TryGetTableEntry(H.ByLayerName);n&&(this.Element.lineType=n)}else if(this.LinetypeIndex===32766){let n=i.TryGetTableEntry(H.ByBlockName);n&&(this.Element.lineType=n)}else try{let n=i.LineTypesTable;if(n){let a=Array.from(n);this.LinetypeIndex<a.length&&(this.Element.lineType=a[this.LinetypeIndex])}}catch(n){i.Notify(`Linetype not assigned, index ${this.LinetypeIndex}`,g.Error,n)}}}r.ElementTemplate=e})(Pi||(Pi={}));J();D();x();R();var Oi;(function(r){r[r.None=0]="None",r[r.NoAutoTransform=1]="NoAutoTransform",r[r.ScaleMapper=2]="ScaleMapper",r[r.IncludeCurrentBlock=4]="IncludeCurrentBlock"})(Oi||(Oi={}));var oi;(function(r){r[r.Current=0]="Current",r[r.Override=1]="Override"})(oi||(oi={}));var ee;(function(r){r[r.UseCurrentScene=0]="UseCurrentScene",r[r.UseImageFile=1]="UseImageFile",r[r.Procedural=2]="Procedural"})(ee||(ee={}));var ji;(function(r){r[r.None=0]="None",r[r.Planar=1]="Planar",r[r.Box=2]="Box",r[r.Cylinder=3]="Cylinder",r[r.Sphere=4]="Sphere"})(ji||(ji={}));var Ni;(function(r){r[r.None=0]="None",r[r.Tile=1]="Tile",r[r.Crop=2]="Crop",r[r.Clamp=3]="Clamp"})(Ni||(Ni={}));var at=class extends O{ambientColor=B.ByLayer;_ambientColorFactor=1;get ambientColorFactor(){return this._ambientColorFactor}set ambientColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._ambientColorFactor=e}ambientColorMethod=oi.Current;bumpAutoTransform=Oi.NoAutoTransform;bumpMapBlendFactor=1;bumpMapFileName="";bumpMapSource=ee.UseImageFile;bumpMatrix=[];bumpProjectionMethod=ji.Planar;bumpTilingMethod=Ni.Tile;channelFlags=0;description="";diffuseAutoTransform=Oi.NoAutoTransform;diffuseColor=B.ByLayer;_diffuseColorFactor=1;get diffuseColorFactor(){return this._diffuseColorFactor}set diffuseColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._diffuseColorFactor=e}diffuseColorMethod=oi.Current;diffuseMapBlendFactor=1;diffuseMapFileName="";diffuseMapSource=ee.UseImageFile;diffuseMatrix=[];diffuseProjectionMethod=ji.Planar;diffuseTilingMethod=Ni.Tile;illuminationModel=0;get objectName(){return d.ObjectMaterial}get objectType(){return u.UNLISTED}opacity=1;opacityAutoTransform=Oi.NoAutoTransform;opacityMapBlendFactor=1;opacityMapFileName="";opacityMapSource=ee.UseImageFile;opacityMatrix=[];opacityProjectionMethod=ji.Planar;opacityTilingMethod=Ni.Tile;reflectionAutoTransform=Oi.NoAutoTransform;reflectionMapBlendFactor=1;reflectionMapFileName="";reflectionMapSource=ee.UseImageFile;reflectionMatrix=[];reflectionProjectionMethod=ji.Planar;reflectionTilingMethod=Ni.Tile;reflectivity=0;refractionAutoTransform=Oi.NoAutoTransform;refractionIndex=1;refractionMapBlendFactor=1;refractionMapFileName="";refractionMapSource=ee.UseImageFile;refractionMatrix=[];refractionProjectionMethod=ji.Planar;refractionTilingMethod=Ni.Tile;specularAutoTransform=Oi.NoAutoTransform;specularColor=B.ByLayer;_specularColorFactor=1;get specularColorFactor(){return this._specularColorFactor}set specularColorFactor(e){if(e<0||e>1)throw new Error("Value must be in range 0 to 1");this._specularColorFactor=e}specularColorMethod=oi.Current;specularGlossFactor=.5;specularMapBlendFactor=1;specularMapFileName="";specularMapSource=ee.UseImageFile;specularMatrix=[];specularProjectionMethod=ji.Planar;specularTilingMethod=Ni.Tile;get subclassMarker(){return l.Material}translucence=0;static ByBlockName="ByBlock";static ByLayerName="ByLayer";static GlobalName="Global";constructor(e){super(e)}};var Zn=class extends G{constructor(e){super(e??new at)}build(e){super.build(e)}};var Kn=class extends ke{SubclassMarker=!1;constructor(e){super(e??new ar)}};var Jn=class extends ke{Chunks=[];constructor(e){super(e??new dr)}build(e){if(super.build(e),this.Chunks.length>0){let t=this.Chunks.reduce((n,a)=>n+a.length,0),i=new Uint8Array(t),s=0;for(let n of this.Chunks)i.set(n,s),s+=n.length;this.CadObject.binaryData=i}if(this.CadObject.binaryData&&this.CadObject.binaryData.length>0){let t=new DataView(this.CadObject.binaryData.buffer,this.CadObject.binaryData.byteOffset),i=2;this.CadObject.upperLeftCorner=this.read3Double(t,i),i+=24,i+=24,this.CadObject.lowerRightCorner=this.read3Double(t,i)}}read3Double(e,t){let i=e.getFloat64(t,!0),s=e.getFloat64(t+8,!0),n=e.getFloat64(t+16,!0);return new c(i,s,n)}};R();var Kt=class extends k{FirstVertexHandle=null;LastVertexHandle=null;SeqendHandle=null;OwnedObjectsHandlers=new Set;constructor(e){super(e||new Hh)}SetPolyLineObject(e){e.handle=this.CadObject.handle,e.color=this.CadObject.color,e.lineWeight=this.CadObject.lineWeight,e.lineTypeScale=this.CadObject.lineTypeScale,e.isInvisible=this.CadObject.isInvisible,e.transparency=this.CadObject.transparency,this.CadObject=e}addVertices(e,...t){let i=this.CadObject;if(i instanceof et)for(let s of t)i.vertices.push(s),s.owner=i;else if(i instanceof tt)for(let s of t)i.vertices.push(s),s.owner=i;else if(i instanceof ut)for(let s of t)this.addPolyfaceMeshVertex(e,i,s);else if(i instanceof Et)for(let s of t)i.vertices.push(s),s.owner=i;else e.Notify(`Unknown polyline type ${this.CadObject.subclassMarker}`,g.Warning)}build(e){super.build(e);let t=e.TryGetCadObject(this.SeqendHandle);if(t&&this.setSeqend(e,t),this.FirstVertexHandle!=null){let i=Array.from(this.getEntitiesCollection(e,this.FirstVertexHandle,this.LastVertexHandle));this.addVertices(e,...i)}else if(this.CadObject instanceof ut)this.buildPolyfaceMesh(this.CadObject,e);else for(let i of this.OwnedObjectsHandlers){let s=e.TryGetCadObject(i);if(s)this.addVertices(e,s);else{let n=e.TryGetCadObject(i);n?this.setSeqend(e,n):e.Notify(`Vertex ${i} not found for polyline ${this.CadObject.handle}`,g.Warning)}}}setSeqend(e,t){let i=this.CadObject;t.owner=i,i instanceof et||i instanceof tt||i instanceof ut||i instanceof Et?i.vertices.Seqend=t:e.Notify(`Unknown polyline type ${this.CadObject.subclassMarker}`,g.Warning)}buildPolyfaceMesh(e,t){for(let i of this.OwnedObjectsHandlers){let s=t.TryGetCadObject(i);s&&this.addPolyfaceMeshVertex(t,e,s)}}addPolyfaceMeshVertex(e,t,i){i instanceof ri?(t.vertices.push(i),i.owner=t):i instanceof Zt?(t.faces.push(i),i.owner=t):i instanceof Le?(t.vertices.Seqend=i,i.owner=t):e.Notify(`Unidentified type for PolyfaceMesh ${i.constructor.name}`)}},Hh=class extends hr{get objectType(){return u.INVALID}get subclassMarker(){return"PolyLinePlaceholder"}getBoundingBox(){return null}};var Vl=class extends G{constructor(e){super(e)}};var qn=class extends k{ShapeIndex=null;ShapeFileHandle=null;ShapeFileName=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.ShapeFileHandle,this.ShapeFileName??"");i&&(i.isShapeFile?t.shapeStyle=i:e.Notify(`Shape style ${this.ShapeFileHandle} | ${this.ShapeFileName} not found`,g.Warning))}};var Qn=class extends ke{HistoryHandle=null;constructor(e){super(e??new ti)}};var ea=class extends ke{constructor(e){super(e??new mr)}};var Sr=class extends k{StyleHandle=null;StyleName=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=this.getTableReference(e,this.StyleHandle,this.StyleName??"");i&&(t.style=i)}};var Ns=class extends Sr{MTextTemplate=null;constructor(e){super(e)}build(e){super.build(e),this.MTextTemplate!==null&&this.MTextTemplate.Build(e)}};var ta=class extends k{DimensionStyleHandle=null;DimensionStyleName=null;constructor(e){super(e??new Yt)}build(e){super.build(e);let t=this.getTableReference(e,this.DimensionStyleHandle,this.DimensionStyleName);t&&(this.CadObject.style=t)}};var ra=class extends fe{constructor(e){super(e??new ot)}};D();x();R();var Vi=class extends De{get objectType(){return u.VIEW}get objectName(){return d.TableView}get subclassMarker(){return l.View}height=0;width=0;lensLength=0;frontClipping=0;backClipping=0;angle=0;viewMode=se.Off;isUcsAssociated=!1;isPlottable=!1;renderMode=en.Optimized2D;center=new C(0,0);direction=new c(0,0,0);target=new c(0,0,0);visualStyle=null;ucsOrigin=new c(0,0,0);ucsXAxis=new c(0,0,0);ucsYAxis=new c(0,0,0);ucsElevation=0;ucsOrthographicType=Mt.None;constructor(e){super(e)}clone(){let e=super.clone();return e.visualStyle=this.visualStyle?.clone?.()??null,e}};var ia=class extends fe{VisualStyleHandle=null;NamedUcsHandle=null;UcsHandle=null;constructor(e){super(e??new Vi)}build(e){super.build(e)}};var sa=class extends ke{ViewportHeaderHandle=null;BoundaryHandle=null;NamedUcsHandle=null;BaseUcsHandle=null;VisualStyleHandle=null;ViewportId=null;BlockHandle=null;FrozenLayerHandles=new Set;constructor(e){super(e??new fr)}build(e){super.build(e);let t=e.TryGetCadObject(this.BoundaryHandle);t?this.CadObject.boundary=t:this.BoundaryHandle!=null&&this.BoundaryHandle>0&&e.Notify(`Boundary ${this.BoundaryHandle} not found for viewport ${this.CadObject.handle}`,g.Warning),this.NamedUcsHandle!=null&&this.NamedUcsHandle>0&&e.Notify(`Named ucs not implemented for Viewport, handle ${this.NamedUcsHandle}`),this.BaseUcsHandle!=null&&this.BaseUcsHandle>0&&e.Notify(`Base ucs not implemented for Viewport, handle ${this.BaseUcsHandle}`);for(let i of this.FrozenLayerHandles){let s=e.TryGetCadObject(i);s?this.CadObject.frozenLayers.push(s):e.Notify(`Frozen layer ${i} not found for viewport ${this.CadObject.handle}`,g.Warning)}}};Te();R();var Il=class extends Pt{EntryHandles=new Set;constructor(){super(new Fh)}build(e){super.build(e)}},Fh=class extends I{get objectType(){return u.INVALID}get subclassMarker(){return""}};var Ml=class extends fe{BlockHandle=null;constructor(e){super(e)}};var na=class extends fe{VportControlHandle=0;BackgroundHandle=null;StyleHandle=null;SunHandle=null;NamedUcsHandle=null;BaseUcsHandle=null;constructor(e){super(e??new xt)}build(e){super.build(e);let t=e.TryGetCadObject(this.BaseUcsHandle);t?this.CadObject.baseUcs=t:this.BaseUcsHandle!=null&&this.BaseUcsHandle>0&&e.Notify(`Boundary ${this.BaseUcsHandle} not found for viewport ${this.CadObject.handle}`,g.Warning);let i=e.TryGetCadObject(this.NamedUcsHandle);i?this.CadObject.baseUcs=i:this.NamedUcsHandle!=null&&this.NamedUcsHandle>0&&e.Notify(`Boundary ${this.BaseUcsHandle} not found for viewport ${this.CadObject.handle}`,g.Warning);let s=e.TryGetCadObject(this.StyleHandle)}};var mn=class extends k{ImgDefHandle=null;ImgReactorHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.ImgDefHandle);i&&(t.definition=i);let s=e.TryGetCadObject(this.ImgReactorHandle);s&&(t.definitionReactor=s)}};kr();var Vs=class extends G{Entries=new Map;constructor(e){super(e??new xe)}build(e){if(super.build(e),this.OwnerHandle!=null&&this.OwnerHandle===0&&e.DocumentToBuild.rootDictionary==null)if(e instanceof On){let t=e;this.CadObject.handle===t.HeaderHandles.DICTIONARY_NAMED_OBJECTS?e.DocumentToBuild.rootDictionary=this.CadObject:e.DocumentToBuild.rootDictionary=this.CadObject}else e.DocumentToBuild.rootDictionary=this.CadObject;for(let[t,i]of this.Entries){let s=e.TryGetCadObject(i);if(s){(!s.name||s.name.length===0)&&(s.name=t);try{this.CadObject.add(s)}catch(n){e.Notify(`Error when trying to add the entry ${s.name} to ${this.CadObject.name}|${this.CadObject.handle}`,g.Error,n)}}else e.Notify(`Entry not found ${t}|${i} for dictionary ${this.CadObject.name}|${this.CadObject.handle}`,g.Warning)}}};kr();D();x();R();var Cr=class extends xe{defaultEntry=null;get objectName(){return d.ObjectDictionaryWithDefault}get objectType(){return u.UNLISTED}get subclassMarker(){return l.DictionaryWithDefault}constructor(e,t){super(e),t&&(this.defaultEntry=t)}};var aa=class extends Vs{DefaultEntryHandle=null;constructor(e){super(e??new Cr)}build(e){super.build(e);let t=e.TryGetCadObject(this.DefaultEntryHandle);t&&(this.CadObject.defaultEntry=t)}};J();D();x();R();var Wo;(function(r){r[r.Unknown=0]="Unknown",r[r.LocalGrid=1]="LocalGrid",r[r.ProjectedGrid=2]="ProjectedGrid",r[r.Geographic=3]="Geographic"})(Wo||(Wo={}));var We;(function(r){r[r.R2009=1]="R2009",r[r.R2010=2]="R2010",r[r.R2013=3]="R2013"})(We||(We={}));var Ho;(function(r){r[r.None=1]="None",r[r.UserSpecifiedScaleFactor=2]="UserSpecifiedScaleFactor",r[r.GridScaleAtReferencePoint=3]="GridScaleAtReferencePoint",r[r.Prismodial=4]="Prismodial"})(Ho||(Ho={}));var oa=class{index1=0;index2=0;index3=0},la=class{source=new C(0,0);destination=new C(0,0);toString(){return`src:${this.source.x},${this.source.y} dest:${this.destination.x},${this.destination.y}`}},Jt=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectGeoData}get subclassMarker(){return l.GeoData}version=We.R2013;coordinatesType=Wo.LocalGrid;hostBlock=null;designPoint=new c(0,0,0);referencePoint=new c(0,0,0);northDirection=new C(0,1);horizontalUnitScale=1;verticalUnitScale=1;horizontalUnits=0;verticalUnits=0;upDirection=new c(0,0,1);scaleEstimationMethod=Ho.None;enableSeaLevelCorrection=!1;userSpecifiedScaleFactor=0;seaLevelElevation=0;coordinateProjectionRadius=0;coordinateSystemDefinition="";geoRssTag="";observationFromTag="";observationToTag="";observationCoverageTag="";points=[];faces=[]};var da=class extends G{HostBlockHandle=null;constructor(e){super(e??new Jt)}build(e){super.build(e);let t=this.getTableReference(e,this.HostBlockHandle,"");t&&(this.CadObject.hostBlock=t)}};J();D();x();R();var Ot=class extends O{description="";get entities(){return this._entities}get isUnnamed(){return!this.name||this.name.startsWith("*")}get objectName(){return d.TableGroup}get objectType(){return u.GROUP}selectable=!0;get subclassMarker(){return l.Group}_entities=[];constructor(e){super(e)}add(e){if(this.document!==e.document)throw new Error("The Group and the entity must belong to the same document.");this._entities.push(e),e.addReactor(this)}addRange(e){for(let t of e)this.add(t)}clear(){for(let e of this._entities)e.removeReactor(this);this._entities=[]}remove(e){e.removeReactor(this);let t=this._entities.indexOf(e);return t>=0?(this._entities.splice(t,1),!0):!1}clone(){let e=super.clone();return e._entities=[],e}};var ha=class extends G{Handles=new Set;constructor(e){super(e??new Ot)}build(e){super.build(e);for(let t of this.Handles){let i=e.GetObjectTemplate(t);if(i){i.Build(e);try{this.CadObject.add(i.CadObject)}catch(s){e.Notify(`Entity with handle ${t} could not be added to group ${this.CadObject.handle}`,g.Error,s)}}else e.Notify(`Entity with handle ${t} not found for group ${this.CadObject.handle}`,g.Warning)}}};J();D();x();R();var ah=class{sortHandle=0;entity=null;constructor(e,t){this.entity=e,this.sortHandle=t}toString(){return`${this.sortHandle} | ${this.entity?.toString()}`}compareTo(e){return this.sortHandle<e.sortHandle?-1:this.sortHandle>e.sortHandle?1:0}},Br=class r extends O{blockOwner=null;get objectName(){return d.ObjectSortEntsTable}get objectType(){return u.UNLISTED}get subclassMarker(){return l.SortentsTable}static DictionaryEntryName="ACAD_SORTENTS";_sorters=[];constructor(e){super(r.DictionaryEntryName),e&&(this.blockOwner=e)}add(e,t){this._sorters.push(new ah(e,t))}clear(){this._sorters.length=0}clone(){let e=super.clone();return e._sorters=[],e}getSorterHandle(e){let t=this._sorters.find(i=>i.entity===e);return t?t.sortHandle:e.handle}remove(e){let t=this._sorters.findIndex(i=>i.entity===e);return t<0?!1:(this._sorters.splice(t,1),!0)}[Symbol.iterator](){return[...this._sorters].sort((t,i)=>t.compareTo(i))[Symbol.iterator]()}};var ca=class extends G{BlockOwnerHandle=null;Values=[];constructor(e){super(e??new Br)}build(e){super.build(e);let t=e.TryGetCadObject(this.BlockOwnerHandle);if(t)if(t instanceof U)this.CadObject.blockOwner=t;else{e.Notify(`Block owner for SortEntitiesTable ${this.CadObject.handle} is not a block ${t.constructor.name} | ${t.handle}`,g.Warning);return}else{e.Notify(`Block owner for SortEntitiesTable ${this.CadObject.handle} not found`,g.Warning);return}for(let i of this.Values){let s=e.TryGetCadObject(i[1]);s?this.CadObject.add(s,i[0]):e.Notify(`Entity in SortEntitiesTable ${this.CadObject.handle} not found ${i[1]}`,g.Warning)}}};J();D();x();R();var Fo;(function(r){r[r.Down=0]="Down",r[r.Up=1]="Up"})(Fo||(Fo={}));var Ye=class r extends O{static get default_(){return new r(r.DefaultName)}cellStyles=[];dataCellStyle={};description="";flags=0;flowDirection=Fo.Down;headerCellStyle={};horizontalCellMargin=.06;get objectName(){return d.TableStyle}get objectType(){return u.UNLISTED}get subclassMarker(){return l.TableStyle}suppressHeaderRow=!1;suppressTitle=!1;tableCellStyle={};titleCellStyle={};verticalCellMargin=.06;static DefaultName="Standard";constructor(e=""){super(e)}};var ua=class extends xr{BlockOwnerHandle=null;cadTableCellTemplates=[];get CurrentCell(){return this.CurrentCellTemplate.Cell}CurrentCellTemplate;HorizontalMargin=null;NullHandle=null;styleHandle=null;get TableEntity(){return this.CadObject}_currCellIndex=0;constructor(e){super(e??new Ti)}CreateCell(e){let t=Math.floor(this._currCellIndex/this.TableEntity.columns.length),i=new ys;i.type=e,this.TableEntity.rows[t].cells.push(i),this.CurrentCellTemplate=new Uo(i),this.cadTableCellTemplates.push(this.CurrentCellTemplate),this._currCellIndex++}build(e){super.build(e);for(let t of this.cadTableCellTemplates)t.Build(e)}},ma=class{Format;TextStyleHandle=null;TextStyleName=null;constructor(e){this.Format=e}Build(e){throw new Error("Not implemented")}},jt=class extends ma{BorderLinetypePairs=[];get CellStyle(){return this.Format}textStyleHandle=null;constructor(e){super(e??new os)}},Uh=class{AttDefHandle=null;_tableAtt;constructor(e){this._tableAtt=e}Build(e){throw new Error("Not implemented")}},fa=class{BlockRecordHandle=null;CadValueTemplate=null;Content;FieldHandle=null;constructor(e){this.Content=e}Build(e){throw new Error("Not implemented")}},Uo=class{AttributeHandles=new Set;Cell;ContentTemplates=[];FormatTextHeight=null;StyleId=0;TextStyleOverrideHandle=null;UnknownHandle=null;ValueHandle=null;constructor(e){this.Cell=e}Build(e){let t=e.TryGetCadObject(this.ValueHandle)}};var pa=class extends Pt{CellStyleTemplates=[];CurrentCellStyleTemplate;constructor(e){super(e??new Ye)}CreateCurrentCellStyleTemplate(){return this.CurrentCellStyleTemplate=new jt,this.CellStyleTemplates.push(this.CurrentCellStyleTemplate),this.CurrentCellStyleTemplate}build(e){super.build(e);for(let t of this.CellStyleTemplates)this.CadObject.cellStyles.push(t.CellStyle)}};J();Te();D();x();R();il();var oh=class{code;value;owner;get groupCode(){return Be.transformValue(this.code)}get hasLinkedObject(){let e=this.groupCode;return e===5||e===105}constructor(e,t,i){this.code=e,this.value=t,this.owner=i}getReference(){return this.hasLinkedObject&&this.value instanceof I?this.value.document!==this.owner.document?null:this.value:null}toString(){return`${this.code}:${this.value}`}},_t=class extends O{cloningFlags=bs.NotApplicable;get entries(){return this._entries}get objectName(){return d.ObjectXRecord}get objectType(){return u.XRECORD}get subclassMarker(){return l.XRecord}_entries=[];constructor(e){super(e)}createEntry(e,t){this._entries.push(new oh(e,t,this))}CreateEntry(e,t){this.createEntry(e,t)}};var wa=class extends Pt{_entries=[];constructor(e){super(e??new _t)}AddHandleReference(e,t){this._entries.push([e,t])}build(e){super.build(e);for(let t of this._entries){let i=e.TryGetCadObject(t[1]);i?this.CadObject.createEntry(t[0],i):e.Notify(`XRecord reference not found ${t[0]}|${t[1]}`,g.Warning)}}};var _a=class extends K{constructor(e){super(e)}},ba=class extends k{constructor(e){super(e)}};var ga=class extends k{DefinitionHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject,i=e.TryGetCadObject(this.DefinitionHandle);i?t.definition=i:e.Notify(`UnderlayDefinition not found for ${this.CadObject.handle}`,g.Warning)}};J();D();x();R();var he;(function(r){r[r.None=0]="None",r[r.FirstPointReference=1]="FirstPointReference",r[r.SecondPointReference=2]="SecondPointReference",r[r.ThirdPointReference=4]="ThirdPointReference",r[r.FourthPointReference=8]="FourthPointReference"})(he||(he={}));var vo;(function(r){r[r.None=0]="None",r[r.Endpoint=1]="Endpoint",r[r.Midpoint=2]="Midpoint",r[r.Center=3]="Center",r[r.Node=4]="Node",r[r.Quadrant=5]="Quadrant",r[r.Intersection=6]="Intersection",r[r.Insertion=7]="Insertion",r[r.Perpendicular=8]="Perpendicular",r[r.Tangent=9]="Tangent",r[r.Nearest=10]="Nearest",r[r.ApparentIntersection=11]="ApparentIntersection",r[r.Parallel=12]="Parallel",r[r.StartPoint=13]="StartPoint"})(vo||(vo={}));var zo;(function(r){r[r.Unknown=0]="Unknown",r[r.Parallel=1]="Parallel",r[r.Perpendicular=2]="Perpendicular"})(zo||(zo={}));var Go;(function(r){r[r.Unknown=0]="Unknown",r[r.Edge=1]="Edge",r[r.Face=2]="Face"})(Go||(Go={}));var fs=class{geometryParameter=0;objectOsnapType=vo.None;osnapPoint=new c(0,0,0);subentType=Go.Unknown;gsMarker=0;intersectionSubType=Go.Unknown;intersectionGsMarker=0;hasLastPointRef=!1;geometry=null},Xe=class extends O{associativityFlags=he.None;dimension=null;firstPointRef=null;fourthPointRef=null;isTransSpace=!1;get objectName(){return d.ObjectDimensionAssociation}get objectType(){return u.UNLISTED}rotatedDimensionType=zo.Unknown;secondPointRef=null;get subclassMarker(){return l.DimensionAssociation}thirdPointRef=null;static OsnapPointRefClassName="AcDbOsnapPointRef"};var Ii=class extends G{DimensionHandle=null;FirstPointRef=null;FourthPointRef=null;SecondPointRef=null;ThirdPointRef=null;constructor(e){super(e??new Xe)}build(e){super.build(e);let t=e.TryGetCadObject(this.DimensionHandle);t&&(this.CadObject.dimension=t),this.FirstPointRef!==null&&(this.CadObject.firstPointRef=this.FirstPointRef.OsnapPointRef,this.FirstPointRef.Build(e)),this.SecondPointRef!==null&&(this.CadObject.secondPointRef=this.SecondPointRef.OsnapPointRef,this.SecondPointRef.Build(e)),this.ThirdPointRef!==null&&(this.CadObject.thirdPointRef=this.ThirdPointRef.OsnapPointRef,this.ThirdPointRef.Build(e)),this.FourthPointRef!==null&&(this.CadObject.fourthPointRef=this.FourthPointRef.OsnapPointRef,this.FourthPointRef.Build(e))}};(function(r){class e{ObjectHandle=null;OsnapPointRef;constructor(i){this.OsnapPointRef=i}Build(i){let s=i.TryGetCadObject(this.ObjectHandle);s&&(this.OsnapPointRef.geometry=s)}}r.OsnapPointRefTemplate=e})(Ii||(Ii={}));J();D();x();R();var vh=class{},xa=class r{index=0;nextNodeIndex=0;next=null;flags=0;data1=0;data2=0;data3=0;data4=0;expression=null;clone(){let e=new r;return e.index=this.index,e.nextNodeIndex=this.nextNodeIndex,e.flags=this.flags,e.data1=this.data1,e.data2=this.data2,e.data3=this.data3,e.data4=this.data4,e.next=this.next?.clone()??null,e.expression=this.expression?.clone()??null,e}},yr=class extends O{edges=[];nodes=[];get objectName(){return d.ObjectEvalGraph}get objectType(){return u.UNLISTED}get subclassMarker(){return l.EvalGraph}value96=0;value97=0;static DictionaryEntryName="ACAD_ENHANCEDBLOCK";clone(){let e=super.clone();return e.nodes=this.nodes.map(t=>t.clone()),e}};var Mi=class extends G{NodeTemplates=[];constructor(e){super(e??new yr)}build(e){super.build(e);for(let t of this.NodeTemplates)t.Build(e),this.CadObject.nodes.push(t.Node)}};(function(r){class e{Node=new xa;ExpressionHandle=null;Build(i){let s=i.TryGetCadObject(this.ExpressionHandle);s?this.Node.expression=s:i.Notify(`Evaluation graph couldn't find the EvaluationExpression with handle ${this.ExpressionHandle}`,g.Warning)}}r.GraphNodeTemplate=e})(Mi||(Mi={}));var Da=class extends G{constructor(e){super(e)}};var Is=class extends Da{get blockElement(){return this.CadObject}constructor(e){super(e)}};var Sa=class extends Is{get blockAction(){return this.CadObject}entityHandles=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.entityHandles){let i=e.TryGetCadObject(t);i?this.blockAction.entities.push(i):e.Notify(`[${this.blockAction.toString()}] entity with handle ${t} not found.`)}}};var Wl=class extends Sa{get BlockFlipAction(){return this.CadObject}constructor(e){super(e)}};var Ca=class extends Is{get blockParameter(){return this.CadObject}constructor(e){super(e)}};var Ba=class extends Ca{get block2PtParameter(){return this.CadObject}constructor(e){super(e)}};var Hl=class extends Ba{get BlockFlipParameter(){return this.CadObject}constructor(e){super(e)}};Te();x();R();var ya=class extends I{id=0;get objectType(){return u.UNLISTED}get subclassMarker(){return l.EvalGraphExpr}value98=0;value99=0};x();var Ms=class extends ya{get subclassMarker(){return l.BlockElement}elementName="";value1071=0};x();var Ra=class extends Ms{get subclassMarker(){return l.BlockParameter}value280=!1;value281=!1};x();var Ws=class extends Ra{firstPoint=new c(0,0,0);secondPoint=new c(0,0,0);get subclassMarker(){return l.Block2PtParameter}value170=0;value171=0;value172=0;value173=0;value174=0;value177=0;value303="";value304="";value94=0;value95=0};D();x();var Hs=class extends Ws{description="";name="";nameOffset=0;get objectName(){return d.ObjectBlockRotationParameter}point=new c(0,0,0);get subclassMarker(){return l.BlockRotationParameter}value141=0;value142=0;value143=0;value175=0;value307="";value96=0};var Ta=class extends Ba{constructor(e){super(e??new Hs)}};x();var Aa=class extends Ra{get subclassMarker(){return l.Block1PtParameter}location=new c(0,0,0);value93=0;value170=0;value171=0};D();x();var Ea=class r{name="";entities=[];expressions=[];clone(){let e=new r;return e.name=this.name,e.entities=this.entities.map(t=>t.clone?t.clone():{...t}),e.expressions=this.expressions.map(t=>t.clone()),e}},Fs=class extends Aa{description="";entities=[];name="";get objectName(){return d.ObjectBlockVisibilityParameter}_states=new Map;get states(){return this._states}get subclassMarker(){return l.BlockVisibilityParameter}value91=!1;addState(e){this._states.set(e.name,e)}clone(){let e=super.clone();e.entities=this.entities.map(t=>t.clone?t.clone():{...t}),e._states=new Map;for(let[t,i]of this._states){let s=i.clone();e._states.set(s.name,s)}return e}};var Fl=class extends Ca{get block1PtParameter(){return this.CadObject}constructor(e){super(e)}};var Wi=class extends Fl{entityHandles=[];StateTemplates=[];constructor(e){super(e??new Fs)}build(e){super.build(e);let t=this.CadObject;for(let i of this.entityHandles){let s=e.TryGetCadObject(i);s?t.entities.push(s):e.Notify(`[${t.toString()}] entity with handle ${i} not found.`)}for(let i of this.StateTemplates)i.Build(e,this.entityHandles),t.addState(i.state)}};(function(r){class e{state=new Ea;entityHandles=new Set;expressionHandles=new Set;constructor(i){i&&(this.state=i)}Build(i,s){this.setEntities(i,this.state.entities,this.entityHandles,s),this.setEntities(i,this.state.expressions,this.expressionHandles,null)}setEntities(i,s,n,a){for(let o of n){a!==null&&!a.includes(o)&&i.Notify(`[${this.state.toString()}] parent does not contain handle ${o}.`);let h=i.TryGetCadObject(o);h?s.push(h):i.Notify(`[${this.state.toString()}] object with handle ${o} not found.`)}}}r.StateTemplate=e})(Wi||(Wi={}));x();var La=class extends Ms{actionPoint=new c(0,0,0);entities=[];get subclassMarker(){return l.BlockAction}value70=0};x();var Ul=class extends La{get subclassMarker(){return l.BlockActionBasePt}value1011=new c(0,0,0);value1012=new c(0,0,0);value280=!1;value301="";value302="";value92=0;value93=0};x();var Us=class extends Ul{get subclassMarker(){return l.BlockRotationAction}value303="";value94=0};var vl=class extends Sa{constructor(e){super(e)}};var ka=class extends vl{constructor(e){super(e??new Us)}};J();D();x();var Rr=class extends O{block=null;get objectName(){return d.ObjectBlockRepresentationData}get subclassMarker(){return l.BlockRepresentationData}value70=0};var Pa=class extends G{BlockHandle=null;constructor(e){super(e??new Rr)}build(e){super.build(e);let t=this.getTableReference(e,this.BlockHandle,"");t&&(this.CadObject.block=t)}};x();var vs=class extends Ms{location=new c(0,0,0);get subclassMarker(){return l.BlockGrip}value280=0;value91=0;value92=0;value93=0};D();x();var Oa=class extends vs{get objectName(){return d.ObjectBlockRotationGrip}get subclassMarker(){return l.BlockRotationGrip}};var ja=class extends Is{constructor(e){super(e)}};var Na=class extends ja{constructor(e){super(e??new Oa)}};D();x();var Va=class extends vs{get objectName(){return d.ObjectBlockVisibilityGrip}get subclassMarker(){return l.BlockVisibilityGrip}};var Ia=class extends ja{constructor(e){super(e??new Va)}};D();x();var zs=class extends ya{get objectName(){return d.ObjectBlockGripLocationComponent}get subclassMarker(){return l.BlockGripExpression}value300="";value91=0};var Ma=class extends Da{constructor(e){super(e??new zs)}};var Wa=class extends G{CadObjectsHandles=[];CadValueTemplates=[];ChildrenHandles=[];constructor(e){super(e)}build(e){super.build(e);for(let t of this.CadObjectsHandles){let i=e.TryGetCadObject(t);i?this.CadObject.cadObjects.push(i):e.Notify(`[${this.CadObject.subclassMarker}] CadObject with handle ${t} not found.`,g.Warning)}for(let t of this.ChildrenHandles){let i=e.TryGetCadObject(t);i?this.CadObject.children.push(i):e.Notify(`[${this.CadObject.subclassMarker}] CadObject with handle ${t} not found.`,g.Warning)}}};var Ha=class extends G{OwnedObjectsHandlers=new Set;constructor(e){super(e)}build(e){super.build(e);for(let t of this.OwnedObjectsHandlers){let i=e.TryGetCadObject(t);i?this.CadObject.fields.push(i):e.Notify(`Field ${t} not found for FieldList ${this.CadObject.handle}`,g.Warning)}}};var Fa=class{CadValue;ValueHandle=null;constructor(e){this.CadValue=e}Build(e){let t=e.TryGetCadObject(this.ValueHandle);t&&this.CadValue.setValue(t,W.Handle)}};var zl=class extends k{BinRecordHandle=null;CleanupGroupHandle=null;RawData=null;StyleHandle=null;constructor(e){super(e)}build(e){super.build(e);let t=this.CadObject;this.RawData!==null&&(t.rawData=this.RawData);let i=e.TryGetCadObject(this.BinRecordHandle);i&&(t.binRecord=i);let s=e.TryGetCadObject(this.StyleHandle);s&&(t.style=s);let n=e.TryGetCadObject(this.CleanupGroupHandle);n&&(t.cleanupGroup=n)}};R();var Gl=class extends De{get objectType(){return u.VP_ENT_HDR}};kr();J();D();x();R();var He=class extends O{static CurrentAnnotationScale="CANNOSCALE";static CurrentMultiLeaderStyle="CMLEADERSTYLE";static CurrentTableStyle="CTABLESTYLE";static WipeoutFrame="WIPEOUTFRAME";get objectName(){return d.ObjectDictionaryVar}objectSchemaNumber=0;get objectType(){return u.UNLISTED}get subclassMarker(){return l.DictionaryVariables}value="";constructor(e,t){super(e),t!==void 0&&(this.value=t)}};J();D();x();R();var $o;(function(r){r[r.None=0]="None",r[r.Centimeters=2]="Centimeters",r[r.Inches=5]="Inches"})($o||($o={}));var Tr=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectImageDefinition}get subclassMarker(){return l.RasterImageDef}classVersion=0;fileName="";size=new C(0,0);defaultSize=new C(1,1);isLoaded=!0;units=$o.None};J();D();x();R();var li=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectImageDefinitionReactor}get subclassMarker(){return l.RasterImageDefReactor}classVersion=2;image=null};J();D();x();var Yo;(function(r){r[r.Draft=0]="Draft",r[r.High=1]="High"})(Yo||(Yo={}));var Ar=class extends O{classVersion=0;displayQuality=Yo.High;isDisplayFrameShown=!1;get objectName(){return d.ObjectRasterVariables}get subclassMarker(){return l.RasterVariables}units=0};J();D();x();R();var $l;(function(r){r[r.NoEdges=0]="NoEdges",r[r.Isolines=1]="Isolines",r[r.FacetEdges=2]="FacetEdges"})($l||($l={}));var Yl;(function(r){r[r.NoColor=0]="NoColor",r[r.ObjectColor=1]="ObjectColor",r[r.BackgroundColor=2]="BackgroundColor",r[r.CustomColor=3]="CustomColor",r[r.Monochrome=4]="Monochrome",r[r.Tinted=5]="Tinted",r[r.Desaturated=6]="Desaturated"})(Yl||(Yl={}));var Xl;(function(r){r[r.Invisible=0]="Invisible",r[r.Visible=1]="Visible",r[r.Phong=2]="Phong",r[r.Gooch=3]="Gooch"})(Xl||(Xl={}));var Zl;(function(r){r[r.NoLighting=0]="NoLighting",r[r.PerFaceLighting=1]="PerFaceLighting",r[r.PerVertexLighting=2]="PerVertexLighting"})(Zl||(Zl={}));var Kl;(function(r){r[r.None=0]="None",r[r.Opacity=1]="Opacity",r[r.Specular=2]="Specular"})(Kl||(Kl={}));var di=class extends O{brightness=0;color=B.ByLayer;description="";displaySettings=0;edgeApplyStyleFlag=0;edgeColor=0;edgeCreaseAngle=0;edgeIntersectionColor=B.ByLayer;edgeIntersectionLineType=0;edgeIsolineCount=0;edgeJitter=0;edgeModifiers=0;edgeObscuredColor=B.ByLayer;edgeObscuredLineType=0;edgeOverhang=0;edgeSilhouetteColor=B.ByLayer;edgeSilhouetteWidth=0;edgeStyle=0;edgeStyleModel=$l.NoEdges;edgeWidth=0;faceColorMode=Yl.NoColor;faceLightingModel=Xl.Invisible;faceLightingQuality=Zl.NoLighting;faceModifiers=Kl.None;faceOpacityLevel=0;faceSpecularLevel=0;faceStyleMonoColor=B.ByLayer;haloGap=0;internalFlag=!1;get objectName(){return d.ObjectVisualStyle}get objectType(){return u.UNLISTED}opacityLevel=0;precisionFlag=!1;rasterFile="";shadowType=0;get subclassMarker(){return l.VisualStyle}type=0;static DefaultName="2dWireframe"};J();x();R();var Jl=class extends O{get objectType(){return u.UNLISTED}get subclassMarker(){return l.UnderlayDefinition}file=""};D();var hi=class extends Jl{get objectName(){return d.ObjectPdfDefinition}_page="";get page(){return this._page}set page(e){this._page=e||""}};J();D();x();R();var ci=class extends O{get objectType(){return u.ACDBPLACEHOLDER}get objectName(){return d.ObjectPlaceholder}get subclassMarker(){return l.AcDbPlaceHolder}};J();D();x();var ui=class extends O{get objectName(){return d.ObjectDBColor}get subclassMarker(){return l.DbColor}get name(){return this.colorName?`${this.bookName}$${this.colorName}`:""}set name(e){if(e.includes("$")){let t=e.split("$");this.bookName=t[0],this.colorName=t[t.length-1]}else this.colorName=e}colorName="";bookName="";color=B.ByBlock;constructor(e,t){super(e),t&&(this.bookName=t)}};J();D();x();var Er=class extends O{get classId(){return this.dxfClass?.classNumber??0}get drawingFormat(){return this.version|this.maintenanceVersion<<16}dxfClass=null;maintenanceVersion=0;get objectName(){return d.ObjectProxyObject}originalDataFormatDxf=!1;proxyClassId=499;binaryData=null;data=null;get subclassMarker(){return l.ProxyObject}version=m.Unknown};J();x();R();var ql=class extends O{static FilterEntryName="ACAD_FILTER";get objectType(){return u.UNLISTED}get subclassMarker(){return l.Filter}constructor(e){super(e)}};D();x();R();var qt=class extends ql{static SpatialFilterEntryName="SPATIAL";backDistance=0;boundaryPoints=[];clipBackPlane=!1;clipFrontPlane=!1;displayBoundary=!1;frontDistance=0;insertTransform=it.identity();inverseInsertTransform=it.identity();normal=new c(0,0,1);get objectName(){return d.ObjectSpatialFilter}get objectType(){return u.UNLISTED}origin=new c(0,0,1);get subclassMarker(){return l.SpatialFilter}constructor(e){super(e)}};D();x();var Ql=class extends La{caption301="";caption302="";caption303="";caption304="";get objectName(){return d.ObjectBlockFlipAction}get subclassMarker(){return l.BlockFlipAction}value92=0;value93=0;value94=0;value95=0};D();x();var ed=class extends Ws{get objectName(){return d.ObjectBlockFlipParameter}get subclassMarker(){return l.BlockFlipParameter}caption="";description="";baseStateName="";flippedStateName="";captionLocation=new c(0,0,0);caption309="";value96=0;caption1001="";point1010=new c(0,0,0)};D();var mi=class extends Os{insertionPoint=new c(0,0,0);get objectName(){return d.BlkRefObjectContextData}rotation=0;get xScale(){return this._xscale}set xScale(e){if(e===0)throw new Error("XScale value must be non-zero.");this._xscale=e}get yScale(){return this._yscale}set yScale(e){if(e===0)throw new Error("YScale value must be non-zero.");this._yscale=e}get zScale(){return this._zscale}set zScale(e){if(e===0)throw new Error("ZScale value must be non-zero.");this._zscale=e}_xscale=1;_yscale=1;_zscale=1};J();D();x();var Xo;(function(r){r[r.Never=0]="Never",r[r.OnOpen=1]="OnOpen",r[r.OnSave=2]="OnSave",r[r.OnPlot=4]="OnPlot",r[r.OnPackedETransmit=8]="OnPackedETransmit",r[r.OnRegeneration=16]="OnRegeneration",r[r.OnDemand=32]="OnDemand"})(Xo||(Xo={}));var Zo;(function(r){r[r.NotEvaluated=1]="NotEvaluated",r[r.Success=2]="Success",r[r.EvaluatorNotFound=4]="EvaluatorNotFound",r[r.SyntaxError=8]="SyntaxError",r[r.InvalidCode=16]="InvalidCode",r[r.InvalidContext=32]="InvalidContext",r[r.OtherError=64]="OtherError"})(Zo||(Zo={}));var Ko;(function(r){r[r.Unknown=0]="Unknown",r[r.Initialized=1]="Initialized",r[r.Compiled=2]="Compiled",r[r.Modified=4]="Modified",r[r.Evaluated=8]="Evaluated",r[r.Cached=16]="Cached"})(Ko||(Ko={}));var Jo;(function(r){r[r.None=0]="None",r[r.NoFieldResult=1]="NoFieldResult"})(Jo||(Jo={}));var fi=class extends O{cadObjects=[];children=[];evaluationErrorCode=0;evaluationErrorMessage="";evaluationOptionFlags=Xo.Never;evaluationStatusFlags=Zo.NotEvaluated;evaluatorId="";fieldCode="";fieldStateFlags=Ko.Unknown;filingOptionFlags=Jo.None;formatString="";get objectName(){return d.ObjectField}get subclassMarker(){return l.Field}value=new Ht;values=new Map};J();D();x();R();var pi=class extends O{fields=[];get objectName(){return d.ObjectFieldList}get objectType(){return u.UNLISTED}get subclassMarker(){return l.FieldList}clone(){let e=super.clone();return e.fields=[...this.fields],e}};J();D();x();R();var Gs=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectAecCleanupGroupDef}get subclassMarker(){return l.AecDbCleanupGroupDef}version=0;description="";rawData=null;constructor(e){super(e)}};J();D();x();R();var $s=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectAecWallStyle}get subclassMarker(){return l.AecDbWallStyle}version=0;description="";rawData=null;constructor(e){super(e)}};J();D();x();R();var Ys=class extends O{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectBinRecord}get subclassMarker(){return l.BinRecord}version=0;binaryData=new Uint8Array(0)};q();bt();var Hi=class extends ae{constructor(e){super(p.ExtendedDataAsciiString,e)}};wn();q();bt();var Ua=class extends ae{constructor(e,t){super(e,t)}resolveReference(e){return e.getCadObject(this.value)}};var va=class extends Ua{constructor(e){super(p.ExtendedDataLayerName,e)}};q();bt();var Fi=class extends ae{constructor(e){super(p.ExtendedDataBinaryChunk,e)}};q();var za=class extends Ua{constructor(e){super(p.ExtendedDataHandle,e)}};q();bt();var Ui=class extends ae{constructor(e){super(p.ExtendedDataWorldXDisp,e)}};q();bt();var vi=class extends ae{constructor(e){super(p.ExtendedDataDist,e)}};q();bt();var zi=class extends ae{constructor(e){super(p.ExtendedDataScale,e)}};q();bt();var Gi=class extends ae{constructor(e){super(p.ExtendedDataXCoordinate,e)}};q();bt();var $i=class extends ae{constructor(e){super(p.ExtendedDataWorldXDir,e)}};q();bt();var Yi=class extends ae{constructor(e){super(p.ExtendedDataInteger16,e)}};q();bt();var Xi=class extends ae{constructor(e){super(p.ExtendedDataInteger32,e)}};q();bt();var Zi=class extends ae{constructor(e){super(p.ExtendedDataReal,e)}};q();bt();var Ki=class extends ae{constructor(e){super(p.ExtendedDataWorldXCoordinate,e)}};var td=class r extends Y{get sectionName(){return T.AcDbObjects}_classes;_crcReader;_map;_memoryStream;_readedObjects=new Map;_reader;_builder;_handles;_handlesReader;_mergedReaders;_objectInitialPos=0;_objectReader;_size=0;_textReader;constructor(e,t,i,s,n,a){super(e),this._builder=t,this._reader=i,this._handles=[...s],this._map=new Map(n),this._classes=new Map;for(let o of a)this._classes.set(o.classNumber,o);this._memoryStream=new Uint8Array(i.stream),this._crcReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream))}read(){for(;this._handles.length>0;){let e=this._handles.shift(),t=this._map.get(e);if(t===void 0||this._builder.TryGetObjectTemplate(e)!==void 0||this._readedObjects.has(e))continue;let i=this.getEntityType(t);this._readedObjects.set(e,i);let s=null;try{s=this.readObject(i)}catch(n){if(!this._builder.Configuration.Failsafe)throw n;let a=this._classes.get(i);a?this._builder.Notify(`Could not read ${a.dxfName} number ${a.classNumber} with handle: ${e}`,g.Error,n):this._builder.Notify(`Could not read ${i} with handle: ${e}`,g.Error,n);continue}s!=null&&this._builder.AddTemplate(s)}}getEntityType(e){let t=u.INVALID;if(this._crcReader.position=e,this._size=this._crcReader.readModularShort(),this._size<=0)return t;let i=this._size<<3;if(this.R2010Plus){let s=this._crcReader.readModularChar(),n=this._crcReader.positionInBits()+i-s;this._objectReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._objectReader.setPositionInBits(this._crcReader.positionInBits()),this._objectInitialPos=this._objectReader.positionInBits(),t=this._objectReader.readObjectType(),this._handlesReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._handlesReader.setPositionInBits(n),this._textReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader.setPositionByFlag(n-1),this._mergedReaders=new us(this._objectReader,this._textReader,this._handlesReader)}else this._objectReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._objectReader.setPositionInBits(this._crcReader.positionInBits()),this._handlesReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader=this._objectReader,this._objectInitialPos=this._objectReader.positionInBits(),t=this._objectReader.readObjectType();return t}handleReference(e=0){let t=e===0?this._handlesReader.handleReference():this._handlesReader.handleReferenceWithRef(e);return t!==0&&this._builder.TryGetObjectTemplate(t)===void 0&&!this._readedObjects.has(t)&&this._handles.push(t),t}readCommonData(e){this._version>=m.AC1015&&this._version<m.AC1024&&this.updateHandleReader(),e.CadObject.handle=this._objectReader.handleReference(),this.readExtendedData(e)}readCommonEntityData(e){let t=e.CadObject;if(this.readCommonData(e),this._objectReader.readBit()){let i=this._version>=m.AC1024?this._objectReader.readBitLongLong():this._objectReader.readRawLong();this._objectReader.advance(i)}this._version>=m.AC1012&&this._version<=m.AC1014&&this.updateHandleReader(),this.readEntityMode(e)}readCommonNonEntityData(e){this.readCommonData(e),this.R13_14Only&&this.updateHandleReader(),e.OwnerHandle=this.handleReference(e.CadObject.handle),this.readReactorsAndDictionaryHandle(e)}readEntityMode(e){let t=e.CadObject;e.EntityMode=this._objectReader.read2Bits(),e.EntityMode===0?e.OwnerHandle=this._handlesReader.handleReferenceWithRef(t.handle):e.EntityMode===1?this._builder.PaperSpaceEntities.push(t):e.EntityMode===2&&this._builder.ModelSpaceEntities.push(t),this.readReactorsAndDictionaryHandle(e),this.R13_14Only&&(e.LayerHandle=this.handleReference(),this._objectReader.readBit()||(e.LineTypeHandle=this.handleReference())),!this.R2004Plus&&!this._objectReader.readBit()?(e.PrevEntity=this.handleReference(t.handle),e.NextEntity=this.handleReference(t.handle)):this.R2004Plus||(this._readedObjects.has(t.handle-1)||this._handles.push(t.handle-1),this._readedObjects.has(t.handle+1)||this._handles.push(t.handle+1));let{color:i,transparency:s,flag:n}=this._objectReader.readEnColor();if(t.color=i,t.transparency=s,this._version>=m.AC1018&&n&&(e.ColorHandle=this.handleReference()),t.lineTypeScale=this._objectReader.readBitDouble(),!(this._version>=m.AC1015)){t.isInvisible=(this._objectReader.readBitShort()&1)===0;return}e.LayerHandle=this.handleReference(),e.LtypeFlags=this._objectReader.read2Bits(),e.LtypeFlags===3&&(e.LineTypeHandle=this.handleReference()),this.R2007Plus&&(this._objectReader.read2Bits()===3&&(e.MaterialHandle=this.handleReference()),this._objectReader.readByte()),this._objectReader.read2Bits()===3&&this.handleReference(),this.R2010Plus&&(this._objectReader.readBit()&&this.handleReference(),this._objectReader.readBit()&&this.handleReference(),this._objectReader.readBit()&&this.handleReference()),t.isInvisible=(this._objectReader.readBitShort()&1)===1,t.lineWeight=Z.toValue(this._objectReader.readByte())}readExtendedData(e){let t=this._objectReader.readBitShort();for(;t!==0;){let i=this._objectReader.handleReference(),s=this._objectReader.position+t,n=this.readExtendedDataRecords(s);e.EDataTemplate.set(i,n),t=this._objectReader.readBitShort()}}readExtendedDataRecords(e){let t=[];for(;this._objectReader.position<e;){let i=1e3+this._objectReader.readByte(),s=null;switch(i){case p.ExtendedDataAsciiString:case p.ExtendedDataRegAppName:s=new Hi(this._objectReader.readTextUnicode());break;case p.ExtendedDataControlString:s=new Pe(this._objectReader.readByte()===1);break;case p.ExtendedDataLayerName:{let n=this._objectReader.readBytes(8),a=ko.toUInt64(n);s=new va(a);break}case p.ExtendedDataBinaryChunk:s=new Fi(this._objectReader.readBytes(this._objectReader.readByte()));break;case p.ExtendedDataHandle:{let n=this._objectReader.readBytes(8),a=ko.toUInt64(n);s=new za(a);break}case p.ExtendedDataXCoordinate:s=new Gi(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXCoordinate:s=new Ki(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXDisp:s=new Ui(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataWorldXDir:s=new $i(new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case p.ExtendedDataReal:s=new Zi(this._objectReader.readDouble());break;case p.ExtendedDataDist:s=new vi(this._objectReader.readDouble());break;case p.ExtendedDataScale:s=new zi(this._objectReader.readDouble());break;case p.ExtendedDataInteger16:s=new Yi(this._objectReader.readShort());break;case p.ExtendedDataInteger32:s=new Xi(this._objectReader.readRawLong());break;default:return this._objectReader.readBytes(e-this._objectReader.position),this._builder.Notify(`Unknown code for extended data: ${i}`,g.Warning),t}t.push(s)}return t}readReactorsAndDictionaryHandle(e){let t=this._objectReader.readBitLong();for(let s=0;s<t;++s)e.ReactorsHandles.add(this.handleReference());let i=!1;this.R2004Plus&&(i=this._objectReader.readBit()),i||(e.XDictHandle=this.handleReference()),this.R2013Plus&&this._objectReader.readBit()}readXrefDependantBit(e){if(this.R2007Plus)(this._objectReader.readBitShort()&256)>0&&(e.flags|=Vt.XrefDependent);else{this._objectReader.readBit()&&(e.flags|=Vt.Referenced);let t=this._objectReader.readBitShort()-1;this._objectReader.readBit()&&(e.flags|=Vt.XrefDependent)}}updateHandleReader(){let e=this._objectReader.readRawLong();this._handlesReader.setPositionInBits(e+this._objectInitialPos),this._version===m.AC1021&&(this._textReader=be.getStreamHandler(this._version,new Uint8Array(this._memoryStream),this._reader.encoding),this._textReader.setPositionByFlag(e+this._objectInitialPos-1)),this._mergedReaders=new us(this._objectReader,this._textReader,this._handlesReader)}static looksLikeUtf16Le(e,t){if(e==null||t<0||t+1>=e.length)return!1;let i=!1;for(let s=t;s+1<e.length;s+=2){let n=e[s],a=e[s+1];if(n===0&&a===0)return i;if(a!==0)return!1;n!==0&&(i=!0)}return!1}readObject(e){let t=null;switch(e){case u.TEXT:t=this.readText();break;case u.ATTRIB:t=this.readAttribute();break;case u.ATTDEF:t=this.readAttributeDefinition();break;case u.BLOCK:t=this.readBlock();break;case u.ENDBLK:t=this.readEndBlock();break;case u.SEQEND:t=this.readSeqend();break;case u.INSERT:t=this.readInsert();break;case u.MINSERT:t=this.readMInsert();break;case u.VERTEX_2D:t=this.readVertex2D();break;case u.VERTEX_3D:t=this.readVertex3D(new cr);break;case u.VERTEX_PFACE:t=this.readVertex3D(new ri);break;case u.VERTEX_MESH:t=this.readVertex3D(new ss);break;case u.VERTEX_PFACE_FACE:t=this.readPfaceVertex();break;case u.POLYLINE_2D:t=this.readPolyline2D();break;case u.POLYLINE_3D:t=this.readPolyline3D();break;case u.ARC:t=this.readArc();break;case u.CIRCLE:t=this.readCircle();break;case u.LINE:t=this.readLine();break;case u.DIMENSION_ORDINATE:t=this.readDimOrdinate();break;case u.DIMENSION_LINEAR:t=this.readDimLinear();break;case u.DIMENSION_ALIGNED:t=this.readDimAligned();break;case u.DIMENSION_ANG_3_Pt:t=this.readDimAngular3pt();break;case u.DIMENSION_ANG_2_Ln:t=this.readDimLine2pt();break;case u.DIMENSION_RADIUS:t=this.readDimRadius();break;case u.DIMENSION_DIAMETER:t=this.readDimDiameter();break;case u.POINT:t=this.readPoint();break;case u.FACE3D:t=this.read3dFace();break;case u.POLYLINE_PFACE:t=this.readPolyfaceMesh();break;case u.POLYLINE_MESH:t=this.readPolylineMesh();break;case u.SOLID:case u.TRACE:t=this.readSolid();break;case u.SHAPE:t=this.readShape();break;case u.VIEWPORT:t=this.readViewport();break;case u.ELLIPSE:t=this.readEllipse();break;case u.SPLINE:t=this.readSpline();break;case u.REGION:t=this.readModelerGeometry(new k(new as));break;case u.SOLID3D:t=this.readSolid3D();break;case u.BODY:t=this.readModelerGeometry(new k(new ts));break;case u.RAY:t=this.readRay();break;case u.XLINE:t=this.readXLine();break;case u.DICTIONARY:t=this.readDictionary();break;case u.MTEXT:t=this.readMText();break;case u.LEADER:t=this.readLeader();break;case u.TOLERANCE:t=this.readTolerance();break;case u.MLINE:t=this.readMLine();break;case u.BLOCK_CONTROL_OBJ:t=this.readBlockControlObject(),this._builder.BlockRecords=t.CadObject;break;case u.BLOCK_HEADER:t=this.readBlockHeader();break;case u.LAYER_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Mr),this._builder.Layers=t.CadObject;break;case u.LAYER:t=this.readLayer();break;case u.STYLE_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Hr),this._builder.TextStyles=t.CadObject;break;case u.STYLE:t=this.readTextStyle();break;case u.LTYPE_CONTROL_OBJ:t=this.readLTypeControlObject(),this._builder.LineTypesTable=t.CadObject;break;case u.LTYPE:t=this.readLType();break;case u.VIEW_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Ur),this._builder.Views=t.CadObject;break;case u.VIEW:t=this.readView();break;case u.UCS_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Fr),this._builder.UCSs=t.CadObject;break;case u.UCS:t=this.readUcs();break;case u.VPORT_CONTROL_OBJ:t=this.readDocumentTableGeneric(new zr),this._builder.VPorts=t.CadObject;break;case u.VPORT:t=this.readVPort();break;case u.APPID_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Vr),this._builder.AppIds=t.CadObject;break;case u.APPID:t=this.readAppId();break;case u.DIMSTYLE_CONTROL_OBJ:t=this.readDocumentTableGeneric(new Wt),this._builder.DimensionStyles=t.CadObject;break;case u.DIMSTYLE:t=this.readDimStyle();break;case u.VP_ENT_HDR_CTRL_OBJ:t=this.readViewportEntityControl();break;case u.VP_ENT_HDR:t=this.readViewportEntityHeader();break;case u.GROUP:t=this.readGroup();break;case u.MLINESTYLE:t=this.readMLineStyle();break;case u.LWPOLYLINE:t=this.readLWPolyline();break;case u.HATCH:t=this.readHatch();break;case u.XRECORD:t=this.readXRecord();break;case u.ACDBPLACEHOLDER:t=this.readPlaceHolder();break;case u.LAYOUT:t=this.readLayout();break;case u.ACAD_PROXY_ENTITY:t=this.readProxyEntity();break;case u.ACAD_PROXY_OBJECT:t=this.readProxyObject();break;case u.OLE2FRAME:t=this.readOle2Frame();break;case u.OLEFRAME:case u.DUMMY:return t=this.readUnknownEntity(null),this._builder.Notify(`Unlisted object with DXF name ${e} has been read as an UnknownEntity`,g.Warning),t;case u.VBA_PROJECT:case u.LONG_TRANSACTION:return t=this.readUnknownNonGraphicalObject(null),this._builder.Notify(`Unlisted object with DXF name ${e} has been read as an UnknownNonGraphicalObject`,g.Warning),t;case u.UNDEFINED:case u.UNKNOW_3A:case u.UNKNOW_3B:case u.UNKNOW_36:case u.UNKNOW_37:case u.UNKNOW_9:break;default:return this.readUnlistedType(e)}return t==null&&this._builder.Notify(`Object type not implemented: ${e}`,g.NotImplemented),t}readUnlistedType(e){let t=this._classes.get(e);if(!t)return null;let i=null;switch(t.dxfName){case d.EntityAecWall:i=this.readAecWall();break;case d.ObjectBinRecord:i=this.readBinRecord();break;case d.ObjectAecWallStyle:i=this.readAecWallStyle();break;case d.ObjectAecCleanupGroupDef:i=this.readAecCleanupGroup();break;case"ACDBDICTIONARYWDFLT":i=this.readDictionaryWithDefault();break;case"ACDBPLACEHOLDER":i=this.readPlaceHolder();break;case"ACAD_TABLE":i=this.readTableEntity();break;case d.ObjectDimensionAssociation:i=this.readDimensionAssociation();break;case"DBCOLOR":i=this.readDbColor();break;case"DICTIONARYVAR":i=this.readDictionaryVar();break;case"DICTIONARYWDFLT":i=this.readDictionaryWithDefault();break;case d.ObjectGeoData:i=this.readGeoData();break;case"GROUP":i=this.readGroup();break;case"HATCH":i=this.readHatch();break;case"IMAGE":i=this.readCadImage(new ns);break;case"IMAGEDEF":i=this.readImageDefinition();break;case"IMAGEDEF_REACTOR":i=this.readImageDefinitionReactor();break;case"LAYOUT":i=this.readLayout();break;case"LWPLINE":case"LWPOLYLINE":i=this.readLWPolyline();break;case"MATERIAL":i=this.readMaterial();break;case"MESH":i=this.readMesh();break;case"MULTILEADER":i=this.readMultiLeader();break;case"ACDB_MLEADEROBJECTCONTEXTDATA_CLASS":i=this.readMultiLeaderAnnotContext();break;case"MLEADERSTYLE":i=this.readMultiLeaderStyle();break;case"PDFDEFINITION":i=this.readPdfDefinition();break;case"PDFUNDERLAY":case"PDFREFERENCE":i=this.readPdfUnderlay();break;case"SCALE":i=this.readScale();break;case"SORTENTSTABLE":i=this.readSortentsTable();break;case"RASTERVARIABLES":i=this.readRasterVariables();break;case"WIPEOUT":i=this.readCadImage(new ls);break;case"XRECORD":i=this.readXRecord();break;case d.ObjectEvalGraph:i=this.readEvaluationGraph();break;case d.ObjectBlockRotationParameter:i=this.readBlockRotationParameter();break;case d.ObjectBlockVisibilityParameter:i=this.readBlockVisibilityParameter();break;case"BLOCKFLIPPARAMETER":i=this.readBlockFlipParameter();break;case d.ObjectBlockRepresentationData:i=this.readBlockRepresentationData();break;case d.ObjectBlockGripLocationComponent:i=this.readBlockGripLocationComponent();break;case d.ObjectBlockRotationGrip:{let s=new Na;this.readBlockGrip(s),i=s;break}case d.ObjectBlockVisibilityGrip:{let s=new Ia;this.readBlockGrip(s),i=s;break}case d.ObjectBlockFlipAction:i=this.readBlockFlipAction();break;case d.ObjectBlockRotateAction:i=this.readBlockRotateAction();break;case"SPATIAL_FILTER":i=this.readSpatialFilter();break;case"ACAD_PROXY_ENTITY":i=this.readProxyEntity();break;case"ACAD_PROXY_OBJECT":i=this.readProxyObject();break;case d.ObjectVisualStyle:i=this.readVisualStyle();break;case d.ObjectPlotSettings:i=this.readPlotSettings();break;case d.ObjectTableStyle:i=this.readTableStyle();break;case d.BlkRefObjectContextData:i=this.readBlkRefObjectContextData();break;case d.MTextAttributeObjectContextData:i=this.readMTextAttributeObjectContextData();break;case d.ObjectFieldList:i=this.readFieldList();break;case d.ObjectField:i=this.readField();break}return i==null&&t.isAnEntity?(i=this.readUnknownEntity(t),this._builder.Notify(`Unlisted object with DXF name ${t.dxfName} has been read as an UnknownEntity`,g.Warning)):i==null&&!t.isAnEntity&&(i=this.readUnknownNonGraphicalObject(t),this._builder.Notify(`Unlisted object with DXF name ${t.dxfName} has been read as an UnknownNonGraphicalObject`,g.Warning)),i}read3dFace(){let e=new Yr,t=new k(e);if(this.readCommonEntityData(t),this.R13_14Only&&(e.firstCorner=this._objectReader.read3BitDouble(),e.secondCorner=this._objectReader.read3BitDouble(),e.thirdCorner=this._objectReader.read3BitDouble(),e.fourthCorner=this._objectReader.read3BitDouble(),e.flags=this._objectReader.readBitShort()),this.R2000Plus){let i=this._objectReader.readBit(),s=this._objectReader.readBit(),n=this._objectReader.readDouble(),a=this._objectReader.readDouble(),o=0;s||(o=this._objectReader.readDouble()),e.firstCorner=new c(n,a,o),e.secondCorner=this._objectReader.read3BitDoubleWithDefault(e.firstCorner),e.thirdCorner=this._objectReader.read3BitDoubleWithDefault(e.secondCorner),e.fourthCorner=this._objectReader.read3BitDoubleWithDefault(e.thirdCorner),i||(e.flags=this._objectReader.readBitShort())}return t}readArc(){let e=new Ft,t=new k(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return e.radius=i<=0?Q.Epsilon:i,e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),e.startAngle=this._objectReader.readBitDouble(),e.endAngle=this._objectReader.readBitDouble(),t}readCircle(){let e=new dt,t=new k(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return e.radius=i<=0?Q.Epsilon:i,e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),t}readLine(){let e=new zt,t=new k(e);if(this.readCommonEntityData(t),this.R13_14Only&&(e.startPoint=this._objectReader.read3BitDouble(),e.endPoint=this._objectReader.read3BitDouble()),this.R2000Plus){let i=this._objectReader.readBit(),s=this._objectReader.readDouble(),n=this._objectReader.readBitDoubleWithDefault(s),a=this._objectReader.readDouble(),o=this._objectReader.readBitDoubleWithDefault(a),h=0,f=0;i||(h=this._objectReader.readDouble(),f=this._objectReader.readBitDoubleWithDefault(h)),e.startPoint=new c(s,a,h),e.endPoint=new c(n,o,f)}return e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),t}readPoint(){let e=new Gt,t=new k(e);return this.readCommonEntityData(t),e.location=this._objectReader.read3BitDouble(),e.thickness=this._objectReader.readBitThickness(),e.normal=this._objectReader.readBitExtrusion(),e.rotation=this._objectReader.readBitDouble(),t}readEllipse(){let e=new Ut,t=new k(e);return this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble(),e.majorAxisEndPoint=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.radiusRatio=this._objectReader.readBitDouble(),e.startParameter=this._objectReader.readBitDouble(),e.endParameter=this._objectReader.readBitDouble(),t}readRay(){let e=new ei,t=new k(e);return this.readCommonEntityData(t),e.startPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),t}readXLine(){let e=new ii,t=new k(e);return this.readCommonEntityData(t),e.firstPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),t}readSolid(){let e=new $t,t=new k(e);this.readCommonEntityData(t),e.thickness=this._objectReader.readBitThickness();let i=this._objectReader.readBitDouble(),s=this._objectReader.read2RawDouble();return e.firstCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.secondCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.thirdCorner=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),e.fourthCorner=new c(s.x,s.y,i),e.normal=this._objectReader.readBitExtrusion(),t}readBlock(){let e=new Pr(new U),t=new k(e);this.readCommonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),t}readEndBlock(){let e=new gs(new U),t=new k(e);return this.readCommonEntityData(t),t}readSeqend(){let e=new k(new Le);return this.readCommonEntityData(e),e}readShape(){let e=new ur,t=new qn(e);return this.readCommonEntityData(t),e.insertionPoint=this._objectReader.read3BitDouble(),e.size=this._objectReader.readBitDouble(),e.rotation=this._objectReader.readBitDouble(),e.relativeXScale=this._objectReader.readBitDouble(),e.obliqueAngle=this._objectReader.readBitDouble(),e.thickness=this._objectReader.readBitDouble(),e.shapeIndex=this._objectReader.readBitShort()&65535,e.normal=this._objectReader.read3BitDouble(),t.ShapeFileHandle=this.handleReference(),t}readTolerance(){let e=new Yt,t=new ta(e);return this.readCommonEntityData(t),this.R13_14Only&&(this._objectReader.readBitShort(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),e.insertionPoint=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.text=this._textReader.readVariableText(),t.DimensionStyleHandle=this.handleReference(),t}readPlaceHolder(){let e=new K(new ci);return this.readCommonNonEntityData(e),e}readUnknownEntity(e){let t=new Lt(e),i=new ba(t);return this.readCommonEntityData(i),i}readUnknownNonGraphicalObject(e){let t=new pr(e),i=new _a(t);return this.readCommonNonEntityData(i),i}readBlockControlObject(){let e=new Mn(new Ir);return this.readDocumentTable(e),e.ModelSpaceHandle=this.handleReference(),e.PaperSpaceHandle=this.handleReference(),e}readBlockHeader(){let e=new U,t=e.blockEntity,i=new br(e);this._builder.BlockRecordTemplates.push(i),this.readCommonNonEntityData(i);let s=this._textReader.readVariableText();(s.toLowerCase()===U.ModelSpaceName.toLowerCase()||s.toLowerCase()===U.PaperSpaceName.toLowerCase())&&(e.name=s),this.readXrefDependantBit(i.CadObject),this._objectReader.readBit()&&(t.flags|=ne.Anonymous);let n=this._objectReader.readBit();this._objectReader.readBit()&&(t.flags|=ne.XRef),this._objectReader.readBit()&&(t.flags|=ne.XRefOverlay),this.R2000Plus&&(t.isUnloaded=this._objectReader.readBit());let a=0;this.R2004Plus&&!(t.flags&ne.XRef)&&!(t.flags&ne.XRefOverlay)&&(a=this._objectReader.readBitLong()),t.basePoint=this._objectReader.read3BitDouble(),t.xRefPath=this._textReader.readVariableText();let o=0;if(this.R2000Plus){for(let b=this._objectReader.readByte();b!==0;b=this._objectReader.readByte())++o;t.comments=this._textReader.readVariableText();let h=this._objectReader.readBitLong(),f=[];for(let b=0;b<h;++b)f.push(this._objectReader.readByte());e.preview=new Uint8Array(f)}if(this.R2007Plus&&(e.units=this._objectReader.readBitShort(),e.isExplodable=this._objectReader.readBit(),e.canScale=this._objectReader.readByte()>0),this.handleReference(),i.BeginBlockHandle=this.handleReference(),this._version>=m.AC1012&&this._version<=m.AC1015&&!(t.flags&ne.XRef)&&!(t.flags&ne.XRefOverlay)&&(i.FirstEntityHandle=this.handleReference(),i.LastEntityHandle=this.handleReference()),this.R2004Plus)for(let h=0;h<a;++h)i.OwnedObjectsHandlers.add(this.handleReference());if(i.EndBlockHandle=this.handleReference(),this.R2000Plus){for(let h=0;h<o;++h)i.InsertHandles.push(this.handleReference());i.LayoutHandle=this.handleReference()}return i}readDocumentTable(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();for(let i=0;i<t;++i)e.EntryHandles.add(this.handleReference());return e}readDocumentTableGeneric(e){let t=new st(e);return this.readDocumentTable(t)}readLTypeControlObject(){let e=new st(new Wr);return this.readDocumentTable(e),e.EntryHandles.add(this.handleReference()),e.EntryHandles.add(this.handleReference()),e}readAppId(){let e=new gt,t=new fe(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(e),this._objectReader.readByte(),this.handleReference(),t}readTextStyle(){let e=new te,t=new fe(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),this._objectReader.readBit()&&(e.flags|=Nr.IsShape),this._objectReader.readBit()&&(e.flags|=Nr.VerticalText),e.height=this._objectReader.readBitDouble(),e.width=this._objectReader.readBitDouble(),e.obliqueAngle=this._objectReader.readBitDouble(),e.mirrorFlag=this._objectReader.readByte(),e.lastHeight=this._objectReader.readBitDouble(),e.filename=this._textReader.readVariableText(),e.bigFontFilename=this._textReader.readVariableText(),this.handleReference(),t}readLayer(){let e=new Se,t=new Fn(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();if(i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),this.R13_14Only&&(this._objectReader.readBit()&&(e.flags|=ze.Frozen),e.isOn=this._objectReader.readBit(),this._objectReader.readBit()&&(e.flags|=ze.FrozenNewViewports),this._objectReader.readBit()&&(e.flags|=ze.Locked)),this.R2000Plus){let n=this._objectReader.readBitShort();(n&1)>0&&(e.flags|=ze.Frozen),e.isOn=(n&2)===0,(n&4)>0&&(e.flags|=ze.FrozenNewViewports),(n&8)>0&&(e.flags|=ze.Locked),e.plotFlag=(n&16)>0;let a=(n&992)>>5;e.lineWeight=Z.toValue(a)}let s=this._mergedReaders.readCmColor();return e.color=s.isByBlock||s.isByLayer?new B(30):s,t.LayerControlHandle=this.handleReference(),this.R2000Plus&&(t.PlotStyleHandle=this.handleReference()),this.R2007Plus&&(t.MaterialHandle=this.handleReference()),t.LineTypeHandle=this.handleReference(),this.R2013Plus&&this.handleReference(),t}readLType(){let e=new H,t=new ki(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(t.CadObject),e.description=this._textReader.readVariableText(),t.TotalLen=this._objectReader.readBitDouble(),e.alignment=String.fromCharCode(this._objectReader.readRawChar());let s=this._objectReader.readByte(),n=!1;for(let o=0;o<s;o++){let h=new ki.SegmentTemplate;h.Segment.length=this._objectReader.readBitDouble(),h.Segment.shapeNumber=this._objectReader.readBitShort(),h.Segment.offset=new C(this._objectReader.readDouble(),this._objectReader.readDouble()),h.Segment.scale=this._objectReader.readBitDouble(),h.Segment.rotation=this._objectReader.readBitDouble(),h.Segment.shapeFlags=this._objectReader.readBitShort(),h.Segment.shapeFlags&Ze.Text&&(n=!0),t.SegmentTemplates.push(h)}let a=null;this._version<=m.AC1018&&(a=this._objectReader.readBytes(256)),this.R2007Plus&&n&&(a=this._objectReader.readBytes(512)),n&&a&&this.readLineTypeSegmentTexts(t.SegmentTemplates,a),t.LtypeControlHandle=this.handleReference();for(let o=0;o<s;o++)t.SegmentTemplates[o].StyleHandle=this.handleReference();return t}readLineTypeSegmentTexts(e,t){if(!(!e||!t||t.length===0))for(let i of e){if(!(i.Segment.shapeFlags&Ze.Text))continue;let s=i.Segment.shapeNumber&65535;if(s>=t.length){this._builder.Notify(`Unable to read linetype text segment; offset ${s} is outside the available buffer (${t.length} bytes).`,g.Warning),i.Segment.text="",i.Segment.shapeNumber=0;continue}i.Segment.text=this.readLineTypeTextString(t,s),i.Segment.shapeNumber=0}}readLineTypeTextString(e,t){if(!e||t<0||t>=e.length)return"";if(r.looksLikeUtf16Le(e,t)){let s=t;for(;s+1<e.length&&!(e[s]===0&&e[s+1]===0);)s+=2;return new TextDecoder("utf-16le").decode(e.slice(t,s))}let i=t;for(;i<e.length&&e[i]!==0;)i++;return i===t?"":new TextDecoder("ascii").decode(e.slice(t,i))}readCommonDimensionData(e){this.readCommonEntityData(e);let t=e.CadObject;this.R2010Plus&&(t.version=this._objectReader.readByte()),t.normal=this._objectReader.read3BitDouble();let i=this._objectReader.read2RawDouble(),s=this._objectReader.readBitDouble();t.textMiddlePoint=new c(i.x,i.y,s);let n=this._objectReader.readByte();t.isTextUserDefinedLocation=(n&1)===0,t.text=this._textReader.readVariableText(),t.textRotation=this._objectReader.readBitDouble(),t.horizontalDirection=this._objectReader.readBitDouble();let a=new c(this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),o=this._objectReader.readBitDouble();this.R2000Plus&&(t.attachmentPoint=this._objectReader.readBitShort(),t.lineSpacingStyle=this._objectReader.readBitShort(),t.lineSpacingFactor=this._objectReader.readBitDouble(),this._objectReader.readBitDouble()),this.R2007Plus&&(this._objectReader.readBit(),t.flipArrow1=this._objectReader.readBit(),t.flipArrow2=this._objectReader.readBit());let h=this._objectReader.read2RawDouble();t.insertionPoint=new c(h.x,h.y,s)}readCommonDimensionAlignedData(e){let t=e.CadObject;t.firstPoint=this._objectReader.read3BitDouble(),t.secondPoint=this._objectReader.read3BitDouble(),t.definitionPoint=this._objectReader.read3BitDouble(),t.extLineRotation=this._objectReader.readBitDouble()}readCommonDimensionHandles(e){e.StyleHandle=this.handleReference(),e.BlockHandle=this.handleReference()}readDimAligned(){let e=new je,t=new gr(e);return this.readCommonDimensionData(t),this.readCommonDimensionAlignedData(t),this.readCommonDimensionHandles(t),t}readDimAngular3pt(){let e=new Ct,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.firstPoint=this._objectReader.read3BitDouble(),e.secondPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),this.readCommonDimensionHandles(t),t}readDimDiameter(){let e=new Bt,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.leaderLength=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readDimLine2pt(){let e=new St,t=new gr(e);this.readCommonDimensionData(t);let i=this._objectReader.read2RawDouble();return e.dimensionArc=new c(i.x,i.y,e.textMiddlePoint.z),e.firstPoint=this._objectReader.read3BitDouble(),e.secondPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.definitionPoint=this._objectReader.read3BitDouble(),this.readCommonDimensionHandles(t),t}readDimLinear(){let e=new Qe,t=new gr(e);return this.readCommonDimensionData(t),this.readCommonDimensionAlignedData(t),e.rotation=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readDimOrdinate(){let e=new yt,t=new gr(e);this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.featureLocation=this._objectReader.read3BitDouble(),e.leaderEndpoint=this._objectReader.read3BitDouble();let i=this._objectReader.readByte();return e.isOrdinateTypeX=(i&1)!==0,this.readCommonDimensionHandles(t),t}readDimRadius(){let e=new Rt,t=new gr(e);return this.readCommonDimensionData(t),e.definitionPoint=this._objectReader.read3BitDouble(),e.angleVertex=this._objectReader.read3BitDouble(),e.leaderLength=this._objectReader.readBitDouble(),this.readCommonDimensionHandles(t),t}readText(){let e=new Je,t=new Sr(e);return this.readCommonTextData(t),t}readAttribute(){let e=new Dt,t=new Ns(e);return this.readCommonTextData(t),this.readCommonAttData(t),t}readAttributeDefinition(){let e=new es,t=new Ns(e);return this.readCommonTextData(t),this.readCommonAttData(t),this.R2010Plus&&(e.version=this._objectReader.readByte()),e.prompt=this._textReader.readVariableText(),t}readCommonAttData(e){let t=e.CadObject;switch(this.R2010Plus&&(t.version=this._objectReader.readByte()),this.R2018Plus&&(t.attributeType=this._objectReader.readByte()),t.attributeType){case Gr.MultiLine:case Gr.ConstantMultiLine:{t.mText=new Ne;let i=new Sr(t.mText);e.MTextTemplate=i,this.readEntityMode(i),this.readMTextBody(i,!1);let s=this._objectReader.readBitShort();s>0&&(this._objectReader.readBytes(s),this.handleReference(),this._objectReader.readBitShort());break}}t.tag=this._textReader.readVariableText(),this._objectReader.readBitShort(),t.flags=this._objectReader.readByte(),this.R2007Plus&&(t.isReallyLocked=this._objectReader.readBit())}readCommonTextData(e){this.readCommonEntityData(e);let t=e.CadObject,i=0,s;if(this.R13_14Only){i=this._objectReader.readBitDouble(),s=this._objectReader.read2RawDouble(),t.insertPoint=new c(s.x,s.y,i),s=this._objectReader.read2RawDouble(),t.alignmentPoint=new c(s.x,s.y,i),t.normal=this._objectReader.read3BitDouble(),t.thickness=this._objectReader.readBitDouble(),t.obliqueAngle=this._objectReader.readBitDouble(),t.rotation=this._objectReader.readBitDouble(),t.height=this._objectReader.readBitDouble(),t.widthFactor=this._objectReader.readBitDouble(),t.value=this._textReader.readVariableText(),t.mirror=this._objectReader.readBitShort(),t.horizontalAlignment=this._objectReader.readBitShort(),t.verticalAlignment=this._objectReader.readBitShort(),e.StyleHandle=this.handleReference();return}let n=this._objectReader.readByte();if((n&1)===0&&(i=this._objectReader.readDouble()),s=this._objectReader.read2RawDouble(),t.insertPoint=new c(s.x,s.y,i),(n&2)===0){let a=this._objectReader.readBitDoubleWithDefault(t.insertPoint.x),o=this._objectReader.readBitDoubleWithDefault(t.insertPoint.y);t.alignmentPoint=new c(a,o,i)}t.normal=this._objectReader.readBitExtrusion(),t.thickness=this._objectReader.readBitThickness(),(n&4)===0&&(t.obliqueAngle=this._objectReader.readDouble()),(n&8)===0&&(t.rotation=this._objectReader.readDouble()),t.height=this._objectReader.readDouble(),(n&16)===0&&(t.widthFactor=this._objectReader.readDouble()),t.value=this._textReader.readVariableText(),(n&32)===0&&(t.mirror=this._objectReader.readBitShort()),(n&64)===0&&(t.horizontalAlignment=this._objectReader.readBitShort()),(n&128)===0&&(t.verticalAlignment=this._objectReader.readBitShort()),e.StyleHandle=this.handleReference()}readInsert(){let e=new xr(new Ee);return this.readInsertCommonData(e),this.readInsertCommonHandles(e),e}readMInsert(){let e=new Ee,t=new xr(e);return this.readInsertCommonData(t),e.columnCount=this._objectReader.readBitShort()&65535,e.rowCount=this._objectReader.readBitShort()&65535,e.columnSpacing=this._objectReader.readBitDouble(),e.rowSpacing=this._objectReader.readBitDouble(),this.readInsertCommonHandles(t),t}readInsertCommonData(e){let t=e.CadObject;if(this.readCommonEntityData(e),t.insertPoint=this._objectReader.read3BitDouble(),this.R13_14Only){let i=this._objectReader.read3BitDouble();t.xScale=i.x,t.yScale=i.y,t.zScale=i.z}if(this.R2000Plus)switch(this._objectReader.read2Bits()){case 0:t.xScale=this._objectReader.readDouble(),t.yScale=this._objectReader.readBitDoubleWithDefault(t.xScale),t.zScale=this._objectReader.readBitDoubleWithDefault(t.xScale);break;case 1:t.yScale=this._objectReader.readBitDoubleWithDefault(t.xScale),t.zScale=this._objectReader.readBitDoubleWithDefault(t.xScale);break;case 2:{let i=this._objectReader.readDouble();t.xScale=i,t.yScale=i,t.zScale=i;break}case 3:t.xScale=1,t.yScale=1,t.zScale=1;break}t.rotation=this._objectReader.readBitDouble(),t.normal=this._objectReader.read3BitDouble(),e.HasAtts=this._objectReader.readBit(),e.OwnedObjectsCount=0,this.R2004Plus&&e.HasAtts&&(e.OwnedObjectsCount=this._objectReader.readBitLong())}readInsertCommonHandles(e){if(e.BlockHeaderHandle=this.handleReference(),!!e.HasAtts){if(this._version>=m.AC1012&&this._version<=m.AC1015)e.FirstAttributeHandle=this.handleReference(),e.EndAttributeHandle=this.handleReference();else if(this.R2004Plus)for(let t=0;t<e.OwnedObjectsCount;++t)e.OwnedObjectsHandlers.add(this.handleReference());e.SeqendHandle=this.handleReference()}}readVertex2D(){let e=new Xt,t=new k(e);this.readCommonEntityData(t),e.flags=this._objectReader.readByte(),e.location=this._objectReader.read3BitDouble();let i=this._objectReader.readBitDouble();return i<0?(e.startWidth=-i,e.endWidth=-i):(e.startWidth=i,e.endWidth=this._objectReader.readBitDouble()),e.bulge=this._objectReader.readBitDouble(),this.R2010Plus&&(e.id=this._objectReader.readBitLong()),e.curveTangent=this._objectReader.readBitDouble(),t}readVertex3D(e){let t=new k(e);return this.readCommonEntityData(t),e.flags=this._objectReader.readByte(),e.location=this._objectReader.read3BitDouble(),t}readPfaceVertex(){let e=new Zt,t=new k(e);return this.readCommonEntityData(t),e.index1=this._objectReader.readBitShort(),e.index2=this._objectReader.readBitShort(),e.index3=this._objectReader.readBitShort(),e.index4=this._objectReader.readBitShort(),t}readPolyline2D(){let e=new et,t=new Kt(e);if(this.readCommonEntityData(t),e.flags=this._objectReader.readBitShort(),e.smoothSurface=this._objectReader.readBitShort(),e.startWidth=this._objectReader.readBitDouble(),e.endWidth=this._objectReader.readBitDouble(),e.thickness=this._objectReader.readBitThickness(),e.elevation=this._objectReader.readBitDouble(),e.normal=this._objectReader.readBitExtrusion(),this.R2004Plus){let i=this._objectReader.readBitLong();for(let s=0;s<i;++s)t.OwnedObjectsHandlers.add(this.handleReference())}return this._version>=m.AC1012&&this._version<=m.AC1015&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),t.SeqendHandle=this.handleReference(),t}readPolyline3D(){let e=new tt,t=new Kt(e);this.readCommonEntityData(t);let i=this._objectReader.readByte(),s=(i&1)>0,n=(i&2)>0;if((s||n)&&(e.flags|=Ve.SplineFit),e.flags|=Ve.Polyline3D,(this._objectReader.readByte()&1)>0&&(e.flags|=Ve.ClosedPolylineOrClosedPolygonMeshInM),this.R2004Plus){let a=this._objectReader.readBitLong();for(let o=0;o<a;++o)t.OwnedObjectsHandlers.add(this.handleReference())}return this._version>=m.AC1012&&this._version<=m.AC1015&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),t.SeqendHandle=this.handleReference(),t}readPolyfaceMesh(){let e=new Kt(new ut);if(this.readCommonEntityData(e),this._objectReader.readBitShort(),this._objectReader.readBitShort(),this.R2004Plus){let t=this._objectReader.readBitLong();for(let i=0;i<t;i++)e.OwnedObjectsHandlers.add(this.handleReference())}return this.R13_15Only&&(e.FirstVertexHandle=this.handleReference(),e.LastVertexHandle=this.handleReference()),e.SeqendHandle=this.handleReference(),e}readPolylineMesh(){let e=new Et,t=new Kt(e);if(this.readCommonEntityData(t),e.flags=this._objectReader.readBitShort(),e.smoothSurface=this._objectReader.readBitShort(),e.mVertexCount=this._objectReader.readBitShort(),e.nVertexCount=this._objectReader.readBitShort(),e.mSmoothSurfaceDensity=this._objectReader.readBitShort(),e.nSmoothSurfaceDensity=this._objectReader.readBitShort(),this.R13_15Only&&(t.FirstVertexHandle=this.handleReference(),t.LastVertexHandle=this.handleReference()),this.R2004Plus){let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)t.OwnedObjectsHandlers.add(this.handleReference())}return t.SeqendHandle=this.handleReference(),t}readLWPolyline(){let e=new qr,t=new k(e);try{this.readCommonEntityData(t);let i=this._objectReader.readBitShort();(i&256)!==0&&(e.flags|=At.Plinegen),(i&512)!==0&&(e.flags|=At.Closed),(i&4)!==0&&(e.constantWidth=this._objectReader.readBitDouble()),(i&8)!==0&&(e.elevation=this._objectReader.readBitDouble()),(i&2)!==0&&(e.thickness=this._objectReader.readBitDouble()),(i&1)!==0&&(e.normal=this._objectReader.read3BitDouble());let s=this._objectReader.readBitLong(),n=0;(i&16)!==0&&(n=this._objectReader.readBitLong());let a=0;(i&1024)!==0&&(a=this._objectReader.readBitLong());let o=0;if((i&32)!==0&&(o=this._objectReader.readBitLong()),this.R13_14Only)for(let h=0;h<s;h++){let f=this._objectReader.read2RawDouble();e.vertices.push(new Ci(f))}if(this.R2000Plus&&s>0){let h=this._objectReader.read2RawDouble();e.vertices.push(new Ci(h));for(let f=1;f<s;f++)h=this._objectReader.read2BitDoubleWithDefault(h),e.vertices.push(new Ci(h))}for(let h=0;h<n;h++)e.vertices[h].bulge=this._objectReader.readBitDouble();for(let h=0;h<a;h++)e.vertices[h].id=this._objectReader.readBitLong();for(let h=0;h<o;h++){let f=e.vertices[h];f.startWidth=this._objectReader.readBitDouble(),f.endWidth=this._objectReader.readBitDouble()}}catch(i){return this._builder.Notify(`Exception while reading LwPolyline: ${i.constructor?.name||"Error"}`,g.Error,i),t}return t}readSpline(){let e=new mr,t=new ea(e);this.readCommonEntityData(t);let i=this._objectReader.readBitLong();this.R2013Plus?(e.flags1=this._mergedReaders.readBitLong(),e.isClosed=!!(e.flags1&mt.Closed),e.knotParametrization=this._mergedReaders.readBitLong(),i=e.knotParametrization===Si.Custom||(e.flags1&mt.UseKnotParameter)===0?1:2):i===2?e.flags1|=mt.MethodFitPoints:e.knotParametrization=Si.Custom,e.degree=this._objectReader.readBitLong();let s=0,n=0,a=0,o=!1;switch(i){case 1:this._objectReader.readBit()&&(e.flags|=Ie.Rational),this._objectReader.readBit()&&(e.flags|=Ie.Closed),this._objectReader.readBit()&&(e.flags|=Ie.Periodic),e.knotTolerance=this._objectReader.readBitDouble(),e.controlPointTolerance=this._objectReader.readBitDouble(),n=this._objectReader.readBitLong(),a=this._objectReader.readBitLong(),o=this._objectReader.readBit();break;case 2:e.fitTolerance=this._objectReader.readBitDouble(),e.startTangent=this._objectReader.read3BitDouble(),e.endTangent=this._objectReader.read3BitDouble(),s=this._objectReader.readBitLong();break}for(let h=0;h<n;h++)e.knots.push(this._objectReader.readBitDouble());for(let h=0;h<a;h++)e.controlPoints.push(this._objectReader.read3BitDouble()),o&&e.weights.push(this._objectReader.readBitDouble());for(let h=0;h<s;h++)e.fitPoints.push(this._objectReader.read3BitDouble());return t}readMesh(){let e=new ar,t=new Kn(e);this.readCommonEntityData(t),e.version=this._objectReader.readBitShort(),e.blendCrease=this._objectReader.readBit()?1:0,e.subdivisionLevel=this._objectReader.readBitLong();let i=this._objectReader.readBitLong();for(let o=0;o<i;o++)e.vertices.push(this._objectReader.read3BitDouble());let s=this._objectReader.readBitLong();for(let o=0;o<s;o++){let h=this._objectReader.readBitLong(),f=[];for(let b=0;b<h;b++)f.push(this._objectReader.readBitLong());o+=h,e.faces.push([...f])}let n=this._objectReader.readBitLong();for(let o=0;o<n;o++){let h=this._objectReader.readBitLong(),f=this._objectReader.readBitLong();e.edges.push(new ln(h,f))}let a=this._objectReader.readBitLong();for(let o=0;o<a;o++)e.edges[o].crease=this._objectReader.readBitDouble();return this._objectReader.readBitLong(),t}readViewport(){let e=new fr,t=new sa(e);this.readCommonEntityData(t),e.center=this._objectReader.read3BitDouble(),e.width=this._objectReader.readBitDouble(),e.height=this._objectReader.readBitDouble(),this.R2000Plus&&(e.viewTarget=this._objectReader.read3BitDouble(),e.viewDirection=this._objectReader.read3BitDouble(),e.twistAngle=this._objectReader.readBitDouble(),e.viewHeight=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClipPlane=this._objectReader.readBitDouble(),e.backClipPlane=this._objectReader.readBitDouble(),e.snapAngle=this._objectReader.readBitDouble(),e.viewCenter=this._objectReader.read2RawDouble(),e.snapBase=this._objectReader.read2RawDouble(),e.snapSpacing=this._objectReader.read2RawDouble(),e.gridSpacing=this._objectReader.read2RawDouble(),e.circleZoomPercent=this._objectReader.readBitShort()),this.R2007Plus&&(e.majorGridLineFrequency=this._objectReader.readBitShort());let i=0;if(this.R2000Plus&&(i=this._objectReader.readBitLong(),e.status=this._objectReader.readBitLong(),e.styleSheetName=this._textReader.readVariableText(),e.renderMode=this._objectReader.readByte(),e.displayUcsIcon=this._objectReader.readBit(),e.ucsPerViewport=this._objectReader.readBit(),e.ucsOrigin=this._objectReader.read3BitDouble(),e.ucsXAxis=this._objectReader.read3BitDouble(),e.ucsYAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort()),this.R2004Plus&&(e.shadePlotMode=this._objectReader.readBitShort()),this.R2007Plus&&(e.useDefaultLighting=this._objectReader.readBit(),e.defaultLightingType=this._objectReader.readByte(),e.brightness=this._objectReader.readBitDouble(),e.contrast=this._objectReader.readBitDouble(),e.ambientLightColor=this._objectReader.readCmColor()),this.R13_14Only&&(t.ViewportHeaderHandle=this.handleReference()),this.R2000Plus){for(let s=0;s<i;++s)t.FrozenLayerHandles.add(this.handleReference());t.BoundaryHandle=this.handleReference()}return this._version===m.AC1015&&(t.ViewportHeaderHandle=this.handleReference()),this.R2000Plus&&(t.NamedUcsHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference()),this.R2007Plus&&(this.handleReference(),this.handleReference(),this.handleReference(),this.handleReference()),t}readViewportEntityControl(){let e=new Il;this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();for(let i=0;i<t;++i)e.EntryHandles.add(this.handleReference());return e}readViewportEntityHeader(){let e=new Gl,t=new Ml(e);return this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(t.CadObject),this._objectReader.readBit(),this.handleReference(),this.handleReference(),t.BlockHandle=this.handleReference(),t}readMText(){let e=new Ne,t=new Sr(e);return this.readMTextBody(t,!0)}readMTextBody(e,t){let i=e.CadObject;if(t&&this.readCommonEntityData(e),i.insertPoint=this._objectReader.read3BitDouble(),i.normal=this._objectReader.read3BitDouble(),i.alignmentPoint=this._objectReader.read3BitDouble(),i.rectangleWidth=this._objectReader.readBitDouble(),this.R2007Plus&&(i.rectangleHeight=this._objectReader.readBitDouble()),i.height=this._objectReader.readBitDouble(),i.attachmentPoint=this._objectReader.readBitShort(),i.drawingDirection=this._objectReader.readBitShort(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),i.value=this._textReader.readVariableText(),e.StyleHandle=this.handleReference(),this.R2000Plus&&(i.lineSpacingStyle=this._objectReader.readBitShort(),i.lineSpacing=this._objectReader.readBitDouble(),this._objectReader.readBit()),this.R2004Plus&&(i.backgroundFillFlags=this._objectReader.readBitLong(),((i.backgroundFillFlags&rr.UseBackgroundFillColor)!==0||this._version>m.AC1027&&(i.backgroundFillFlags&rr.TextFrame)>0)&&(i.backgroundScale=this._objectReader.readBitDouble(),i.backgroundColor=this._mergedReaders.readCmColor(),i.backgroundTransparency=this._objectReader.readBitLong())),!this.R2018Plus)return e;if(i.isAnnotative=!this._objectReader.readBit(),!i.isAnnotative&&(this._objectReader.readBitShort(),this._objectReader.readBit(),this.handleReference(),this._objectReader.readBitLong(),this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),this._objectReader.readBitDouble(),i.columnData.columnType=this._objectReader.readBitShort(),i.columnData.columnType!==rs.NoColumns)){let s=this._objectReader.readBitLong();if(i.columnData.width=this._objectReader.readBitDouble(),i.columnData.gutter=this._objectReader.readBitDouble(),i.columnData.autoHeight=this._objectReader.readBit(),i.columnData.flowReversed=this._objectReader.readBit(),!i.columnData.autoHeight&&i.columnData.columnType===rs.DynamicColumns&&s>0)for(let n=0;n<s;++n)i.columnData.heights.push(this._objectReader.readBitDouble())}return e}readHatch(){let e=new Tt,t=new Li(e);if(this.readCommonEntityData(t),this.R2004Plus){e.gradientColor.enabled=this._objectReader.readBitLong()!==0,e.gradientColor.reserved=this._objectReader.readBitLong(),e.gradientColor.angle=this._objectReader.readBitDouble(),e.gradientColor.shift=this._objectReader.readBitDouble(),e.gradientColor.isSingleColorGradient=this._objectReader.readBitLong()>0,e.gradientColor.colorTint=this._objectReader.readBitDouble();let a=this._objectReader.readBitLong();for(let o=0;o<a;++o){let h=new Sn;h.value=this._objectReader.readBitDouble(),h.color=this._mergedReaders.readCmColor(),e.gradientColor.colors.push(h)}e.gradientColor.name=this._textReader.readVariableText()}e.elevation=this._objectReader.readBitDouble(),e.normal=this._objectReader.read3BitDouble(),e.pattern=new an(this._textReader.readVariableText()),e.isSolid=this._objectReader.readBit(),e.isAssociative=this._objectReader.readBit();let i=this._objectReader.readBitLong(),s=!1;for(let a=0;a<i;a++){let o=new Li.CadBoundaryPathTemplate,h=this._objectReader.readBitLong();if(o.Path.flags=h,h&qe.Derived&&(s=!0),h&qe.Polyline){let b=new is,S=this._objectReader.readBit();b.isClosed=this._objectReader.readBit();let N=this._objectReader.readBitLong();for(let L=0;L<N;++L){let j=this._objectReader.read2RawDouble(),we=0;S&&(we=this._objectReader.readBitDouble()),b.vertices.push(new c(j.x,j.y,we))}o.Path.edges.push(b)}else{let b=this._objectReader.readBitLong();for(let S=0;S<b;++S)switch(this._objectReader.readByte()){case 1:{let L=new Kr;L.start=this._objectReader.read2RawDouble(),L.end=this._objectReader.read2RawDouble(),o.Path.edges.push(L)}break;case 2:{let L=new Xr;L.center=this._objectReader.read2RawDouble(),L.radius=this._objectReader.readBitDouble(),L.startAngle=this._objectReader.readBitDouble(),L.endAngle=this._objectReader.readBitDouble(),L.counterClockWise=this._objectReader.readBit(),o.Path.edges.push(L)}break;case 3:{let L=new Zr;L.center=this._objectReader.read2RawDouble(),L.majorAxisEndPoint=this._objectReader.read2RawDouble(),L.minorToMajorRatio=this._objectReader.readBitDouble(),L.startAngle=this._objectReader.readBitDouble(),L.endAngle=this._objectReader.readBitDouble(),L.counterClockWise=this._objectReader.readBit(),o.Path.edges.push(L)}break;case 4:{let L=new Jr;L.degree=this._objectReader.readBitLong(),L.isRational=this._objectReader.readBit(),L.isPeriodic=this._objectReader.readBit();let j=this._objectReader.readBitLong(),we=this._objectReader.readBitLong();for(let z=0;z<j;++z)L.knots.push(this._objectReader.readBitDouble());for(let z=0;z<we;++z){let X=this._objectReader.read2RawDouble(),qi=0;L.isRational&&(qi=this._objectReader.readBitDouble()),L.controlPoints.push(new c(X.x,X.y,qi))}if(this.R2010Plus){let z=this._objectReader.readBitLong();if(z>0){for(let X=0;X<z;++X)L.fitPoints.push(this._objectReader.read2RawDouble());L.startTangent=this._objectReader.read2RawDouble(),L.endTangent=this._objectReader.read2RawDouble()}}o.Path.edges.push(L);break}}}let f=this._objectReader.readBitLong();for(let b=0;b<f;b++)o.Handles.add(this.handleReference());t.PathTemplates.push(o)}if(e.style=this._objectReader.readBitShort(),e.patternType=this._objectReader.readBitShort(),!e.isSolid){e.patternAngle=this._objectReader.readBitDouble(),e.patternScale=this._objectReader.readBitDouble(),e.isDouble=this._objectReader.readBit();let a=this._objectReader.readBitShort();for(let o=0;o<a;++o){let h=new Cn;h.angle=this._objectReader.readBitDouble(),h.basePoint=this._objectReader.read2BitDouble(),h.offset=this._objectReader.read2BitDouble();let f=this._objectReader.readBitShort();for(let b=0;b<f;++b)h.dashLengths.push(this._objectReader.readBitDouble());e.pattern.lines.push(h)}}s&&(e.pixelSize=this._objectReader.readBitDouble());let n=this._objectReader.readBitLong();for(let a=0;a<n;++a)e.seedPoints.push(this._objectReader.read2RawDouble());return t}readModelerGeometry(e){let t=e.CadObject;if(this.readCommonEntityData(e),!this.R2013Plus&&!this._mergedReaders.readBit())return this.readModelerGeometryData(e),e;if(this._mergedReaders.readBit()){this._mergedReaders.readBit()&&(t.point=this._objectReader.read3BitDouble());let n=this._mergedReaders.readBitLong();if(this._mergedReaders.readBit()){let o=this._mergedReaders.readBitLong();for(let h=0;h<o;h++){let f=new _o;this.readWire(f),t.wires.push(f)}}let a=this._mergedReaders.readBitLong();for(let o=0;o<a;o++){let h=new wl;if(h.viewportId=this._mergedReaders.readBitLongLong(),h.viewportTarget=this._mergedReaders.read3BitDouble(),h.viewportDirectionFromTarget=this._mergedReaders.read3BitDouble(),h.viewportUpDirection=this._mergedReaders.read3BitDouble(),h.viewportPerspective=this._mergedReaders.readBit(),this._mergedReaders.readBit()){let f=this._mergedReaders.readBitLong();for(let b=0;b<f;b++){let S=new _o;this.readWire(S),h.wires.push(S)}}t.silhouettes.push(h)}if(!this._mergedReaders.readBit())return this.readModelerGeometryData(e),e}return this.R2007Plus&&this._mergedReaders.readBitLong(),e}readModelerGeometryData(e){this._mergedReaders.readBit();let t=this._mergedReaders.readBitShort();this.notify(`Stream data reader hasn't been implemented for ${e.CadObject.objectName}`,g.NotImplemented)}readSolid3D(){let e=new ti,t=new Qn(e);return this.readModelerGeometry(t),this.R2007Plus&&(t.HistoryHandle=this._mergedReaders.handleReference()),t}readWire(e){e.type=this._mergedReaders.readByte(),e.selectionMarker=this._mergedReaders.readBitLong();let t=this._mergedReaders.readBitShort();t=t>256?256:t,e.color=new B(t),e.acisIndex=this._mergedReaders.readBitLong();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++)e.points.push(this._mergedReaders.read3BitDouble());e.applyTransformPresent=this._mergedReaders.readBit(),e.applyTransformPresent&&(e.xAxis=this._mergedReaders.read3BitDouble(),e.yAxis=this._mergedReaders.read3BitDouble(),e.zAxis=this._mergedReaders.read3BitDouble(),e.translation=this._mergedReaders.read3BitDouble(),e.scale=this._mergedReaders.readBitDouble(),e.hasRotation=this._mergedReaders.readBit(),e.hasReflection=this._mergedReaders.readBit(),e.hasShear=this._mergedReaders.readBit())}readCadImage(e){let t=new mn(e);switch(this.readCommonEntityData(t),e.classVersion=this._objectReader.readBitLong(),e.insertPoint=this._objectReader.read3BitDouble(),e.uVector=this._objectReader.read3BitDouble(),e.vVector=this._objectReader.read3BitDouble(),e.size=this._objectReader.read2RawDouble(),e.flags=this._objectReader.readBitShort(),e.clippingState=this._objectReader.readBit(),e.brightness=this._objectReader.readByte(),e.contrast=this._objectReader.readByte(),e.fade=this._objectReader.readByte(),this.R2010Plus&&(e.clipMode=this._objectReader.readBit()?xi.Inside:xi.Outside),e.clipType=this._objectReader.readBitShort(),e.clipType){case $r.Rectangular:e.clipBoundaryVertices.push(this._objectReader.read2RawDouble()),e.clipBoundaryVertices.push(this._objectReader.read2RawDouble());break;case $r.Polygonal:{let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.clipBoundaryVertices.push(this._objectReader.read2RawDouble());break}}return t.ImgDefHandle=this.handleReference(),t.ImgReactorHandle=this.handleReference(),t}readImageDefinition(){let e=new Tr,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._mergedReaders.readBitLong(),e.size=this._mergedReaders.read2RawDouble(),e.fileName=this._mergedReaders.readVariableText(),e.isLoaded=this._mergedReaders.readBit(),e.units=this._mergedReaders.readByte(),e.defaultSize=this._mergedReaders.read2RawDouble(),t}readImageDefinitionReactor(){let e=new li,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._objectReader.readBitLong(),t}readOle2Frame(){let e=new dr,t=new Jn(e);this.readCommonEntityData(t),e.version=this._mergedReaders.readBitShort(),this.R2000Plus&&this._mergedReaders.readBitShort();let i=this._mergedReaders.readBitLong();return t.CadObject.binaryData=this._mergedReaders.readBytes(i),this.R2000Plus&&this._mergedReaders.readByte(),t}readPdfDefinition(){let e=new hi,t=new K(e);return this.readCommonNonEntityData(t),e.file=this._objectReader.readVariableText(),e.page=this._objectReader.readVariableText(),t}readPdfUnderlay(){let e=new Qr,t=new ga(e);this.readCommonEntityData(t),e.normal=this._objectReader.read3BitDouble(),e.insertPoint=this._objectReader.read3BitDouble(),e.rotation=this._objectReader.readBitDouble(),e.xScale=this._objectReader.readBitDouble(),e.yScale=this._objectReader.readBitDouble(),e.zScale=this._objectReader.readBitDouble(),e.flags=this._objectReader.readByte(),e.contrast=this._objectReader.readByte(),e.fade=this._objectReader.readByte(),t.DefinitionHandle=this.handleReference();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++)e.clipBoundaryVertices.push(this._mergedReaders.read2RawDouble());return t}readProxyEntity(){let e=new Tn,t=new k(e);return this.readCommonEntityData(t),this.readCommonProxyData(e),t}readProxyObject(){let e=new Er,t=new K(e);return this.readCommonNonEntityData(t),this.readCommonProxyData(e),t}readCommonProxyData(e){let t=this._mergedReaders.readBitLong(),i=this._classes.get(t);if(i&&(e.dxfClass=i),this.R2000Plus){if(this._version>m.AC1015&&this._mergedReaders.readVariableText(),this.R2018Plus)e.version=this._mergedReaders.readBitLong(),e.maintenanceVersion=this._mergedReaders.readBitLong();else{let s=this._mergedReaders.readBitLong();e.version=s&65535,e.maintenanceVersion=s>>16}e.originalDataFormatDxf=this._mergedReaders.readBit()}}readDictionary(){let e=new xe,t=new Vs(e);return this.readCommonDictionary(t),t}readDictionaryVar(){let e=new He,t=new K(e);return this.readCommonNonEntityData(t),this._objectReader.readByte(),e.value=this._textReader.readVariableText(),t}readDictionaryWithDefault(){let e=new Cr,t=new aa(e);return this.readCommonDictionary(t),t.DefaultEntryHandle=this.handleReference(),t}readCommonDictionary(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();this._version===m.AC1014&&this._objectReader.readByte(),this.R2000Plus&&(e.CadObject.clonningFlags=this._objectReader.readBitShort(),e.CadObject.hardOwnerFlag=this._objectReader.readByte()>0);for(let i=0;i<t;++i){let s=this._textReader.readVariableText(),n=this.handleReference();n===0||!s||s.length===0||e.Entries.set(s,n)}}readGroup(){let e=new Ot,t=new ha(e);this.readCommonNonEntityData(t),e.description=this._textReader.readVariableText(),this._objectReader.readBitShort(),e.selectable=this._objectReader.readBitShort()>0;let i=this._objectReader.readBitLong();for(let s=0;s<i;++s)t.Handles.add(this.handleReference());return t}readXRecord(){let e=new _t,t=new wa(e);this.readCommonNonEntityData(t);let i=this._objectReader.readBitLong()+this._objectReader.position;for(;this._objectReader.position<i;){let n=this._objectReader.readShort();switch(Be.transformValue(n)){case _.String:case _.ExtendedDataString:e.createEntry(n,this._objectReader.readTextUnicode());break;case _.Point3D:e.createEntry(n,new c(this._objectReader.readDouble(),this._objectReader.readDouble(),this._objectReader.readDouble()));break;case _.Double:case _.ExtendedDataDouble:e.createEntry(n,this._objectReader.readDouble());break;case _.Byte:e.createEntry(n,this._objectReader.readByte());break;case _.Int16:case _.ExtendedDataInt16:e.createEntry(n,this._objectReader.readShort());break;case _.Int32:case _.ExtendedDataInt32:e.createEntry(n,this._objectReader.readRawLong());break;case _.Int64:e.createEntry(n,this._objectReader.readRawULong());break;case _.Handle:{let o=this._objectReader.readTextUnicode(),h=parseInt(o,16);isNaN(h)?this.notify(`Failed to parse ${o} to handle`,g.Warning):t.AddHandleReference(n,h);break}case _.Bool:e.createEntry(n,this._objectReader.readByte()>0);break;case _.Chunk:case _.ExtendedDataChunk:e.createEntry(n,this._objectReader.readBytes(this._objectReader.readByte()));break;case _.ObjectId:case _.ExtendedDataHandle:t.AddHandleReference(n,this._objectReader.readRawULong());break;default:this.notify(`Unidentified GroupCodeValueType ${n} for XRecord [${e.handle}]`,g.Warning);break}}this.R2000Plus&&(e.cloningFlags=this._objectReader.readBitShort());let s=this._objectInitialPos+this._size*8-7;for(;this._handlesReader.positionInBits()<s;)this.handleReference();return t}readSortentsTable(){let e=new Br,t=new ca(e);this.readCommonNonEntityData(t),t.BlockOwnerHandle=this.handleReference();let i=this._mergedReaders.readBitLong();for(let s=0;s<i;s++){let n=this._objectReader.handleReference(),a=this.handleReference();t.Values.push([n,a])}return t}readScale(){let e=new Ge,t=new K(e);return this.readCommonNonEntityData(t),this._mergedReaders.readBitShort(),e.name=this._mergedReaders.readVariableText(),e.paperUnits=this._mergedReaders.readBitDouble(),e.drawingUnits=this._mergedReaders.readBitDouble(),e.isUnitScale=this._mergedReaders.readBit(),t}readRasterVariables(){let e=new Ar,t=new K(e);return this.readCommonNonEntityData(t),e.classVersion=this._mergedReaders.readBitLong(),e.isDisplayFrameShown=this._mergedReaders.readBitShort()!==0,e.displayQuality=this._mergedReaders.readBitShort(),e.units=this._mergedReaders.readBitShort(),t}readDbColor(){let e=new ui,t=new K(e);this.readCommonNonEntityData(t);let i=this._objectReader.readBitShort();if(this.R2004Plus){let s=this._objectReader.readBitLong()>>>0,n=this._objectReader.readByte();(n&1)>0&&(e.colorName=this._textReader.readVariableText()),(n&2)>0&&(e.bookName=this._textReader.readVariableText());let a=As.getBytes(s);e.color=new B(a[2],a[1],a[0])}else e.color=new B(i);return t}readDimStyle(){let e=new re,t=new Hn(e);this.readCommonNonEntityData(t);let i=this._textReader.readVariableText();return i&&i.trim().length>0&&(e.name=i),this.readXrefDependantBit(e),this.R13_14Only&&(e.generateTolerances=this._objectReader.readBit(),e.limitsGeneration=this._objectReader.readBit(),e.textOutsideHorizontal=this._objectReader.readBit(),e.suppressFirstExtensionLine=this._objectReader.readBit(),e.suppressSecondExtensionLine=this._objectReader.readBit(),e.textInsideHorizontal=this._objectReader.readBit(),e.alternateUnitDimensioning=this._objectReader.readBit(),e.textOutsideExtensions=this._objectReader.readBit(),e.separateArrowBlocks=this._objectReader.readBit(),e.textInsideExtensions=this._objectReader.readBit(),e.suppressOutsideExtensions=this._objectReader.readBit(),e.alternateUnitDecimalPlaces=this._objectReader.readByte(),e.zeroHandling=this._objectReader.readRawChar(),e.suppressFirstDimensionLine=this._objectReader.readBit(),e.suppressSecondDimensionLine=this._objectReader.readBit(),e.toleranceAlignment=this._objectReader.readRawChar(),e.textHorizontalAlignment=this._objectReader.readByte(),e.dimensionFit=this._objectReader.readRawChar(),e.cursorUpdate=this._objectReader.readBit(),e.toleranceZeroHandling=this._objectReader.readByte(),e.alternateUnitZeroHandling=this._objectReader.readByte(),e.alternateUnitToleranceZeroHandling=this._objectReader.readByte(),e.textVerticalAlignment=this._objectReader.readByte(),e.dimensionUnit=this._objectReader.readBitShort(),e.angularUnit=this._objectReader.readBitShort(),e.decimalPlaces=this._objectReader.readBitShort(),e.toleranceDecimalPlaces=this._objectReader.readBitShort(),e.alternateUnitFormat=this._objectReader.readBitShort(),e.alternateUnitToleranceDecimalPlaces=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),e.arrowSize=this._objectReader.readBitDouble(),e.extensionLineOffset=this._objectReader.readBitDouble(),e.dimensionLineIncrement=this._objectReader.readBitDouble(),e.extensionLineExtension=this._objectReader.readBitDouble(),e.rounding=this._objectReader.readBitDouble(),e.dimensionLineExtension=this._objectReader.readBitDouble(),e.plusTolerance=this._objectReader.readBitDouble(),e.minusTolerance=this._objectReader.readBitDouble(),e.textHeight=this._objectReader.readBitDouble(),e.centerMarkSize=this._objectReader.readBitDouble(),e.tickSize=this._objectReader.readBitDouble(),e.alternateUnitScaleFactor=this._objectReader.readBitDouble(),e.linearScaleFactor=this._objectReader.readBitDouble(),e.textVerticalPosition=this._objectReader.readBitDouble(),e.toleranceScaleFactor=this._objectReader.readBitDouble(),e.dimensionLineGap=this._objectReader.readBitDouble(),e.postFix=this._textReader.readVariableText(),e.alternateDimensioningSuffix=this._textReader.readVariableText(),t.DIMBL_Name=this._textReader.readVariableText(),t.DIMBLK1_Name=this._textReader.readVariableText(),t.DIMBLK2_Name=this._textReader.readVariableText(),e.dimensionLineColor=this._objectReader.readColorByIndex(),e.extensionLineColor=this._objectReader.readColorByIndex(),e.textColor=this._objectReader.readColorByIndex()),this.R2000Plus&&(e.postFix=this._textReader.readVariableText(),e.alternateDimensioningSuffix=this._textReader.readVariableText(),e.scaleFactor=this._objectReader.readBitDouble(),e.arrowSize=this._objectReader.readBitDouble(),e.extensionLineOffset=this._objectReader.readBitDouble(),e.dimensionLineIncrement=this._objectReader.readBitDouble(),e.extensionLineExtension=this._objectReader.readBitDouble(),e.rounding=this._objectReader.readBitDouble(),e.dimensionLineExtension=this._objectReader.readBitDouble(),e.plusTolerance=this._objectReader.readBitDouble(),e.minusTolerance=this._objectReader.readBitDouble()),this.R2007Plus&&(e.fixedExtensionLineLength=this._objectReader.readBitDouble(),e.joggedRadiusDimensionTransverseSegmentAngle=this._objectReader.readBitDouble(),e.textBackgroundFillMode=this._objectReader.readBitShort(),e.textBackgroundColor=this._mergedReaders.readCmColor()),this.R2000Plus&&(e.generateTolerances=this._objectReader.readBit(),e.limitsGeneration=this._objectReader.readBit(),e.textInsideHorizontal=this._objectReader.readBit(),e.textOutsideHorizontal=this._objectReader.readBit(),e.suppressFirstExtensionLine=this._objectReader.readBit(),e.suppressSecondExtensionLine=this._objectReader.readBit(),e.textVerticalAlignment=this._objectReader.readBitShort(),e.zeroHandling=this._objectReader.readBitShort(),e.angularZeroHandling=this._objectReader.readBitShort()),this.R2007Plus&&(e.arcLengthSymbolPosition=this._objectReader.readBitShort()),this.R2000Plus&&(e.textHeight=this._objectReader.readBitDouble(),e.centerMarkSize=this._objectReader.readBitDouble(),e.tickSize=this._objectReader.readBitDouble(),e.alternateUnitScaleFactor=this._objectReader.readBitDouble(),e.linearScaleFactor=this._objectReader.readBitDouble(),e.textVerticalPosition=this._objectReader.readBitDouble(),e.toleranceScaleFactor=this._objectReader.readBitDouble(),e.dimensionLineGap=this._objectReader.readBitDouble(),e.alternateUnitRounding=this._objectReader.readBitDouble(),e.alternateUnitDimensioning=this._objectReader.readBit(),e.alternateUnitDecimalPlaces=this._objectReader.readBitShort(),e.textOutsideExtensions=this._objectReader.readBit(),e.separateArrowBlocks=this._objectReader.readBit(),e.textInsideExtensions=this._objectReader.readBit(),e.suppressOutsideExtensions=this._objectReader.readBit(),e.dimensionLineColor=this._mergedReaders.readCmColor(),e.extensionLineColor=this._mergedReaders.readCmColor(),e.textColor=this._mergedReaders.readCmColor(),e.angularDecimalPlaces=this._objectReader.readBitShort(),e.decimalPlaces=this._objectReader.readBitShort(),e.toleranceDecimalPlaces=this._objectReader.readBitShort(),e.alternateUnitFormat=this._objectReader.readBitShort(),e.alternateUnitToleranceDecimalPlaces=this._objectReader.readBitShort(),e.angularUnit=this._objectReader.readBitShort(),e.fractionFormat=this._objectReader.readBitShort(),e.linearUnitFormat=this._objectReader.readBitShort(),e.decimalSeparator=String.fromCharCode(this._objectReader.readBitShort()),e.textMovement=this._objectReader.readBitShort(),e.textHorizontalAlignment=this._objectReader.readBitShort(),e.suppressFirstDimensionLine=this._objectReader.readBit(),e.suppressSecondDimensionLine=this._objectReader.readBit(),e.toleranceAlignment=this._objectReader.readBitShort(),e.toleranceZeroHandling=this._objectReader.readBitShort(),e.alternateUnitZeroHandling=this._objectReader.readBitShort(),e.alternateUnitToleranceZeroHandling=this._objectReader.readBitShort(),e.cursorUpdate=this._objectReader.readBit(),e.dimensionFit=this._objectReader.readBitShort()),this.R2007Plus&&(e.isExtensionLineLengthFixed=this._objectReader.readBit()),this.R2010Plus&&(e.textDirection=this._objectReader.readBit()?_i.RightToLeft:_i.LeftToRight,e.altMzf=this._objectReader.readBitDouble(),e.altMzs=this._textReader.readVariableText(),e.mzf=this._objectReader.readBitDouble(),e.mzs=this._textReader.readVariableText()),this.R2000Plus&&(e.dimensionLineWeight=this._objectReader.readBitShort(),e.extensionLineWeight=this._objectReader.readBitShort()),this._objectReader.readBit(),t.BlockHandle=this.handleReference(),t.TextStyleHandle=this.handleReference(),this.R2000Plus&&(t.DIMLDRBLK=this.handleReference(),t.DIMBLK=this.handleReference(),t.DIMBLK1=this.handleReference(),t.DIMBLK2=this.handleReference()),this.R2007Plus&&(t.Dimltype=this.handleReference(),t.Dimltex1=this.handleReference(),t.Dimltex2=this.handleReference()),t}readView(){let e=new Vi,t=new ia(e);return this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.height=this._objectReader.readBitDouble(),e.width=this._objectReader.readBitDouble(),e.center=this._objectReader.read2RawDouble(),e.target=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.angle=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClipping=this._objectReader.readBitDouble(),e.backClipping=this._objectReader.readBitDouble(),this._objectReader.readBit()&&(e.viewMode|=se.PerspectiveView),this._objectReader.readBit()&&(e.viewMode|=se.FrontClipping),this._objectReader.readBit()&&(e.viewMode|=se.BackClipping),this._objectReader.readBit()&&(e.viewMode|=se.FrontClippingZ),this.R2000Plus&&(e.renderMode=this._objectReader.readByte()),this.R2007Plus&&(this._mergedReaders.readBit(),this._mergedReaders.readByte(),this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble(),this._mergedReaders.readCmColor()),this._objectReader.readBit()&&(e.flags|=1),this.R2000Plus&&(e.isUcsAssociated=this._objectReader.readBit(),e.isUcsAssociated&&(e.ucsOrigin=this._objectReader.read3BitDouble(),e.ucsXAxis=this._objectReader.read3BitDouble(),e.ucsYAxis=this._objectReader.read3BitDouble(),e.ucsElevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort())),this.handleReference(),this.R2007Plus&&(e.isPlottable=this._objectReader.readBit(),this.handleReference(),this.handleReference(),this.handleReference()),this.R2000Plus&&e.isUcsAssociated&&(t.UcsHandle=this.handleReference(),t.NamedUcsHandle=this.handleReference()),this.R2007Plus&&this.handleReference(),t}readVPort(){let e=new xt,t=new na(e);if(this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.viewHeight=this._objectReader.readBitDouble(),e.aspectRatio=this._objectReader.readBitDouble()/e.viewHeight,e.center=this._objectReader.read2RawDouble(),e.target=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.twistAngle=this._objectReader.readBitDouble(),e.lensLength=this._objectReader.readBitDouble(),e.frontClippingPlane=this._objectReader.readBitDouble(),e.backClippingPlane=this._objectReader.readBitDouble(),this._objectReader.readBit()&&(e.viewMode|=se.PerspectiveView),this._objectReader.readBit()&&(e.viewMode|=se.FrontClipping),this._objectReader.readBit()&&(e.viewMode|=se.BackClipping),this._objectReader.readBit()&&(e.viewMode|=se.FrontClippingZ),this.R2000Plus&&(e.renderMode=this._objectReader.readByte()),this.R2007Plus&&(e.useDefaultLighting=this._objectReader.readBit(),e.defaultLighting=this._objectReader.readByte(),e.brightness=this._objectReader.readBitDouble(),e.contrast=this._objectReader.readBitDouble(),e.ambientColor=this._mergedReaders.readCmColor()),e.bottomLeft=this._objectReader.read2RawDouble(),e.topRight=this._objectReader.read2RawDouble(),this._objectReader.readBit()&&(e.viewMode|=se.Follow),e.circleZoomPercent=this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()&&(e.ucsIconDisplay=vr.OnLower),this._objectReader.readBit()&&(e.ucsIconDisplay=vr.OnOrigin),e.showGrid=this._objectReader.readBit(),e.gridSpacing=this._objectReader.read2RawDouble(),e.snapOn=this._objectReader.readBit(),e.isometricSnap=this._objectReader.readBit(),e.snapIsoPair=this._objectReader.readBitShort(),e.snapRotation=this._objectReader.readBitDouble(),e.snapBasePoint=this._objectReader.read2RawDouble(),e.snapSpacing=this._objectReader.read2RawDouble(),this.R2000Plus){this._objectReader.readBit();let i=this._objectReader.readBit();e.origin=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.orthographicType=this._objectReader.readBitShort()}return this.R2007Plus&&(e.gridFlags=this._objectReader.readBitShort(),e.minorGridLinesPerMajorGridLine=this._objectReader.readBitShort()),t.VportControlHandle=this.handleReference(),this.R2007Plus&&(t.BackgroundHandle=this.handleReference(),t.StyleHandle=this.handleReference(),t.SunHandle=this.handleReference()),this.R2000Plus&&(t.NamedUcsHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference()),t}readUcs(){let e=new ot,t=new ra(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),this.readXrefDependantBit(e),e.origin=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),this.R2000Plus&&(e.elevation=this._objectReader.readBitDouble(),e.orthographicViewType=this._objectReader.readBitShort(),e.orthographicType=this._objectReader.readBitShort());let i=this.handleReference();if(this.R2000Plus){let s=this.handleReference(),n=this.handleReference()}return t}readLayout(){let e=new nt,t=new Un(e);this.readCommonNonEntityData(t),this.readPlotSettingsData(e),e.name=this._textReader.readVariableText(),e.tabOrder=this._objectReader.readBitLong(),e.layoutFlags=this._objectReader.readBitShort(),e.origin=this._objectReader.read3BitDouble(),e.minLimits=this._objectReader.read2RawDouble(),e.maxLimits=this._objectReader.read2RawDouble(),e.insertionBasePoint=this._objectReader.read3BitDouble(),e.xAxis=this._objectReader.read3BitDouble(),e.yAxis=this._objectReader.read3BitDouble(),e.elevation=this._objectReader.readBitDouble(),e.ucsOrthographicType=this._objectReader.readBitShort(),e.minExtents=this._objectReader.read3BitDouble(),e.maxExtents=this._objectReader.read3BitDouble();let i=0;if(this.R2004Plus&&(i=this._objectReader.readBitLong()),t.PaperSpaceBlockHandle=this.handleReference(),t.ActiveViewportHandle=this.handleReference(),t.BaseUcsHandle=this.handleReference(),t.NamesUcsHandle=this.handleReference(),this.R2004Plus)for(let s=0;s<i;s++)t.ViewportHandles.add(this.handleReference());return t}readLeader(){let e=new nr,t=new vn(e);this.readCommonEntityData(t),this._objectReader.readBit(),e.creationType=this._objectReader.readBitShort(),e.pathType=this._objectReader.readBitShort();let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.vertices.push(this._objectReader.read3BitDouble());return this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.horizontalDirection=this._objectReader.read3BitDouble(),e.blockOffset=this._objectReader.read3BitDouble(),this._version>=m.AC1014&&(e.annotationOffset=this._objectReader.read3BitDouble()),this.R13_14Only&&(e.style.dimensionLineGap=this._objectReader.readBitDouble()),this._version<=m.AC1021&&(e.textHeight=this._objectReader.readBitDouble(),e.textWidth=this._objectReader.readBitDouble()),e.hookLineDirection=this._objectReader.readBit()?Di.Same:Di.Opposite,e.arrowHeadEnabled=this._objectReader.readBit(),this.R13_14Only&&(this._objectReader.readBitShort(),t.Dimasz=this._objectReader.readBitDouble(),this._objectReader.readBit(),this._objectReader.readBit(),this._objectReader.readBitShort(),this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()),this.R2000Plus&&(this._objectReader.readBitShort(),this._objectReader.readBit(),this._objectReader.readBit()),t.AnnotationHandle=this.handleReference(),t.DIMSTYLEHandle=this.handleReference(),t}readMultiLeader(){let e=new lr,t=new $n(e);if(this.readCommonEntityData(t),this.R2010Plus){let s=this._objectReader.readBitShort()}if(this.readMultiLeaderAnnotContextData(e.contextData,t.CadMLeaderAnnotContextTemplate),t.LeaderStyleHandle=this.handleReference(),e.propertyOverrideFlags=this._objectReader.readBitLong(),e.pathType=this._objectReader.readBitShort(),e.lineColor=this._mergedReaders.readCmColor(),t.LeaderLineTypeHandle=this.handleReference(),e.leaderLineWeight=this._objectReader.readBitLong(),e.enableLanding=this._objectReader.readBit(),e.enableDogleg=this._objectReader.readBit(),e.landingDistance=this._objectReader.readBitDouble(),t.ArrowheadHandle=this.handleReference(),e.arrowheadSize=this._objectReader.readBitDouble(),e.contentType=this._objectReader.readBitShort(),t.MTextStyleHandle=this.handleReference(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAngle=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.textColor=this._mergedReaders.readCmColor(),e.textFrame=this._objectReader.readBit(),t.BlockContentHandle=this.handleReference(),e.blockContentColor=this._mergedReaders.readCmColor(),e.blockContentScale=this._objectReader.read3BitDouble(),e.blockContentRotation=this._objectReader.readBitDouble(),e.blockContentConnection=this._objectReader.readBitShort(),e.enableAnnotationScale=this._objectReader.readBit(),this.R2007Pre){let s=this._objectReader.readBitLong();for(let n=0;n<s;n++){let a=this._objectReader.readBit();t.ArrowheadHandles.set(this.handleReference(),a)}}let i=this._objectReader.readBitLong();for(let s=0;s<i;s++){let n=this.handleReference(),a=new gl;a.text=this._textReader.readVariableText(),a.index=this._objectReader.readBitShort(),a.width=this._objectReader.readBitDouble(),e.blockAttributes.push(a),t.BlockAttributeHandles.set(a,n)}return e.textDirectionNegative=this._objectReader.readBit(),e.textAligninIPE=this._objectReader.readBitShort()!==0,e.textAttachmentPoint=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),this.R2010Plus&&(e.textAttachmentDirection=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort(),e.textTopAttachment=this._objectReader.readBitShort()),this.R2013Plus&&(e.extendedToText=this._objectReader.readBit()),t}readMultiLeaderAnnotContext(){let e=new Dr,t=new ai(e);return this.readAnnotScaleObjectContextData(t),this.readMultiLeaderAnnotContextData(e,t),t}readMultiLeaderAnnotContextData(e,t){let i=this._objectReader.readBitLong();if(i===0){let s=this._objectReader.readBit(),n=this._objectReader.readBit(),a=this._objectReader.readBit(),o=this._objectReader.readBit(),h=this._objectReader.readBit(),f=this._objectReader.readBit(),b=this._objectReader.readBit();i=f?2:1}for(let s=0;s<i;s++)e.leaderRoots.push(this.readLeaderRoot(t));if(e.scaleFactor=this._objectReader.readBitDouble(),e.contentBasePoint=this._objectReader.read3BitDouble(),e.textHeight=this._objectReader.readBitDouble(),e.arrowheadSize=this._objectReader.readBitDouble(),e.landingGap=this._objectReader.readBitDouble(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.blockContentConnection=this._objectReader.readBitShort(),e.hasTextContents=this._objectReader.readBit(),e.hasTextContents){e.textLabel=this._textReader.readVariableText(),e.textNormal=this._objectReader.read3BitDouble(),t.TextStyleHandle=this.handleReference(),e.textLocation=this._objectReader.read3BitDouble(),e.direction=this._objectReader.read3BitDouble(),e.textRotation=this._objectReader.readBitDouble(),e.boundaryWidth=this._objectReader.readBitDouble(),e.boundaryHeight=this._objectReader.readBitDouble(),e.lineSpacingFactor=this._objectReader.readBitDouble(),e.lineSpacing=this._objectReader.readBitShort(),e.textColor=this._objectReader.readCmColor(),e.textAttachmentPoint=this._objectReader.readBitShort(),e.flowDirection=this._objectReader.readBitShort(),e.backgroundFillColor=this._objectReader.readCmColor(),e.backgroundScaleFactor=this._objectReader.readBitDouble(),e.backgroundTransparency=this._objectReader.readBitLong(),e.backgroundFillEnabled=this._objectReader.readBit(),e.backgroundMaskFillOn=this._objectReader.readBit(),e.columnType=this._objectReader.readBitShort(),e.textHeightAutomatic=this._objectReader.readBit(),e.columnWidth=this._objectReader.readBitDouble(),e.columnGutter=this._objectReader.readBitDouble(),e.columnFlowReversed=this._objectReader.readBit();let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)e.columnSizes.push(this._objectReader.readBitDouble());e.wordBreak=this._objectReader.readBit(),this._objectReader.readBit()}else if(e.hasContentsBlock=this._objectReader.readBit()){t.BlockRecordHandle=this.handleReference(),e.blockContentNormal=this._objectReader.read3BitDouble(),e.blockContentLocation=this._objectReader.read3BitDouble(),e.blockContentScale=this._objectReader.read3BitDouble(),e.blockContentRotation=this._objectReader.readBitDouble(),e.blockContentColor=this._objectReader.readCmColor();let s=this._objectReader.readBitDouble(),n=this._objectReader.readBitDouble(),a=this._objectReader.readBitDouble(),o=this._objectReader.readBitDouble(),h=this._objectReader.readBitDouble(),f=this._objectReader.readBitDouble(),b=this._objectReader.readBitDouble(),S=this._objectReader.readBitDouble(),N=this._objectReader.readBitDouble(),L=this._objectReader.readBitDouble(),j=this._objectReader.readBitDouble(),we=this._objectReader.readBitDouble(),z=this._objectReader.readBitDouble(),X=this._objectReader.readBitDouble(),qi=this._objectReader.readBitDouble(),_s=this._objectReader.readBitDouble(),_e=it.identity();_e.m00=s,_e.m10=n,_e.m20=a,_e.m30=o,_e.m01=h,_e.m11=f,_e.m21=b,_e.m31=S,_e.m02=N,_e.m12=L,_e.m22=j,_e.m32=we,_e.m03=z,_e.m13=X,_e.m23=qi,_e.m33=_s,e.transformationMatrix=_e}return e.basePoint=this._objectReader.read3BitDouble(),e.baseDirection=this._objectReader.read3BitDouble(),e.baseVertical=this._objectReader.read3BitDouble(),e.normalReversed=this._objectReader.readBit(),this.R2010Plus&&(e.textTopAttachment=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort()),e}readMultiLeaderStyle(){let e=new $e,t=new Yn(e);if(this.readCommonNonEntityData(t),this.R2010Plus){let i=this._objectReader.readBitShort()}return e.contentType=this._objectReader.readBitShort(),e.multiLeaderDrawOrder=this._objectReader.readBitShort(),e.leaderDrawOrder=this._objectReader.readBitShort(),e.maxLeaderSegmentsPoints=this._objectReader.readBitLong(),e.firstSegmentAngleConstraint=this._objectReader.readBitDouble(),e.secondSegmentAngleConstraint=this._objectReader.readBitDouble(),e.pathType=this._objectReader.readBitShort(),e.lineColor=this._mergedReaders.readCmColor(),t.LeaderLineTypeHandle=this.handleReference(),e.leaderLineWeight=this._objectReader.readBitLong(),e.enableLanding=this._objectReader.readBit(),e.landingGap=this._objectReader.readBitDouble(),e.enableDogleg=this._objectReader.readBit(),e.landingDistance=this._objectReader.readBitDouble(),e.description=this._mergedReaders.readVariableText(),t.ArrowheadHandle=this.handleReference(),e.arrowheadSize=this._objectReader.readBitDouble(),e.defaultTextContents=this._mergedReaders.readVariableText(),t.MTextStyleHandle=this.handleReference(),e.textLeftAttachment=this._objectReader.readBitShort(),e.textRightAttachment=this._objectReader.readBitShort(),e.textAngle=this._objectReader.readBitShort(),e.textAlignment=this._objectReader.readBitShort(),e.textColor=this._mergedReaders.readCmColor(),e.textHeight=this._objectReader.readBitDouble(),e.textFrame=this._objectReader.readBit(),e.textAlignAlwaysLeft=this._objectReader.readBit(),e.alignSpace=this._objectReader.readBitDouble(),t.BlockContentHandle=this.handleReference(),e.blockContentColor=this._mergedReaders.readCmColor(),e.blockContentScale=this._objectReader.read3BitDouble(),e.enableBlockContentScale=this._objectReader.readBit(),e.blockContentRotation=this._objectReader.readBitDouble(),e.enableBlockContentRotation=this._objectReader.readBit(),e.blockContentConnection=this._objectReader.readBitShort(),e.scaleFactor=this._objectReader.readBitDouble(),e.overwritePropertyValue=this._objectReader.readBit(),e.isAnnotative=this._objectReader.readBit(),e.breakGapSize=this._objectReader.readBitDouble(),this.R2010Plus&&(e.textAttachmentDirection=this._objectReader.readBitShort(),e.textBottomAttachment=this._objectReader.readBitShort(),e.textTopAttachment=this._objectReader.readBitShort()),this.R2013Plus&&(e.unknownFlag298=this._objectReader.readBit()),t}readMaterial(){let e=new at,t=new Zn(e);if(this.readCommonNonEntityData(t),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.ambientColorMethod=this._mergedReaders.readByte(),e.ambientColorFactor=this._mergedReaders.readBitDouble(),e.ambientColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.ambientColor=new B(s[2],s[1],s[0])}if(e.diffuseColorMethod=this._mergedReaders.readByte(),e.diffuseColorFactor=this._mergedReaders.readBitDouble(),e.diffuseColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.diffuseColor=new B(s[2],s[1],s[0])}switch(e.diffuseMapBlendFactor=this._mergedReaders.readBitDouble(),e.diffuseProjectionMethod=this._mergedReaders.readByte(),e.diffuseTilingMethod=this._mergedReaders.readByte(),e.diffuseAutoTransform=this._mergedReaders.readByte(),e.diffuseMatrix=this.readMatrix4(),e.diffuseMapSource=this._mergedReaders.readByte(),e.diffuseMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.diffuseMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}if(e.specularColorMethod=this._mergedReaders.readByte(),e.specularColorFactor=this._mergedReaders.readBitDouble(),e.specularColorMethod===oi.Override){let i=this._mergedReaders.readBitLong()>>>0,s=As.getBytes32(i);e.specularColor=new B(s[2],s[1],s[0])}switch(e.specularMapBlendFactor=this._mergedReaders.readBitDouble(),e.specularProjectionMethod=this._mergedReaders.readByte(),e.specularTilingMethod=this._mergedReaders.readByte(),e.specularAutoTransform=this._mergedReaders.readByte(),e.specularMatrix=this.readMatrix4(),e.specularMapSource=this._mergedReaders.readByte(),e.specularMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.specularMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.specularGlossFactor=this._objectReader.readBitDouble(),e.reflectionMapBlendFactor=this._mergedReaders.readBitDouble(),e.reflectionProjectionMethod=this._mergedReaders.readByte(),e.reflectionTilingMethod=this._mergedReaders.readByte(),e.reflectionAutoTransform=this._mergedReaders.readByte(),e.reflectionMatrix=this.readMatrix4(),e.reflectionMapSource=this._mergedReaders.readByte(),e.reflectionMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.reflectionMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.opacity=this._mergedReaders.readBitDouble(),e.opacityMapBlendFactor=this._mergedReaders.readBitDouble(),e.opacityProjectionMethod=this._mergedReaders.readByte(),e.opacityTilingMethod=this._mergedReaders.readByte(),e.opacityAutoTransform=this._mergedReaders.readByte(),e.opacityMatrix=this.readMatrix4(),e.opacityMapSource=this._mergedReaders.readByte(),e.opacityMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.opacityMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.bumpMapBlendFactor=this._mergedReaders.readBitDouble(),e.bumpProjectionMethod=this._mergedReaders.readByte(),e.bumpTilingMethod=this._mergedReaders.readByte(),e.bumpAutoTransform=this._mergedReaders.readByte(),e.bumpMatrix=this.readMatrix4(),e.bumpMapSource=this._mergedReaders.readByte(),e.bumpMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.bumpMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}switch(e.refractionIndex=this._mergedReaders.readBitDouble(),e.refractionMapBlendFactor=this._mergedReaders.readBitDouble(),e.refractionProjectionMethod=this._mergedReaders.readByte(),e.refractionTilingMethod=this._mergedReaders.readByte(),e.refractionAutoTransform=this._mergedReaders.readByte(),e.refractionMatrix=this.readMatrix4(),e.refractionMapSource=this._mergedReaders.readByte(),e.refractionMapSource){case ee.UseCurrentScene:break;case ee.UseImageFile:e.refractionMapFileName=this._mergedReaders.readVariableText();break;case ee.Procedural:throw new Error("Procedural map source not implemented")}return t}readMLine(){let e=new or,t=new Xn(e);this.readCommonEntityData(t),e.scaleFactor=this._objectReader.readBitDouble(),e.justification=this._objectReader.readByte(),e.startPoint=this._objectReader.read3BitDouble(),e.normal=this._objectReader.read3BitDouble(),e.flags|=this._objectReader.readBitShort()===3?Bi.Closed:Bi.Has;let i=this._objectReader.readByte(),s=this._objectReader.readBitShort();for(let n=0;n<s;n++){let a=new yn;a.position=this._objectReader.read3BitDouble(),a.direction=this._objectReader.read3BitDouble(),a.miter=this._objectReader.read3BitDouble();for(let o=0;o<i;o++){let h=new Bn,f=this._objectReader.readBitShort();for(let S=0;S<f;S++)h.parameters.push(this._objectReader.readBitDouble());let b=this._objectReader.readBitShort();for(let S=0;S<b;S++)h.areaFillParameters.push(this._objectReader.readBitDouble());a.segments.push(h)}e.vertices.push(a)}return t.MLineStyleHandle=this.handleReference(),t}readMLineStyle(){let e=new wt,t=new Pi(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),e.description=this._textReader.readVariableText();let i=this._objectReader.readBitShort();(i&1)>0&&(e.flags|=ge.DisplayJoints),(i&2)>0&&(e.flags|=ge.FillOn),(i&16)>0&&(e.flags|=ge.StartSquareCap),(i&32)>0&&(e.flags|=ge.StartRoundCap),(i&64)>0&&(e.flags|=ge.StartInnerArcsCap),(i&256)>0&&(e.flags|=ge.EndSquareCap),(i&512)>0&&(e.flags|=ge.EndRoundCap),(i&1024)>0&&(e.flags|=ge.EndInnerArcsCap),e.fillColor=this._mergedReaders.readCmColor(),e.startAngle=this._objectReader.readBitDouble(),e.endAngle=this._objectReader.readBitDouble();let s=this._objectReader.readByte();for(let n=0;n<s;n++){let a=new js,o=new Pi.ElementTemplate(a);a.offset=this._objectReader.readBitDouble(),a.color=this._mergedReaders.readCmColor(),this.R2018Plus?o.LineTypeHandle=this.handleReference():o.LinetypeIndex=this._objectReader.readBitShort(),t.ElementTemplates.push(o),e.addElement(a)}return t}readGeoData(){let e=new Jt,t=new da(e);switch(this.readCommonNonEntityData(t),e.version=this._mergedReaders.readBitLong(),t.HostBlockHandle=this.handleReference(),e.coordinatesType=this._mergedReaders.readBitShort(),e.version){case We.R2009:e.referencePoint=this._mergedReaders.read3BitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.verticalUnits=e.horizontalUnits,e.designPoint=this._mergedReaders.read3BitDouble(),this._mergedReaders.read3BitDouble(),e.upDirection=this._mergedReaders.read3BitDouble();let n=Math.PI/2-this._mergedReaders.readBitDouble();e.northDirection=new C(Math.cos(n),Math.sin(n)),this._mergedReaders.read3BitDouble(),e.coordinateSystemDefinition=this._mergedReaders.readVariableText(),e.geoRssTag=this._mergedReaders.readVariableText(),e.horizontalUnitScale=this._mergedReaders.readBitDouble(),e.verticalUnitScale=e.horizontalUnitScale,this._mergedReaders.readVariableText(),this._mergedReaders.readVariableText();break;case We.R2010:case We.R2013:e.designPoint=this._mergedReaders.read3BitDouble(),e.referencePoint=this._mergedReaders.read3BitDouble(),e.horizontalUnitScale=this._mergedReaders.readBitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.verticalUnitScale=this._mergedReaders.readBitDouble(),e.horizontalUnits=this._mergedReaders.readBitLong(),e.upDirection=this._mergedReaders.read3BitDouble(),e.northDirection=this._mergedReaders.read2RawDouble(),e.scaleEstimationMethod=this._mergedReaders.readBitLong(),e.userSpecifiedScaleFactor=this._mergedReaders.readBitDouble(),e.enableSeaLevelCorrection=this._mergedReaders.readBit(),e.seaLevelElevation=this._mergedReaders.readBitDouble(),e.coordinateProjectionRadius=this._mergedReaders.readBitDouble(),e.coordinateSystemDefinition=this._mergedReaders.readVariableText(),e.geoRssTag=this._mergedReaders.readVariableText();break}e.observationFromTag=this._mergedReaders.readVariableText(),e.observationToTag=this._mergedReaders.readVariableText(),e.observationCoverageTag=this._mergedReaders.readVariableText();let i=this._mergedReaders.readBitLong();for(let n=0;n<i;n++){let a=new la;a.source=this._mergedReaders.read2RawDouble(),a.destination=this._mergedReaders.read2RawDouble(),e.points.push(a)}let s=this._mergedReaders.readBitLong();for(let n=0;n<s;n++){let a=new oa;a.index1=this._mergedReaders.readBitLong(),a.index2=this._mergedReaders.readBitLong(),a.index3=this._mergedReaders.readBitLong(),e.faces.push(a)}return t}readTableStyle(){let e=new Ye,t=new pa(e);if(this.readCommonNonEntityData(t),this.R2007Pre)return e.description=this._mergedReaders.readVariableText(),e.flowDirection=this._mergedReaders.readBitShort(),e.flags=this._mergedReaders.readBitShort(),e.horizontalCellMargin=this._mergedReaders.readBitDouble(),e.verticalCellMargin=this._mergedReaders.readBitDouble(),e.suppressTitle=this._mergedReaders.readBit(),e.suppressHeaderRow=this._mergedReaders.readBit(),this.readRowCellStyle(t,e.dataCellStyle),this.readRowCellStyle(t,e.titleCellStyle),this.readRowCellStyle(t,e.headerCellStyle),t;let i=this._mergedReaders.readByte();e.description=this._mergedReaders.readVariableText();let s=this._mergedReaders.readBitLong(),n=this._mergedReaders.readBitLong(),a=this.handleReference(),o=new jt(e.tableCellStyle);this.readCellStyle(o),e.tableCellStyle.id=this._mergedReaders.readBitLong(),e.tableCellStyle.styleClass=this._mergedReaders.readBitLong(),e.tableCellStyle.name=this._mergedReaders.readVariableText();let h=this._mergedReaders.readBitLong();for(let f=0;f<h;f++){let b=new os,S=new jt(b);t.CellStyleTemplates.push(S);let N=this._mergedReaders.readBitLong();this.readCellStyle(S),b.id=this._mergedReaders.readBitLong(),b.styleClass=this._mergedReaders.readBitLong(),b.name=this._mergedReaders.readVariableText()}return t}readVisualStyle(){let e=new di,t=new K(e);this.readCommonNonEntityData(t),e.name=this._textReader.readVariableText(),e.type=this._objectReader.readBitLong();let i=this._objectReader.readBitShort(),s=this._objectReader.readBit(),n=this._objectReader.readBitLong();return t}readPlotSettingsEntity(){let e=new pt,t=new Vl(e);return this.readCommonNonEntityData(t),this.readPlotSettingsData(e),t}readPlotSettings(){return this.readPlotSettingsEntity()}readPlotSettingsData(e){e.pageName=this._textReader.readVariableText(),e.systemPrinterName=this._textReader.readVariableText(),e.flags=this._objectReader.readBitShort();let t=new un;if(t.left=this._objectReader.readBitDouble(),t.bottom=this._objectReader.readBitDouble(),t.right=this._objectReader.readBitDouble(),t.top=this._objectReader.readBitDouble(),e.unprintableMargin=t,e.paperWidth=this._objectReader.readBitDouble(),e.paperHeight=this._objectReader.readBitDouble(),e.paperSize=this._textReader.readVariableText(),e.plotOriginX=this._objectReader.readBitDouble(),e.plotOriginY=this._objectReader.readBitDouble(),e.paperUnits=this._objectReader.readBitShort(),e.paperRotation=this._objectReader.readBitShort(),e.plotType=this._objectReader.readBitShort(),e.windowLowerLeftX=this._objectReader.readBitDouble(),e.windowLowerLeftY=this._objectReader.readBitDouble(),e.windowUpperLeftX=this._objectReader.readBitDouble(),e.windowUpperLeftY=this._objectReader.readBitDouble(),this._version>=m.AC1012&&this._version<=m.AC1015&&(e.plotViewName=this._textReader.readVariableText()),e.numeratorScale=this._objectReader.readBitDouble(),e.denominatorScale=this._objectReader.readBitDouble(),e.styleSheet=this._textReader.readVariableText(),e.scaledFit=this._objectReader.readBitShort(),e.standardScale=this._objectReader.readBitDouble(),e.paperImageOrigin=this._objectReader.read2BitDouble(),this.R2004Plus){e.shadePlotMode=this._objectReader.readBitShort(),e.shadePlotResolutionMode=this._objectReader.readBitShort(),e.shadePlotDPI=this._objectReader.readBitShort();let i=this.handleReference()}this.R2007Plus&&this.handleReference()}readEvaluationGraph(){let e=new yr,t=new Mi(e);this.readCommonNonEntityData(t),e.value96=this._objectReader.readBitLong(),e.value97=this._objectReader.readBitLong();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++){let a=new Mi.GraphNodeTemplate,o=new xa;t.NodeTemplates.push(a),o.index=this._objectReader.readBitLong(),o.flags=this._objectReader.readBitLong(),o.nextNodeIndex=this._objectReader.readBitLong(),a.ExpressionHandle=this.handleReference(),o.data1=this._objectReader.readBitLong(),o.data2=this._objectReader.readBitLong(),o.data3=this._objectReader.readBitLong(),o.data4=this._objectReader.readBitLong()}let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong(),this._objectReader.readBitLong();return t}readSpatialFilter(){let e=new qt,t=new K(e);this.readCommonNonEntityData(t);let i=this._mergedReaders.readBitShort();for(let s=0;s<i;s++)e.boundaryPoints.push(this._mergedReaders.read2RawDouble());return e.normal=this._mergedReaders.read3BitDouble(),e.origin=this._mergedReaders.read3BitDouble(),e.displayBoundary=this._mergedReaders.readBitShort()!==0,e.clipFrontPlane=this._mergedReaders.readBitShort()!==0,e.clipFrontPlane&&(e.frontDistance=this._mergedReaders.readBitDouble()),e.clipBackPlane=this._mergedReaders.readBitShort()!==0,e.clipBackPlane&&(e.backDistance=this._mergedReaders.readBitDouble()),e.inverseInsertTransform=this.read4x3Matrix(),e.insertTransform=this.read4x3Matrix(),t}readDimensionAssociation(){let e=new Xe,t=new Ii(e);return this.readCommonNonEntityData(t),t.DimensionHandle=this.handleReference(),e.associativityFlags=this._mergedReaders.readBitLong(),e.isTransSpace=this._mergedReaders.readBit(),e.rotatedDimensionType=this._mergedReaders.readByte(),(e.associativityFlags&he.FirstPointReference)!==0&&(t.FirstPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.SecondPointReference)!==0&&(t.SecondPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.ThirdPointReference)!==0&&(t.ThirdPointRef=this.readOsnapPointRef()),(e.associativityFlags&he.FourthPointReference)!==0&&(t.FourthPointRef=this.readOsnapPointRef()),t}readOsnapPointRef(){let e=new fs,t=new Ii.OsnapPointRefTemplate(e),i=this._mergedReaders.readVariableText();return e.objectOsnapType=this._mergedReaders.readByte(),t.ObjectHandle=this.handleReference(),t}readBlockFlipAction(){let e=new Ql,t=new Wl(e);return this.readBlockAction(t),e.value92=this._mergedReaders.readBitLong(),e.value93=this._mergedReaders.readBitLong(),e.value94=this._mergedReaders.readBitLong(),e.value95=this._mergedReaders.readBitLong(),e.caption301=this._mergedReaders.readVariableText(),e.caption302=this._mergedReaders.readVariableText(),e.caption303=this._mergedReaders.readVariableText(),e.caption304=this._mergedReaders.readVariableText(),t}readBlockFlipParameter(){let e=new ed,t=new Hl(e);return this.readBlock2PtParameter(t),e.caption=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.baseStateName=this._mergedReaders.readVariableText(),e.flippedStateName=this._mergedReaders.readVariableText(),e.captionLocation=this._mergedReaders.read3BitDouble(),e.caption309=this._mergedReaders.readVariableText(),e.value96=this._mergedReaders.readBitLong(),t}readBlockRotationParameter(){let e=new Hs,t=new Ta(e);return this.readBlock2PtParameter(t),e.point=this._mergedReaders.read3BitDouble(),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.nameOffset=this._mergedReaders.readBitDouble(),e.value96=this._mergedReaders.readBitLong(),e.value141=this._mergedReaders.readBitDouble(),e.value142=this._mergedReaders.readBitDouble(),e.value143=this._mergedReaders.readBitDouble(),e.value175=this._mergedReaders.readBitLong(),t}readBlockVisibilityParameter(){let e=new Fs,t=new Wi(e);this.readBlock1PtParameter(t),e.value281=this._mergedReaders.readBit(),e.name=this._mergedReaders.readVariableText(),e.description=this._mergedReaders.readVariableText(),e.value91=this._mergedReaders.readBit();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++)t.entityHandles.push(this.handleReference());let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.StateTemplates.push(this.readState());return t}readBlockRotateAction(){let e=new Us,t=new ka(e);return this.readBlockActionBasePt(t),e.value94=this._mergedReaders.readBitLong(),e.value303=this._mergedReaders.readVariableText(),t}readBlockRepresentationData(){let e=new Rr,t=new Pa(e);return this.readCommonNonEntityData(t),e.value70=this._mergedReaders.readBitShort(),t.BlockHandle=this.handleReference(),t}readBlockGripLocationComponent(){let e=new zs,t=new Ma(e);return this.readEvaluationExpression(t),t}readBlockGrip(e){this.readBlockElement(e);let t=e.CadObject;t.value91=this._mergedReaders.readBitLong(),t.value92=this._mergedReaders.readBitLong(),t.location=this._mergedReaders.read3BitDouble(),t.value280=this._mergedReaders.readBitAsShort(),t.value93=this._mergedReaders.readBitLong()}readAecCleanupGroup(){let e=new Gs,t=new K(e);this.readCommonNonEntityData(t);try{this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),e.description=this._mergedReaders.readVariableText();let i=this._mergedReaders.positionInBits(),n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.rawData=this._mergedReaders.readBytes(a))}}catch(i){this._builder.Notify(`Error reading AEC_CLEANUP_GROUP [Handle: ${e.handle.toString(16)}]: ${i.message}`,g.Error,i)}return t}readAecWall(){let e=new xn,t=new zl(e);this.readCommonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),this.handleReference(),t.StyleHandle=this.handleReference(),t.CleanupGroupHandle=this.handleReference();let i=this._objectReader.positionInBits(),n=this._handlesReader.positionInBits()-i;if(n>0){let a=Math.floor(n/8);n%8!==0&&a++;let o=this._objectReader.readBytes(a);t.RawData=o}return t}readAecWallStyle(){let e=new $s,t=new K(e);this.readCommonNonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong()),e.description=this._mergedReaders.readVariableText();let i=this._mergedReaders.positionInBits(),n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.rawData=this._mergedReaders.readBytes(a))}return t}readBinRecord(){let e=new Ys,t=new K(e);this.readCommonNonEntityData(t),this.R2000Plus&&(e.version=this._mergedReaders.readBitLong());let i=this._mergedReaders.positionInBits();this._builder.Notify(`BinRecord: Handle reader at position ${i}, BinRecord Handle: ${e.handle.toString(16)}`,g.None);let n=this._objectInitialPos+this._size*8-i;if(n>0){let a=Math.floor(n/8);a>0&&(e.binaryData=this._mergedReaders.readBytes(a),this._builder.Notify(`BinRecord: Read ${a} bytes of binary data. Version: ${e.version}, Handle: ${e.handle.toString(16)}`,g.None))}return t}readTableEntity(){let e=new Ti,t=new ua(e);if(this.readInsertCommonData(t),this.readInsertCommonHandles(t),this.R2010Plus){this._mergedReaders.readByte(),t.NullHandle=this.handleReference();let n=this._mergedReaders.readBitLong();if(this.R2013Plus?this._mergedReaders.readBitLong():this._mergedReaders.readBit(),this.readTableContent(e.content,t),this._mergedReaders.readBitShort(),e.horizontalDirection=this._mergedReaders.read3BitDouble(),this._mergedReaders.readBitLong()===1){let h=e.tableBreakData;h.flags=this._mergedReaders.readBitLong(),h.flowDirection=this._mergedReaders.readBitLong(),h.breakSpacing=this._mergedReaders.readBitDouble(),this._mergedReaders.readBitLong(),this._mergedReaders.readBitLong();let f=this._mergedReaders.readBitLong();for(let b=0;b<f;b++){let S=new Bl;S.position=this._mergedReaders.read3BitDouble(),S.height=this._mergedReaders.readBitDouble(),this._mergedReaders.readBitLong(),h.heights.push(S)}}let o=this._mergedReaders.readBitLong();for(let h=0;h<o;h++){let f=new yl;f.position=this._mergedReaders.read3BitDouble(),f.startRowIndex=this._mergedReaders.readBitLong(),f.endRowIndex=this._mergedReaders.readBitLong(),e.breakRowRanges.push(f)}return t}e.valueFlag=this._mergedReaders.readBitShort(),e.horizontalDirection=this._mergedReaders.read3BitDouble();let i=this._mergedReaders.readBitLong(),s=this._mergedReaders.readBitLong();for(let n=0;n<i;n++){let a=new Rs;a.width=this._mergedReaders.readBitDouble(),e.columns.push(a)}for(let n=0;n<s;n++){let a=new Ts;a.height=this._mergedReaders.readBitDouble(),e.rows.push(a)}t.styleHandle=this.handleReference();for(let n=0;n<e.rows.length;n++)for(let a=0;a<e.columns.length;a++){let o=new ys;e.rows[n].cells.push(o);let h=new Uo(o);t.cadTableCellTemplates.push(h),this.readTableCellData(h)}if(this._mergedReaders.readBit()){let n=new Ye;e.content.style=n;let a=this._mergedReaders.readBitLong();(a&de.TitleSuppressed)!==0&&(n.suppressTitle=this._mergedReaders.readBit()),(a&de.FlowDirection)!==0&&this._mergedReaders.readBitShort(),(a&de.HorizontalCellMargin)!==0&&this._mergedReaders.readBitDouble(),(a&de.VerticalCellMargin)!==0&&this._mergedReaders.readBitDouble(),(a&de.TitleRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.HeaderRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.DataRowColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.TitleRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.HeaderRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.DataRowFillNone)!==0&&this._mergedReaders.readBit(),(a&de.TitleRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.HeaderRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.DataRowFillColor)!==0&&this._mergedReaders.readCmColor(this.R2004Pre),(a&de.TitleRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.HeaderRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.DataRowAlign)!==0&&this._mergedReaders.readBitShort(),(a&de.TitleTextStyle)!==0&&this.handleReference(),(a&de.HeaderTextStyle)!==0&&this.handleReference(),(a&de.DataTextStyle)!==0&&this.handleReference(),(a&de.TitleRowHeight)!==0&&this._mergedReaders.readBitDouble(),(a&de.HeaderRowHeight)!==0&&this._mergedReaders.readBitDouble(),(a&de.DataRowHeight)!==0&&this._mergedReaders.readBitDouble()}if(this._mergedReaders.readBit()){let n=this._mergedReaders.readBitLong(),a=[[0,$.TitleHorizontalTop],[0,$.TitleHorizontalInsert],[0,$.TitleHorizontalBottom],[0,$.TitleVerticalLeft],[0,$.TitleVerticalInsert],[0,$.TitleVerticalRight],[0,$.HeaderHorizontalTop],[0,$.HeaderHorizontalInsert],[0,$.HeaderHorizontalBottom],[0,$.HeaderVerticalLeft],[0,$.HeaderVerticalInsert],[0,$.HeaderVerticalRight],[0,$.DataHorizontalTop],[0,$.DataHorizontalInsert],[0,$.DataHorizontalBottom],[0,$.DataVerticalLeft],[0,$.DataVerticalInsert],[0,$.DataVerticalRight]];for(let[o,h]of a)(n&h)!==0&&this._mergedReaders.readCmColor(this.R2004Pre)}if(this._mergedReaders.readBit()){let n=this._mergedReaders.readBitLong(),a=[$.TitleHorizontalTop,$.TitleHorizontalInsert,$.TitleHorizontalBottom,$.TitleVerticalLeft,$.TitleVerticalInsert,$.TitleVerticalRight,$.HeaderHorizontalTop,$.HeaderHorizontalInsert,$.HeaderHorizontalBottom,$.HeaderVerticalLeft,$.HeaderVerticalInsert,$.HeaderVerticalRight,$.DataHorizontalTop,$.DataHorizontalInsert,$.DataHorizontalBottom,$.DataVerticalLeft,$.DataVerticalInsert,$.DataVerticalRight];for(let o of a)(n&o)!==0&&this._mergedReaders.readBitShort()}return t}readBlkRefObjectContextData(){let e=new mi,t=new ms(e);return this.readAnnotScaleObjectContextData(t),e.rotation=this._mergedReaders.readBitDouble(),e.insertionPoint=this._mergedReaders.read3BitDouble(),e.xScale=this._mergedReaders.readBitDouble(),e.yScale=this._mergedReaders.readBitDouble(),e.zScale=this._mergedReaders.readBitDouble(),t}readMTextAttributeObjectContextData(){return null}readFieldList(){let e=new pi,t=new Ha(e);this.readCommonNonEntityData(t);let i=this._mergedReaders.readBitLong();this._mergedReaders.readBit();for(let s=0;s<i;s++)t.OwnedObjectsHandlers.add(this.handleReference());return t}readField(){let e=new fi,t=new Wa(e);this.readCommonNonEntityData(t),e.evaluatorId=this._mergedReaders.readVariableText(),e.fieldCode=this._mergedReaders.readVariableText();let i=this._mergedReaders.readBitLong();for(let a=0;a<i;a++)t.ChildrenHandles.push(this.handleReference());let s=this._mergedReaders.readBitLong();for(let a=0;a<s;a++)t.CadObjectsHandles.push(this.handleReference());this._version<m.AC1021&&(e.formatString=this._mergedReaders.readVariableText()),e.evaluationOptionFlags=this._mergedReaders.readBitLong(),e.filingOptionFlags=this._mergedReaders.readBitLong(),e.fieldStateFlags=this._mergedReaders.readBitLong(),e.evaluationStatusFlags=this._mergedReaders.readBitLong(),e.evaluationErrorCode=this._mergedReaders.readBitLong(),e.evaluationErrorMessage=this._mergedReaders.readVariableText(),t.CadValueTemplates.push(this.readCadValue(e.value)),e.formatString=this._mergedReaders.readVariableText(),this._mergedReaders.readBitLong();let n=this._mergedReaders.readBitLong();for(let a=0;a<n;a++){let o=this._mergedReaders.readVariableText(),h=new Ht;t.CadValueTemplates.push(this.readCadValue(h)),e.values.set(o,h)}return t}readMatrix4(){let e=[];for(let t=0;t<16;t++)e.push(this._mergedReaders.readBitDouble());return e}read4x3Matrix(){let e=it.identity();for(let t=0;t<3;t++)for(let i=0;i<4;i++)e.setElement(t,i,this._mergedReaders.readBitDouble());return e}readBorderStyle(e){e.lineWeight=this._mergedReaders.readBitShort(),e.isInvisible=!this._mergedReaders.readBit(),e.color=this._mergedReaders.readCmColor(this.R2004Pre)}readAnnotScaleObjectContextData(e){this.readObjectContextData(e),e.scaleHandle=this.handleReference()}readObjectContextData(e){this.readCommonNonEntityData(e);let t=e.CadObject;t.version=this._objectReader.readBitShort(),t.default=this._objectReader.readBit()}readLeaderLine(e){let t=new zn,i=new ai.LeaderLineTemplate(t);e.leaderLineTemplates.push(i);let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.points.push(this._objectReader.read3BitDouble());if(t.breakInfoCount=this._objectReader.readBitLong(),t.breakInfoCount>0){t.segmentIndex=this._objectReader.readBitLong();let n=this._objectReader.readBitLong();for(let a=0;a<n;a++)t.startEndPoints.push(new Vo(this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble()))}return t.index=this._objectReader.readBitLong(),this.R2010Plus&&(t.pathType=this._objectReader.readBitShort(),t.lineColor=this._objectReader.readCmColor(),i.LineTypeHandle=this.handleReference(),t.lineWeight=this._objectReader.readBitLong(),t.arrowheadSize=this._objectReader.readBitDouble(),i.ArrowSymbolHandle=this.handleReference(),t.overrideFlags=this._objectReader.readBitLong()),t}readLeaderRoot(e){let t=new Gn;t.contentValid=this._objectReader.readBit(),t.unknown=this._objectReader.readBit(),t.connectionPoint=this._objectReader.read3BitDouble(),t.direction=this._objectReader.read3BitDouble();let i=this._objectReader.readBitLong();for(let n=0;n<i;n++)t.breakStartEndPointsPairs.push(new Vo(this._objectReader.read3BitDouble(),this._objectReader.read3BitDouble()));t.leaderIndex=this._objectReader.readBitLong(),t.landingDistance=this._objectReader.readBitDouble();let s=this._objectReader.readBitLong();for(let n=0;n<s;n++)t.lines.push(this.readLeaderLine(e));return this.R2010Plus&&(t.textAttachmentDirection=this._objectReader.readBitShort()),t}readBlockElement(e){this.readEvaluationExpression(e),e.blockElement.elementName=this._mergedReaders.readVariableText(),e.blockElement.value98=this._mergedReaders.readBitLong(),e.blockElement.value99=this._mergedReaders.readBitLong(),e.blockElement.value1071=this._mergedReaders.readBitLong()}readBlockParameter(e){this.readBlockElement(e),e.blockParameter.value280=this._mergedReaders.readBit(),e.blockParameter.value281=this._mergedReaders.readBit()}readBlock1PtParameter(e){this.readBlockParameter(e),e.block1PtParameter.location=this._mergedReaders.read3BitDouble(),e.block1PtParameter.value170=this._mergedReaders.readBitShort(),e.block1PtParameter.value171=this._mergedReaders.readBitShort(),e.block1PtParameter.value93=this._mergedReaders.readBitLong()}readBlock2PtParameter(e){this.readBlockParameter(e),e.block2PtParameter.firstPoint=this._mergedReaders.read3BitDouble(),e.block2PtParameter.secondPoint=this._mergedReaders.read3BitDouble();for(let i=0;i<4;i++){let s=this._mergedReaders.readBitShort();for(let n=0;n<s;n++){let a=this._mergedReaders.readBitLong(),o=this._mergedReaders.readVariableText()}}for(let i=0;i<4;i++){let s=this._mergedReaders.readBitLong()}let t=this._mergedReaders.readBitShort()}readBlockAction(e){this.readBlockElement(e);let t=e.blockAction;t.actionPoint=this._mergedReaders.read3BitDouble();let i=this._objectReader.readBitShort();for(let s=0;s<i;s++){let n=this.handleReference();e.entityHandles.add(n)}t.value70=this._mergedReaders.readBitShort()}readBlockActionBasePt(e){this.readBlockAction(e);let t=e.CadObject;t.value1011=this._mergedReaders.read3BitDouble(),t.value92=this._mergedReaders.readBitLong(),t.value301=this._mergedReaders.readVariableText(),t.value93=this._mergedReaders.readBitLong(),t.value302=this._mergedReaders.readVariableText(),t.value280=this._mergedReaders.readBit(),t.value1012=this._mergedReaders.read3BitDouble()}readEvaluationExpression(e){this.readCommonNonEntityData(e);let t=this._objectReader.readBitLong();e.CadObject.value98=this._objectReader.readBitLong(),e.CadObject.value99=this._objectReader.readBitLong();let i=this._mergedReaders.readBitShort();if(i>0){let s=Be.transformValue(i);switch(s){case _.Double:case _.ExtendedDataDouble:this._mergedReaders.readBitDouble();break;default:throw new Error(`[EvaluationExpression] Code not implemented ${s}`)}}e.CadObject.id=this._objectReader.readBitLong()}readRowCellStyle(e,t){let i=new jt(t);e.CellStyleTemplates.push(i),i.textStyleHandle=this.handleReference(),t.textHeight=this._mergedReaders.readBitDouble(),t.cellAlignment=this._mergedReaders.readBitShort(),t.textColor=this._mergedReaders.readCmColor(this.R2004Pre),t.backgroundColor=this._mergedReaders.readCmColor(this.R2004Pre),t.isFillColorOn=this._mergedReaders.readBit(),this.readBorderStyle(t.topBorder),this.readBorderStyle(t.horizontalInsideBorder),this.readBorderStyle(t.bottomBorder),this.readBorderStyle(t.leftBorder),this.readBorderStyle(t.verticalInsideBorder),this.readBorderStyle(t.rightBorder),this.R2007Plus&&(t.valueDataType=this._mergedReaders.readBitLong(),t.valueUnitType=this._mergedReaders.readBitLong(),t.valueFormatString=this._mergedReaders.readVariableText())}readCellStyle(e){}readTableContent(e,t){}readTableCellData(e){}readCadValue(e){let t=new Fa(e);if(this.R2007Plus&&(e.flags=this._mergedReaders.readBitLong()),e.valueType=this._mergedReaders.readBitLong(),!this.R2007Plus||!e.isEmpty)switch(e.valueType){case W.Unknown:case W.Long:e.setValue(this._mergedReaders.readBitLong());break;case W.Double:e.setValue(this._mergedReaders.readBitDouble());break;case W.General:case W.String:e.setValue(this.readStringCadValue());break;case W.Date:{let i=this.readDateCadValue();i!==null&&e.setValue(i);break}case W.Point2D:e.setValue(this.readValueXY());break;case W.Point3D:e.setValue(this.readValueXYZ());break;case W.Handle:t.ValueHandle=this.handleReference();break;default:throw new Error("CadValue type not implemented")}return this.R2007Plus&&(e.units=this._mergedReaders.readBitLong(),e.format=this._mergedReaders.readVariableText(),e.formattedValue=this._mergedReaders.readVariableText()),t}readStringCadValue(){return this._mergedReaders.readVariableText()}readDateCadValue(){let e=this._mergedReaders.readBitLong(),t=this._mergedReaders.readBitLong(),i=e-2440588;return new Date(i*864e5+t)}readValueXY(){return new C(this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble())}readValueXYZ(){return new c(this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble(),this._mergedReaders.readBitDouble())}readState(){let e=new Wi.StateTemplate;e.state.name=this._textReader.readVariableText();let t=this._objectReader.readBitLong();for(let s=0;s<t;s++)e.entityHandles.add(this.handleReference());let i=this._objectReader.readBitLong();for(let s=0;s<i;s++)e.expressionHandles.add(this.handleReference());return e}get SectionName(){return"AcDb:AcDbObjects"}};var rd=class extends Y{get SectionName(){return T.Preview}_startSentinel=T.StartSentinels.get(T.Preview);_endSentinel=T.EndSentinels.get(T.Preview);_reader;_previewAddress;constructor(e,t,i){super(e),this._reader=t,this._previewAddress=i}read(){let e=this._reader.readSentinel();console.assert(Y.CheckSentinel(e,this._startSentinel));let t=this._reader.readRawLong(),i=this._reader.readRawChar()&255,s=null,n=null,a=null,o=null,h=tn.PreviewType.Unknown;for(let N=0;N<i;N++){let L=this._reader.readRawChar()&255;L===1?(s=this._reader.readRawLong(),n=this._reader.readRawLong()):(h=L,a=this._reader.readRawLong(),o=this._reader.readRawLong())}let f=null;f=this._reader.readBytes(n);let b;o!==null?b=this._reader.readBytes(o):b=new Uint8Array(0);let S=this._reader.readSentinel();return console.assert(Y.CheckSentinel(S,this._endSentinel)),new tn(h,f,b)}};var id=class extends Y{get SectionName(){return T.SummaryInfo}_readStringMethod;_reader;constructor(e,t){super(e),this._reader=t,e<m.AC1021?this._readStringMethod=()=>this.readUnicodeString():this._readStringMethod=()=>this._reader.readTextUnicode()}read(){let e=new Or;try{e.title=this._readStringMethod(),e.subject=this._readStringMethod(),e.author=this._readStringMethod(),e.keywords=this._readStringMethod(),e.comments=this._readStringMethod(),e.lastSavedBy=this._readStringMethod(),e.revisionNumber=this._readStringMethod(),e.hyperlinkBase=this._readStringMethod(),this._reader.readInt(),this._reader.readInt(),e.createdDate=this._reader.read8BitJulianDate(),e.modifiedDate=this._reader.read8BitJulianDate();let t=this._reader.readShort();for(let i=0;i<t;i++){let s=this._readStringMethod(),n=this._readStringMethod();try{e.properties.set(s,n)}catch(a){this.notify("[SummaryInfo] An error ocurred while adding a property in the SummaryInfo",g.Error,a instanceof Error?a:void 0)}}this._reader.readInt(),this._reader.readInt()}catch(t){this.notify("An error occurred while reading the Summary Info",g.Error,t instanceof Error?t:void 0)}return e}readUnicodeString(){let e=this._reader.readShort(),t;if(e===0)t="";else{let i=this._reader.readBytes(e);t=new TextDecoder("windows-1252").decode(i).replace(/\0/g,"")}return t}};var Ga=class r{static decompress(e,t,i){let s=new Uint8Array(i);return r.decompressToDest(e,t,s),s}static decompressToDest(e,t,i){let s=t,n=0,a=new Uint8Array(128);if(s>=e.length)return;let o=e[s++];if((o&240)===0){let h=r.literalCount(o,e,{pos:s});s=r._lastSrcPos;let f=r.copy(h+3,e,s,i,n,a);s=f.srcPos,n=f.dstPos,a=f.tempBuf,o=f.nextByte}for(;o!==17;){if(s>=e.length)throw new Error(`LZ77AC18: read past end of source at srcPos=${s}, src.length=${e.length}`);let h=0,f=0;if(o<16||o>=64){f=(o>>4)-1;let z=e[s++];h=(o>>2&3|z<<2)+1}else if(o<32){let z=r.readCompressedBytes(o,7,e,{pos:s});f=z.value,s=z.srcPos,h=(o&8)<<11;let X=r.twoByteOffset(h,16384,e,s);h=X.offset,o=X.firstByte,s=X.srcPos}else if(o>=32){let z=r.readCompressedBytes(o,31,e,{pos:s});f=z.value,s=z.srcPos;let X=r.twoByteOffset(h,1,e,s);h=X.offset,o=X.firstByte,s=X.srcPos}let b=n;a.length<f&&(a=new Uint8Array(f));let S=b-h,N=Math.min(f,h);for(let z=0;z<N;z++)a[z]=i[S+z];let L=f,j=b;for(;L>0;){let z=Math.min(L,h);for(let X=0;X<z;X++)i[j+X]=a[X];j+=z,L-=h}n=b+f;let we=o&3;if(we===0&&(o=e[s++],(o&240)===0)){let z=r.literalCount(o,e,{pos:s});s=r._lastSrcPos,we=z+3}if(we>0){let z=r.copy(we,e,s,i,n,a);s=z.srcPos,n=z.dstPos,a=z.tempBuf,o=z.nextByte}}}static _lastSrcPos=0;static copy(e,t,i,s,n,a){a.length<e&&(a=new Uint8Array(e));for(let h=0;h<e;h++)a[h]=t[i+h],s[n+h]=t[i+h];i+=e,n+=e;let o=t[i++];return{srcPos:i,dstPos:n,tempBuf:a,nextByte:o}}static literalCount(e,t,i){let s=e&15;if(s===0){let n;for(n=t[i.pos++];n===0;)s+=255,n=t[i.pos++];s+=15+n}return r._lastSrcPos=i.pos,s}static readCompressedBytes(e,t,i,s){let n=e&t;if(n===0){let a;for(a=i[s.pos++];a===0;)n+=255,a=i[s.pos++];n+=a+t}return{value:n+2,srcPos:s.pos}}static twoByteOffset(e,t,i,s){let n=i[s++];return e|=n>>2,e|=i[s++]<<6,e+=t,{offset:e,firstByte:n,srcPos:s}}};var $a=class r{static m_sourceOffset=0;static m_length=0;static m_sourceIndex=0;static m_opCode=0;static decompress(e,t,i,s){r.m_sourceOffset=0,r.m_length=0,r.m_sourceIndex=t,r.m_opCode=e[r.m_sourceIndex];let n=0,a=r.m_sourceIndex+i;if(++r.m_sourceIndex,!(r.m_sourceIndex>=a))for((r.m_opCode&240)===32&&(r.m_sourceIndex+=3,r.m_length=e[r.m_sourceIndex-1],r.m_length&=7);r.m_sourceIndex<a&&(n=r.nextIndex(e,s,n),!(r.m_sourceIndex>=a));)n=r.copyDecompressedChunks(e,a,s,n)}static nextIndex(e,t,i){return r.m_length===0&&r.readLiteralLength(e),r.copyRaw(e,r.m_sourceIndex,t,i,r.m_length),r.m_sourceIndex+=r.m_length,i+=r.m_length,i}static copyDecompressedChunks(e,t,i,s){for(r.m_length=0,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.readInstructions(e);r.copyBytes(i,s,r.m_length,r.m_sourceOffset),s+=r.m_length,r.m_length=r.m_opCode&7,!(r.m_length!==0||r.m_sourceIndex>=t||(r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode>>4===0));)r.m_opCode>>4===15&&(r.m_opCode&=15),r.readInstructions(e);return s}static readInstructions(e){switch(r.m_opCode>>4){case 0:r.m_length=(r.m_opCode&15)+19,r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=(r.m_opCode>>3&16)+r.m_length,r.m_sourceOffset=((r.m_opCode&120)<<5)+1+r.m_sourceOffset;break;case 1:r.m_length=(r.m_opCode&15)+3,r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=((r.m_opCode&248)<<5)+1+r.m_sourceOffset;break;case 2:r.m_sourceOffset=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=e[r.m_sourceIndex]<<8&65280|r.m_sourceOffset,++r.m_sourceIndex,r.m_length=r.m_opCode&7,(r.m_opCode&8)===0?(r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=(r.m_opCode&248)+r.m_length):(++r.m_sourceOffset,r.m_length=(e[r.m_sourceIndex]<<3)+r.m_length,++r.m_sourceIndex,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_length=((r.m_opCode&248)<<8)+r.m_length+256);break;default:r.m_length=r.m_opCode>>4,r.m_sourceOffset=r.m_opCode&15,r.m_opCode=e[r.m_sourceIndex],++r.m_sourceIndex,r.m_sourceOffset=((r.m_opCode&248)<<1)+r.m_sourceOffset+1;break}}static readLiteralLength(e){if(r.m_length=r.m_opCode+8,r.m_length===23){let t=e[r.m_sourceIndex];if(++r.m_sourceIndex,r.m_length+=t,t===255)do t=e[r.m_sourceIndex],++r.m_sourceIndex,t|=e[r.m_sourceIndex]<<8,++r.m_sourceIndex,r.m_length+=t;while(t===65535)}}static copyBytes(e,t,i,s){let n=t-s,a=n+i;for(;n<a;)e[t++]=e[n++]}static copyRaw(e,t,i,s,n){for(;n>=32;n-=32)r.copy4b(e,t+24,i,s),r.copy4b(e,t+28,i,s+4),r.copy4b(e,t+16,i,s+8),r.copy4b(e,t+20,i,s+12),r.copy4b(e,t+8,i,s+16),r.copy4b(e,t+12,i,s+20),r.copy4b(e,t,i,s+24),r.copy4b(e,t+4,i,s+28),t+=32,s+=32;n<=0||r.m_copyMethods[n](e,t,i,s)}static copy1b(e,t,i,s){i[s]=e[t]}static copy2b(e,t,i,s){i[s]=e[t+1],i[s+1]=e[t]}static copy3b(e,t,i,s){i[s]=e[t+2],i[s+1]=e[t+1],i[s+2]=e[t]}static copy4b(e,t,i,s){i[s]=e[t],i[s+1]=e[t+1],i[s+2]=e[t+2],i[s+3]=e[t+3]}static copy8b(e,t,i,s){r.copy4b(e,t,i,s),r.copy4b(e,t+4,i,s+4)}static copy16b(e,t,i,s){r.copy8b(e,t+8,i,s),r.copy8b(e,t,i,s+8)}static m_copyMethods=[null,(e,t,i,s)=>{r.copy1b(e,t,i,s)},(e,t,i,s)=>{r.copy2b(e,t,i,s)},(e,t,i,s)=>{r.copy3b(e,t,i,s)},(e,t,i,s)=>{r.copy4b(e,t,i,s)},(e,t,i,s)=>{r.copy1b(e,t+4,i,s),r.copy4b(e,t,i,s+1)},(e,t,i,s)=>{r.copy1b(e,t+5,i,s),r.copy4b(e,t+1,i,s+1),r.copy1b(e,t,i,s+5)},(e,t,i,s)=>{r.copy2b(e,t+5,i,s),r.copy4b(e,t+1,i,s+2),r.copy1b(e,t,i,s+6)},(e,t,i,s)=>{r.copy8b(e,t,i,s)},(e,t,i,s)=>{r.copy1b(e,t+8,i,s),r.copy8b(e,t,i,s+1)},(e,t,i,s)=>{r.copy1b(e,t+9,i,s),r.copy8b(e,t+1,i,s+1),r.copy1b(e,t,i,s+9)},(e,t,i,s)=>{r.copy2b(e,t+9,i,s),r.copy8b(e,t+1,i,s+2),r.copy1b(e,t,i,s+10)},(e,t,i,s)=>{r.copy4b(e,t+8,i,s),r.copy8b(e,t,i,s+4)},(e,t,i,s)=>{r.copy1b(e,t+12,i,s),r.copy4b(e,t+8,i,s+1),r.copy8b(e,t,i,s+5)},(e,t,i,s)=>{r.copy1b(e,t+13,i,s),r.copy4b(e,t+9,i,s+1),r.copy8b(e,t+1,i,s+5),r.copy1b(e,t,i,s+13)},(e,t,i,s)=>{r.copy2b(e,t+13,i,s),r.copy4b(e,t+9,i,s+2),r.copy8b(e,t+1,i,s+6),r.copy1b(e,t,i,s+14)},(e,t,i,s)=>{r.copy16b(e,t,i,s)},(e,t,i,s)=>{r.copy8b(e,t+9,i,s),r.copy1b(e,t+8,i,s+8),r.copy8b(e,t,i,s+9)},(e,t,i,s)=>{r.copy1b(e,t+17,i,s),r.copy16b(e,t+1,i,s+1),r.copy1b(e,t,i,s+17)},(e,t,i,s)=>{r.copy3b(e,t+16,i,s),r.copy16b(e,t,i,s+3)},(e,t,i,s)=>{r.copy4b(e,t+16,i,s),r.copy8b(e,t+8,i,s+4),r.copy8b(e,t,i,s+12)},(e,t,i,s)=>{r.copy1b(e,t+20,i,s),r.copy4b(e,t+16,i,s+1),r.copy8b(e,t+8,i,s+5),r.copy8b(e,t,i,s+13)},(e,t,i,s)=>{r.copy2b(e,t+20,i,s),r.copy4b(e,t+16,i,s+2),r.copy8b(e,t+8,i,s+6),r.copy8b(e,t,i,s+14)},(e,t,i,s)=>{r.copy3b(e,t+20,i,s),r.copy4b(e,t+16,i,s+3),r.copy8b(e,t+8,i,s+7),r.copy8b(e,t,i,s+15)},(e,t,i,s)=>{r.copy8b(e,t+16,i,s),r.copy16b(e,t,i,s+8)},(e,t,i,s)=>{r.copy8b(e,t+17,i,s),r.copy1b(e,t+16,i,s+8),r.copy16b(e,t,i,s+9)},(e,t,i,s)=>{r.copy1b(e,t+25,i,s),r.copy8b(e,t+17,i,s+1),r.copy1b(e,t+16,i,s+9),r.copy16b(e,t,i,s+10)},(e,t,i,s)=>{r.copy2b(e,t+25,i,s),r.copy8b(e,t+17,i,s+2),r.copy1b(e,t+16,i,s+10),r.copy16b(e,t,i,s+11)},(e,t,i,s)=>{r.copy4b(e,t+24,i,s),r.copy8b(e,t+16,i,s+4),r.copy8b(e,t+8,i,s+12),r.copy8b(e,t,i,s+20)},(e,t,i,s)=>{r.copy1b(e,t+28,i,s),r.copy4b(e,t+24,i,s+1),r.copy8b(e,t+16,i,s+5),r.copy8b(e,t+8,i,s+13),r.copy8b(e,t,i,s+21)},(e,t,i,s)=>{r.copy2b(e,t+28,i,s),r.copy4b(e,t+24,i,s+2),r.copy8b(e,t+16,i,s+6),r.copy8b(e,t+8,i,s+14),r.copy8b(e,t,i,s+22)},(e,t,i,s)=>{r.copy1b(e,t+30,i,s),r.copy4b(e,t+26,i,s+1),r.copy8b(e,t+18,i,s+5),r.copy8b(e,t+10,i,s+13),r.copy8b(e,t+2,i,s+21),r.copy2b(e,t,i,s+29)}]};var zh=class r extends Ln{_builder;_fileHeader;constructor(e,t=null){super(e,t)}createDefaultConfiguration(){return new Po}static ReadFromStream(e,t=null){return r.ReadFromStreamWithConfig(e,new Po,t)}static ReadFromStreamWithConfig(e,t,i=null){let s=new r(e,i);s.Configuration=t;let n=s.Read();return s.Dispose(),n}Read(){return this._document=new xs,this._fileHeader=this.readFileHeader(),this._builder=new On(this._fileHeader.AcadVersion,this._document,this.Configuration),this._builder.OnNotification=(e,t)=>this.onNotificationEvent(e,t),this._document.summaryInfo=this.ReadSummaryInfo(),this._document.header=this.ReadHeader(),this._document.header.Document=this._document,this._document.classes=this.readClasses(),this.readObjects(),this._builder.BuildDocument(),this._document}ReadSummaryInfo(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.AcadVersion<m.AC1018||!this.Configuration.ReadSummaryInfo)return new Or;let e=this.getSectionStream(T.SummaryInfo);return e?new id(this._fileHeader.AcadVersion,e).read():new Or}ReadPreview(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.PreviewAddress<0)return null;let e=this.getSectionStream(T.Preview);return e||(e=be.getStreamHandler(this._fileHeader.AcadVersion,new Uint8Array(this._fileStream)),e.position=this._fileHeader.PreviewAddress),new rd(this._fileHeader.AcadVersion,e,this._fileHeader.PreviewAddress).read()}ReadHeader(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=new lt;e.codePage=Z.getCodePageName(this._fileHeader.DrawingCodePage);let t=this.getSectionStream(T.Header),i=new Ol(this._fileHeader.AcadVersion,t,e);i.OnNotification=(n,a)=>this.onNotificationEvent(n,a);let s=i.read(this._fileHeader.AcadMaintenanceVersion);return this._builder&&(this._builder.HeaderHandles=s.objectPointers),e}readFileHeader(){let e=new Uint8Array(this._fileStream),t=String.fromCharCode(...e.slice(0,6)),i=Z.getVersionFromName(t),s=Ai.CreateFileHeader(i),n=be.getStreamHandler(s.AcadVersion,e);switch(n.position=6,s.AcadVersion){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(s.AcadVersion);case m.AC1012:case m.AC1014:case m.AC1015:this.readFileHeaderAC15(s,n);break;case m.AC1018:this.readFileHeaderAC18(s,n);break;case m.AC1021:try{this.readFileHeaderAC21(s,n)}catch{n.position=6,this.readFileHeaderAC18(s,n)}break;case m.AC1024:case m.AC1027:case m.AC1032:this.readFileHeaderAC18(s,n);break;default:break}return s}readClasses(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=this.getSectionStream(T.Classes),t=new kl(this._fileHeader.AcadVersion,e,this._fileHeader);return t.OnNotification=(i,s)=>this.onNotificationEvent(i,s),t.read()}readHandles(){this._fileHeader=this._fileHeader??this.readFileHeader();let e=this.getSectionStream(T.Handles),t=new Pl(this._fileHeader.AcadVersion,e);return t.OnNotification=(i,s)=>this.onNotificationEvent(i,s),t.read()}readObjFreeSpace(){if(this._fileHeader=this._fileHeader??this.readFileHeader(),this._fileHeader.AcadVersion<m.AC1018)return 0;let e=this.getSectionStream(T.ObjFreeSpace);return e.advance(16),e.readUInt()}readObjects(){let e=this.readHandles();this._document.classes=this.readClasses();let t;this._fileHeader.AcadVersion<=m.AC1015?(t=be.getStreamHandler(this._fileHeader.AcadVersion,new Uint8Array(this._fileStream),this._encoding),t.position=0):t=this.getSectionStream(T.AcDbObjects);let i=this._builder.HeaderHandles.GetHandles().filter(n=>n!=null).map(n=>n);new td(this._fileHeader.AcadVersion,this._builder,t,i,e,this._document.classes).read()}getSectionStream(e){let t=null;switch(this._fileHeader.AcadVersion){case m.Unknown:throw new Me;case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Me(this._fileHeader.AcadVersion);case m.AC1012:case m.AC1014:case m.AC1015:t=this.getSectionBuffer15(this._fileHeader,e);break;case m.AC1018:t=this.getSectionBuffer18(this._fileHeader,e);break;case m.AC1021:this._fileHeader.CompressedMetadata?t=this.getSectionBuffer21(this._fileHeader,e):t=this.getSectionBuffer18(this._fileHeader,e);break;case m.AC1024:case m.AC1027:case m.AC1032:t=this.getSectionBuffer18(this._fileHeader,e);break;default:break}if(!t)return null;let i=be.getStreamHandler(this._fileHeader.AcadVersion,t);return i.encoding=this._encoding,i}readFileHeaderAC15(e,t){t.readBytes(7),e.PreviewAddress=t.readInt(),t.readBytes(2),e.DrawingCodePage=Z.getCodePage(t.readShort()),this._encoding=this.getListedEncoding(e.DrawingCodePage);let i=t.readRawLong();for(let n=0;n<i;++n){let a=new ft;a.Number=t.readByte(),a.Seeker=t.readRawLong(),a.Size=t.readRawLong(),e.Records.set(a.Number,a)}t.resetShift();let s=t.readSentinel();Y.CheckSentinel(s,Ei.EndSentinel)}readFileMetaData(e,t){t.advance(5),e.AcadMaintenanceVersion=t.readByte(),t.advance(1),e.PreviewAddress=t.readRawLong(),e.DwgVersion=t.readByte(),e.AppReleaseVersion=t.readByte(),e.DrawingCodePage=Z.getCodePage(t.readShort()),this._encoding=this.getListedEncoding(e.DrawingCodePage),t.advance(3),e.SecurityType=t.readRawLong(),t.readRawLong(),e.SummaryInfoAddr=t.readRawLong(),e.VbaProjectAddr=t.readRawLong(),t.readRawLong(),t.readRawLong(),t.advance(80)}readFileHeaderAC18(e,t){this.readFileMetaData(e,t);let i=t.readBytes(108),s=new Tl(i,0,!0);t.readBytes(20);let n=new Uint8Array(12);s.Read(n,0,12);let a=String.fromCharCode(...n);a.startsWith("AcFssFcAJMB")||this.triggerNotification(`File validation failed, id should be: AcFssFcAJMB, but is: ${a}`,g.Warning);let o=()=>{let le=new Uint8Array(4);return s.Read(le,0,4),new DataView(le.buffer).getInt32(0,!0)},h=()=>{let le=new Uint8Array(4);return s.Read(le,0,4),new DataView(le.buffer).getUint32(0,!0)},f=()=>{let le=new Uint8Array(8);s.Read(le,0,8);let ue=new DataView(le.buffer),Ks=ue.getUint32(0,!0);return ue.getUint32(4,!0)*4294967296+Ks};o(),o(),o(),e.RootTreeNodeGap=o(),e.LeftGap=o(),e.RigthGap=o(),o(),e.LastPageId=o(),e.LastSectionAddr=f(),e.SecondHeaderAddr=f(),e.GapAmount=h(),e.SectionAmount=h(),o(),o(),o(),e.SectionPageMapId=h(),e.PageMapAddress=f()+256,e.SectionMapId=h(),e.SectionArrayPageSize=h(),e.GapArraySize=h(),e.CRCSeed=h(),t.position=e.PageMapAddress;let b=t.readRawLong(),S=t.readRawLong(),N=t.readRawLong(),L=t.readRawLong(),j=t.readRawLong(),we=Ga.decompress(t.stream,t.position,S),z=256,X=0,qi=new DataView(we.buffer,we.byteOffset,we.byteLength);for(;X<we.length;){let le=new ft;le.Number=qi.getInt32(X,!0),X+=4,le.Size=qi.getInt32(X,!0),X+=4,le.Number>=0?(le.Seeker=z,e.Records.set(le.Number,le)):X+=16,z+=le.Size}t.position=e.Records.get(e.SectionMapId).Seeker;let _s=t.readRawLong(),_e=t.readRawLong(),wi=t.readRawLong(),Qt=t.readRawLong(),Fd=t.readRawLong(),ce=Ga.decompress(t.stream,t.position,_e),Re=0,tl=new DataView(ce.buffer,ce.byteOffset,ce.byteLength),Fe=()=>{let le=tl.getInt32(Re,!0);return Re+=4,le},ve=()=>{let le=tl.getUint32(Re,!0),ue=tl.getUint32(Re+4,!0);return Re+=8,ue*4294967296+le},Ud=le=>{let ue="";for(let Ks=0;Ks<le;Ks++)ue+=String.fromCharCode(ce[Re+Ks]);return Re+=le,ue.split("\0")[0]},kc=Fe();Fe(),Fe(),Fe(),Fe();for(let le=0;le<kc;++le){let ue=new _r;ue.CompressedSize=ve(),ue.PageCount=Fe(),ue.DecompressedSize=Fe(),Fe(),ue.CompressedCode=Fe(),ue.SectionId=Fe(),ue.Encrypted=Fe(),ue.Name=Ud(64);for(let ch=0;ch<ue.PageCount;++ch){let pn=new cs;pn.PageNumber=Fe(),pn.CompressedSize=Fe(),pn.Offset=ve(),pn.DecompressedSize=ue.DecompressedSize,pn.Seeker=e.Records.get(pn.PageNumber)?.Seeker??0,ue.LocalSections.push(pn)}let Ks=ue.CompressedSize%ue.DecompressedSize;Ks>0&&ue.LocalSections.length>0&&(ue.LocalSections[ue.LocalSections.length-1].DecompressedSize=Ks),e.Descriptors.set(ue.Name,ue)}}readFileHeaderAC21(e,t){this.readFileMetaData(e,t);let i=t.readBytes(1024),s=new Uint8Array(717);this.reedSolomonDecoding(i,s,3,239);let n=new DataView(s.buffer),a=this.readInt64(n,0),o=this.readInt64(n,8),h=this.readInt64(n,16),f=n.getInt32(24,!0),b=n.getInt32(28,!0),S=new Uint8Array(272);f<0?S.set(s.subarray(32,32+Math.abs(f))):$a.decompress(s,32,f,S);let N=new DataView(S.buffer),L=0,j=()=>{let ce=N.getUint32(L,!0),Re=N.getUint32(L+4,!0);return L+=8,Re*4294967296+ce};e.CompressedMetadata=new El,e.CompressedMetadata.HeaderSize=j(),e.CompressedMetadata.FileSize=j(),e.CompressedMetadata.PagesMapCrcCompressed=j(),e.CompressedMetadata.PagesMapCorrectionFactor=j(),e.CompressedMetadata.PagesMapCrcSeed=j(),e.CompressedMetadata.Map2Offset=j(),e.CompressedMetadata.Map2Id=j(),e.CompressedMetadata.PagesMapOffset=j(),e.CompressedMetadata.PagesMapId=j(),e.CompressedMetadata.Header2offset=j(),e.CompressedMetadata.PagesMapSizeCompressed=j(),e.CompressedMetadata.PagesMapSizeUncompressed=j(),e.CompressedMetadata.PagesAmount=j(),e.CompressedMetadata.PagesMaxId=j(),e.CompressedMetadata.Unknow0x20=j(),e.CompressedMetadata.Unknow0x40=j(),e.CompressedMetadata.PagesMapCrcUncompressed=j(),e.CompressedMetadata.Unknown0xF800=j(),e.CompressedMetadata.Unknown4=j(),e.CompressedMetadata.Unknown1=j(),e.CompressedMetadata.SectionsAmount=j(),e.CompressedMetadata.SectionsMapCrcUncompressed=j(),e.CompressedMetadata.SectionsMapSizeCompressed=j(),e.CompressedMetadata.SectionsMap2Id=j(),e.CompressedMetadata.SectionsMapId=j(),e.CompressedMetadata.SectionsMapSizeUncompressed=j(),e.CompressedMetadata.SectionsMapCrcCompressed=j(),e.CompressedMetadata.SectionsMapCorrectionFactor=j(),e.CompressedMetadata.SectionsMapCrcSeed=j(),e.CompressedMetadata.StreamVersion=j(),e.CompressedMetadata.CrcSeed=j(),e.CompressedMetadata.CrcSeedEncoded=j(),e.CompressedMetadata.RandomSeed=j(),e.CompressedMetadata.HeaderCRC64=j();let we=this.getPageBuffer(e.CompressedMetadata.PagesMapOffset,e.CompressedMetadata.PagesMapSizeCompressed,e.CompressedMetadata.PagesMapSizeUncompressed,e.CompressedMetadata.PagesMapCorrectionFactor,239,new Uint8Array(this._fileStream)),z=new DataView(we.buffer,we.byteOffset,we.byteLength),X=0,qi=0;for(;X<we.length;){let ce=this.readInt64View(z,X);X+=8;let Re=Math.abs(this.readInt64View(z,X));X+=8,e.Records.set(Re,new ft(Re,qi,ce)),qi+=ce}let _s=this.getPageBuffer(e.Records.get(e.CompressedMetadata.SectionsMapId).Seeker,e.CompressedMetadata.SectionsMapSizeCompressed,e.CompressedMetadata.SectionsMapSizeUncompressed,e.CompressedMetadata.SectionsMapCorrectionFactor,239,new Uint8Array(this._fileStream)),_e=new DataView(_s.buffer,_s.byteOffset,_s.byteLength),wi=0,Qt=()=>{let ce=_e.getUint32(wi,!0),Re=_e.getUint32(wi+4,!0);return wi+=8,Re*4294967296+ce},Fd=()=>{let ce=_e.getInt32(wi,!0),Re=_e.getInt32(wi+4,!0);return wi+=8,Re*4294967296+ce};for(;wi<_s.length;){let ce=new _r;ce.CompressedSize=Qt(),ce.DecompressedSize=Qt(),ce.Encrypted=Qt(),ce.HashCode=Qt();let Re=Fd();if(Qt(),ce.Encoding=Qt(),ce.PageCount=Qt(),Re>0){let Fe="";for(let ve=0;ve<Re;ve+=2){let Ud=_s[wi+ve]|_s[wi+ve+1]<<8;Ud!==0&&(Fe+=String.fromCharCode(Ud))}wi+=Re,ce.Name=Fe}let tl=0;for(let Fe=0;Fe<ce.PageCount;++Fe){let ve=new cs;ve.Offset=Qt(),ve.Size=Fd(),ve.PageNumber=Fd(),ve.DecompressedSize=Qt(),ve.CompressedSize=Qt(),ve.Checksum=Qt(),ve.CRC=Qt(),ce.LocalSections.push(ve),tl=ve.Offset+ve.DecompressedSize}Re>0&&e.Descriptors.set(ce.Name,ce)}}getSectionBuffer15(e,t){let i=T.GetSectionLocatorByName(t);if(i===null)return null;let s=e.Records.get(i);return s?new Uint8Array(this._fileStream).subarray(s.Seeker,s.Seeker+s.Size):null}getSectionBuffer18(e,t){let i=e.Descriptors.get(t);if(!i)return null;let s=i.DecompressedSize*i.LocalSections.length,n=new Uint8Array(s),a=0,o=new Uint8Array(this._fileStream);for(let h of i.LocalSections)if(h.IsEmpty)for(let f=0;f<h.DecompressedSize;++f)n[a++]=0;else{let f=be.getStreamHandler(e.AcadVersion,o);if(f.position=h.Seeker,this.decryptDataSection(h,f),i.IsCompressed){let b=Ga.decompress(f.stream,f.position,h.DecompressedSize);n.set(b.subarray(0,h.DecompressedSize),a),a+=h.DecompressedSize}else{let b=f.readBytes(h.CompressedSize);n.set(b,a),a+=h.CompressedSize}}return n.subarray(0,a)}decryptDataSection(e,t){let i=1097093995^t.position,s=t.readRawLong()^i|0,n=t.readRawLong()^i|0;e.CompressedSize=t.readRawLong()^i|0,e.PageSize=t.readRawLong()^i|0;let a=t.readRawLong()^i|0,o=t.readRawLong()^i|0;e.Offset=(o+a|0)>>>0,e.Checksum=(t.readRawLong()^i|0)>>>0;let h=(t.readRawLong()^i|0)>>>0}getSectionBuffer21(e,t){let i=e.Descriptors.get(t);if(!i)return null;let s=0;for(let h of i.LocalSections)s+=h.DecompressedSize;let n=new Uint8Array(s),a=0,o=new Uint8Array(this._fileStream);for(let h of i.LocalSections)if(h.IsEmpty)for(let f=0;f<h.DecompressedSize;++f)n[a++]=0;else{let f=e.Records.get(h.PageNumber);if(!f)continue;let b=f.Seeker+1152,S=o.slice(b,b+f.Size);if(i.Encoding===4){let N=h.CompressedSize+7;N=N&4294967288;let L=Math.floor((N+251-1)/251),j=new Uint8Array(L*251);this.reedSolomonDecoding(S,j,L,251),S=j}if(h.CompressedSize!==h.DecompressedSize){let N=new Uint8Array(h.DecompressedSize);$a.decompress(S,0,h.CompressedSize,N),S=N}n.set(S.subarray(0,h.DecompressedSize),a),a+=h.DecompressedSize}return n.subarray(0,a)}getPageBuffer(e,t,i,s,n,a){let o=t+7;o=o&4294967288;let h=o*s,f=Math.floor((h+n-1)/n),b=f*255,S=new Uint8Array(b),N=1152+e;S.set(a.subarray(N,N+b));let L=new Uint8Array(h);this.reedSolomonDecoding(S,L,f,n);let j=new Uint8Array(i);return $a.decompress(L,0,t,j),j}readInt64(e,t){let i=e.getUint32(t,!0);return e.getInt32(t+4,!0)*4294967296+i}readInt64View(e,t){let i=e.getUint32(t,!0);return e.getInt32(t+4,!0)*4294967296+i}reedSolomonDecoding(e,t,i,s){let n=0,a=0,o=t.length;for(let h=0;h<i;++h){let f=a;if(a<e.length){let b=Math.min(o,s);o-=b;let S=n+b;for(;n<S;)t[n]=e[f],++n,f+=i}++a}}};var Gh=class extends Y{get SectionName(){return T.AppInfo}_reader;constructor(e,t){super(e),this._reader=t}read(){this.R2007Plus||this.readR18();let e=this._reader.readInt(),t=this._reader.readTextUnicode(),i=this._reader.readInt(),s=this._reader.readBytes(16),n=this._reader.readTextUnicode(),a=this._reader.readBytes(16);if(!this.R2010Plus)return;let o=this._reader.readTextUnicode(),h=this._reader.readBytes(16),f=this._reader.readTextUnicode()}readR18(){let e=this._reader.readVariableText(),t=this._reader.readInt(),i=this._reader.readVariableText(),s=this._reader.readVariableText(),n=this._reader.readVariableText()}};var w;(function(r){r[r.Undefined=0]="Undefined",r[r.SoftOwnership=2]="SoftOwnership",r[r.HardOwnership=3]="HardOwnership",r[r.SoftPointer=4]="SoftPointer",r[r.HardPointer=5]="HardPointer"})(w||(w={}));var $h=new Map,Lc=new Map;function Ya(r,e){$h.set(r,e)}function lh(r,e){Lc.set(r,e)}var ye=class{get main(){return this}get positionInBits(){return this._position*8+this.bitShift}savedPositionInBits=0;bitShift=0;encoding;get stream(){return this._buffer.buffer}_buffer;_view;_position=0;_lastByte=0;constructor(e,t){this._buffer=e,this._view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.encoding=t}static getStreamWriter(e,t,i){let s;switch(e){case m.Unknown:throw new Error("Unknown version");case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Error(`Dwg version not supported: ${e}`);case m.AC1012:case m.AC1014:s="AC12";break;case m.AC1015:s="AC15";break;case m.AC1018:s="AC18";break;case m.AC1021:s="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:s="AC24";break;default:throw new Error(`Dwg version not supported: ${e}`)}let n=$h.get(s);if(!n)throw new Error(`DwgStreamWriter factory for ${s} not registered. Import DwgStreamWriterFactory first.`);return new n(t,i)}static getMergedWriter(e,t,i){let s;switch(e){case m.Unknown:throw new Error("Unknown version");case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:throw new Error(`Dwg version not supported: ${e}`);case m.AC1012:case m.AC1014:s="AC12";break;case m.AC1015:s="AC15";break;case m.AC1018:s="AC18";break;case m.AC1021:s="AC21";break;case m.AC1024:case m.AC1027:case m.AC1032:s="AC24";break;default:throw new Error(`Dwg version not supported: ${e}`)}let n=$h.get(s);if(!n)throw new Error(`DwgStreamWriter factory for ${s} not registered. Import DwgStreamWriterFactory first.`);let a;switch(e){case m.AC1012:case m.AC1014:case m.AC1015:case m.AC1018:a="MergedAC14";break;default:a="Merged";break}let o=Lc.get(a);if(!o)throw new Error(`Merged writer factory for ${a} not registered. Import DwgStreamWriterFactory first.`);return a==="MergedAC14"?new o(t,new n(t,i),new n(new Uint8Array(0),i)):new o(t,new n(t,i),new n(new Uint8Array(0),i),new n(new Uint8Array(0),i))}writeInt(e){this.ensureCapacity(4);let t=new Uint8Array(4);new DataView(t.buffer).setInt32(0,e,!0),this.writeBytes(t)}writeObjectType(e){this.writeBitShort(e)}writeObjectTypeEnum(e){this.writeObjectType(e)}writeRawLong(e){let t=new Uint8Array(4);new DataView(t.buffer).setInt32(0,e,!0),this.writeBytes(t)}writeBytes(e){if(this.bitShift===0){this.ensureCapacity(e.length);for(let i=0;i<e.length;i++)this._buffer[this._position++]=e[i];return}let t=8-this.bitShift;this.ensureCapacity(e.length+1);for(let i of e)this._buffer[this._position++]=(this._lastByte|i>>>this.bitShift)&255,this._lastByte=i<<t&255}writeBytesOffset(e,t,i){if(this.bitShift===0){this.ensureCapacity(i);for(let n=0,a=t;n<i;n++,a++)this._buffer[this._position++]=e[a];return}let s=8-this.bitShift;this.ensureCapacity(i+1);for(let n=0,a=t;n<i;n++,a++){let o=e[a];this._buffer[this._position++]=(this._lastByte|o>>>this.bitShift)&255,this._lastByte=o<<s&255}}writeBitShort(e){e===0?this.write2Bits(2):e>0&&e<256?(this.write2Bits(1),this.writeByte(e)):e===256?this.write2Bits(3):(this.write2Bits(0),this.writeByte(e&255),this.writeByte(e>>>8&255))}writeBitDouble(e){if(e===0){this.write2Bits(2);return}if(e===1){this.write2Bits(1);return}this.write2Bits(0);let t=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.writeBytes(t)}writeBitLong(e){if(e===0){this.write2Bits(2);return}if(e>0&&e<256){this.write2Bits(1),this.writeByte(e);return}this.write2Bits(0),this.writeByte(e&255),this.writeByte(e>>>8&255),this.writeByte(e>>>16&255),this.writeByte(e>>>24&255)}writeBitLongLong(e){let t=0,i=e<0?e+18446744073709552e3:e,s=i;for(;s!==0;)s=Math.floor(s/256),t++;this.write3Bits(t),s=i;for(let n=0;n<t;n++)this.writeByte(s&255),s=Math.floor(s/256)}writeVariableText(e){if(!e||e.length===0){this.writeBitShort(0);return}let i=new TextEncoder().encode(e);this.writeBitShort(i.length),this.writeBytes(i)}writeTextUnicode(e){let t=e??"",s=new TextEncoder().encode(t);this.writeRawShort(s.length+1),this.ensureCapacity(s.length+1);for(let n=0;n<s.length;n++)this._buffer[this._position++]=s[n];this._buffer[this._position++]=0}write2Bits(e){this.bitShift<6?(this._lastByte|=e<<6-this.bitShift&255,this.bitShift+=2):this.bitShift===6?(this._lastByte|=e,this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this.resetShift()):(this._lastByte|=e>>>1&255,this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this._lastByte=e<<7&255,this.bitShift=1)}writeBit(e){if(this.bitShift<7){e&&(this._lastByte|=1<<7-this.bitShift&255),this.bitShift++;return}e&&(this._lastByte|=1),this.ensureCapacity(1),this._buffer[this._position++]=this._lastByte&255,this.resetShift()}writeByte(e){if(this.bitShift===0){this.ensureCapacity(1),this._buffer[this._position++]=e&255;return}let t=8-this.bitShift;this.ensureCapacity(1),this._buffer[this._position++]=(this._lastByte|e>>>this.bitShift)&255,this._lastByte=e<<t&255}resetShift(){this.bitShift=0,this._lastByte=0}writeDateTime(e){let{jdate:t,milliseconds:i}=Z.dateToJulian(e);this.writeBitLong(t),this.writeBitLong(i)}writeTimeSpan(e){let t=Math.floor(e/864e5),i=e%864e5;this.writeBitLong(t),this.writeBitLong(i)}write8BitJulianDate(e){let{jdate:t,milliseconds:i}=Z.dateToJulian(e);this.writeRawLong(t),this.writeRawLong(i)}writeCmColor(e){let t=0;e.isTrueColor?t=e.getApproxIndex():t=e.index,this.writeBitShort(t)}writeEnColor(e,t){this.writeCmColor(e)}writeEnColorBook(e,t,i){this.writeCmColor(e)}write2BitDouble(e){this.writeBitDouble(e.X),this.writeBitDouble(e.Y)}write3BitDouble(e){this.writeBitDouble(e.X),this.writeBitDouble(e.Y),this.writeBitDouble(e.Z)}write2RawDouble(e){this.writeRawDouble(e.X),this.writeRawDouble(e.Y)}writeRawShort(e){let t=new Uint8Array(2);new DataView(t.buffer).setInt16(0,e,!0),this.writeBytes(t)}writeRawDouble(e){let t=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.writeBytes(t)}handleReference(e){this.handleReferenceTyped(w.Undefined,e)}handleReferenceTyped(e,t){t==null?this.handleReferenceTypedHandle(e,0):typeof t=="number"?this.handleReferenceTypedHandle(e,t):this.handleReferenceTypedHandle(e,t.handle)}handleReferenceHandle(e){this.handleReferenceTypedHandle(w.Undefined,e)}handleReferenceTypedHandle(e,t){let i=e<<4&255;t===0?this.writeByte(i):t<256?(this.writeByte(i|1),this.writeByte(t)):t<65536?(this.writeByte(i|2),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<16777216?(this.writeByte(i|3),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<4294967296?(this.writeByte(i|4),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<1099511627776?(this.writeByte(i|5),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<281474976710656?(this.writeByte(i|6),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):t<72057594037927940?(this.writeByte(i|7),this.writeByte(Math.floor(t/281474976710656)&255),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255)):(this.writeByte(i|8),this.writeByte(Math.floor(t/72057594037927940)&255),this.writeByte(Math.floor(t/281474976710656)&255),this.writeByte(Math.floor(t/1099511627776)&255),this.writeByte(Math.floor(t/4294967296)&255),this.writeByte(t>>>24&255),this.writeByte(t>>>16&255),this.writeByte(t>>>8&255),this.writeByte(t&255))}writeSpearShift(){if(this.bitShift>0)for(let e=this.bitShift;e<8;e++)this.writeBit(!1)}writeBitThickness(e){this.writeBitDouble(e)}writeBitExtrusion(e){this.write3BitDouble(e)}write2BitDoubleWithDefault(e,t){this.writeBitDoubleWithDefault(e.X,t.X),this.writeBitDoubleWithDefault(e.Y,t.Y)}write3BitDoubleWithDefault(e,t){this.writeBitDoubleWithDefault(e.X,t.X),this.writeBitDoubleWithDefault(e.Y,t.Y),this.writeBitDoubleWithDefault(e.Z,t.Z)}writeBitDoubleWithDefault(e,t){if(e===t){this.write2Bits(0);return}let i=new Uint8Array(8);new DataView(i.buffer).setFloat64(0,e,!0);let n=new Uint8Array(8);new DataView(n.buffer).setFloat64(0,t,!0);let o=0,h=7;for(;h>=0&&i[h]===n[h];)o++,h--;o>=4?(this.write2Bits(1),this.writeBytesOffset(i,0,4)):o>=2?(this.write2Bits(2),this.writeByte(i[4]),this.writeByte(i[5]),this.writeByte(i[0]),this.writeByte(i[1]),this.writeByte(i[2]),this.writeByte(i[3])):(this.write2Bits(3),this.writeBytes(i))}resetStream(){this._position=0,this.bitShift=0,this._lastByte=0}savePositonForSize(){this.writeRawLong(0)}setPositionByFlag(e){if(e>=32768){if(e>=1073741824){let i=new Uint8Array(2);new DataView(i.buffer).setUint16(0,e>>>30&65535,!0),this.writeBytes(i);let s=new Uint8Array(2);new DataView(s.buffer).setUint16(0,e>>>15&32767|32768,!0),this.writeBytes(s)}else{let i=new Uint8Array(2);new DataView(i.buffer).setUint16(0,e>>>15&65535,!0),this.writeBytes(i)}let t=new Uint8Array(2);new DataView(t.buffer).setUint16(0,e&32767|32768,!0),this.writeBytes(t)}else{let t=new Uint8Array(2);new DataView(t.buffer).setUint16(0,e&65535,!0),this.writeBytes(t)}}setPositionInBits(e){let t=Math.floor(e/8);if(this.bitShift=e%8,this._position=t,this.bitShift>0){if(t>=this._buffer.length)throw new Error("EndOfStreamException");this._lastByte=this._buffer[t]}else this._lastByte=0}writeShiftValue(){if(this.bitShift>0){let e=this._position;if(e<this._buffer.length){let t=this._buffer[e],i=(this._lastByte|t&255>>>this.bitShift)&255;this._buffer[e]=i}}}write3Bits(e){this.writeBit((e&4)!==0),this.writeBit((e&2)!==0),this.writeBit((e&1)!==0)}ensureCapacity(e){let t=this._position+e;if(t>this._buffer.length){let i=Math.max(t,this._buffer.length*2),s=new Uint8Array(i);s.set(this._buffer),this._buffer=s,this._view=new DataView(s.buffer,s.byteOffset,s.byteLength)}}};var sd=class extends Y{get SectionName(){return T.AppInfo}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_writer;_emptyArr=new Uint8Array(16);constructor(e,t){super(e),this._writer=ye.getStreamWriter(e,t,"utf-16le")}write(){let e="1.0.0.0";this._writer.writeInt(3),this._writer.writeTextUnicode("AppInfoDataList"),this._writer.writeInt(3),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode(e),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode("This is a comment from ACadSharp"),this._writer.writeBytes(this._emptyArr),this._writer.writeTextUnicode(`<ProductInformation name ="ACadSharp" build_version="${e}" registry_version="${e}" install_id_string="ACadSharp" registry_localeID="1033"/>`)}};var nd=class extends Y{get SectionName(){return T.AuxHeader}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_stream;_encoding;_header;_writer;constructor(e,t,i){super(i.version),this._stream=e,this._encoding=t,this._header=i,this._writer=ye.getStreamWriter(this._version,this._stream,t)}write(){this._writer.writeByte(255),this._writer.writeByte(119),this._writer.writeByte(1),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawLong(1),this._writer.writeRawLong(-1),this._writer.writeRawShort(1),this._writer.writeRawShort(0),this._writer.writeRawLong(0),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawShort(this._version),this._writer.writeRawShort(this._header.maintenanceVersion),this._writer.writeRawShort(5),this._writer.writeRawShort(2195),this._writer.writeRawShort(5),this._writer.writeRawShort(2195),this._writer.writeRawShort(0),this._writer.writeRawShort(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.write8BitJulianDate(this._header.createDateTime),this._writer.write8BitJulianDate(this._header.updateDateTime);let e=-1;this._header.handleSeed<=2147483647&&(e=this._header.handleSeed),this._writer.writeRawLong(e),this._writer.writeRawLong(0),this._writer.writeRawShort(0),this._writer.writeRawShort(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(1),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this._writer.writeRawLong(0),this.R2018Plus&&(this._writer.writeRawShort(0),this._writer.writeRawShort(0))}};var ad=class extends Y{get SectionName(){return T.Classes}get bytesWritten(){return Math.ceil(this._startWriter.positionInBits/8)}get startWriterStream(){return this._startWriter.main.stream}_document;_sectionBuffer=[];_startWriter;_writer;_startSentinel=new Uint8Array([141,161,196,184,196,169,248,197,192,220,244,95,231,207,182,138]);_endSentinel=new Uint8Array([114,94,59,71,59,86,7,58,63,35,11,160,24,48,73,117]);constructor(e,t,i){super(t.header.version),this._document=t,this._startWriter=ye.getStreamWriter(this._version,e,i);let s=new Uint8Array(4096);this._writer=ye.getMergedWriter(this._version,s,i)}write(){this.R2007Plus&&this._writer.savePositonForSize();let e=0,t=[...this._document.classes];t.length>0&&(e=Math.max(...t.map(i=>i.classNumber))),this.R2004Plus&&(this.R2007Plus?(this._writer.writeBitLong(e),this._writer.writeBit(!0)):(this._writer.writeBitShort(e),this._writer.writeByte(0),this._writer.writeByte(0),this._writer.writeBit(!0)));for(let i of t)this._writer.writeBitShort(i.classNumber),this._writer.writeBitShort(i.proxyFlags),this._writer.writeVariableText(i.applicationName),this._writer.writeVariableText(i.cppClassName),this._writer.writeVariableText(i.dxfName),this._writer.writeBit(i.wasZombie),this._writer.writeBitShort(i.itemClassId),this.R2004Plus&&(this._writer.writeBitLong(i.instanceCount),this._writer.writeBitLong(i.dwgVersion),this._writer.writeBitLong(i.maintenanceVersion),this._writer.writeBitLong(0),this._writer.writeBitLong(0));this._writer.writeSpearShift(),this.writeSizeAndCrc()}writeSizeAndCrc(){this._startWriter.writeBytes(this._startSentinel);let e=Math.ceil(this._writer.main.positionInBits/8),t=new Uint8Array(this._writer.main.stream).slice(0,e),i=t.length,s=new Uint8Array(4);new DataView(s.buffer).setInt32(0,i,!0);let a=[];for(let h=0;h<4;h++)a.push(s[h]);if(this._document.header.version>=m.AC1024&&this._document.header.maintenanceVersion>3||this._document.header.version>m.AC1027)for(let h=0;h<4;h++)a.push(0);for(let h=0;h<i;h++)a.push(t[h]);let o=wr.GetCRCValue(49345,new Uint8Array(a),0,a.length);this._startWriter.writeBytes(s),(this._document.header.version>=m.AC1024&&this._document.header.maintenanceVersion>3||this._document.header.version>m.AC1027)&&this._startWriter.writeRawLong(0),this._startWriter.writeBytes(t),this._startWriter.writeRawShort(o),this._startWriter.writeBytes(this._endSentinel),this.R2004Plus&&(this._startWriter.writeRawLong(0),this._startWriter.writeRawLong(0))}};var Xa=class{FileHeader;get bytesWritten(){return this._streamPosition}_document;_encoding;_stream;_streamPosition=0;_version;constructor(e,t,i,s){this._document=i,this._stream=e,this._version=i.header.version,this._encoding=t,this.FileHeader=s}applyMagicSequence(e,t){for(let i=0;i<t;i++)e[i]^=rt.MagicSequence[i]}applyMask(e,t,i){let s=1097093995^this._streamPosition,n=new Uint8Array(4);new DataView(n.buffer).setInt32(0,s,!0);let o=t+i;for(;t<o;){for(let h=0;h<4;h++)e[t+h]^=n[h];t+=4}}checkEmptyBytes(e,t,i){let s=!0,n=t+i;for(let a=t;a<n;a++)if(e[a]!==0){s=!1;break}return s}getFileCodePage(){let e=Z.getCodeIndex(Z.getCodePage(this._document.header.codePage));return e<1?30:e}writeMagicNumber(){let e=this._streamPosition%32;for(let t=0;t<e;t++)this._stream[this._streamPosition++]=rt.MagicSequence[t]}writeToStream(e,t=0,i){let s=i??e.length;for(let n=0;n<s;n++)this._stream[this._streamPosition++]=e[t+n]}writeUint32ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,4).setUint32(0,e>>>0,!0),this._streamPosition+=4}writeInt32ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,4).setInt32(0,e,!0),this._streamPosition+=4}writeUint16ToStream(e){new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPosition,2).setUint16(0,e&65535,!0),this._streamPosition+=2}writeByteToStream(e){this._stream[this._streamPosition++]=e&255}};var od=class r extends Xa{get FileHeaderSize(){return 97}get HandleSectionOffset(){return this.FileHeaderSize+(this._records.get(T.AuxHeader).Stream?.length??0)+(this._records.get(T.Preview).Stream?.length??0)+(this._records.get(T.Header).Stream?.length??0)+(this._records.get(T.Classes).Stream?.length??0)}static _nRecords=6;_endSentinel=new Uint8Array([149,160,78,40,153,130,26,229,94,65,224,95,157,58,77,0]);_records=new Map;constructor(e,t,i){super(e,t,i,new Ei),this._records.set(T.AuxHeader,new ft(5)),this._records.set(T.Preview,new ft(null)),this._records.set(T.Header,new ft(0)),this._records.set(T.Classes,new ft(1)),this._records.set(T.AcDbObjects,new ft(null)),this._records.set(T.Handles,new ft(2)),this._records.set(T.ObjFreeSpace,new ft(3)),this._records.set(T.Template,new ft(4))}addSection(e,t,i,s=29696){this._records.get(e).Stream=t}writeFile(){this.setSeekers(),this.writeFileHeader(),this.writeRecordStreams()}setSeekers(){let e=this.FileHeaderSize;for(let[,t]of this._records)t.Seeker=e,e+=t.Stream?.length??0}writeFileHeader(){let e=[],t={pos:0,writeByte(h){e.push(h&255)},writeBytes(h,f=0,b){let S=b??h.length;for(let N=0;N<S;N++)e.push(h[f+N])},writeRawLong(h){e.push(h&255),e.push(h>>>8&255),e.push(h>>>16&255),e.push(h>>>24&255)},writeRawShort(h){e.push(h&255),e.push(h>>>8&255)}},i=new TextEncoder().encode(this._document.header.versionString);t.writeBytes(i,0,6),t.writeBytes(new Uint8Array([0,0,0,0,0,15,1])),t.writeRawLong(this._records.get(T.Preview).Seeker),t.writeByte(27),t.writeByte(25),t.writeRawShort(this.getFileCodePage()),t.writeRawLong(r._nRecords),this.writeRecord(t,this._records.get(T.Header)),this.writeRecord(t,this._records.get(T.Classes)),this.writeRecord(t,this._records.get(T.Handles)),this.writeRecord(t,this._records.get(T.ObjFreeSpace)),this.writeRecord(t,this._records.get(T.Template)),this.writeRecord(t,this._records.get(T.AuxHeader)),(8-e.length*8%8)%8>0;let n=new Uint8Array(e),a=wr.GetCRCValue(49345,n,0,n.length);t.writeRawShort(a),t.writeBytes(this._endSentinel,0,this._endSentinel.length);let o=new Uint8Array(e);this.writeToStream(o)}writeRecord(e,t){e.writeByte(t.Number),e.writeRawLong(t.Seeker),e.writeRawLong(t.Stream?.length??0)}writeRecordStreams(){for(let[,e]of this._records)e.Stream!=null&&this.writeToStream(e.Stream)}};var ld=class{_source;_dest;_block=new Int32Array(32768);_initialOffset=0;_currPosition=0;_currOffset=0;_totalOffset=0;constructor(){}compress(e,t,i,s){this.restartBlock(),this._source=e,this._dest=s,this._initialOffset=t,this._totalOffset=this._initialOffset+i,this._currOffset=this._initialOffset,this._currPosition=this._initialOffset+4;let n=0,a=0,o={value:0},h={value:0};for(;this._currPosition<this._totalOffset-19;){if(!this.compressChunk(o,h)){this._currPosition++;continue}let b=this._currPosition-this._currOffset;n!==0&&this.applyMask(a,n,b),this.writeLiteralLength(b),this._currPosition+=o.value,this._currOffset=this._currPosition,n=o.value,a=h.value}let f=this._totalOffset-this._currOffset;n!==0&&this.applyMask(a,n,f),this.writeLiteralLength(f),s.push(17),s.push(0),s.push(0)}restartBlock(){this._block.fill(-1)}writeLen(e){if(e<=0)throw new Error("Invalid length");for(;e>255;)e-=255,this._dest.push(0);this._dest.push(e&255)}writeOpCode(e,t,i){if(t<=0)throw new Error("Invalid compressionOffset");if(i<=0)throw new Error("Invalid value");t<=i?this._dest.push((e|t-2)&255):(this._dest.push(e&255),this.writeLen(t-i))}writeLiteralLength(e){if(e<=0)return;e>3&&this.writeOpCode(0,e-1,17);let t=this._currOffset;for(let i=0;i<e;i++)this._dest.push(this._source[t]),t++}applyMask(e,t,i){let s=0,n=0;t>=15||e>1024?(e<=16384?(e--,this.writeOpCode(32,t,33)):(e-=16384,this.writeOpCode(16|e>>>11&8,t,9)),s=(e&255)<<2,n=e>>>6):(e--,s=t+1<<4|(e&3)<<2,n=e>>>2),i<4&&(s|=i),this._dest.push(s&255),this._dest.push(n&255)}compressChunk(e,t){e.value=0;let a=((this._source[this._currPosition+3]<<6^this._source[this._currPosition+2])<<5^this._source[this._currPosition+1])<<5^this._source[this._currPosition],o=a+(a>>>5)&32767,h=this._block[o];if(t.value=this._currPosition-h,h>=this._initialOffset&&t.value<=49151){if(t.value>1024&&this._source[this._currPosition+3]!==this._source[h+3]&&(o=o&2047^16415,h=this._block[o],t.value=this._currPosition-h,h<this._initialOffset||t.value>49151||t.value>1024&&this._source[this._currPosition+3]!==this._source[h+3]))return this._block[o]=this._currPosition,!1;if(this._source[this._currPosition]===this._source[h]&&this._source[this._currPosition+1]===this._source[h+1]&&this._source[this._currPosition+2]===this._source[h+2]){e.value=3;let f=h+3,b=this._currPosition+3;for(;b<this._totalOffset&&this._source[f++]===this._source[b++];)e.value++}}return this._block[o]=this._currPosition,e.value>=3}};var Xs=class extends Xa{get FileHeaderSize(){return 256}get HandleSectionOffset(){return 0}get compressor(){return new ld}get _descriptors(){return this.FileHeader.Descriptors}_localSectionsMaps=[];constructor(e,t,i){super(e,t,i,new hs);for(let s=0;s<this.FileHeaderSize;s++)this._stream[this._streamPosition++]=0}addSection(e,t,i,s=29696){let n=new _r(e);this.FileHeader.AddSectionDescriptor(n),n.DecompressedSize=s,n.CompressedSize=t.length,n.CompressedCode=i?2:1;let a=Math.floor(t.length/n.DecompressedSize),o=0;for(let f=0;f<a;f++)this.createLocalSection(n,t,n.DecompressedSize,o,n.DecompressedSize,i),o+=n.DecompressedSize;let h=t.length%n.DecompressedSize;h>0&&!this.checkEmptyBytes(t,o,h)&&this.createLocalSection(n,t,n.DecompressedSize,o,h,i)}writeFile(){this.FileHeader.SectionArrayPageSize=this._localSectionsMaps.length+2,this.FileHeader.SectionPageMapId=this.FileHeader.SectionArrayPageSize,this.FileHeader.SectionMapId=this.FileHeader.SectionArrayPageSize-1,this.writeDescriptors(),this.writeRecords(),this.writeFileMetaData()}applyCompression(e,t,i,s,n){if(n){let a=new Uint8Array(t);for(let h=0;h<s;h++)a[h]=e[i+h];let o=[];return this.compressor.compress(a,0,t,o),new Uint8Array(o)}else{let a=new Uint8Array(t);for(let o=0;o<s;o++)a[o]=e[i+o];return a}}createLocalSection(e,t,i,s,n,a){let o=this.applyCompression(t,i,s,n,a);this.writeMagicNumber();let h=this._streamPosition,f=new cs;f.Offset=s,f.Seeker=h,f.PageNumber=this._localSectionsMaps.length+1,f.ODA=rt.Calculate(0,o,0,o.length);let b=rt.CompressionCalculator(o.length);f.CompressedSize=o.length,f.DecompressedSize=n,f.PageSize=f.CompressedSize+32+b,f.Checksum=0;let S=this.buildDataSection(e,f,e.PageType);if(f.Checksum=rt.Calculate(f.ODA,S,0,S.length),S=this.buildDataSection(e,f,e.PageType),this.applyMask(S,0,S.length),this.writeToStream(S),this.writeToStream(o),a)this.writeToStream(rt.MagicSequence,0,b);else if(b!==0)throw new Error("Compression diff should be 0 for uncompressed data");f.PageNumber>0&&e.PageCount++,f.Size=this._streamPosition-h,e.LocalSections.push(f),this._localSectionsMaps.push(f)}writeFileMetaData(){this.FileHeader.SecondHeaderAddr=this._streamPosition;let e=this.buildFileHeader();this.writeToStream(e);let t=this._streamPosition;this._streamPosition=0;let i=new TextEncoder().encode(this._document.header.versionString);this.writeToStream(i,0,6),this.writeToStream(new Uint8Array(5)),this.writeByteToStream(this._document.header.maintenanceVersion),this.writeByteToStream(3);let s=this._descriptors.get(T.Preview);this.writeUint32ToStream(s?.LocalSections?.[0]?s.LocalSections[0].Seeker+32:0),this.writeByteToStream(33),this.writeByteToStream(this._document.header.maintenanceVersion),this.writeUint16ToStream(this.getFileCodePage()),this.writeToStream(new Uint8Array(3)),this.writeInt32ToStream(0),this.writeInt32ToStream(0);let n=this._descriptors.get(T.SummaryInfo);this.writeUint32ToStream(n?.LocalSections?.[0]?n.LocalSections[0].Seeker+32:0),this.writeUint32ToStream(0),this.writeUint32ToStream(128);let a=this._descriptors.get(T.AppInfo);this.writeUint32ToStream(a?.LocalSections?.[0]?a.LocalSections[0].Seeker+32:0),this.writeToStream(new Uint8Array(80)),this.writeToStream(e),this.writeToStream(rt.MagicSequence,236,20),this._streamPosition=t}addSectionMap(e){e.PageNumber=this._localSectionsMaps.length+1,this._localSectionsMaps.push(e)}compressChecksum(e,t){e.DecompressedSize=t.length;let i=[];this.compressor.compress(t,0,t.length,i);let s=new Uint8Array(i);e.CompressedSize=s.length;let n=this.buildPageHeaderData(e);e.Checksum=rt.Calculate(0,n,0,n.length),e.Checksum=rt.Calculate(e.Checksum,s,0,s.length);let a=this.buildPageHeaderData(e);this.writeToStream(a),this.writeToStream(s)}setSeeker(e,t){let i=new cs;return i.SectionMap=e,this.writeMagicNumber(),i.Seeker=this._streamPosition,this.compressChecksum(i,t),i}buildDataSection(e,t,i){let s=new Uint8Array(32),n=new DataView(s.buffer);return n.setInt32(0,i,!0),n.setInt32(4,e.SectionId,!0),n.setInt32(8,t.CompressedSize,!0),n.setInt32(12,t.PageSize,!0),n.setInt32(16,t.Offset&4294967295,!0),n.setInt32(20,0,!0),n.setUint32(24,t.Checksum>>>0,!0),n.setUint32(28,t.ODA>>>0,!0),s}writeDescriptors(){let e=[],t=h=>{e.push(h&255),e.push(h>>>8&255),e.push(h>>>16&255),e.push(h>>>24&255)},i=h=>{t(h),t(0)},s=(h,f=0,b)=>{let S=b??h.length;for(let N=0;N<S;N++)e.push(h[f+N])};t(this._descriptors.size),t(2),t(29696),t(0),t(this._descriptors.size);for(let h of this._descriptors.values()){i(h.CompressedSize),t(h.PageCount),t(h.DecompressedSize),t(1),t(h.CompressedCode),t(h.SectionId),t(h.Encrypted);let f=new Uint8Array(64);if(h.Name){let b=new TextEncoder().encode(h.Name),S=Math.min(b.length,f.length);for(let N=0;N<S;N++)f[N]=b[N]}s(f);for(let b of h.LocalSections)b.PageNumber>0&&(t(b.PageNumber),t(b.CompressedSize),i(b.Offset))}let n=new Uint8Array(e),a=this.setSeeker(1097007163,n),o=rt.CompressionCalculator(this._streamPosition-a.Seeker);this.writeToStream(rt.MagicSequence,0,o),a.Size=this._streamPosition-a.Seeker,this.addSectionMap(a)}buildFileHeader(){let e=new Uint8Array(108),t=0,i=o=>{e[t++]=o&255,e[t++]=o>>>8&255,e[t++]=o>>>16&255,e[t++]=o>>>24&255},s=o=>{i(o),i(0)},n=new TextEncoder().encode("AcFssFcAJMB");for(let o=0;o<11;o++)e[t++]=n[o];e[t++]=0,i(0),i(108),i(4),i(this.FileHeader.RootTreeNodeGap),i(this.FileHeader.LeftGap),i(this.FileHeader.RigthGap),i(1),i(this.FileHeader.LastPageId),s(this.FileHeader.LastSectionAddr),s(this.FileHeader.SecondHeaderAddr),i(this.FileHeader.GapAmount),i(this.FileHeader.SectionAmount),i(32),i(128),i(64),i(this.FileHeader.SectionPageMapId),s(this.FileHeader.PageMapAddress-256),i(this.FileHeader.SectionMapId),i(this.FileHeader.SectionArrayPageSize),i(this.FileHeader.GapArraySize),i(0);let a=4294967295;for(let o=0;o<108;o++)a=(a>>>8^ds.Crc32Table[(a^e[o])&255])>>>0;return a=~a>>>0,e[104]=a&255,e[105]=a>>>8&255,e[106]=a>>>16&255,e[107]=a>>>24&255,this.applyMagicSequence(e,e.length),e}buildPageHeaderData(e){let t=new Uint8Array(20),i=new DataView(t.buffer);return i.setInt32(0,e.SectionMap,!0),i.setInt32(4,e.DecompressedSize,!0),i.setInt32(8,e.CompressedSize,!0),i.setInt32(12,e.Compression,!0),i.setUint32(16,e.Checksum>>>0,!0),t}writeRecords(){this.writeMagicNumber();let e=new cs;e.SectionMap=1097010747,this.addSectionMap(e);let t=this._localSectionsMaps.length*8;e.Seeker=this._streamPosition;let i=t+rt.CompressionCalculator(t);e.Size=i;let s=[];for(let o of this._localSectionsMaps)if(o!=null){s.push(o.PageNumber&255),s.push(o.PageNumber>>>8&255),s.push(o.PageNumber>>>16&255),s.push(o.PageNumber>>>24&255);let h=o.Size;s.push(h&255),s.push(h>>>8&255),s.push(h>>>16&255),s.push(h>>>24&255)}let n=new Uint8Array(s);this.compressChecksum(e,n);let a=this._localSectionsMaps[this._localSectionsMaps.length-1];this.FileHeader.GapAmount=0,this.FileHeader.LastPageId=a.PageNumber,this.FileHeader.LastSectionAddr=a.Seeker+i-256,this.FileHeader.SectionAmount=this._localSectionsMaps.length-1,this.FileHeader.PageMapAddress=e.Seeker}};var dd=class{compress(e,t,i,s){throw new Error("AC1021 DWG compression is not supported yet.")}};var Yh=class extends Xs{get FileHeaderSize(){return 1152}get compressor(){return new dd}constructor(e,t,i){super(e,t,i)}createLocalSection(e,t,i,s,n,a){let o=this.applyCompression(t,i,s,n,a);this.writeMagicNumber()}};var hd=class extends Y{get SectionName(){return T.Handles}_buffer=[];_handleMap;constructor(e,t){super(e),this._handleMap=new Map([...t.entries()].sort((i,s)=>i[0]-s[0]))}write(e=0){let t=new Uint8Array(10),i=new Uint8Array(5),s=0,n=0,a=this._buffer.length;this._buffer.push(0),this._buffer.push(0);for(let[o,h]of this._handleMap){let f=o-s,b=h+e,S=b-n,N=this.modularShortToValue(f,t),L=this.signedModularShortToValue(S,i);if(this._buffer.length-a+(N+L)>2032){if(this.processPosition(a),s=0,n=0,a=this._buffer.length,this._buffer.push(0),this._buffer.push(0),s=0,n=0,f=o-s,f===0)throw new Error("Handle offset is zero");S=b-n,N=this.modularShortToValue(f,t),L=this.signedModularShortToValue(S,i)}for(let j=0;j<N;j++)this._buffer.push(t[j]);for(let j=0;j<L;j++)this._buffer.push(i[j]);s=o,n=b}return this.processPosition(a),a=this._buffer.length,this._buffer.push(0),this._buffer.push(0),this.processPosition(a),new Uint8Array(this._buffer)}modularShortToValue(e,t){let i=0;for(;e>=128;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=e&255,i+1}signedModularShortToValue(e,t){let i=0;if(e<0){for(e=-e;e>=64;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=(e|64)&255,i+1}for(;e>=64;)t[i]=(e&127|128)&255,i++,e=e>>>7;return t[i]=e&255,i+1}processPosition(e){let t=this._buffer.length-e;this._buffer[e]=t>>>8&255,this._buffer[e+1]=t&255;let i=new Uint8Array(this._buffer),s=wr.GetCRCValue(49345,i,e,this._buffer.length-e);this._buffer.push(s>>>8&255),this._buffer.push(s&255)}};var cd=class extends Y{get SectionName(){return T.Header}get bytesWritten(){return Math.ceil(this._startWriter.positionInBits/8)}get startWriterStream(){return this._startWriter.main.stream}_msmain;_startWriter;_writer;_document;_header;_encoding;constructor(e,t,i){super(t.header.version),this._document=t,this._header=t.header,this._encoding=i,this._startWriter=ye.getStreamWriter(this._version,e,this._encoding),this._msmain=new Uint8Array(8192),this._writer=ye.getStreamWriter(this._version,this._msmain,this._encoding)}write(){if(this.R2007Plus&&(this._writer=ye.getMergedWriter(this._version,this._msmain,this._encoding),this._writer.savePositonForSize()),this.R2013Plus&&this._writer.writeBitLongLong(0),this._writer.writeBitDouble(412148564080),this._writer.writeBitDouble(1),this._writer.writeBitDouble(1),this._writer.writeBitDouble(1),this._writer.writeVariableText("m"),this._writer.writeVariableText(""),this._writer.writeVariableText(""),this._writer.writeVariableText(""),this._writer.writeBitLong(24),this._writer.writeBitLong(0),this.R13_14Only&&this._writer.writeBitShort(0),this.R2004Pre&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBit(this._header.associatedDimensions),this._writer.writeBit(this._header.updateDimensionsWhileDragging),this.R13_14Only&&this._writer.writeBit(this._header.DIMSAV!==0),this._writer.writeBit(this._header.polylineLineTypeGeneration),this._writer.writeBit(this._header.orthoMode),this._writer.writeBit(this._header.regenerationMode!==0),this._writer.writeBit(this._header.fillMode),this._writer.writeBit(this._header.quickTextMode),this._writer.writeBit(this._header.paperSpaceLineTypeScaling===bi.Normal),this._writer.writeBit(this._header.limitCheckingOn),this.R13_14Only&&this._writer.writeBit(this._header.blipMode),this.R2004Plus&&this._writer.writeBit(!1),this._writer.writeBit(this._header.userTimer),this._writer.writeBit(this._header.sketchPolylineType!==0),this._writer.writeBit(this._header.angularDirection!==0),this._writer.writeBit(this._header.showSplineControlPoints),this.R13_14Only&&(this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.writeBit(this._header.mirrorText),this._writer.writeBit(this._header.worldView),this.R13_14Only&&this._writer.writeBit(!1),this._writer.writeBit(this._header.showModelSpaceInPaperSpace),this._writer.writeBit(this._header.paperSpaceLimitsChecking),this._writer.writeBit(this._header.retainXRefDependentVisibilitySettings),this.R13_14Only&&this._writer.writeBit(!1),this._writer.writeBit(this._header.displaySilhouetteCurves),this._writer.writeBit(this._header.createEllipseAsPolyline),this._writer.writeBitShort(this._header.proxyGraphics?1:0),this.R13_14Only&&this._writer.writeBitShort(0),this._writer.writeBitShort(this._header.spatialIndexMaxTreeDepth),this._writer.writeBitShort(this._header.linearUnitFormat),this._writer.writeBitShort(this._header.linearUnitPrecision),this._writer.writeBitShort(this._header.angularUnit),this._writer.writeBitShort(this._header.angularUnitPrecision),this.R13_14Only&&this._writer.writeBitShort(this._header.objectSnapMode),this._writer.writeBitShort(this._header.attributeVisibility),this.R13_14Only&&this._writer.writeBitShort(0),this._writer.writeBitShort(this._header.pointDisplayMode),this.R13_14Only&&this._writer.writeBitShort(0),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitLong(0)),this._writer.writeBitShort(this._header.userShort1),this._writer.writeBitShort(this._header.userShort2),this._writer.writeBitShort(this._header.userShort3),this._writer.writeBitShort(this._header.userShort4),this._writer.writeBitShort(this._header.userShort5),this._writer.writeBitShort(this._header.numberOfSplineSegments),this._writer.writeBitShort(this._header.surfaceDensityM),this._writer.writeBitShort(this._header.surfaceDensityM),this._writer.writeBitShort(this._header.surfaceType),this._writer.writeBitShort(this._header.surfaceTabulation1),this._writer.writeBitShort(this._header.surfaceTabulation2),this._writer.writeBitShort(this._header.splineType),this._writer.writeBitShort(this._header.shadeEdge),this._writer.writeBitShort(this._header.shadeDiffuseToAmbientPercentage),this._writer.writeBitShort(this._header.unitMode),this._writer.writeBitShort(this._header.maxViewportCount),this._writer.writeBitShort(this._header.surfaceIsolineCount),this._writer.writeBitShort(this._header.currentMultiLineJustification),this._writer.writeBitShort(this._header.textQuality),this._writer.writeBitDouble(this._header.lineTypeScale),this._writer.writeBitDouble(this._header.textHeightDefault),this._writer.writeBitDouble(this._header.traceWidthDefault),this._writer.writeBitDouble(this._header.sketchIncrement),this._writer.writeBitDouble(this._header.filletRadius),this._writer.writeBitDouble(this._header.thicknessDefault),this._writer.writeBitDouble(this._header.angleBase),this._writer.writeBitDouble(this._header.pointDisplaySize),this._writer.writeBitDouble(this._header.polylineWidthDefault),this._writer.writeBitDouble(this._header.userDouble1),this._writer.writeBitDouble(this._header.userDouble2),this._writer.writeBitDouble(this._header.userDouble3),this._writer.writeBitDouble(this._header.userDouble4),this._writer.writeBitDouble(this._header.userDouble5),this._writer.writeBitDouble(this._header.chamferDistance1),this._writer.writeBitDouble(this._header.chamferDistance2),this._writer.writeBitDouble(this._header.chamferLength),this._writer.writeBitDouble(this._header.chamferAngle),this._writer.writeBitDouble(this._header.facetResolution),this._writer.writeBitDouble(this._header.currentMultilineScale),this._writer.writeBitDouble(this._header.currentEntityLinetypeScale),this._writer.writeVariableText(this._header.menuFileName),this._writer.writeDateTime(this._header.createDateTime),this._writer.writeDateTime(this._header.updateDateTime),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitLong(0)),this._writer.writeTimeSpan(this._header.totalEditingTime),this._writer.writeTimeSpan(this._header.userElapsedTimeSpan),this._writer.writeCmColor(this._header.currentEntityColor),this._writer.main.handleReferenceHandle(this._header.handleSeed),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentLayer),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentTextStyle),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentLineType),this.R2007Plus&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentDimensionStyle),this._writer.handleReferenceTyped(w.HardPointer,this._header.currentMLineStyleName),this.R2000Plus&&this._writer.writeBitDouble(this._header.viewportDefaultViewScaleFactor),this._writer.write3BitDouble(this._header.paperSpaceInsertionBase),this._writer.write3BitDouble(this._header.paperSpaceExtMin),this._writer.write3BitDouble(this._header.paperSpaceExtMax),this._writer.write2RawDouble(this._header.paperSpaceLimitsMin),this._writer.write2RawDouble(this._header.paperSpaceLimitsMax),this._writer.writeBitDouble(this._header.paperSpaceElevation),this._writer.write3BitDouble(this._header.paperSpaceUcs),this._writer.write3BitDouble(this._header.paperSpaceXAxis),this._writer.write3BitDouble(this._header.paperSpaceYAxis),this._writer.handleReferenceTyped(w.HardPointer,this._header.paperSpaceUcs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitShort(0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.write3BitDouble(this._header.paperSpaceOrthographicTopDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicBottomDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicLeftDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicRightDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicFrontDOrigin),this._writer.write3BitDouble(this._header.paperSpaceOrthographicBackDOrigin)),this._writer.write3BitDouble(this._header.modelSpaceInsertionBase),this._writer.write3BitDouble(this._header.modelSpaceExtMin),this._writer.write3BitDouble(this._header.modelSpaceExtMax),this._writer.write2RawDouble(this._header.modelSpaceLimitsMin),this._writer.write2RawDouble(this._header.modelSpaceLimitsMax),this._writer.writeBitDouble(this._header.elevation),this._writer.write3BitDouble(this._header.modelSpaceOrigin),this._writer.write3BitDouble(this._header.modelSpaceXAxis),this._writer.write3BitDouble(this._header.modelSpaceYAxis),this._writer.handleReferenceTyped(w.HardPointer,this._header.modelSpaceUcs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitShort(0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.write3BitDouble(this._header.modelSpaceOrthographicTopDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicBottomDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicLeftDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicRightDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicFrontDOrigin),this._writer.write3BitDouble(this._header.modelSpaceOrthographicBackDOrigin),this._writer.writeVariableText(this._header.dimensionPostFix),this._writer.writeVariableText(this._header.dimensionAlternateDimensioningSuffix)),this.R13_14Only&&(this._writer.writeBit(this._header.dimensionGenerateTolerances),this._writer.writeBit(this._header.dimensionLimitsGeneration),this._writer.writeBit(this._header.dimensionTextInsideHorizontal),this._writer.writeBit(this._header.dimensionTextOutsideHorizontal),this._writer.writeBit(this._header.dimensionSuppressFirstExtensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondExtensionLine),this._writer.writeBit(this._header.dimensionAlternateUnitDimensioning),this._writer.writeBit(this._header.dimensionTextOutsideExtensions),this._writer.writeBit(this._header.dimensionSeparateArrowBlocks),this._writer.writeBit(this._header.dimensionTextInsideExtensions),this._writer.writeBit(this._header.dimensionSuppressOutsideExtensions),this._writer.writeByte(this._header.dimensionAlternateUnitDecimalPlaces),this._writer.writeByte(this._header.dimensionZeroHandling),this._writer.writeBit(this._header.dimensionSuppressFirstDimensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondDimensionLine),this._writer.writeByte(this._header.dimensionToleranceAlignment),this._writer.writeByte(this._header.dimensionTextHorizontalAlignment),this._writer.writeByte(this._header.dimensionFit),this._writer.writeBit(this._header.dimensionCursorUpdate),this._writer.writeByte(this._header.dimensionToleranceZeroHandling),this._writer.writeByte(this._header.dimensionAlternateUnitZeroHandling),this._writer.writeByte(this._header.dimensionAlternateUnitToleranceZeroHandling),this._writer.writeByte(this._header.dimensionTextVerticalAlignment),this._writer.writeBitShort(this._header.dimensionUnit),this._writer.writeBitShort(this._header.dimensionAngularDimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAlternateUnitFormat),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceDecimalPlaces),this._writer.handleReferenceTyped(w.HardPointer,this._header.dimensionTextStyle)),this._writer.writeBitDouble(this._header.dimensionScaleFactor),this._writer.writeBitDouble(this._header.dimensionArrowSize),this._writer.writeBitDouble(this._header.dimensionExtensionLineOffset),this._writer.writeBitDouble(this._header.dimensionLineIncrement),this._writer.writeBitDouble(this._header.dimensionExtensionLineExtension),this._writer.writeBitDouble(this._header.dimensionRounding),this._writer.writeBitDouble(this._header.dimensionLineExtension),this._writer.writeBitDouble(this._header.dimensionPlusTolerance),this._writer.writeBitDouble(this._header.dimensionMinusTolerance),this.R2007Plus&&(this._writer.writeBitDouble(this._header.dimensionFixedExtensionLineLength),this._writer.writeBitDouble(this._header.dimensionJoggedRadiusDimensionTransverseSegmentAngle),this._writer.writeBitShort(this._header.dimensionTextBackgroundFillMode),this._writer.writeCmColor(this._header.dimensionTextBackgroundColor)),this.R2000Plus&&(this._writer.writeBit(this._header.dimensionGenerateTolerances),this._writer.writeBit(this._header.dimensionLimitsGeneration),this._writer.writeBit(this._header.dimensionTextInsideHorizontal),this._writer.writeBit(this._header.dimensionTextOutsideHorizontal),this._writer.writeBit(this._header.dimensionSuppressFirstExtensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondExtensionLine),this._writer.writeBitShort(this._header.dimensionTextVerticalAlignment),this._writer.writeBitShort(this._header.dimensionZeroHandling),this._writer.writeBitShort(this._header.dimensionAngularZeroHandling)),this.R2007Plus&&this._writer.writeBitShort(this._header.dimensionArcLengthSymbolPosition),this._writer.writeBitDouble(this._header.dimensionTextHeight),this._writer.writeBitDouble(this._header.dimensionCenterMarkSize),this._writer.writeBitDouble(this._header.dimensionTickSize),this._writer.writeBitDouble(this._header.dimensionAlternateUnitScaleFactor),this._writer.writeBitDouble(this._header.dimensionLinearScaleFactor),this._writer.writeBitDouble(this._header.dimensionTextVerticalPosition),this._writer.writeBitDouble(this._header.dimensionToleranceScaleFactor),this._writer.writeBitDouble(this._header.dimensionLineGap),this.R13_14Only&&(this._writer.writeVariableText(this._header.dimensionPostFix),this._writer.writeVariableText(this._header.dimensionAlternateDimensioningSuffix),this._writer.writeVariableText(this._header.dimensionBlockName),this._writer.writeVariableText(this._header.dimensionBlockNameFirst),this._writer.writeVariableText(this._header.dimensionBlockNameSecond)),this.R2000Plus&&(this._writer.writeBitDouble(this._header.dimensionAlternateUnitRounding),this._writer.writeBit(this._header.dimensionAlternateUnitDimensioning),this._writer.writeBitShort(this._header.dimensionAlternateUnitDecimalPlaces),this._writer.writeBit(this._header.dimensionTextOutsideExtensions),this._writer.writeBit(this._header.dimensionSeparateArrowBlocks),this._writer.writeBit(this._header.dimensionTextInsideExtensions),this._writer.writeBit(this._header.dimensionSuppressOutsideExtensions)),this._writer.writeCmColor(this._header.dimensionLineColor),this._writer.writeCmColor(this._header.dimensionExtensionLineColor),this._writer.writeCmColor(this._header.dimensionTextColor),this.R2000Plus&&(this._writer.writeBitShort(this._header.dimensionAngularDimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionDecimalPlaces),this._writer.writeBitShort(this._header.dimensionToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAlternateUnitFormat),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceDecimalPlaces),this._writer.writeBitShort(this._header.dimensionAngularUnit),this._writer.writeBitShort(this._header.dimensionFractionFormat),this._writer.writeBitShort(this._header.dimensionLinearUnitFormat),this._writer.writeBitShort(this._header.dimensionDecimalSeparator.charCodeAt(0)||0),this._writer.writeBitShort(this._header.dimensionTextMovement),this._writer.writeBitShort(this._header.dimensionTextHorizontalAlignment),this._writer.writeBit(this._header.dimensionSuppressFirstDimensionLine),this._writer.writeBit(this._header.dimensionSuppressSecondDimensionLine),this._writer.writeBitShort(this._header.dimensionToleranceAlignment),this._writer.writeBitShort(this._header.dimensionToleranceZeroHandling),this._writer.writeBitShort(this._header.dimensionAlternateUnitZeroHandling),this._writer.writeBitShort(this._header.dimensionAlternateUnitToleranceZeroHandling),this._writer.writeBit(this._header.dimensionCursorUpdate),this._writer.writeBitShort(this._header.dimensionDimensionTextArrowFit)),this.R2007Plus&&this._writer.writeBit(this._header.dimensionIsExtensionLineLengthFixed),this.R2010Plus&&(this._writer.writeBit(this._header.dimensionTextDirection===1),this._writer.writeBitDouble(this._header.dimensionAltMzf),this._writer.writeVariableText(this._header.dimensionAltMzs),this._writer.writeBitDouble(this._header.dimensionFit),this._writer.writeVariableText(this._header.dimensionMzs)),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,this._header.dimensionTextStyle),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2000Plus&&(this._writer.writeBitShort(this._header.dimensionLineWeight),this._writer.writeBitShort(this._header.extensionLineWeight)),this._writer.handleReferenceTyped(w.HardOwnership,this._document.blockRecords),this._writer.handleReferenceTyped(w.HardOwnership,this._document.layers),this._writer.handleReferenceTyped(w.HardOwnership,this._document.textStyles),this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes),this._writer.handleReferenceTyped(w.HardOwnership,this._document.views),this._writer.handleReferenceTyped(w.HardOwnership,this._document.uCSs),this._writer.handleReferenceTyped(w.HardOwnership,this._document.vPorts),this._writer.handleReferenceTyped(w.HardOwnership,this._document.appIds),this._writer.handleReferenceTyped(w.HardOwnership,this._document.dimensionStyles),this.R13_15Only&&this._writer.handleReferenceTyped(w.HardOwnership,this._document.vEntityControl),this._writer.handleReferenceTyped(w.HardPointer,this._document.groups),this._writer.handleReferenceTyped(w.HardPointer,this._document.mLineStyles),this._writer.handleReferenceTyped(w.HardOwnership,this._document.rootDictionary),this.R2000Plus&&(this._writer.writeBitShort(this._header.stackedTextAlignment),this._writer.writeBitShort(this._header.stackedTextSizePercentage),this._writer.writeVariableText(this._header.hyperLinkBase),this._writer.writeVariableText(this._header.styleSheetName),this._writer.handleReferenceTyped(w.HardPointer,this._document.layouts),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2004Plus&&(this._writer.handleReferenceTyped(w.HardPointer,this._document.materials),this._writer.handleReferenceTyped(w.HardPointer,this._document.colors)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this.R2013Plus&&this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2000Plus){let e=this._header.currentEntityLineWeight&31|this._header.endCaps<<5|this._header.joinStyle<<7;this._header.displayLineWeight||(e|=512),this._header.xEdit||(e|=1024),this._header.extendedNames&&(e|=2048),this._header.plotStyleMode===1&&(e|=8192),this._header.loadOLEObject&&(e|=16384),this._writer.writeBitLong(e),this._writer.writeBitShort(this._header.insUnits),this._writer.writeBitShort(this._header.currentEntityPlotStyle),this._header.currentEntityPlotStyle===Qi.ByObjectId&&this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeVariableText(this._header.fingerPrintGuid),this._writer.writeVariableText(this._header.versionGuid)}this.R2004Plus&&(this._writer.writeByte(this._header.entitySortingFlags),this._writer.writeByte(this._header.indexCreationFlags),this._writer.writeByte(this._header.hideText),this._writer.writeByte(this._header.externalReferenceClippingBoundaryType),this._writer.writeByte(this._header.dimensionAssociativity),this._writer.writeByte(this._header.haloGapPercentage),this._writer.writeBitShort(this._header.obscuredColor.index),this._writer.writeBitShort(this._header.interfereColor.index),this._writer.writeByte(this._header.obscuredType),this._writer.writeByte(this._header.intersectionDisplay),this._writer.writeVariableText(this._header.projectName)),this._writer.handleReferenceTyped(w.HardPointer,this._document.paperSpace),this._writer.handleReferenceTyped(w.HardPointer,this._document.modelSpace),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("ByLayer")),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("ByBlock")),this._writer.handleReferenceTyped(w.HardPointer,this._document.lineTypes.get("Continuous")),this.R2007Plus&&(this._writer.writeBit(this._header.cameraDisplayObjects),this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBitDouble(0),this._writer.writeBitDouble(this._header.stepsPerSecond),this._writer.writeBitDouble(this._header.stepSize),this._writer.writeBitDouble(this._header.dw3DPrecision),this._writer.writeBitDouble(this._header.lensLength),this._writer.writeBitDouble(this._header.cameraHeight),this._writer.writeByte(this._header.solidsRetainHistory?1:0),this._writer.writeByte(this._header.showSolidsHistory?1:0),this._writer.writeBitDouble(this._header.sweptSolidWidth),this._writer.writeBitDouble(this._header.sweptSolidHeight),this._writer.writeBitDouble(this._header.draftAngleFirstCrossSection),this._writer.writeBitDouble(this._header.draftAngleSecondCrossSection),this._writer.writeBitDouble(this._header.draftMagnitudeFirstCrossSection),this._writer.writeBitDouble(this._header.draftMagnitudeSecondCrossSection),this._writer.writeBitShort(this._header.solidLoftedShape),this._writer.writeByte(this._header.loftedObjectNormals.charCodeAt(0)||0),this._writer.writeBitDouble(this._header.latitude),this._writer.writeBitDouble(this._header.longitude),this._writer.writeBitDouble(this._header.northDirection),this._writer.writeBitLong(this._header.timeZone),this._writer.writeByte(this._header.displayLightGlyphs.charCodeAt(0)||0),this._writer.writeByte(48),this._writer.writeByte(this._header.dwgUnderlayFramesVisibility.charCodeAt(0)||0),this._writer.writeByte(this._header.dgnUnderlayFramesVisibility.charCodeAt(0)||0),this._writer.writeBit(!1),this._writer.writeCmColor(this._header.interfereColor),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeByte(this._header.shadowMode),this._writer.writeBitDouble(this._header.shadowPlaneLocation)),this._header.version>=m.AC1014&&(this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this._writer.writeBitShort(-1),this.R2004Plus&&(this._writer.writeBitLong(0),this._writer.writeBitLong(0),this._writer.writeBit(!1))),this._writer.writeSpearShift(),this.writeSizeAndCrc()}writeSizeAndCrc(){this._startWriter.writeBytes(T.StartSentinels.get(this.SectionName));let e=Math.ceil(this._writer.main.positionInBits/8),t=new Uint8Array(this._writer.main.stream).slice(0,e),i=t.length,s=new Uint8Array(4);new DataView(s.buffer).setInt32(0,i,!0);let a=[];for(let h=0;h<4;h++)a.push(s[h]);if(this.R2010Plus&&this._header.maintenanceVersion>3||this.R2018Plus)for(let h=0;h<4;h++)a.push(0);for(let h=0;h<i;h++)a.push(t[h]);let o=wr.GetCRCValue(49345,new Uint8Array(a),0,a.length);this._startWriter.writeBytes(s),(this.R2010Plus&&this._header.maintenanceVersion>3||this.R2018Plus)&&this._startWriter.writeRawLong(0),this._startWriter.writeBytes(t),this._startWriter.writeRawShort(o),this._startWriter.writeBytes(T.EndSentinels.get(this.SectionName))}};var Za=class{get encoding(){return this.main.encoding}main;textWriter;handleWriter;stream;savedPositionInBits=0;positionInBits=0;_savedPosition=!1;constructor(e,t,i,s){this.stream=e.buffer,this.main=t,this.textWriter=i,this.handleWriter=s}handleReference(e){this.handleWriter.handleReference(e)}handleReferenceTyped(e,t){this.handleWriter.handleReferenceTyped(e,t)}handleReferenceHandle(e){this.handleWriter.handleReferenceHandle(e)}handleReferenceTypedHandle(e,t){this.handleWriter.handleReferenceTypedHandle(e,t)}resetStream(){this.main.resetStream(),this.textWriter.resetStream(),this.handleWriter.resetStream()}savePositonForSize(){this._savedPosition=!0,this.positionInBits=this.main.positionInBits,this.main.writeRawLong(0)}write2RawDouble(e){this.main.write2RawDouble(e)}write2BitDouble(e){this.main.write2BitDouble(e)}write3BitDouble(e){this.main.write3BitDouble(e)}writeBit(e){this.main.writeBit(e)}write2Bits(e){this.main.write2Bits(e)}writeBitDouble(e){this.main.writeBitDouble(e)}write2BitDoubleWithDefault(e,t){this.main.write2BitDoubleWithDefault(e,t)}write3BitDoubleWithDefault(e,t){this.main.write3BitDoubleWithDefault(e,t)}writeBitDoubleWithDefault(e,t){this.main.writeBitDoubleWithDefault(e,t)}writeBitExtrusion(e){this.main.writeBitExtrusion(e)}writeBitLong(e){this.main.writeBitLong(e)}writeBitLongLong(e){this.main.writeBitLongLong(e)}writeBitShort(e){this.main.writeBitShort(e)}writeBitThickness(e){this.main.writeBitThickness(e)}writeByte(e){this.main.writeByte(e)}writeBytes(e){this.main.writeBytes(e)}writeBytesOffset(e,t,i){this.main.writeBytesOffset(e,t,i)}writeCmColor(e){this.main.writeCmColor(e)}writeEnColor(e,t){this.main.writeEnColor(e,t)}writeEnColorBook(e,t,i){this.main.writeEnColorBook(e,t,i)}writeDateTime(e){this.main.writeDateTime(e)}write8BitJulianDate(e){this.main.write8BitJulianDate(e)}writeInt(e){this.main.writeInt(e)}writeObjectType(e){this.main.writeObjectType(e)}writeObjectTypeEnum(e){this.main.writeObjectTypeEnum(e)}writeRawDouble(e){this.main.writeRawDouble(e)}writeRawLong(e){this.main.writeRawLong(e)}writeRawShort(e){this.main.writeRawShort(e)}writeSpearShift(){let e=this.main.positionInBits,t=this.textWriter.positionInBits;if(this.main.writeSpearShift(),this._savedPosition){let n=e+t+1;t>0&&(n+=16,t>=32768&&(n+=16,t>=1073741824&&(n+=16))),this.main.setPositionInBits(this.positionInBits),this.main.writeRawLong(n),this.main.writeShiftValue()}if(this.main.setPositionInBits(e),t>0){this.textWriter.writeSpearShift();let n=Math.ceil(this.textWriter.positionInBits/8),a=new Uint8Array(this.textWriter.stream).slice(0,n);this.main.writeBytes(a),this.main.writeSpearShift(),this.main.setPositionInBits(e+t),this.main.setPositionByFlag(t),this.main.writeBit(!0)}else this.main.writeBit(!1);this.handleWriter.writeSpearShift(),this.savedPositionInBits=this.main.positionInBits;let i=Math.ceil(this.handleWriter.positionInBits/8),s=new Uint8Array(this.handleWriter.stream).slice(0,i);this.main.writeBytes(s),this.main.writeSpearShift()}writeTimeSpan(e){this.main.writeTimeSpan(e)}writeVariableText(e){this.textWriter.writeVariableText(e)}writeTextUnicode(e){this.textWriter.writeTextUnicode(e)}setPositionInBits(e){this.main.setPositionInBits(e)}setPositionByFlag(e){this.main.setPositionByFlag(e)}writeShiftValue(){this.main.writeShiftValue()}};var ud=class extends Za{constructor(e,t,i){super(e,t,t,i)}writeSpearShift(){let e=this.main.positionInBits;this._savedPosition&&(this.main.writeSpearShift(),this.main.setPositionInBits(this.positionInBits),this.main.writeRawLong(e),this.main.writeShiftValue(),this.main.setPositionInBits(e)),this.handleWriter.writeSpearShift();let t=Math.ceil(this.handleWriter.positionInBits/8),i=new Uint8Array(this.handleWriter.stream).slice(0,t);this.main.writeBytes(i),this.main.writeSpearShift()}};R();kr();wn();D();var ps=class extends Os{alignmentPoint=new c(1,0,0);attachmentPoint=Oe.TopLeft;insertPoint=new c(0,0,0);get objectName(){return d.MTextAttributeObjectContextData}rotation=0;value290=!1};var md=class extends Y{get SectionName(){return T.AcDbObjects}Map=new Map;WriteXRecords;WriteXData;WriteShapes=!0;_dictionaries=new Map;_objects=[];_msmain;_msmainPos=0;_writer;_stream;_streamPos=0;_document;_prev=null;_next=null;constructor(e,t,i,s=!0,n=!0,a=!0){super(t.header.version),this._stream=e.length<65536?new Uint8Array(1048576):e,this._document=t,this._msmain=new Uint8Array(65536),this._writer=ye.getMergedWriter(t.header.version,this._msmain,i),this.WriteXRecords=s,this.WriteXData=n,this.WriteShapes=a}get bytesWritten(){return this._streamPos}getWrittenData(){return this._stream.slice(0,this._streamPos)}ensureStreamCapacity(e){if(e>this._stream.length){let t=Math.max(e,this._stream.length*2),i=new Uint8Array(t);i.set(this._stream.subarray(0,this._streamPos)),this._stream=i}}write(){this.R2004Plus&&(this.ensureStreamCapacity(this._streamPos+4),new DataView(this._stream.buffer,this._stream.byteOffset+this._streamPos).setInt32(0,3530,!0),this._streamPos+=4),this._objects.push(this._document.rootDictionary),this.writeBlockControl(),this.writeTable(this._document.layers),this.writeTable(this._document.textStyles),this.writeLTypeControlObject(),this.writeTable(this._document.views),this.writeTable(this._document.uCSs),this.writeTable(this._document.vPorts),this.writeTable(this._document.appIds),this.writeTable(this._document.dimensionStyles),this.R2004Pre&&this._document.vEntityControl&&this.writeTable(this._document.vEntityControl),this.writeBlockEntities(),this.writeObjects()}writeLTypeControlObject(){this.writeCommonNonEntityData(this._document.lineTypes),this._writer.writeBitLong(this._document.lineTypes.length-2);for(let e of this._document.lineTypes)e.name.toLowerCase()===H.ByBlockName.toLowerCase()||e.name.toLowerCase()===H.ByLayerName.toLowerCase()||this._writer.handleReferenceTyped(w.SoftOwnership,e);this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes.ByBlock),this._writer.handleReferenceTyped(w.HardOwnership,this._document.lineTypes.ByLayer),this.registerObject(this._document.lineTypes),this.writeEntries(this._document.lineTypes)}writeBlockControl(){this.writeCommonNonEntityData(this._document.blockRecords),this._writer.writeBitLong(this._document.blockRecords.length-2);for(let e of this._document.blockRecords)e.name.toLowerCase()===U.ModelSpaceName.toLowerCase()||e.name.toLowerCase()===U.PaperSpaceName.toLowerCase()||this._writer.handleReferenceTyped(w.SoftOwnership,e);this._writer.handleReferenceTyped(w.HardOwnership,this._document.modelSpace),this._writer.handleReferenceTyped(w.HardOwnership,this._document.paperSpace),this.registerObject(this._document.blockRecords),this.writeEntries(this._document.blockRecords)}writeTable(e){this.writeCommonNonEntityData(e),this._writer.writeBitLong(e.count),this.R2000Plus&&e instanceof Wt&&this._writer.writeByte(0);for(let t of e)this._writer.handleReferenceTyped(w.SoftOwnership,t);this.registerObject(e),this.writeEntries(e)}writeEntries(e){for(let t of e)t instanceof gt?this.writeAppId(t):t instanceof U?this.writeBlockRecord(t):t instanceof Se?this.writeLayer(t):t instanceof H?this.writeLineType(t):t instanceof te?this.writeTextStyle(t):t instanceof ot?this.writeUCS(t):t instanceof Vi?this.writeView(t):t instanceof re?this.writeDimensionStyle(t):t instanceof xt?this.writeVPort(t):this.notify(`Table entry not implemented : ${t.constructor.name}`,g.NotImplemented)}writeBlockEntities(){for(let e of this._document.blockRecords){this.writeBlockBegin(e.blockEntity),this._prev=null,this._next=null;let t=this.getCompatibleEntities(e.entities);for(let i=0;i<t.length;i++){this._prev=i>0?t[i-1]:null;let s=t[i];this._next=i<t.length-1?t[i+1]:null,this.writeEntity(s)}this._prev=null,this._next=null,this.writeBlockEnd(e.blockEnd)}}getCompatibleEntities(e){return Array.from(e).filter(t=>this.isEntitySupported(t))}isEntitySupported(e){return e instanceof Lt?!1:e instanceof ur?this.WriteShapes:e instanceof xn||e instanceof Tn||e instanceof Ti||e instanceof ti||e instanceof ts||e instanceof as?(this.notify(`Entity type not implemented ${e.constructor.name}`,g.NotImplemented),!1):!0}writeAppId(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeByte(0),this._writer.handleReferenceTyped(w.HardPointer,0),this.registerObject(e)}writeBlockRecord(e){this.writeBlockHeader(e)}writeBlockHeader(e){let t=this.getCompatibleEntities(e.entities);if(this.writeCommonNonEntityData(e),(e.flags&ne.Anonymous)!==0)this._writer.writeVariableText(e.name.substring(0,2));else if(e.layout!=null){let i=e.name.replace(/[0-9]/g,"");this._writer.writeVariableText(i)}else this._writer.writeVariableText(e.name);if(this.writeXrefDependantBit(e),this._writer.writeBit((e.flags&ne.Anonymous)!==0),this._writer.writeBit(e.hasAttributes),this._writer.writeBit((e.flags&ne.XRef)!==0),this._writer.writeBit((e.flags&ne.XRefOverlay)!==0),this.R2000Plus&&this._writer.writeBit(e.isUnloaded),this.R2004Plus&&(e.flags&ne.XRef)===0&&(e.flags&ne.XRefOverlay)===0&&this._writer.writeBitLong(t.length),this._writer.write3BitDouble(e.blockEntity.basePoint),this._writer.writeVariableText(e.blockEntity.xRefPath),this.R2000Plus){let i=Array.from(this._document.entities).filter(s=>s instanceof Ee&&s.block?.name===e.name);for(let s of i)this._writer.writeByte(1);this._writer.writeByte(0),this._writer.writeVariableText(e.blockEntity.comments),this._writer.writeBitLong(0)}if(this.R2007Plus&&(this._writer.writeBitShort(e.units),this._writer.writeBit(e.isExplodable),this._writer.writeByte(e.canScale?1:0)),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardOwnership,e.blockEntity),this._version>=m.AC1012&&this._version<=m.AC1015&&(e.flags&ne.XRef)===0&&(e.flags&ne.XRefOverlay)===0&&(t.length>0?(this._writer.handleReferenceTyped(w.SoftPointer,t[0]),this._writer.handleReferenceTyped(w.SoftPointer,t[t.length-1])):(this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0))),this.R2004Plus)for(let i of t)this._writer.handleReferenceTyped(w.HardOwnership,i);if(this._writer.handleReferenceTyped(w.HardOwnership,e.blockEnd),this.R2000Plus){let i=Array.from(this._document.entities).filter(s=>s instanceof Ee&&s.block?.name===e.name);for(let s of i)this._writer.handleReferenceTyped(w.SoftPointer,s);this._writer.handleReferenceTyped(w.HardPointer,e.layout)}this.registerObject(e)}writeBlockBegin(e){this.writeCommonEntityData(e),this._writer.writeVariableText(e.name),this.registerObject(e)}writeBlockEnd(e){this.writeCommonEntityData(e),this.registerObject(e)}writeLayer(e){if(this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this.R13_14Only&&(this._writer.writeBit((e.flags&ze.Frozen)!==0),this._writer.writeBit(e.isOn),this._writer.writeBit((e.flags&ze.FrozenNewViewports)!==0),this._writer.writeBit((e.flags&ze.Locked)!==0)),this.R2000Plus){let t=Z.toIndex(e.lineWeight)<<5;(e.flags&ze.Frozen)!==0&&(t|=1),e.isOn||(t|=2),(e.flags&ze.Frozen)!==0&&(t|=4),(e.flags&ze.Locked)!==0&&(t|=8),e.plotFlag&&(t|=16),this._writer.writeBitShort(t)}this._writer.writeCmColor(e.color),this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this.R2007Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.lineType.handle),this.R2013Plus&&this._writer.handleReferenceTyped(w.HardPointer,0),this.registerObject(e)}writeLineType(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeVariableText(e.description),this._writer.writeBitDouble(e.patternLength),this._writer.writeByte((e.alignment?.charCodeAt(0)??0)&255),this._writer.writeByte(e.segments.length);let t=!1;for(let n of e.segments)if((n.shapeFlags&Ze.Text)!==0){t=!0;break}let i=null,s=0;this._version<=m.AC1018?(i=new Uint8Array(256),this._version<=m.AC1014&&(s=1)):this.R2007Plus&&t&&(i=new Uint8Array(512));for(let n of e.segments){if((n.shapeFlags&Ze.Text)!==0)if(i==null||!n.text)n.shapeNumber=0;else{let a=this.R2007Plus?this.encodeUtf16LE(n.text):this.encodeText(n.text),o=this.R2007Plus?2:1,h=a.length+o;if(s+h<=i.length){n.shapeNumber=s,i.set(a,s),s+=a.length;for(let f=0;f<o;f++)i[s++]=0}else n.shapeNumber=0}this._writer.writeBitDouble(n.length),this._writer.writeBitShort(n.shapeNumber),this._writer.writeRawDouble(n.offset.x),this._writer.writeRawDouble(n.offset.y),this._writer.writeBitDouble(n.scale),this._writer.writeBitDouble(n.rotation),this._writer.writeBitShort(n.shapeFlags)}if(this._version<=m.AC1018){let n=i??new Uint8Array(256);for(let a=0;a<n.length;a++)this._writer.writeByte(n[a])}if(this.R2007Plus&&t){let n=i??new Uint8Array(512);for(let a=0;a<n.length;a++)this._writer.writeByte(n[a])}this._writer.handleReferenceTyped(w.HardPointer,0);for(let n of e.segments)this._writer.handleReferenceTyped(w.HardPointer,n.style);this.registerObject(e)}writeTextStyle(e){this.writeCommonNonEntityData(e),e.isShapeFile?this._writer.writeVariableText(""):this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBit((e.flags&Nr.IsShape)!==0),this._writer.writeBit((e.flags&Nr.VerticalText)!==0),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.width),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeByte(e.mirrorFlag),this._writer.writeBitDouble(e.lastHeight),this._writer.writeVariableText(e.filename),this._writer.writeVariableText(e.bigFontFilename),this._writer.handleReferenceTyped(w.HardPointer,this._document.textStyles),this.registerObject(e)}writeUCS(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.write3BitDouble(e.origin),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this.R2000Plus&&(this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.orthographicViewType),this._writer.writeBitShort(e.orthographicType)),this._writer.handleReferenceTyped(w.SoftPointer,this._document.uCSs),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0)),this.registerObject(e)}writeView(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.width),this._writer.write2RawDouble(e.center),this._writer.write3BitDouble(e.target),this._writer.write3BitDouble(e.direction),this._writer.writeBitDouble(e.angle),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClipping),this._writer.writeBitDouble(e.backClipping),this._writer.writeBit((e.viewMode&se.PerspectiveView)!==0),this._writer.writeBit((e.viewMode&se.FrontClipping)!==0),this._writer.writeBit((e.viewMode&se.BackClipping)!==0),this._writer.writeBit((e.viewMode&se.FrontClippingZ)!==0),this.R2000Plus&&this._writer.writeByte(e.renderMode),this.R2007Plus&&(this._writer.writeBit(!0),this._writer.writeByte(1),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0),this._writer.writeCmColor(new B(250))),this._writer.writeBit((e.flags&1)!==0),this.R2000Plus&&(this._writer.writeBit(e.isUcsAssociated),e.isUcsAssociated&&(this._writer.write3BitDouble(e.ucsOrigin),this._writer.write3BitDouble(e.ucsXAxis),this._writer.write3BitDouble(e.ucsYAxis),this._writer.writeBitDouble(e.ucsElevation),this._writer.writeBitShort(e.ucsOrthographicType))),this._writer.handleReferenceTyped(w.SoftPointer,this._document.views),this.R2007Plus&&(this._writer.writeBit(e.isPlottable),this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardOwnership,0)),this.R2000Plus&&e.isUcsAssociated&&(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,0)),this.R2007Plus&&this._writer.handleReferenceTyped(w.SoftPointer,0),this.registerObject(e)}writeDimensionStyle(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this.R13_14Only&&(this._writer.writeBit(e.generateTolerances),this._writer.writeBit(e.limitsGeneration),this._writer.writeBit(e.textOutsideHorizontal),this._writer.writeBit(e.suppressFirstExtensionLine),this._writer.writeBit(e.suppressSecondExtensionLine),this._writer.writeBit(e.textInsideHorizontal),this._writer.writeBit(e.alternateUnitDimensioning),this._writer.writeBit(e.textOutsideExtensions),this._writer.writeBit(e.separateArrowBlocks),this._writer.writeBit(e.textInsideExtensions),this._writer.writeBit(e.suppressOutsideExtensions),this._writer.writeByte(e.alternateUnitDecimalPlaces),this._writer.writeByte(e.zeroHandling),this._writer.writeBit(e.suppressFirstDimensionLine),this._writer.writeBit(e.suppressSecondDimensionLine),this._writer.writeByte(e.toleranceAlignment),this._writer.writeByte(e.textHorizontalAlignment),this._writer.writeByte(e.dimensionFit),this._writer.writeBit(e.cursorUpdate),this._writer.writeByte(e.toleranceZeroHandling),this._writer.writeByte(e.alternateUnitZeroHandling),this._writer.writeByte(e.alternateUnitToleranceZeroHandling),this._writer.writeByte(e.textVerticalAlignment),this._writer.writeBitShort(e.dimensionUnit),this._writer.writeBitShort(e.angularUnit),this._writer.writeBitShort(e.decimalPlaces),this._writer.writeBitShort(e.toleranceDecimalPlaces),this._writer.writeBitShort(e.alternateUnitFormat),this._writer.writeBitShort(e.alternateUnitToleranceDecimalPlaces),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBitDouble(e.arrowSize),this._writer.writeBitDouble(e.extensionLineOffset),this._writer.writeBitDouble(e.dimensionLineIncrement),this._writer.writeBitDouble(e.extensionLineExtension),this._writer.writeBitDouble(e.rounding),this._writer.writeBitDouble(e.dimensionLineExtension),this._writer.writeBitDouble(e.plusTolerance),this._writer.writeBitDouble(e.minusTolerance),this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.centerMarkSize),this._writer.writeBitDouble(e.tickSize),this._writer.writeBitDouble(e.alternateUnitScaleFactor),this._writer.writeBitDouble(e.linearScaleFactor),this._writer.writeBitDouble(e.textVerticalPosition),this._writer.writeBitDouble(e.toleranceScaleFactor),this._writer.writeBitDouble(e.dimensionLineGap),this._writer.writeVariableText(e.postFix),this._writer.writeVariableText(e.alternateDimensioningSuffix),this._writer.writeVariableText(e.arrowBlock?.name??""),this._writer.writeVariableText(e.dimArrow1?.name??""),this._writer.writeVariableText(e.dimArrow2?.name??""),this._writer.writeCmColor(e.dimensionLineColor),this._writer.writeCmColor(e.extensionLineColor),this._writer.writeCmColor(e.textColor)),this.R2000Plus&&(this._writer.writeVariableText(e.postFix),this._writer.writeVariableText(e.alternateDimensioningSuffix),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBitDouble(e.arrowSize),this._writer.writeBitDouble(e.extensionLineOffset),this._writer.writeBitDouble(e.dimensionLineIncrement),this._writer.writeBitDouble(e.extensionLineExtension),this._writer.writeBitDouble(e.rounding),this._writer.writeBitDouble(e.dimensionLineExtension),this._writer.writeBitDouble(e.plusTolerance),this._writer.writeBitDouble(e.minusTolerance)),this.R2007Plus&&(this._writer.writeBitDouble(e.fixedExtensionLineLength),this._writer.writeBitDouble(e.joggedRadiusDimensionTransverseSegmentAngle),this._writer.writeBitShort(e.textBackgroundFillMode),this._writer.writeCmColor(e.textBackgroundColor)),this.R2000Plus&&(this._writer.writeBit(e.generateTolerances),this._writer.writeBit(e.limitsGeneration),this._writer.writeBit(e.textInsideHorizontal),this._writer.writeBit(e.textOutsideHorizontal),this._writer.writeBit(e.suppressFirstExtensionLine),this._writer.writeBit(e.suppressSecondExtensionLine),this._writer.writeBitShort(e.textVerticalAlignment),this._writer.writeBitShort(e.zeroHandling),this._writer.writeBitShort(e.angularZeroHandling)),this.R2007Plus&&this._writer.writeBitShort(e.arcLengthSymbolPosition),this.R2000Plus&&(this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.centerMarkSize),this._writer.writeBitDouble(e.tickSize),this._writer.writeBitDouble(e.alternateUnitScaleFactor),this._writer.writeBitDouble(e.linearScaleFactor),this._writer.writeBitDouble(e.textVerticalPosition),this._writer.writeBitDouble(e.toleranceScaleFactor),this._writer.writeBitDouble(e.dimensionLineGap),this._writer.writeBitDouble(e.alternateUnitRounding),this._writer.writeBit(e.alternateUnitDimensioning),this._writer.writeBitShort(e.alternateUnitDecimalPlaces),this._writer.writeBit(e.textOutsideExtensions),this._writer.writeBit(e.separateArrowBlocks),this._writer.writeBit(e.textInsideExtensions),this._writer.writeBit(e.suppressOutsideExtensions),this._writer.writeCmColor(e.dimensionLineColor),this._writer.writeCmColor(e.extensionLineColor),this._writer.writeCmColor(e.textColor),this._writer.writeBitShort(e.angularDecimalPlaces),this._writer.writeBitShort(e.decimalPlaces),this._writer.writeBitShort(e.toleranceDecimalPlaces),this._writer.writeBitShort(e.alternateUnitFormat),this._writer.writeBitShort(e.alternateUnitToleranceDecimalPlaces),this._writer.writeBitShort(e.angularUnit),this._writer.writeBitShort(e.fractionFormat),this._writer.writeBitShort(e.linearUnitFormat),this._writer.writeBitShort(e.decimalSeparator.charCodeAt(0)),this._writer.writeBitShort(e.textMovement),this._writer.writeBitShort(e.textHorizontalAlignment),this._writer.writeBit(e.suppressFirstDimensionLine),this._writer.writeBit(e.suppressSecondDimensionLine),this._writer.writeBitShort(e.toleranceAlignment),this._writer.writeBitShort(e.toleranceZeroHandling),this._writer.writeBitShort(e.alternateUnitZeroHandling),this._writer.writeBitShort(e.alternateUnitToleranceZeroHandling),this._writer.writeBit(e.cursorUpdate),this._writer.writeBitShort(3)),this.R2007Plus&&this._writer.writeBit(e.isExtensionLineLengthFixed),this.R2010Plus&&(this._writer.writeBit(e.textDirection===_i.RightToLeft),this._writer.writeBitDouble(e.altMzf),this._writer.writeVariableText(e.altMzs),this._writer.writeBitDouble(e.mzf),this._writer.writeVariableText(e.mzs)),this.R2000Plus&&(this._writer.writeBitShort(e.dimensionLineWeight),this._writer.writeBitShort(e.extensionLineWeight)),this._writer.writeBit(!1),this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.style),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,e.leaderArrow),this._writer.handleReferenceTyped(w.HardPointer,e.arrowBlock),this._writer.handleReferenceTyped(w.HardPointer,e.dimArrow1),this._writer.handleReferenceTyped(w.HardPointer,e.dimArrow2)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.HardPointer,e.lineType),this._writer.handleReferenceTyped(w.HardPointer,e.lineTypeExt1),this._writer.handleReferenceTyped(w.HardPointer,e.lineTypeExt2)),this.registerObject(e)}writeVPort(e){this.writeCommonNonEntityData(e),this._writer.writeVariableText(e.name),this.writeXrefDependantBit(e),this._writer.writeBitDouble(e.viewHeight),this._writer.writeBitDouble(e.aspectRatio*e.viewHeight),this._writer.write2RawDouble(e.center),this._writer.write3BitDouble(e.target),this._writer.write3BitDouble(e.direction),this._writer.writeBitDouble(e.twistAngle),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClippingPlane),this._writer.writeBitDouble(e.backClippingPlane),this._writer.writeBit((e.viewMode&se.PerspectiveView)!==0),this._writer.writeBit((e.viewMode&se.FrontClipping)!==0),this._writer.writeBit((e.viewMode&se.BackClipping)!==0),this._writer.writeBit((e.viewMode&se.FrontClippingZ)!==0),this.R2000Plus&&this._writer.writeByte(e.renderMode),this.R2007Plus&&(this._writer.writeBit(e.useDefaultLighting),this._writer.writeByte(e.defaultLighting),this._writer.writeBitDouble(e.brightness),this._writer.writeBitDouble(e.contrast),this._writer.writeCmColor(e.ambientColor)),this._writer.write2RawDouble(e.bottomLeft),this._writer.write2RawDouble(e.topRight),this._writer.writeBit((e.viewMode&se.Follow)!==0),this._writer.writeBitShort(e.circleZoomPercent),this._writer.writeBit(!0),this._writer.writeBit((e.ucsIconDisplay&vr.OnLower)!==0),this._writer.writeBit((e.ucsIconDisplay&vr.OnOrigin)!==0),this._writer.writeBit(e.showGrid),this._writer.write2RawDouble(e.gridSpacing),this._writer.writeBit(e.snapOn),this._writer.writeBit(e.isometricSnap),this._writer.writeBitShort(e.snapIsoPair),this._writer.writeBitDouble(e.snapRotation),this._writer.write2RawDouble(e.snapBasePoint),this._writer.write2RawDouble(e.snapSpacing),this.R2000Plus&&(this._writer.writeBit(!1),this._writer.writeBit(!0),this._writer.write3BitDouble(e.origin),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.orthographicType)),this.R2007Plus&&(this._writer.writeBitShort(e.gridFlags),this._writer.writeBitShort(e.minorGridLinesPerMajorGridLine)),this._writer.handleReferenceTyped(w.HardPointer,0),this.R2007Plus&&(this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0),this._writer.handleReferenceTyped(w.SoftPointer,0)),this.R2000Plus&&(e.orthographicType===Mt.None?(this._writer.handleReferenceTyped(w.HardPointer,e.namedUcs),this._writer.handleReferenceTyped(w.HardPointer,0)):(this._writer.handleReferenceTyped(w.HardPointer,0),this._writer.handleReferenceTyped(w.HardPointer,e.baseUcs))),this.registerObject(e)}registerObject(e){this._writer.writeSpearShift(),this._msmainPos=Math.ceil(this._writer.main.positionInBits/8),this.ensureStreamCapacity(this._streamPos+this._msmainPos+64);let t=this._streamPos,i=new wr(this._stream.subarray(this._streamPos),49345),s=this._msmainPos,n=(this._msmainPos<<3)-this._writer.savedPositionInBits;this.writeSize(i,s),this.R2010Plus&&this.writeSizeInBits(i,n),i.Write(new Uint8Array(this._writer.main.stream).subarray(0,this._msmainPos),0,this._msmainPos);let a=new Uint8Array(2);new DataView(a.buffer).setUint16(0,i.Seed,!0),this._stream.set(a,this._streamPos+i.Position),this._streamPos+=i.Position+2,this.Map.set(e.handle,t)}writeSize(e,t){if(t>=32768){let i=new Uint8Array(4);i[0]=t&255,i[1]=t>>8&127|128,i[2]=t>>15&255,i[3]=t>>23&255,e.Write(i,0,4)}else{let i=new Uint8Array(2);i[0]=t&255,i[1]=t>>8&255,e.Write(i,0,2)}}writeSizeInBits(e,t){if(t===0){e.Write(new Uint8Array([0]),0,1);return}let i=t,s=i>>>7;for(;i!==0;){let n=i&127;s!==0&&(n=n|128),e.Write(new Uint8Array([n]),0,1),i=s,s=i>>>7}}writeXrefDependantBit(e){this.R2007Plus?this._writer.writeBitShort((e.flags&Vt.XrefDependent)!==0?256:0):(this._writer.writeBit((e.flags&Vt.Referenced)!==0),this._writer.writeBitShort(0),this._writer.writeBit((e.flags&Vt.XrefDependent)!==0))}writeCommonData(e){switch(this._writer.resetStream(),this._msmainPos=0,e.objectType){case u.LAYOUT:if(this.R2004Pre){if(this._document.classes.tryGetByName(e.objectName)){let t=this._document.classes.getByName(e.objectName);this._writer.writeObjectType(t.ClassNumber)}else{this.notify(`Dxf Class not found for ${e.objectType} fullname: ${e.constructor.name}`,g.Warning);return}break}this._writer.writeObjectType(e.objectType);break;case u.UNLISTED:if(this._document.classes.tryGetByName(e.objectName)){let t=this._document.classes.getByName(e.objectName);this._writer.writeObjectType(t.ClassNumber)}else{this.notify(`Dxf Class not found for ${e.objectType} fullname: ${e.constructor.name}`,g.Warning);return}break;case u.INVALID:case u.UNDEFINED:this.notify(`CadObject type: ${e.objectType} fullname: ${e.constructor.name}`,g.NotImplemented);return;default:this._writer.writeObjectType(e.objectType);break}this._version>=m.AC1015&&this._version<m.AC1024&&this._writer.savePositonForSize(),this._writer.main.handleReference(e),this.writeExtendedData(e.extendedData)}writeCommonNonEntityData(e){this.writeCommonData(e),this.R13_14Only&&this._writer.savePositonForSize(),this._writer.handleReferenceTyped(w.SoftPointer,e.owner.handle),this.writeReactorsAndDictionaryHandle(e)}writeCommonEntityData(e){this.writeCommonData(e),this._writer.writeBit(!1),this._version>=m.AC1012&&this._version<=m.AC1014&&this._writer.savePositonForSize(),this.writeEntityMode(e)}writeEntityMode(e){let t=this.getEntMode(e);if(this._writer.write2Bits(t),t===0&&this._writer.handleReferenceTyped(w.SoftPointer,e.owner),this.writeReactorsAndDictionaryHandle(e),this.R13_14Only){this._writer.handleReferenceTyped(w.HardPointer,e.layer);let i=e.lineType.name===H.ByLayerName;this._writer.writeBit(i),i&&this._writer.handleReferenceTyped(w.HardPointer,e.lineType)}if(!this.R2004Plus){let i=this._prev!=null&&this._prev.handle===e.handle-1&&this._next!=null&&this._next.handle===e.handle+1;this._writer.writeBit(i),i||(this._writer.handleReferenceTyped(w.SoftPointer,this._prev),this._writer.handleReferenceTyped(w.SoftPointer,this._next))}if(this._writer.writeEnColor(e.color,e.transparency),this._version>=m.AC1018&&e.bookColor!=null&&this._writer.handleReferenceTyped(w.HardPointer,e.bookColor),this._writer.writeBitDouble(e.lineTypeScale),!(this._version>=m.AC1015)){this._writer.writeBitShort(e.isInvisible?0:1);return}this._writer.handleReferenceTyped(w.HardPointer,e.layer),e.lineType.name===H.ByLayerName?this._writer.write2Bits(0):e.lineType.name===H.ByBlockName?this._writer.write2Bits(1):e.lineType.name===H.ContinuousName?this._writer.write2Bits(2):(this._writer.write2Bits(3),this._writer.handleReferenceTyped(w.HardPointer,e.lineType)),this.R2007Plus&&(this._writer.write2Bits(0),this._writer.writeByte(0)),this._writer.write2Bits(0),this._version>m.AC1021&&(this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.writeBitShort(e.isInvisible?1:0),this._writer.writeByte(Z.toIndex(e.lineWeight))}writeExtendedData(e){if(this.WriteXData)for(let[t,i]of e)this.writeExtendedDataEntry(t,i);this._writer.writeBitShort(0)}writeExtendedDataEntry(e,t){let i=[];for(let s of t.records)if(i.push(s.code-1e3),s instanceof Fi){i.push(s.value.length);for(let n=0;n<s.value.length;n++)i.push(s.value[n])}else if(s instanceof Pe)i.push(s.value==="}"?1:0);else if(s instanceof Yi){let n=new ArrayBuffer(2);new DataView(n).setInt16(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<2;o++)i.push(a[o])}else if(s instanceof Xi){let n=new ArrayBuffer(4);new DataView(n).setInt32(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<4;o++)i.push(a[o])}else if(s instanceof Zi||s instanceof zi||s instanceof vi){let n=new ArrayBuffer(8);new DataView(n).setFloat64(0,s.value,!0);let a=new Uint8Array(n);for(let o=0;o<8;o++)i.push(a[o])}else if(s instanceof $i||s instanceof Ui||s instanceof Gi||s instanceof Ki){let n=new ArrayBuffer(24),a=new DataView(n);a.setFloat64(0,s.value.x,!0),a.setFloat64(8,s.value.y,!0),a.setFloat64(16,s.value.z,!0);let o=new Uint8Array(n);for(let h=0;h<24;h++)i.push(o[h])}else if("ResolveReference"in s&&"Value"in s){let n=s,a=n.Value;n.ResolveReference(this._document)==null&&(a=0);let o=new ArrayBuffer(8);new DataView(o).setFloat64(0,a,!1);let h=new Uint8Array(o);for(let f=0;f<8;f++)i.push(h[f])}else if(s instanceof Hi)if(this.R2007Plus){let n=s.value.length+1,a=new ArrayBuffer(2);new DataView(a).setUint16(0,n,!0);let o=new Uint8Array(a);i.push(o[0],o[1]);let h=this.encodeUtf16LE(s.value);for(let f=0;f<h.length;f++)i.push(h[f]);i.push(0,0)}else{let n=Z.getCodeIndex(Z.getCodePage(this._writer.encoding)),a=this.encodeText(s.value||""),o=new ArrayBuffer(2);new DataView(o).setUint16(0,s.value.length,!0);let h=new Uint8Array(o);i.push(h[0],h[1]),i.push(n);for(let f=0;f<a.length;f++)i.push(a[f])}else throw new Error(`ExtendedDataRecord of type ${s.constructor.name} not supported.`);this._writer.writeBitShort(i.length),this._writer.main.handleReferenceTyped(w.HardPointer,e.handle),this._writer.writeBytesOffset(new Uint8Array(i),0,i.length)}writeReactorsAndDictionaryHandle(e){e.cleanReactors(),this._writer.writeBitLong(e.reactors.length);for(let i of e.reactors)this._writer.handleReferenceTyped(w.SoftPointer,i);let t=e.xDictionary==null;this.R2004Plus?(this._writer.writeBit(t),t||this._writer.handleReferenceTyped(w.HardOwnership,e.xDictionary)):this._writer.handleReferenceTyped(w.HardOwnership,e.xDictionary),this.R2013Plus&&this._writer.writeBit(!1),t||(this._dictionaries.set(e.xDictionary.handle,e.xDictionary),this._objects.push(e.xDictionary))}getEntMode(e){return e.owner==null?0:e.owner.handle===this._document.paperSpace.handle?1:e.owner.handle===this._document.modelSpace.handle?2:0}writeEntity(e){let t=[],i=null;if(this.writeCommonEntityData(e),e instanceof Ft)this.writeArc(e);else if(e instanceof dt)this.writeCircle(e);else if(e instanceof me)if(this.writeCommonDimensionData(e),e instanceof Qe)this.writeDimensionLinear(e);else if(e instanceof je)this.writeDimensionAligned(e);else if(e instanceof Rt)this.writeDimensionRadius(e);else if(e instanceof St)this.writeDimensionAngular2Line(e);else if(e instanceof Ct)this.writeDimensionAngular3Pt(e);else if(e instanceof Bt)this.writeDimensionDiameter(e);else if(e instanceof yt)this.writeDimensionOrdinate(e);else throw new Error(`Dimension not implemented : ${e.constructor.name}`);else if(e instanceof Ut)this.writeEllipse(e);else if(e instanceof Ee)this.writeInsert(e),t.push(...e.attributes),i=e.attributes.Seqend;else if(e instanceof Yr)this.writeFace3D(e);else if(e instanceof Tt)this.writeHatch(e);else if(e instanceof nr)this.writeLeader(e);else if(e instanceof zt)this.writeLine(e);else if(e instanceof qr)this.writeLwPolyline(e);else if(e instanceof ar)this.writeMesh(e);else if(e instanceof or)this.writeMLine(e);else if(e instanceof Ne)this.writeMText(e);else if(e instanceof lr)this.writeMultiLeader(e);else if(e instanceof dr)this.writeOle2Frame(e);else if(e instanceof Qr)this.writePdfUnderlay(e);else if(e instanceof Gt)this.writePoint(e);else if(e instanceof ut)this.writePolyfaceMesh(e),t.push(...e.faces,...e.vertices),i=e.vertices.Seqend;else if(e instanceof et)this.writePolyline2D(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof tt)this.writePolyline3D(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof Et)this.writePolygonMesh(e),t.push(...e.vertices),i=e.vertices.Seqend;else if(e instanceof ei)this.writeRay(e);else if(e instanceof ur)this.writeShape(e);else if(e instanceof $t)this.writeSolid(e);else if(e instanceof ti)this.writeSolid3D(e);else if(e instanceof mr)this.writeSpline(e);else if(e instanceof Ss)this.writeCadImage(e);else if(e instanceof Dt)this.writeAttribute(e);else if(e instanceof es)this.writeAttDefinition(e);else if(e instanceof Je)this.writeTextEntity(e);else if(e instanceof Yt)this.writeTolerance(e);else if(e instanceof Xt)this.writeVertex2D(e);else if(e instanceof Zt)this.writeFaceRecord(e);else if(e instanceof cr||e instanceof ri||e instanceof ss)this.writeVertex(e);else if(e instanceof fr)this.writeViewport(e);else if(e instanceof ii)this.writeXLine(e);else throw new Error(`Entity not implemented : ${e.constructor.name}`);this.registerObject(e),this.writeChildEntities(t,i)}writePdfUnderlay(e){this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.insertPoint),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.xScale),this._writer.writeBitDouble(e.yScale),this._writer.writeBitDouble(e.zScale),this._writer.writeByte(e.flags),this._writer.writeByte(e.contrast),this._writer.writeByte(e.fade),this._writer.handleReferenceTyped(w.HardPointer,e.definition),this._writer.writeBitLong(e.clipBoundaryVertices.length);for(let t of e.clipBoundaryVertices)this._writer.write2RawDouble(t)}writeArc(e){this.writeCircle(e),this._writer.writeBitDouble(e.startAngle),this._writer.writeBitDouble(e.endAngle)}writeAttribute(e){this.writeCommonAttData(e)}writeAttDefinition(e){this.writeCommonAttData(e),this.R2010Plus&&this._writer.writeByte(e.version),this._writer.writeVariableText(e.prompt)}writeCommonAttData(e){this.writeTextEntity(e),this.R2010Plus&&this._writer.writeByte(e.version),this.R2018Plus&&(this._writer.writeByte(e.attributeType),(e.attributeType===Gr.MultiLine||e.attributeType===Gr.ConstantMultiLine)&&(this.writeEntityMode(e.mText),this.writeMText(e.mText),this._writer.writeBitShort(0))),this._writer.writeVariableText(e.tag),this._writer.writeBitShort(0),this._writer.writeByte(e.flags),this.R2007Plus&&this._writer.writeBit(e.isReallyLocked)}writeCircle(e){this._writer.write3BitDouble(e.center),this._writer.writeBitDouble(e.radius),this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal)}writeCommonDimensionData(e){this.R2010Plus&&this._writer.writeByte(e.version),this._writer.write3BitDouble(e.normal),this._writer.write2RawDouble(new C(e.textMiddlePoint.x,e.textMiddlePoint.y)),this._writer.writeBitDouble(e.insertionPoint.z);let t=0;t|=e.isTextUserDefinedLocation?0:1,this._writer.writeByte(t),this._writer.writeVariableText(e.text),this._writer.writeBitDouble(e.textRotation),this._writer.writeBitDouble(e.horizontalDirection),this._writer.write3BitDouble(new c(1,1,1)),this._writer.writeBitDouble(0),this.R2000Plus&&(this._writer.writeBitShort(e.attachmentPoint),this._writer.writeBitShort(e.lineSpacingStyle),this._writer.writeBitDouble(e.lineSpacingFactor),this._writer.writeBitDouble(e.measurement)),this.R2007Plus&&(this._writer.writeBit(!1),this._writer.writeBit(e.flipArrow1),this._writer.writeBit(e.flipArrow2)),this._writer.write2RawDouble(new C(e.insertionPoint.x,e.insertionPoint.y)),this._writer.handleReferenceTyped(w.HardPointer,e.style),this._writer.handleReferenceTyped(w.HardPointer,e.block)}writeDimensionLinear(e){this.writeDimensionAligned(e),this._writer.writeBitDouble(e.rotation)}writeDimensionAligned(e){this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.definitionPoint),this._writer.writeBitDouble(e.extLineRotation)}writeDimensionRadius(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.writeBitDouble(e.leaderLength)}writeDimensionAngular2Line(e){this._writer.write2RawDouble(new C(e.dimensionArc.x,e.dimensionArc.y)),this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.write3BitDouble(e.definitionPoint)}writeDimensionAngular3Pt(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.secondPoint),this._writer.write3BitDouble(e.angleVertex)}writeDimensionDiameter(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.angleVertex),this._writer.writeBitDouble(e.leaderLength)}writeDimensionOrdinate(e){this._writer.write3BitDouble(e.definitionPoint),this._writer.write3BitDouble(e.featureLocation),this._writer.write3BitDouble(e.leaderEndpoint),this._writer.writeByte(e.isOrdinateTypeX?1:0)}writeEllipse(e){this._writer.write3BitDouble(e.center),this._writer.write3BitDouble(e.majorAxisEndPoint),this._writer.write3BitDouble(e.normal),this._writer.writeBitDouble(e.radiusRatio),this._writer.writeBitDouble(e.startParameter),this._writer.writeBitDouble(e.endParameter)}writeInsert(e){if(this._writer.write3BitDouble(e.insertPoint),this.R13_14Only&&(this._writer.writeBitDouble(e.xScale),this._writer.writeBitDouble(e.yScale),this._writer.writeBitDouble(e.zScale)),this.R2000Plus&&(e.xScale===1&&e.yScale===1&&e.zScale===1?this._writer.write2Bits(3):e.xScale===e.yScale&&e.xScale===e.zScale?(this._writer.write2Bits(2),this._writer.writeRawDouble(e.xScale)):e.xScale===1?(this._writer.write2Bits(1),this._writer.writeBitDoubleWithDefault(e.yScale,1),this._writer.writeBitDoubleWithDefault(e.zScale,1)):(this._writer.write2Bits(0),this._writer.writeRawDouble(e.xScale),this._writer.writeBitDoubleWithDefault(e.yScale,e.xScale),this._writer.writeBitDoubleWithDefault(e.zScale,e.xScale))),this._writer.writeBitDouble(e.rotation),this._writer.write3BitDouble(e.normal),this._writer.writeBit(e.hasAttributes),this.R2004Plus&&e.hasAttributes&&this._writer.writeBitLong(e.attributes.length),e.isMultiple&&(this._writer.writeBitShort(e.columnCount),this._writer.writeBitShort(e.rowCount),this._writer.writeBitDouble(e.columnSpacing),this._writer.writeBitDouble(e.rowSpacing)),this._writer.handleReferenceTyped(w.HardPointer,e.block),!!e.hasAttributes){if(this._version>=m.AC1012&&this._version<=m.AC1015)this._writer.handleReferenceTyped(w.SoftPointer,e.attributes[0]),this._writer.handleReferenceTyped(w.SoftPointer,e.attributes[e.attributes.length-1]);else if(this.R2004Plus)for(let t of e.attributes)this._writer.handleReferenceTyped(w.HardOwnership,t);this._writer.handleReferenceTyped(w.HardOwnership,e.attributes.Seqend)}}writeFace3D(e){if(this.R13_14Only&&(this._writer.write3BitDouble(e.firstCorner),this._writer.write3BitDouble(e.secondCorner),this._writer.write3BitDouble(e.thirdCorner),this._writer.write3BitDouble(e.fourthCorner),this._writer.writeBitShort(e.flags)),this.R2000Plus){let t=e.flags===nn.None;this._writer.writeBit(t);let i=e.firstCorner.z===0;this._writer.writeBit(i),this._writer.writeRawDouble(e.firstCorner.x),this._writer.writeRawDouble(e.firstCorner.y),i||this._writer.writeRawDouble(e.firstCorner.z),this._writer.write3BitDoubleWithDefault(e.secondCorner,e.firstCorner),this._writer.write3BitDoubleWithDefault(e.thirdCorner,e.secondCorner),this._writer.write3BitDoubleWithDefault(e.fourthCorner,e.thirdCorner),t||this._writer.writeBitShort(e.flags)}}writeMesh(e){this._writer.writeBitShort(e.version),this._writer.writeBit(e.blendCrease!==0),this._writer.writeBitLong(e.subdivisionLevel),this._writer.writeBitLong(e.vertices.length);for(let i of e.vertices)this._writer.write3BitDouble(i);let t=e.faces.reduce((i,s)=>i+1+s.length,0);this._writer.writeBitLong(t);for(let i of e.faces){this._writer.writeBitLong(i.length);for(let s of i)this._writer.writeBitLong(s)}this._writer.writeBitLong(e.edges.length);for(let i of e.edges)this._writer.writeBitLong(i.start),this._writer.writeBitLong(i.end);this._writer.writeBitLong(e.edges.length);for(let i of e.edges)this._writer.writeBitDouble(i.crease??0);this._writer.writeBitLong(0)}writeMLine(e){this._writer.writeBitDouble(e.scaleFactor),this._writer.writeByte(e.justification),this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.normal),this._writer.writeBitShort((e.flags&Bi.Closed)!==0?3:1);let t=0;e.vertices.length>0&&(t=e.vertices[0].segments.length),this._writer.writeByte(t),this._writer.writeBitShort(e.vertices.length);for(let i of e.vertices){this._writer.write3BitDouble(i.position),this._writer.write3BitDouble(i.direction),this._writer.write3BitDouble(i.miter);for(let s=0;s<t;s++){let n=i.segments[s];this._writer.writeBitShort(n.parameters.length);for(let a of n.parameters)this._writer.writeBitDouble(a);this._writer.writeBitShort(n.areaFillParameters.length);for(let a of n.areaFillParameters)this._writer.writeBitDouble(a)}}this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeLwPolyline(e){let t=!1,i=!1;for(let n of e.vertices)!t&&n.bulge!==0&&(t=!0),!i&&(n.startWidth!==0||n.endWidth!==0)&&(i=!0);let s=0;if((e.flags&At.Plinegen)!==0&&(s|=256),(e.flags&At.Closed)!==0&&(s|=512),e.constantWidth!==0&&(s|=4),e.elevation!==0&&(s|=8),e.thickness!==0&&(s|=2),c.equals(e.normal,c.AxisZ)||(s|=1),t&&(s|=16),i&&(s|=32),this._writer.writeBitShort(s),e.constantWidth!==0&&this._writer.writeBitDouble(e.constantWidth),e.elevation!==0&&this._writer.writeBitDouble(e.elevation),e.thickness!==0&&this._writer.writeBitDouble(e.thickness),c.equals(e.normal,c.AxisZ)||this._writer.write3BitDouble(e.normal),this._writer.writeBitLong(e.vertices.length),t&&this._writer.writeBitLong(e.vertices.length),i&&this._writer.writeBitLong(e.vertices.length),this.R13_14Only)for(let n of e.vertices)this._writer.write2RawDouble(n.location);if(this.R2000Plus&&e.vertices.length>0){let n=e.vertices[0];this._writer.write2RawDouble(n.location);for(let a=1;a<e.vertices.length;a++){let o=e.vertices[a];this._writer.write2BitDoubleWithDefault(o.location,n.location),n=o}}if(t)for(let n of e.vertices)this._writer.writeBitDouble(n.bulge);if(i)for(let n of e.vertices)this._writer.writeBitDouble(n.startWidth),this._writer.writeBitDouble(n.endWidth)}writeHatch(e){if(this.R2004Plus){let i=e.gradientColor;this._writer.writeBitLong(i.enabled?1:0),this._writer.writeBitLong(i.reserved),this._writer.writeBitDouble(i.angle),this._writer.writeBitDouble(i.shift),this._writer.writeBitLong(i.isSingleColorGradient?1:0),this._writer.writeBitDouble(i.colorTint),this._writer.writeBitLong(i.colors.length);for(let s of i.colors)this._writer.writeBitDouble(s.value),this._writer.writeCmColor(s.color);this._writer.writeVariableText(i.name)}this._writer.writeBitDouble(e.elevation),this._writer.write3BitDouble(e.normal),this._writer.writeVariableText(e.pattern.name),this._writer.writeBit(e.isSolid),this._writer.writeBit(e.isAssociative),this._writer.writeBitLong(e.paths.length);let t=!1;for(let i of e.paths){if(this._writer.writeBitLong(i.flags),(i.flags&qe.Derived)!==0&&(t=!0),(i.flags&qe.Polyline)!==0){let s=i.edges[0];this._writer.writeBit(s.hasBulge),this._writer.writeBit(s.isClosed),this._writer.writeBitLong(s.vertices.length);for(let n of s.vertices)this._writer.write2RawDouble(new C(n.X,n.Y)),s.hasBulge&&this._writer.writeBitDouble(n.Z)}else{this._writer.writeBitLong(i.edges.length);for(let s of i.edges)if(this._writer.writeByte(s.type),s instanceof Kr)this._writer.write2RawDouble(s.start),this._writer.write2RawDouble(s.end);else if(s instanceof Xr)this._writer.write2RawDouble(s.center),this._writer.writeBitDouble(s.radius),this._writer.writeBitDouble(s.startAngle),this._writer.writeBitDouble(s.endAngle),this._writer.writeBit(s.counterClockWise);else if(s instanceof Zr)this._writer.write2RawDouble(s.center),this._writer.write2RawDouble(s.majorAxisEndPoint),this._writer.writeBitDouble(s.minorToMajorRatio),this._writer.writeBitDouble(s.startAngle),this._writer.writeBitDouble(s.endAngle),this._writer.writeBit(s.counterClockWise);else if(s instanceof Jr){this._writer.writeBitLong(s.degree),this._writer.writeBit(s.isRational),this._writer.writeBit(s.isPeriodic),this._writer.writeBitLong(s.knots.length),this._writer.writeBitLong(s.controlPoints.length);for(let n of s.knots)this._writer.writeBitDouble(n);for(let n=0;n<s.controlPoints.length;++n)this._writer.write2RawDouble(new C(s.controlPoints[n].X,s.controlPoints[n].Y)),s.isRational&&this._writer.writeBitDouble(s.controlPoints[n].Z);if(this.R2010Plus&&(this._writer.writeBitLong(s.fitPoints.length),s.fitPoints.length>0)){for(let n of s.fitPoints)this._writer.write2RawDouble(n);this._writer.write2RawDouble(s.startTangent),this._writer.write2RawDouble(s.endTangent)}}else throw new Error(`Unrecognized Boundary type: ${s.constructor.name}`)}this._writer.writeBitLong(i.entities.length);for(let s of i.entities)this._writer.handleReferenceTyped(w.SoftPointer,s)}if(this._writer.writeBitShort(e.style),this._writer.writeBitShort(e.patternType),!e.isSolid){let i=e.pattern;this._writer.writeBitDouble(e.patternAngle),this._writer.writeBitDouble(e.patternScale),this._writer.writeBit(e.isDouble),this._writer.writeBitShort(i.lines.length);for(let s of i.lines){this._writer.writeBitDouble(s.angle),this._writer.write2BitDouble(s.basePoint),this._writer.write2BitDouble(s.offset),this._writer.writeBitShort(s.dashLengths.length);for(let n of s.dashLengths)this._writer.writeBitDouble(n)}}t&&this._writer.writeBitDouble(e.pixelSize),this._writer.writeBitLong(e.seedPoints.length);for(let i of e.seedPoints)this._writer.write2RawDouble(i)}writeLeader(e){this._writer.writeBit(!1),this._writer.writeBitShort(e.creationType),this._writer.writeBitShort(e.pathType),this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.write3BitDouble(t);this._writer.write3BitDouble(e.vertices.length>0?e.vertices[0]:c.Zero),this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.horizontalDirection),this._writer.write3BitDouble(e.blockOffset),this._version>=m.AC1014&&this._writer.write3BitDouble(e.annotationOffset),this.R13_14Only&&this._writer.writeBitDouble(e.style.dimensionLineGap),this._version<=m.AC1021&&(this._writer.writeBitDouble(e.textHeight),this._writer.writeBitDouble(e.textWidth)),this._writer.writeBit(e.hookLineDirection===Di.Same),this._writer.writeBit(e.arrowHeadEnabled),this.R13_14Only&&(this._writer.writeBitShort(0),this._writer.writeBitDouble(e.style.arrowSize*e.style.scaleFactor),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBitShort(0),this._writer.writeBitShort(0),this._writer.writeBit(!1),this._writer.writeBit(!1)),this.R2000Plus&&(this._writer.writeBitShort(0),this._writer.writeBit(!1),this._writer.writeBit(!1)),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeOle2Frame(e){this._writer.writeBitShort(e.version),this.R2000Plus&&this._writer.writeBitShort(0),this._writer.writeBitLong(e.binaryData.length),this._writer.writeBytes(e.binaryData),this.R2000Plus&&this._writer.writeByte(3)}writeMultiLeader(e){this.R2010Plus&&this._writer.writeBitShort(2),this.writeMultiLeaderAnnotContextSubObject(!0,e.contextData),this._writer.handleReferenceTyped(w.HardPointer,e.style),this._writer.writeBitLong(e.propertyOverrideFlags),this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.leaderLineType),this._writer.writeBitLong(e.leaderLineWeight),this._writer.writeBit(e.enableLanding),this._writer.writeBit(e.enableDogleg),this._writer.writeBitDouble(e.landingDistance),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitDouble(e.arrowheadSize),this._writer.writeBitShort(e.contentType),this._writer.handleReferenceTyped(w.HardPointer,e.textStyle),this._writer.writeBitShort(e.textLeftAttachment),this._writer.writeBitShort(e.textRightAttachment),this._writer.writeBitShort(e.textAngle),this._writer.writeBitShort(e.textAlignment),this._writer.writeCmColor(e.textColor),this._writer.writeBit(e.textFrame),this._writer.handleReferenceTyped(w.HardPointer,e.blockContentId),this._writer.writeCmColor(e.blockContentColor),this._writer.write3BitDouble(e.blockContentScale),this._writer.writeBitDouble(e.blockContentRotation),this._writer.writeBitShort(e.blockContentConnection),this._writer.writeBit(e.enableAnnotationScale);let t=e.blockAttributes.length;this._writer.writeBitLong(t);for(let i=0;i<t;i++){let s=e.blockAttributes[i];this._writer.handleReferenceTyped(w.HardPointer,s.attributeDefinition),this._writer.writeVariableText(s.text),this._writer.writeBitShort(s.index),this._writer.writeBitDouble(s.width)}this._writer.writeBit(e.textDirectionNegative),this._writer.writeBitShort(e.textAligninIPE?1:0),this._writer.writeBitShort(e.textAttachmentPoint),this._writer.writeBitDouble(e.scaleFactor),this.R2010Plus&&(this._writer.writeBitShort(e.textAttachmentDirection),this._writer.writeBitShort(e.textBottomAttachment),this._writer.writeBitShort(e.textTopAttachment)),this.R2013Plus&&this._writer.writeBit(e.extendedToText)}writeMultiLeaderAnnotContextSubObject(e,t){let i=t.leaderRoots.length;e?this._writer.writeBitLong(i):(this._writer.writeBitLong(0),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(!1),this._writer.writeBit(i===2),this._writer.writeBit(i===1));for(let s=0;s<i;s++)this.writeLeaderRoot(t.leaderRoots[s]);if(this._writer.writeBitDouble(t.scaleFactor),this._writer.write3BitDouble(t.contentBasePoint),this._writer.writeBitDouble(t.textHeight),this._writer.writeBitDouble(t.arrowheadSize),this._writer.writeBitDouble(t.landingGap),this._writer.writeBitShort(t.textLeftAttachment),this._writer.writeBitShort(t.textRightAttachment),this._writer.writeBitShort(t.textAlignment),this._writer.writeBitShort(t.blockContentConnection),this._writer.writeBit(t.hasTextContents),t.hasTextContents){this._writer.writeVariableText(t.textLabel),this._writer.write3BitDouble(t.textNormal),this._writer.handleReferenceTyped(w.HardPointer,t.textStyle),this._writer.write3BitDouble(t.textLocation),this._writer.write3BitDouble(t.direction),this._writer.writeBitDouble(t.textRotation),this._writer.writeBitDouble(t.boundaryWidth),this._writer.writeBitDouble(t.boundaryHeight),this._writer.writeBitDouble(t.lineSpacingFactor),this._writer.writeBitShort(t.lineSpacing),this._writer.writeCmColor(t.textColor),this._writer.writeBitShort(t.textAttachmentPoint),this._writer.writeBitShort(t.flowDirection),this._writer.writeCmColor(t.backgroundFillColor),this._writer.writeBitDouble(t.backgroundScaleFactor),this._writer.writeBitLong(t.backgroundTransparency),this._writer.writeBit(t.backgroundFillEnabled),this._writer.writeBit(t.backgroundMaskFillOn),this._writer.writeBitShort(t.columnType),this._writer.writeBit(t.textHeightAutomatic),this._writer.writeBitDouble(t.columnWidth),this._writer.writeBitDouble(t.columnGutter),this._writer.writeBit(t.columnFlowReversed);let s=t.columnSizes.length;this._writer.writeBitLong(s);for(let n=0;n<s;n++)this._writer.writeBitDouble(t.columnSizes[n]);this._writer.writeBit(t.wordBreak),this._writer.writeBit(!1)}else if(t.hasContentsBlock){this._writer.writeBit(t.hasContentsBlock),this._writer.handleReferenceTyped(w.SoftPointer,t.blockContent),this._writer.write3BitDouble(t.blockContentNormal),this._writer.write3BitDouble(t.blockContentLocation),this._writer.write3BitDouble(t.blockContentScale),this._writer.writeBitDouble(t.blockContentRotation),this._writer.writeCmColor(t.blockContentColor);let s=t.transformationMatrix;this._writer.writeBitDouble(s.M00),this._writer.writeBitDouble(s.M10),this._writer.writeBitDouble(s.M20),this._writer.writeBitDouble(s.M30),this._writer.writeBitDouble(s.M01),this._writer.writeBitDouble(s.M11),this._writer.writeBitDouble(s.M21),this._writer.writeBitDouble(s.M31),this._writer.writeBitDouble(s.M02),this._writer.writeBitDouble(s.M12),this._writer.writeBitDouble(s.M22),this._writer.writeBitDouble(s.M32),this._writer.writeBitDouble(s.M03),this._writer.writeBitDouble(s.M13),this._writer.writeBitDouble(s.M23),this._writer.writeBitDouble(s.M33)}this._writer.write3BitDouble(t.basePoint),this._writer.write3BitDouble(t.baseDirection),this._writer.write3BitDouble(t.baseVertical),this._writer.writeBit(t.normalReversed),this.R2010Plus&&(this._writer.writeBitShort(t.textTopAttachment),this._writer.writeBitShort(t.textBottomAttachment))}writeLeaderRoot(e){this._writer.writeBit(e.contentValid),this._writer.writeBit(!0),this._writer.write3BitDouble(e.connectionPoint),this._writer.write3BitDouble(e.direction),this._writer.writeBitLong(e.breakStartEndPointsPairs.length);for(let t of e.breakStartEndPointsPairs)this._writer.write3BitDouble(t.startPoint),this._writer.write3BitDouble(t.endPoint);this._writer.writeBitLong(e.leaderIndex),this._writer.writeBitDouble(e.landingDistance),this._writer.writeBitLong(e.lines.length);for(let t of e.lines)this.writeLeaderLine(t);this.R2010Plus&&this._writer.writeBitShort(e.textAttachmentDirection)}writeLeaderLine(e){this._writer.writeBitLong(e.points.length);for(let t of e.points)this._writer.write3BitDouble(t);if(this._writer.writeBitLong(e.breakInfoCount),e.breakInfoCount>0){this._writer.writeBitLong(e.segmentIndex),this._writer.writeBitLong(e.startEndPoints.length);for(let t of e.startEndPoints)this._writer.write3BitDouble(t.startPoint),this._writer.write3BitDouble(t.endPoint)}this._writer.writeBitLong(e.index),this.R2010Plus&&(this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.lineType),this._writer.writeBitLong(e.lineWeight),this._writer.writeBitDouble(e.arrowheadSize),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitLong(e.overrideFlags))}writeLine(e){if(this.R13_14Only&&(this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.endPoint)),this.R2000Plus){let t=e.startPoint.z===0&&e.endPoint.z===0;this._writer.writeBit(t),this._writer.writeRawDouble(e.startPoint.x),this._writer.writeBitDoubleWithDefault(e.endPoint.x,e.startPoint.x),this._writer.writeRawDouble(e.startPoint.y),this._writer.writeBitDoubleWithDefault(e.endPoint.y,e.startPoint.y),t||(this._writer.writeRawDouble(e.startPoint.z),this._writer.writeBitDoubleWithDefault(e.endPoint.z,e.startPoint.z))}this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal)}writePoint(e){this._writer.write3BitDouble(e.location),this._writer.writeBitThickness(e.thickness),this._writer.writeBitExtrusion(e.normal),this._writer.writeBitDouble(e.rotation)}writePolyfaceMesh(e){if(this._writer.writeBitShort(e.vertices.length),this._writer.writeBitShort(e.faces.length),this.R2004Plus){this._writer.writeBitLong(e.vertices.length+e.faces.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.SoftPointer,t);for(let t of e.faces)this._writer.handleReferenceTyped(w.SoftPointer,t)}if(this.R13_15Only){let t=[...e.vertices,...e.faces];this._writer.handleReferenceTyped(w.SoftPointer,t.length>0?t[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,t.length>0?t[t.length-1]:null)}this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.Seqend)}writePolyline2D(e){if(this._writer.writeBitShort(e.flags),this._writer.writeBitShort(e.smoothSurface),this._writer.writeBitDouble(e.startWidth),this._writer.writeBitDouble(e.endWidth),this._writer.writeBitThickness(e.thickness),this._writer.writeBitDouble(e.elevation),this._writer.writeBitExtrusion(e.normal),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writePolyline3D(e){if(this._writer.writeByte(0),this._writer.writeByte((e.flags&Ve.ClosedPolylineOrClosedPolygonMeshInM)!==0?1:0),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writePolygonMesh(e){if(this._writer.writeBitShort(e.flags),this._writer.writeBitShort(e.smoothSurface),this._writer.writeBitShort(e.mVertexCount),this._writer.writeBitShort(e.nVertexCount),this._writer.writeBitShort(e.mSmoothSurfaceDensity),this._writer.writeBitShort(e.nSmoothSurfaceDensity),this._version>=m.AC1012&&this._version<=m.AC1015&&(this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[0]:null),this._writer.handleReferenceTyped(w.SoftPointer,e.vertices.length>0?e.vertices[e.vertices.length-1]:null)),this.R2004Plus){this._writer.writeBitLong(e.vertices.length);for(let t of e.vertices)this._writer.handleReferenceTyped(w.HardOwnership,t)}this._writer.handleReferenceTyped(w.HardOwnership,e.vertices.Seqend)}writeSeqend(e){if(e==null)return;let t=this._prev,i=this._next;this._prev=null,this._next=null,this.writeCommonEntityData(e),this.registerObject(e),this._prev=t,this._next=i}writeShape(e){this._writer.write3BitDouble(e.insertionPoint),this._writer.writeBitDouble(e.size),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.relativeXScale),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeBitDouble(e.thickness),this._writer.writeBitShort(e.shapeIndex),this._writer.write3BitDouble(e.normal),this._writer.handleReferenceTyped(w.HardPointer,null)}writeSolid(e){this._writer.writeBitThickness(e.thickness),this._writer.writeBitDouble(e.firstCorner.z),this._writer.writeRawDouble(e.firstCorner.x),this._writer.writeRawDouble(e.firstCorner.y),this._writer.writeRawDouble(e.secondCorner.x),this._writer.writeRawDouble(e.secondCorner.y),this._writer.writeRawDouble(e.thirdCorner.x),this._writer.writeRawDouble(e.thirdCorner.y),this._writer.writeRawDouble(e.fourthCorner.x),this._writer.writeRawDouble(e.fourthCorner.y),this._writer.writeBitExtrusion(e.normal)}writeSolid3D(e){}writeCadImage(e){switch(this._writer.writeBitLong(e.classVersion),this._writer.write3BitDouble(e.insertPoint),this._writer.write3BitDouble(e.uVector),this._writer.write3BitDouble(e.vVector),this._writer.write2RawDouble(e.size),this._writer.writeBitShort(e.flags),this._writer.writeBit(e.clippingState),this._writer.writeByte(e.brightness),this._writer.writeByte(e.contrast),this._writer.writeByte(e.fade),this.R2010Plus&&this._writer.writeBit(e.clipMode===xi.Inside),this._writer.writeBitShort(e.clipType),e.clipType){case $r.Rectangular:this._writer.write2RawDouble(e.clipBoundaryVertices[0]),this._writer.write2RawDouble(e.clipBoundaryVertices[1]);break;case $r.Polygonal:this._writer.writeBitLong(e.clipBoundaryVertices.length);for(let t=0;t<e.clipBoundaryVertices.length;t++)this._writer.write2RawDouble(e.clipBoundaryVertices[t]);break}this._writer.handleReferenceTyped(w.HardPointer,e.definition),this._writer.handleReference(e.definitionReactor),e.definitionReactor!=null&&this._objects.push(e.definitionReactor)}writeSpline(e){let t;this.R2013Plus?(e.knotParametrization===Si.Custom||e.fitPoints.length===0?(t=1,e.flags1&=~mt.UseKnotParameter):(t=2,e.flags1|=mt.MethodFitPoints|mt.UseKnotParameter),this._writer.writeBitLong(t),this._writer.writeBitLong(e.flags1),this._writer.writeBitLong(e.knotParametrization)):(t=e.fitPoints.length<=0?1:2,t===2&&e.knotParametrization!==0&&(t=1),this._writer.writeBitLong(t)),this._writer.writeBitLong(e.degree);let i=e.weights.length>0;switch(t){case 1:this._writer.writeBit((e.flags&Ie.Rational)!==0),this._writer.writeBit((e.flags&Ie.Closed)!==0),this._writer.writeBit((e.flags&Ie.Periodic)!==0),this._writer.writeBitDouble(e.knotTolerance),this._writer.writeBitDouble(e.controlPointTolerance),this._writer.writeBitLong(e.knots.length),this._writer.writeBitLong(e.controlPoints.length),this._writer.writeBit(i);for(let s of e.knots)this._writer.writeBitDouble(s);for(let s=0;s<e.controlPoints.length;s++)this._writer.write3BitDouble(e.controlPoints[s]),i&&this._writer.writeBitDouble(e.weights[s]);break;case 2:this._writer.writeBitDouble(e.fitTolerance),this._writer.write3BitDouble(e.startTangent),this._writer.write3BitDouble(e.endTangent),this._writer.writeBitLong(e.fitPoints.length);for(let s of e.fitPoints)this._writer.write3BitDouble(s);break}}writeRay(e){this._writer.write3BitDouble(e.startPoint),this._writer.write3BitDouble(e.direction)}writeTextEntity(e){if(this.R13_14Only)this._writer.writeBitDouble(e.insertPoint.z),this._writer.writeRawDouble(e.insertPoint.x),this._writer.writeRawDouble(e.insertPoint.y),this._writer.writeRawDouble(e.alignmentPoint.x),this._writer.writeRawDouble(e.alignmentPoint.y),this._writer.write3BitDouble(e.normal),this._writer.writeBitDouble(e.thickness),this._writer.writeBitDouble(e.obliqueAngle),this._writer.writeBitDouble(e.rotation),this._writer.writeBitDouble(e.height),this._writer.writeBitDouble(e.widthFactor),this._writer.writeVariableText(e.value),this._writer.writeBitShort(e.mirror),this._writer.writeBitShort(e.horizontalAlignment),this._writer.writeBitShort(e.verticalAlignment);else{let t=0;e.insertPoint.z===0&&(t|=1),c.equals(e.alignmentPoint,c.Zero)&&(t|=2),e.obliqueAngle===0&&(t|=4),e.rotation===0&&(t|=8),e.widthFactor===1&&(t|=16),e.mirror===rn.None&&(t|=32),e.horizontalAlignment===ht.Left&&(t|=64),e.verticalAlignment===ct.Baseline&&(t|=128),this._writer.writeByte(t),(t&1)===0&&this._writer.writeRawDouble(e.insertPoint.z),this._writer.writeRawDouble(e.insertPoint.x),this._writer.writeRawDouble(e.insertPoint.y),(t&2)===0&&(this._writer.writeBitDoubleWithDefault(e.alignmentPoint.x,e.insertPoint.x),this._writer.writeBitDoubleWithDefault(e.alignmentPoint.y,e.insertPoint.y)),this._writer.writeBitExtrusion(e.normal),this._writer.writeBitThickness(e.thickness),(t&4)===0&&this._writer.writeRawDouble(e.obliqueAngle),(t&8)===0&&this._writer.writeRawDouble(e.rotation),this._writer.writeRawDouble(e.height),(t&16)===0&&this._writer.writeRawDouble(e.widthFactor),this._writer.writeVariableText(e.value),(t&32)===0&&this._writer.writeBitShort(e.mirror),(t&64)===0&&this._writer.writeBitShort(e.horizontalAlignment),(t&128)===0&&this._writer.writeBitShort(e.verticalAlignment)}this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeMText(e){this._writer.write3BitDouble(e.insertPoint),this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.alignmentPoint),this._writer.writeBitDouble(e.rectangleWidth),this.R2007Plus&&this._writer.writeBitDouble(e.rectangleHeight),this._writer.writeBitDouble(e.height),this._writer.writeBitShort(e.attachmentPoint),this._writer.writeBitShort(e.drawingDirection),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0),this._writer.writeVariableText(e.value),this._writer.handleReferenceTyped(w.HardPointer,e.style),this.R2000Plus&&(this._writer.writeBitShort(e.lineSpacingStyle),this._writer.writeBitDouble(e.lineSpacing),this._writer.writeBit(!1)),this.R2004Plus&&(this._writer.writeBitLong(e.backgroundFillFlags),((e.backgroundFillFlags&rr.UseBackgroundFillColor)!==rr.None||this._version>m.AC1027&&(e.backgroundFillFlags&rr.TextFrame)>0)&&(this._writer.writeBitDouble(e.backgroundScale),this._writer.writeCmColor(e.backgroundColor),this._writer.writeBitLong(e.backgroundTransparency))),this.R2018Plus&&(this._writer.writeBit(!e.isAnnotative),!e.isAnnotative&&(this._writer.writeBitShort(4),this._writer.writeBit(!0),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.writeBitLong(e.attachmentPoint),this._writer.write3BitDouble(e.alignmentPoint),this._writer.write3BitDouble(e.insertPoint),this._writer.writeBitDouble(e.rectangleWidth),this._writer.writeBitDouble(e.rectangleHeight),this._writer.writeBitDouble(e.horizontalWidth),this._writer.writeBitDouble(e.verticalHeight)))}writeFaceRecord(e){this._writer.writeBitShort(e.index1),this._writer.writeBitShort(e.index2),this._writer.writeBitShort(e.index3),this._writer.writeBitShort(e.index4)}writeVertex2D(e){this._writer.writeByte(e.flags),this._writer.writeBitDouble(e.location.x),this._writer.writeBitDouble(e.location.y),this._writer.writeBitDouble(0),e.startWidth!==0&&e.endWidth===e.startWidth?this._writer.writeBitDouble(0-e.startWidth):(this._writer.writeBitDouble(e.startWidth),this._writer.writeBitDouble(e.endWidth)),this._writer.writeBitDouble(e.bulge),this.R2010Plus&&this._writer.writeBitLong(e.id),this._writer.writeBitDouble(e.curveTangent)}writeVertex(e){this._writer.writeByte(e.flags),this._writer.write3BitDouble(e.location)}writeTolerance(e){this.R13_14Only&&(this._writer.writeBitShort(0),this._writer.writeBitDouble(0),this._writer.writeBitDouble(0)),this._writer.write3BitDouble(e.insertionPoint),this._writer.write3BitDouble(e.direction),this._writer.write3BitDouble(e.normal),this._writer.writeVariableText(e.text),this._writer.handleReferenceTyped(w.HardPointer,e.style)}writeViewport(e){if(this._writer.write3BitDouble(e.center),this._writer.writeBitDouble(e.width),this._writer.writeBitDouble(e.height),this.R2000Plus&&(this._writer.write3BitDouble(e.viewTarget),this._writer.write3BitDouble(e.viewDirection),this._writer.writeBitDouble(e.twistAngle),this._writer.writeBitDouble(e.viewHeight),this._writer.writeBitDouble(e.lensLength),this._writer.writeBitDouble(e.frontClipPlane),this._writer.writeBitDouble(e.backClipPlane),this._writer.writeBitDouble(e.snapAngle),this._writer.write2RawDouble(e.viewCenter),this._writer.write2RawDouble(e.snapBase),this._writer.write2RawDouble(e.snapSpacing),this._writer.write2RawDouble(e.gridSpacing),this._writer.writeBitShort(e.circleZoomPercent)),this.R2007Plus&&this._writer.writeBitShort(e.majorGridLineFrequency),this.R2000Plus&&(this._writer.writeBitLong(e.frozenLayers.length),this._writer.writeBitLong(e.status),this._writer.writeVariableText(""),this._writer.writeByte(e.renderMode),this._writer.writeBit(e.displayUcsIcon),this._writer.writeBit(e.ucsPerViewport),this._writer.write3BitDouble(e.ucsOrigin),this._writer.write3BitDouble(e.ucsXAxis),this._writer.write3BitDouble(e.ucsYAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.ucsOrthographicType)),this.R2004Plus&&this._writer.writeBitShort(e.shadePlotMode),this.R2007Plus&&(this._writer.writeBit(e.useDefaultLighting),this._writer.writeByte(e.defaultLightingType),this._writer.writeBitDouble(e.brightness),this._writer.writeBitDouble(e.contrast),this._writer.writeCmColor(e.ambientLightColor)),this.R13_14Only&&this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus){for(let t of e.frozenLayers)this.R2004Plus?this._writer.handleReferenceTyped(w.SoftPointer,t):this._writer.handleReferenceTyped(w.HardPointer,t);this._writer.handleReferenceTyped(w.HardPointer,e.boundary)}this._version===m.AC1015&&this._writer.handleReferenceTyped(w.HardPointer,null),this.R2000Plus&&(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&(this._writer.handleReferenceTyped(w.SoftPointer,null),this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.SoftPointer,null),this._writer.handleReferenceTyped(w.HardOwnership,null))}writeXLine(e){this._writer.write3BitDouble(e.firstPoint),this._writer.write3BitDouble(e.direction)}writeChildEntities(e,t){if(e.length===0)return;let i=this._prev,s=this._next;this._prev=null,this._next=null;let n=e[0];for(let a=1;a<e.length;a++)this._next=e[a],this.writeEntity(n),this._prev=n,n=this._next;this._next=null,this.writeEntity(n),this._prev=i,this._next=s,t!=null&&this.writeSeqend(t)}addEntriesToWriter(e){for(let t of e)this._objects.push(t)}skipEntry(e){return e instanceof _t&&!this.WriteXRecords?{skip:!0,notify:!1}:e instanceof $s||e instanceof Gs||e instanceof Ys||e instanceof Xe||e instanceof yr||e instanceof at||e instanceof pr||e instanceof di||e instanceof Ye||e instanceof Er||e instanceof Rr||e instanceof mi||e instanceof ps?{skip:!0,notify:!0}:{skip:!1,notify:!1}}write4x3Matrix(e){for(let t=0;t<3;t++)for(let i=0;i<4;i++)this._writer.writeBitDouble(e.get(t,i))}writeObjects(){for(;this._objects.length>0;){let e=this._objects.shift();this.writeObject(e)}}writeObject(e){let{skip:t,notify:i}=this.skipEntry(e);if(t){i&&this.notify(`Object type not implemented ${e.constructor.name}`,g.NotImplemented);return}if(this.writeCommonNonEntityData(e),e instanceof ci)this.writeAcdbPlaceHolder(e);else if(e instanceof ui)this.writeBookColor(e);else if(e instanceof Cr)this.writeCadDictionaryWithDefault(e);else if(e instanceof xe)this.writeDictionary(e);else if(e instanceof He)this.writeDictionaryVariable(e);else if(e instanceof Xe)this.writeDimensionAssociation(e);else if(e instanceof Jt)this.writeGeoData(e);else if(e instanceof Ot)this.writeGroup(e);else if(e instanceof li)this.writeImageDefinitionReactor(e);else if(e instanceof Tr)this.writeImageDefinition(e);else if(e instanceof nt)this.writeLayout(e);else if(e instanceof wt)this.writeMLineStyle(e);else if(e instanceof $e)this.writeMultiLeaderStyle(e);else if(e instanceof Dr)this.writeObjectContextData(e),this.writeAnnotScaleObjectContextData(e),this.writeMultiLeaderAnnotContext(e);else if(e instanceof hi)this.writePdfDefinition(e);else if(e instanceof pt)this.writePlotSettings(e);else if(e instanceof Ar)this.writeRasterVariables(e);else if(e instanceof Ge)this.writeScale(e);else if(e instanceof Br)this.writeSortEntitiesTable(e);else if(e instanceof qt)this.writeSpatialFilter(e);else if(e instanceof fi)this.writeField(e);else if(e instanceof pi)this.writeFieldList(e);else if(e instanceof _t)this.writeXRecord(e);else throw new Error(`Object not implemented : ${e.constructor.name}`);this.registerObject(e)}writeAcdbPlaceHolder(e){}writeAnnotScaleObjectContextData(e){this._writer.handleReferenceTyped(w.HardPointer,e.scale)}writeObjectContextData(e){this._writer.writeBitShort(e.version),this._writer.writeBit(e.hasFileToExtensionDictionary),this._writer.writeBit(e.default)}writeBookColor(e){if(this._writer.writeBitShort(0),this.R2004Plus){let t=new Uint8Array([e.color.b,e.color.g,e.color.r,194]),i=new DataView(t.buffer).getUint32(0,!0);this._writer.writeBitLong(i);let s=0;e.name&&(s|=1),e.bookName&&(s|=2),this._writer.writeByte(s),e.colorName&&this._writer.writeVariableText(e.colorName),e.bookName&&this._writer.writeVariableText(e.bookName)}}writeCadDictionaryWithDefault(e){this.writeDictionary(e),this._writer.handleReferenceTyped(w.HardPointer,e.defaultEntry)}writeDictionary(e){let t=[];for(let i of e)this.skipEntry(i).skip||t.push(i);this._writer.writeBitLong(t.length),this._version===m.AC1014&&this._writer.writeByte(0),this.R2000Plus&&(this._writer.writeBitShort(e.clonningFlags),this._writer.writeByte(e.hardOwnerFlag?1:0));for(let i of t)this.skipEntry(i).skip||(this._writer.writeVariableText(i.name),this._writer.handleReferenceTyped(w.SoftOwnership,i.handle));this.addEntriesToWriter(e)}writeDictionaryVariable(e){this._writer.writeByte(0),this._writer.writeVariableText(e.value)}writeDimensionAssociation(e){this._writer.handleReferenceTyped(w.SoftPointer,e.dimension),this._writer.writeBitLong(e.associativityFlags),this._writer.writeBit(e.isTransSpace),this._writer.writeByte(e.rotatedDimensionType),(e.associativityFlags&he.FirstPointReference)!==0&&this.writeOsnapPointRef(e.firstPointRef),(e.associativityFlags&he.SecondPointReference)!==0&&this.writeOsnapPointRef(e.secondPointRef),(e.associativityFlags&he.ThirdPointReference)!==0&&this.writeOsnapPointRef(e.thirdPointRef),(e.associativityFlags&he.FourthPointReference)!==0&&this.writeOsnapPointRef(e.fourthPointRef)}writeOsnapPointRef(e){this._writer.writeVariableText(Xe.OsnapPointRefClassName),this._writer.writeByte(e.objectOsnapType),this._writer.handleReferenceTyped(w.Undefined,e.geometry)}writeField(e){this._writer.writeVariableText(e.evaluatorId),this._writer.writeVariableText(e.fieldCode),this._writer.writeBitLong(e.children.length);for(let t of e.children)this._writer.handleReferenceTyped(w.HardOwnership,e);this._writer.writeBitLong(e.cadObjects.length);for(let t of e.cadObjects)this._writer.handleReferenceTyped(w.SoftPointer,t);this._version<m.AC1021&&this._writer.writeVariableText(e.formatString),this._writer.writeBitLong(e.evaluationOptionFlags),this._writer.writeBitLong(e.filingOptionFlags),this._writer.writeBitLong(e.fieldStateFlags),this._writer.writeBitLong(e.evaluationStatusFlags),this._writer.writeBitLong(e.evaluationErrorCode),this._writer.writeVariableText(e.evaluationErrorMessage),this.writeCadValue(e.value),this._writer.writeVariableText(e.formatString),this._writer.writeBitLong(e.formatString.length),this._writer.writeBitLong(e.values.size);for(let[t,i]of e.values)this._writer.writeVariableText(t),this.writeCadValue(i);for(let t of e.children)this._objects.push(t)}writeFieldList(e){this._writer.writeBitLong(e.fields.length),this._writer.writeBit(!0);for(let t of e.fields)this._writer.handleReferenceTyped(w.SoftPointer,t)}writeCadValue(e){if(this.R2007Plus&&this._writer.writeBitLong(e.flags),this._writer.writeBitLong(e.valueType),!this.R2007Plus||!e.isEmpty)switch(e.valueType){case W.Unknown:this._writer.writeBitLong(0);break;case W.Long:this._writer.writeBitLong(e.value);break;case W.Double:this._writer.writeBitDouble(e.value);break;case W.General:case W.String:this.writeStringCadValue(e.value);break;case W.Date:this.writeDateCadValue(e.value);break;case W.Point2D:this.writeCadValueXY(e.value);break;case W.Point3D:this.writeCadValueXYZ(e.value);break;case W.Handle:this._writer.handleReferenceTyped(w.SoftPointer,e.value);break;default:throw new Error("Not implemented")}this.R2007Plus&&(this._writer.writeBitLong(e.units),this._writer.writeVariableText(e.format),this._writer.writeVariableText(e.formattedValue))}writeCadValueXY(e){e!=null?(this._writer.writeBitLong(16),this._writer.write2RawDouble(e)):this._writer.writeBitLong(0)}writeCadValueXYZ(e){e!=null?(this._writer.writeBitLong(24),this._writer.writeRawDouble(e.X),this._writer.writeRawDouble(e.Y),this._writer.writeRawDouble(e.Z)):this._writer.writeBitLong(0)}writeDateCadValue(e){if(e!=null){let t;if(this.R2007Plus){t=new Uint8Array(16);let i=new DataView(t.buffer);i.setInt16(0,e.getFullYear(),!0),i.setInt16(2,e.getMonth()+1,!0),i.setInt16(4,e.getDay(),!0),i.setInt16(6,e.getDate(),!0),i.setInt16(8,e.getHours(),!0),i.setInt16(10,e.getMinutes(),!0),i.setInt16(12,e.getSeconds(),!0),i.setInt16(14,e.getMilliseconds(),!0)}else{let i=Math.floor((e.getTime()-new Date(1970,0,1).getTime())/1e3),s=i>>>32|0,n=i|0;t=new Uint8Array(8);let a=new DataView(t.buffer);a.setInt32(0,s,!1),a.setInt32(4,n,!1)}this._writer.writeBitLong(t.length),this._writer.writeBytes(t)}else this._writer.writeBitLong(0)}writeStringCadValue(e){e||this._writer.writeBitLong(0);let t;this.R2007Plus?(t=this.encodeUtf16LE(e),this._writer.writeBitLong(t.length+2),this._writer.writeBytes(t),this._writer.writeByte(0),this._writer.writeByte(0)):(t=this.encodeText(e),this._writer.writeBitLong(t.length+1),this._writer.writeBytes(t),this._writer.writeByte(0))}writeGeoData(e){switch(this._writer.writeBitLong(e.version),this._writer.handleReferenceTyped(w.SoftPointer,e.hostBlock),this._writer.writeBitShort(e.coordinatesType),e.version){case We.R2009:this._writer.write3BitDouble(e.referencePoint),this._writer.writeBitLong(e.horizontalUnits),this._writer.write3BitDouble(e.designPoint),this._writer.write3BitDouble(c.Zero),this._writer.write3BitDouble(e.upDirection),this._writer.writeBitDouble(Math.PI/2-e.northDirection.getAngle()),this._writer.write3BitDouble(new c(1,1,1)),this._writer.writeVariableText(e.coordinateSystemDefinition),this._writer.writeVariableText(e.geoRssTag),this._writer.writeBitDouble(e.horizontalUnitScale),e.verticalUnitScale=e.horizontalUnitScale,this._writer.writeVariableText(""),this._writer.writeVariableText("");break;case We.R2010:case We.R2013:this._writer.write3BitDouble(e.designPoint),this._writer.write3BitDouble(e.referencePoint),this._writer.writeBitDouble(e.horizontalUnitScale),this._writer.writeBitLong(e.horizontalUnits),this._writer.writeBitDouble(e.verticalUnitScale),this._writer.writeBitLong(e.horizontalUnits),this._writer.write3BitDouble(e.upDirection),this._writer.write2RawDouble(e.northDirection),this._writer.writeBitLong(e.scaleEstimationMethod),this._writer.writeBitDouble(e.userSpecifiedScaleFactor),this._writer.writeBit(e.enableSeaLevelCorrection),this._writer.writeBitDouble(e.seaLevelElevation),this._writer.writeBitDouble(e.coordinateProjectionRadius),this._writer.writeVariableText(e.coordinateSystemDefinition),this._writer.writeVariableText(e.geoRssTag);break}this._writer.writeVariableText(e.observationFromTag),this._writer.writeVariableText(e.observationToTag),this._writer.writeVariableText(e.observationCoverageTag),this._writer.writeBitLong(e.points.length);for(let t of e.points)this._writer.write2RawDouble(t.source),this._writer.write2RawDouble(t.destination);this._writer.writeBitLong(e.faces.length);for(let t of e.faces)this._writer.writeBitLong(t.index1),this._writer.writeBitLong(t.index2),this._writer.writeBitLong(t.index3)}writeGroup(e){this._writer.writeVariableText(e.description),this._writer.writeBitShort(e.isUnnamed?1:0),this._writer.writeBitShort(e.selectable?1:0),this._writer.writeBitLong(e.entities.length);for(let t of e.entities)this._writer.handleReferenceTyped(w.HardPointer,t)}writeImageDefinition(e){this._writer.writeBitLong(e.classVersion),this._writer.write2RawDouble(e.size),this._writer.writeVariableText(e.fileName),this._writer.writeBit(e.isLoaded),this._writer.writeByte(e.units),this._writer.write2RawDouble(e.defaultSize)}writeImageDefinitionReactor(e){this._writer.writeBitLong(e.classVersion)}writeLayout(e){if(this.writePlotSettings(e),this._writer.writeVariableText(e.name),this._writer.writeBitLong(e.tabOrder),this._writer.writeBitShort(e.layoutFlags),this._writer.write3BitDouble(e.origin),this._writer.write2RawDouble(e.minLimits),this._writer.write2RawDouble(e.minLimits),this._writer.write3BitDouble(e.insertionBasePoint),this._writer.write3BitDouble(e.xAxis),this._writer.write3BitDouble(e.yAxis),this._writer.writeBitDouble(e.elevation),this._writer.writeBitShort(e.ucsOrthographicType),this._writer.write3BitDouble(e.minExtents),this._writer.write3BitDouble(e.maxExtents),this.R2004Plus&&this._writer.writeBitLong(e.viewports.length),this._writer.handleReferenceTyped(w.SoftPointer,e.associatedBlock),this._writer.handleReferenceTyped(w.SoftPointer,e.lastActiveViewport),e.ucsOrthographicType===Mt.None?(this._writer.handleReferenceTyped(w.HardPointer,null),this._writer.handleReferenceTyped(w.HardPointer,e.ucs)):(this._writer.handleReferenceTyped(w.HardPointer,e.baseUCS),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2004Plus)for(let t of e.viewports)this._writer.handleReferenceTyped(w.SoftPointer,t)}writeMLineStyle(e){this._writer.writeVariableText(e.name),this._writer.writeVariableText(e.description);let t=0;(e.flags&ge.DisplayJoints)!==0&&(t|=1),(e.flags&ge.FillOn)!==0&&(t|=2),(e.flags&ge.StartSquareCap)!==0&&(t|=16),(e.flags&ge.StartRoundCap)!==0&&(t|=32),(e.flags&ge.StartInnerArcsCap)!==0&&(t|=64),(e.flags&ge.EndSquareCap)!==0&&(t|=256),(e.flags&ge.EndRoundCap)!==0&&(t|=512),(e.flags&ge.EndInnerArcsCap)!==0&&(t|=1024),this._writer.writeBitShort(t),this._writer.writeCmColor(e.fillColor),this._writer.writeBitDouble(e.startAngle),this._writer.writeBitDouble(e.endAngle),this._writer.writeByte(e.elements.length);for(let i of e.elements)this._writer.writeBitDouble(i.offset),this._writer.writeCmColor(i.color),this.R2018Plus?this._writer.handleReferenceTyped(w.HardPointer,i.lineType):this._writer.writeBitShort(0)}writeMultiLeaderAnnotContext(e){this.writeMultiLeaderAnnotContextSubObject(!1,e)}writeMultiLeaderStyle(e){this.R2010Plus&&this._writer.writeBitShort(2),this._writer.writeBitShort(e.contentType),this._writer.writeBitShort(e.multiLeaderDrawOrder),this._writer.writeBitShort(e.leaderDrawOrder),this._writer.writeBitLong(e.maxLeaderSegmentsPoints),this._writer.writeBitDouble(e.firstSegmentAngleConstraint),this._writer.writeBitDouble(e.secondSegmentAngleConstraint),this._writer.writeBitShort(e.pathType),this._writer.writeCmColor(e.lineColor),this._writer.handleReferenceTyped(w.HardPointer,e.leaderLineType),this._writer.writeBitLong(e.leaderLineWeight),this._writer.writeBit(e.enableLanding),this._writer.writeBitDouble(e.landingGap),this._writer.writeBit(e.enableDogleg),this._writer.writeBitDouble(e.landingDistance),this._writer.writeVariableText(e.description),this._writer.handleReferenceTyped(w.HardPointer,e.arrowhead),this._writer.writeBitDouble(e.arrowheadSize),this._writer.writeVariableText(e.defaultTextContents),this._writer.handleReferenceTyped(w.HardPointer,e.textStyle),this._writer.writeBitShort(e.textLeftAttachment),this._writer.writeBitShort(e.textRightAttachment),this._writer.writeBitShort(e.textAngle),this._writer.writeBitShort(e.textAlignment),this._writer.writeCmColor(e.textColor),this._writer.writeBitDouble(e.textHeight),this._writer.writeBit(e.textFrame),this._writer.writeBit(e.textAlignAlwaysLeft),this._writer.writeBitDouble(e.alignSpace),this._writer.handleReferenceTyped(w.HardPointer,e.blockContent),this._writer.writeCmColor(e.blockContentColor),this._writer.write3BitDouble(e.blockContentScale),this._writer.writeBit(e.enableBlockContentScale),this._writer.writeBitDouble(e.blockContentRotation),this._writer.writeBit(e.enableBlockContentRotation),this._writer.writeBitShort(e.blockContentConnection),this._writer.writeBitDouble(e.scaleFactor),this._writer.writeBit(e.overwritePropertyValue),this._writer.writeBit(e.isAnnotative),this._writer.writeBitDouble(e.breakGapSize),this.R2010Plus&&(this._writer.writeBitShort(e.textAttachmentDirection),this._writer.writeBitShort(e.textBottomAttachment),this._writer.writeBitShort(e.textTopAttachment)),this.R2013Plus&&this._writer.writeBit(e.unknownFlag298)}writePdfDefinition(e){this._writer.writeVariableText(e.file),this._writer.writeVariableText(e.page)}writePlotSettings(e){this._writer.writeVariableText(e.pageName),this._writer.writeVariableText(e.systemPrinterName),this._writer.writeBitShort(e.flags),this._writer.writeBitDouble(e.unprintableMargin.left),this._writer.writeBitDouble(e.unprintableMargin.bottom),this._writer.writeBitDouble(e.unprintableMargin.right),this._writer.writeBitDouble(e.unprintableMargin.top),this._writer.writeBitDouble(e.paperWidth),this._writer.writeBitDouble(e.paperHeight),this._writer.writeVariableText(e.paperSize),this._writer.writeBitDouble(e.plotOriginX),this._writer.writeBitDouble(e.plotOriginY),this._writer.writeBitShort(e.paperUnits),this._writer.writeBitShort(e.paperRotation),this._writer.writeBitShort(e.plotType),this._writer.writeBitDouble(e.windowLowerLeftX),this._writer.writeBitDouble(e.windowLowerLeftY),this._writer.writeBitDouble(e.windowUpperLeftX),this._writer.writeBitDouble(e.windowUpperLeftY),this._version>=m.AC1012&&this._version<=m.AC1015&&this._writer.writeVariableText(e.plotViewName),this._writer.writeBitDouble(e.numeratorScale),this._writer.writeBitDouble(e.denominatorScale),this._writer.writeVariableText(e.styleSheet),this._writer.writeBitShort(e.scaledFit),this._writer.writeBitDouble(e.standardScale),this._writer.write2BitDouble(e.paperImageOrigin),this.R2004Plus&&(this._writer.writeBitShort(e.shadePlotMode),this._writer.writeBitShort(e.shadePlotResolutionMode),this._writer.writeBitShort(e.shadePlotDPI),this._writer.handleReferenceTyped(w.HardPointer,null)),this.R2007Plus&&this._writer.handleReferenceTyped(w.SoftPointer,null)}writeRasterVariables(e){this._writer.writeBitLong(e.classVersion),this._writer.writeBitShort(e.isDisplayFrameShown?1:0),this._writer.writeBitShort(e.displayQuality),this._writer.writeBitShort(e.units)}writeScale(e){this._writer.writeBitShort(0),this._writer.writeVariableText(e.name),this._writer.writeBitDouble(e.paperUnits),this._writer.writeBitDouble(e.drawingUnits),this._writer.writeBit(e.isUnitScale)}writeSortEntitiesTable(e){this._writer.handleReferenceTyped(w.SoftPointer,e.blockOwner);let t=Array.from(e);this._writer.writeBitLong(t.length);for(let i of t)this._writer.main.handleReference(i.sortHandle),this._writer.handleReferenceTyped(w.SoftPointer,i.entity)}writeSpatialFilter(e){this._writer.writeBitShort(e.boundaryPoints.length);for(let t of e.boundaryPoints)this._writer.write2RawDouble(t);this._writer.write3BitDouble(e.normal),this._writer.write3BitDouble(e.origin),this._writer.writeBitShort(e.displayBoundary?1:0),this._writer.writeBitShort(e.clipFrontPlane?1:0),e.clipFrontPlane&&this._writer.writeBitDouble(e.frontDistance),this._writer.writeBitShort(e.clipBackPlane?1:0),e.clipBackPlane&&this._writer.writeBitDouble(e.backDistance),this.write4x3Matrix(e.inverseInsertTransform),this.write4x3Matrix(e.insertTransform)}writeXRecord(e){let t=[],i=o=>{t.push(o&255,o>>8&255)},s=o=>{t.push(o&255,o>>8&255,o>>16&255,o>>24&255)},n=o=>{let h=new ArrayBuffer(8);new DataView(h).setFloat64(0,o,!0);let b=new Uint8Array(h);for(let S=0;S<8;S++)t.push(b[S])},a=o=>{let h=new ArrayBuffer(8);new DataView(h).setFloat64(0,o,!0);let f=new Uint8Array(h);for(let b=0;b<8;b++)t.push(f[b])};for(let o of e.entries){if(o.value==null)continue;switch(i(o.code),Be.transformValue(o.code)){case _.Byte:case _.Bool:t.push(Number(o.value)&255);break;case _.Int16:case _.ExtendedDataInt16:i(Number(o.value));break;case _.Int32:case _.ExtendedDataInt32:s(Number(o.value));break;case _.Int64:n(Number(o.value));break;case _.Double:case _.ExtendedDataDouble:a(Number(o.value));break;case _.Point3D:{let f=o.value;a(f.X),a(f.Y),a(f.Z);break}case _.Chunk:case _.ExtendedDataChunk:{let f=o.value;t.push(f.length&255);for(let b=0;b<f.length;b++)t.push(f[b]);break}case _.Handle:{let f=o.getReference(),b=f==null?"":f.handle.toString(16).toUpperCase();this.writeStringInChunks(t,b);break}case _.String:case _.ExtendedDataString:this.writeStringInChunks(t,o.value);break;case _.ObjectId:case _.ExtendedDataHandle:{let f=o.getReference(),b=f==null?0:f.handle;n(b);break}default:throw new Error("Not supported")}}this._writer.writeBitLong(t.length),this._writer.writeBytesOffset(new Uint8Array(t),0,t.length),this.R2000Plus&&this._writer.writeBitShort(e.cloningFlags)}writeStringInChunks(e,t){if(this.R2007Plus){if(!t){e.push(0,0);return}let i=t.length;e.push(i&255,i>>8&255);let s=this.encodeUtf16LE(t);for(let n=0;n<s.length;n++)e.push(s[n])}else if(t){let i=t.length;e.push(i&255,i>>8&255);let s=Z.getCodeIndex(Z.getCodePage(this._writer.encoding));e.push(s);let n=this.encodeText(t);for(let a=0;a<n.length;a++)e.push(n[a])}else{e.push(0,0);let i=Z.getCodeIndex(Z.getCodePage(this._writer.encoding));e.push(i)}}encodeUtf16LE(e){let t=new Uint8Array(e.length*2);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t[i*2]=s&255,t[i*2+1]=s>>8&255}return t}encodeText(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i)&255;return t}};var fd=class extends Y{get SectionName(){return T.Preview}get bytesWritten(){return Math.ceil(this._swriter.positionInBits/8)}get writerStream(){return this._swriter.main.stream}_swriter;_startSentinel=T.StartSentinels.get(T.Preview);_endSentinel=T.EndSentinels.get(T.Preview);constructor(e,t){super(e),this._swriter=ye.getStreamWriter(e,t,"windows-1252")}write(){this._swriter.writeBytes(this._startSentinel),this._swriter.writeRawLong(1),this._swriter.writeByte(0),this._swriter.writeBytes(this._endSentinel)}writePreview(e,t){let i=e.rawHeader.length+e.rawImage.length+19;this._swriter.writeBytes(this._startSentinel),this._swriter.writeRawLong(i),this._swriter.writeByte(2),this._swriter.writeByte(1);let s=t+12+5+32;this._swriter.writeRawLong(s),this._swriter.writeRawLong(e.rawHeader.length),this._swriter.writeByte(e.code);let n=s+e.rawHeader.length;this._swriter.writeRawLong(n),this._swriter.writeRawLong(e.rawImage.length),this._swriter.writeBytes(e.rawHeader),this._swriter.writeBytes(e.rawImage),this._swriter.writeBytes(this._endSentinel)}};var Ka=class extends ye{constructor(e,t){super(e,t)}};var Ja=class extends Ka{constructor(e,t){super(e,t)}writeBitExtrusion(e){if(e.X===0&&e.Y===0&&e.Z===1){super.writeBit(!0);return}super.writeBit(!1),super.write3BitDouble(e)}writeBitThickness(e){if(e===0){super.writeBit(!0);return}super.writeBit(!1),super.writeBitDouble(e)}};var qa=class extends Ja{constructor(e,t){super(e,t)}writeCmColor(e){this.writeBitShort(0);let t=new Uint8Array(4);e.isTrueColor?(t[2]=e.r,t[1]=e.g,t[0]=e.b,t[3]=194):e.isByLayer?t[3]=192:(t[3]=195,t[0]=e.index&255);let i=new DataView(t.buffer);this.writeBitLong(i.getInt32(0,!0)),this.writeByte(0)}writeEnColor(e,t){let i=0;if(e.isByBlock&&t.isByLayer){super.writeBitShort(0);return}if(t.isByLayer||(i=i|8192),e.isTrueColor?i=i|32768:i=i|e.index&65535,super.writeBitShort(i&65535),e.isTrueColor){let s=new Uint8Array([e.b,e.g,e.r,194]),a=new DataView(s.buffer).getUint32(0,!0);super.writeBitLong(a|0)}t.isByLayer||super.writeBitLong(Ke.toAlphaValue(t))}writeEnColorBook(e,t,i){let s=0;if(e.isByBlock&&t.isByLayer&&!i){super.writeBitShort(0);return}if(t.isByLayer||(s=s|8192),i?(s=s|16384,s=s|32768):e.isTrueColor?s=s|32768:s=s|e.index&65535,super.writeBitShort(s&65535),e.isTrueColor){let n=new Uint8Array([e.b,e.g,e.r,194]),o=new DataView(n.buffer).getUint32(0,!0);super.writeBitLong(o|0)}t.isByLayer||super.writeBitLong(Ke.toAlphaValue(t))}};var Qa=class extends qa{constructor(e,t){super(e,t)}writeVariableText(e){if(!e||e.length===0){super.writeBitShort(0);return}super.writeBitShort(e.length);let t=new TextEncoder,i=new Uint8Array(e.length*2);for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);i[s*2]=n&255,i[s*2+1]=n>>>8&255}super.writeBytes(i)}writeTextUnicode(e){this.writeRawShort(e.length+1);let t=new Uint8Array(e.length*2);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);t[i*2]=s&255,t[i*2+1]=s>>>8&255}this.writeBytes(t),this.writeByte(0),this.writeByte(0)}};var pd=class extends Qa{constructor(e,t){super(e,t)}writeObjectType(e){if(e<=255)this.write2Bits(0),this.writeByte(e&255);else if(e>=496&&e<=751)this.write2Bits(1),this.writeByte(e-496&255);else{this.write2Bits(2);let t=new Uint8Array(2);new DataView(t.buffer).setInt16(0,e,!0),this.writeBytes(t)}}};var wd=class extends Y{get SectionName(){return T.SummaryInfo}get bytesWritten(){return Math.ceil(this._writer.positionInBits/8)}get writerStream(){return this._writer.main.stream}_writer;_writeStringMethod;constructor(e,t){super(e),this._version=e,this._writer=ye.getStreamWriter(e,t,"utf-16le"),e<m.AC1021?this._writeStringMethod=i=>this.writeUnicodeString(i):this._writeStringMethod=i=>this._writer.writeTextUnicode(i)}write(e){this._writeStringMethod(e.title??""),this._writeStringMethod(e.subject??""),this._writeStringMethod(e.author??""),this._writeStringMethod(e.keywords??""),this._writeStringMethod(e.comments??""),this._writeStringMethod(e.lastSavedBy??""),this._writeStringMethod(e.revisionNumber??""),this._writeStringMethod(e.hyperlinkBase??""),this._writer.writeInt(0),this._writer.writeInt(0),this._writer.write8BitJulianDate(e.createdDate??new Date),this._writer.write8BitJulianDate(e.modifiedDate??new Date);let t=e.properties?.size??0;if(this._writer.writeRawShort(t),e.properties)for(let[i,s]of e.properties)this._writeStringMethod(i),this._writeStringMethod(s);this._writer.writeInt(0),this._writer.writeInt(0)}writeUnicodeString(e){if(!e||e.length===0){this._writer.writeRawShort(0);return}let i=new TextEncoder().encode(e);this._writer.writeRawShort(i.length),this._writer.writeBytes(i)}};var _d=class extends Ls{};Ya("AC12",Ka);Ya("AC15",Ja);Ya("AC18",qa);Ya("AC21",Qa);Ya("AC24",pd);lh("MergedAC14",ud);lh("Merged",Za);var Xh=class r extends Es{Preview=null;get _version(){return this._document.header.version}_fileHeader;_fileHeaderWriter;_handlesMap=new Map;get bytesWritten(){return this._fileHeaderWriter?.bytesWritten??0}constructor(e,t){super(e,t),this._fileHeader=Ai.CreateFileHeader(this._version)}createDefaultConfiguration(){return new _d}Write(){super.Write(),this.getFileHeaderWriter(),this.writeHeader(),this.writeClasses(),this.writeSummaryInfo(),this.writePreview(),this.writeAppInfo(),this.writeFileDepList(),this.writeRevHistory(),this.writeAuxHeader(),this.writeObjects(),this.writeObjFreeSpace(),this.writeTemplate(),this.writeHandles(),this._fileHeaderWriter.writeFile()}Dispose(){}static WriteToStream(e,t,i=null,s=null){let n=new r(e,t);i&&(n.Configuration=i),n.OnNotification=s,n.Write(),n.Dispose()}getFileHeaderWriter(){switch(this._document.header.version){case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:case m.AC1012:throw new Me(this._document.header.version);case m.AC1014:case m.AC1015:this._fileHeaderWriter=new od(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1018:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1021:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;case m.AC1024:case m.AC1027:case m.AC1032:this._fileHeaderWriter=new Xs(new Uint8Array(this._stream),this._encoding,this._document);break;default:throw new Me}}writeHeader(){let e=new Uint8Array(0),t=new cd(e,this._document,this._encoding);t.OnNotification=(s,n)=>this.triggerNotification(s,n),t.write();let i=new Uint8Array(t.startWriterStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Header,i,!0)}writeClasses(){let e=new Uint8Array(0),t=new ad(e,this._document,this._encoding);t.write();let i=new Uint8Array(t.startWriterStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Classes,i,!0)}writeSummaryInfo(){if(!(this._fileHeader.AcadVersion<m.AC1018))if(this._document.summaryInfo){let e=new Uint8Array(8192),t=new wd(this._version,e);t.write(this._document.summaryInfo);let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.SummaryInfo,i,!1,256)}else this._fileHeaderWriter.addSection(T.SummaryInfo,new Uint8Array(0),!1,256)}writePreview(){let e=new Uint8Array(4096),t=new fd(this._version,e);this.Preview&&this.Preview.code!==0?t.writePreview(this.Preview,0):t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.Preview,i,!1,1024)}writeAppInfo(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(4096),t=new sd(this._version,e);t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.AppInfo,i,!1,128)}writeFileDepList(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(8),t=new DataView(e.buffer);t.setUint32(0,0,!0),t.setUint32(4,0,!0),this._fileHeaderWriter.addSection(T.FileDepList,e,!1,128)}writeRevHistory(){if(this._fileHeader.AcadVersion<m.AC1018)return;let e=new Uint8Array(12),t=new DataView(e.buffer);t.setUint32(0,0,!0),t.setUint32(4,0,!0),t.setUint32(8,0,!0),this._fileHeaderWriter.addSection(T.RevHistory,e,!0)}writeObjects(){let e=new Uint8Array(0),t=new md(e,this._document,this._encoding,this.Configuration.WriteXRecords,this.Configuration.WriteXData,this.Configuration.WriteShapes);t.OnNotification=(i,s)=>this.triggerNotification(i,s),t.write(),this._handlesMap=t.Map,this._fileHeaderWriter.addSection(T.AcDbObjects,t.getWrittenData(),!0)}writeObjFreeSpace(){let e=new Uint8Array(37),t=new DataView(e.buffer),i=0;t.setInt32(i,0,!0),i+=4,t.setUint32(i,this._handlesMap.size,!0),i+=4;let s=this._version>=m.AC1015?this._document.header.universalUpdateDateTime:this._document.header.updateDateTime,{jdate:n,milliseconds:a}=Z.dateToJulian(s);t.setInt32(i,n,!0),i+=4,t.setInt32(i,a,!0),i+=4,t.setUint32(i,0,!0),i+=4,e[i]=4,i+=1,t.setUint32(i,50,!0),i+=4,t.setUint32(i,0,!0),i+=4,t.setUint32(i,100,!0),i+=4,t.setUint32(i,0,!0),i+=4,this._fileHeaderWriter.addSection(T.ObjFreeSpace,e,!0)}writeTemplate(){let e=new Uint8Array(4),t=new DataView(e.buffer);t.setInt16(0,0,!0),t.setUint16(2,this._document.header.measurementUnits,!0),this._fileHeaderWriter.addSection(T.Template,e,!0)}writeHandles(){let t=new hd(this._version,this._handlesMap).write(this._fileHeaderWriter.HandleSectionOffset);this._fileHeaderWriter.addSection(T.Handles,t,!0)}writeAuxHeader(){let e=new Uint8Array(4096),t=new nd(e,this._encoding,this._document.header);t.write();let i=new Uint8Array(t.writerStream).slice(0,t.bytesWritten);this._fileHeaderWriter.addSection(T.AuxHeader,i,!0)}};var Zh;(function(r){r[r.AcDb_Unknown=0]="AcDb_Unknown",r[r.AcDb_Security=1241646314]="AcDb_Security",r[r.AcDb_FileDepList=1816266186]="AcDb_FileDepList",r[r.AcDb_VBAProject=1483605316]="AcDb_VBAProject",r[r.AcDb_AppInfo=1067451454]="AcDb_AppInfo",r[r.AcDb_Preview=1084884083]="AcDb_Preview",r[r.AcDb_SummaryInfo=1903822351]="AcDb_SummaryInfo",r[r.AcDb_RevHistory=1621231027]="AcDb_RevHistory",r[r.AcDb_AcDbObjects=1733035433]="AcDb_AcDbObjects",r[r.AcDb_ObjFreeSpace=2011301407]="AcDb_ObjFreeSpace",r[r.AcDb_Template=1242825934]="AcDb_Template",r[r.AcDb_Handles=1064174672]="AcDb_Handles",r[r.AcDb_Classes=1062470751]="AcDb_Classes",r[r.AcDb_AuxHeader=1425016074]="AcDb_AuxHeader",r[r.AcDb_Header=850920409]="AcDb_Header",r[r.AcDb_Signature=-1]="AcDb_Signature"})(Zh||(Zh={}));var bd=class{Entities=[];Objects=[]};kr();var eo=class extends En{Configuration;get KeepUnknownEntities(){return this.Configuration.KeepUnknownEntities}get KeepUnknownNonGraphicalObjects(){return this.Configuration.KeepUnknownNonGraphicalObjects}ModelSpaceEntities=new Set;ModelSpaceTemplate=null;OrphanTemplates=[];constructor(e,t,i){super(e,t),this.Configuration=i}BuildDocument(){if(this.ModelSpaceTemplate===null){let e=U.ModelSpace;this.BlockRecords.add(e),this.ModelSpaceTemplate=new br(e),this.AddTemplate(this.ModelSpaceTemplate)}this.createMissingHandles();for(let e of this.ModelSpaceEntities)this.ModelSpaceTemplate.OwnedObjectsHandlers.add(e.handle);this.RegisterTables(),this.BuildTables(),this.buildDictionaries();for(let e of this.OrphanTemplates)this.assignOwner(e);super.BuildDocument(),this.Configuration.CreateDefaults&&this.DocumentToBuild.createDefaults()}BuildEntities(){let e=[];for(let t of this.cadObjectsTemplates.values())t instanceof k&&(t.Build(this),t.SetUnlinkedReferences());for(let t of this.cadObjectsTemplates.values())t instanceof k&&t.CadObject.owner===null&&(t.CadObject.handle=0,e.push(t.CadObject));return e}assignOwner(e){if(e.CadObject.owner!==null||e.CadObject instanceof xe||!e.OwnerHandle)return;let t=this.TryGetObjectTemplate(e.OwnerHandle);if(t){let i=t;i instanceof br&&e.CadObject instanceof A||(i instanceof Kt&&e.CadObject instanceof Ue?i.OwnedObjectsHandlers.add(e.CadObject.handle):i instanceof Kt&&e.CadObject instanceof Le?i.SeqendHandle=e.CadObject.handle:i instanceof xr&&e.CadObject instanceof Dt?i.OwnedObjectsHandlers.add(e.CadObject.handle):i instanceof xr&&e.CadObject instanceof Le?i.SeqendHandle=e.CadObject.handle:this.Notify(`Owner ${i.constructor.name} with handle ${e.OwnerHandle} assignation not implemented for ${e.CadObject.constructor.name} with handle ${e.CadObject.handle}`,g.Warning))}else this.Notify(`Owner ${e.OwnerHandle} not found for ${e.constructor.name} with handle ${e.CadObject.handle}`,g.Warning)}};var gd=class extends kn{ClearCache=!0;CreateDefaults=!1};q();D();var to=class{DxfCode=p.Invalid;GroupCodeValue=_.None;get Code(){return this.DxfCode}Value="";Position=0;ValueRaw="";get ValueAsString(){return String(this.Value).replace(/\^J/g,`
3
3
  `).replace(/\^M/g,"\r").replace(/\^I/g," ").replace(/\^ /g,"^")}get ValueAsBool(){return!!this.Value}get ValueAsShort(){return Number(this.Value)&65535}get ValueAsUShort(){return(Number(this.Value)&65535)>>>0}get ValueAsInt(){return Number(this.Value)|0}get ValueAsLong(){return Number(this.Value)}get ValueAsDouble(){return Number(this.Value)}get ValueAsAngle(){return Q.DegToRad(Number(this.Value))}get ValueAsHandle(){return Number(this.Value)}get ValueAsBinaryChunk(){return this.Value}ReadNext(){this.DxfCode=this.readCode(),this.GroupCodeValue=Be.transformValue(this.Code),this.Value=this.transformValue(this.GroupCodeValue),this.DxfCode===p.Comment&&this.ReadNext()}Find(e){this.Start();do this.ReadNext();while(this.ValueAsString!==e&&this.ValueAsString!==d.EndOfFile);return this.ValueAsString===e}ExpectedCode(e){if(this.ReadNext(),this.Code!==e)throw new si(e,this.Position)}toString(){return`${this.Code} | ${this.Value}`}Start(){this.DxfCode=p.Invalid,this.Value="",this._streamPosition=0,this.Position=0}_streamPosition=0;transformValue(e){switch(e){case _.String:case _.Comment:case _.ExtendedDataString:return this.readStringLine();case _.Point3D:case _.Double:case _.ExtendedDataDouble:return this.lineAsDouble();case _.Byte:case _.Int16:case _.ExtendedDataInt16:return this.lineAsShort();case _.Int32:case _.ExtendedDataInt32:return this.lineAsInt();case _.Int64:return this.lineAsLong();case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:return this.lineAsHandle();case _.Bool:return this.lineAsBool();case _.Chunk:case _.ExtendedDataChunk:return this.lineAsBinaryChunk();case _.None:default:throw new si(e,this.Position)}}};q();var xd=class extends to{get baseStream(){return this._data}_data;_text;_textPos=0;constructor(e){super(),this._data=e,this._text=new TextDecoder("utf-8").decode(e),this.Start()}Start(){super.Start(),this._textPos=0}ReadNext(){super.ReadNext(),this.Position+=2}readStringLine(){let e=this._text.indexOf(`
4
4
  `,this._textPos);e===-1&&(e=this._text.length);let t=this._text.substring(this._textPos,e);return this._textPos=e+1,t.endsWith("\r")&&(t=t.substring(0,t.length-1)),t=t.trim(),this.ValueRaw=t,this.ValueRaw}readCode(){let e=this.readStringLine(),t=parseInt(e,10);return isNaN(t)?(this.Position++,p.Invalid):t}lineAsBool(){let e=this.readStringLine(),t=parseInt(e,10);return isNaN(t)?!1:t>0}lineAsDouble(){let e=this.readStringLine(),t=parseFloat(e);return isNaN(t)?0:t}lineAsShort(){let e=this.readStringLine(),t=parseInt(e,10);return isNaN(t)?0:t}lineAsInt(){let e=this.readStringLine(),t=parseInt(e,10);return isNaN(t)?0:t}lineAsLong(){let e=this.readStringLine(),t=parseInt(e,10);return isNaN(t)?0:t}lineAsHandle(){let e=this.readStringLine(),t=parseInt(e,16);return isNaN(t)?0:t}lineAsBinaryChunk(){let e=this.readStringLine(),t=[];for(let i=0;i<e.length;i+=2){let s=e.substring(i,i+2),n=parseInt(s,16);if(!isNaN(n))t.push(n);else return new Uint8Array(0)}return new Uint8Array(t)}};var ws=class extends to{static Sentinel=`AutoCAD Binary DXF\r
5
5
  \0`;static SentinelBytes=new Uint8Array([65,117,116,111,67,65,68,32,66,105,110,97,114,121,32,68,88,70,13,10,26,0]);get baseStream(){return this._data}_data;_view;_pos=0;constructor(e){super(),this._data=e,this._view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.Start()}Start(){super.Start(),this._pos=0,this._pos=22,this.Position=this._pos}readStringLine(){let e=[];for(;this._pos<this._data.length;){let t=this._data[this._pos++];if(t===0)break;e.push(t)}return this.ValueRaw=String.fromCharCode(...e),this.Position=this._pos,this.ValueRaw}readCode(){let e=this._view.getInt16(this._pos,!0);return this._pos+=2,this.Position=this._pos,e}lineAsBool(){let e=this._data[this._pos++];return this.Position=this._pos,e>0}lineAsDouble(){let e=this._view.getFloat64(this._pos,!0);return this._pos+=8,this.Position=this._pos,e}lineAsShort(){let e=this._view.getInt16(this._pos,!0);return this._pos+=2,this.Position=this._pos,e}lineAsInt(){let e=this._view.getInt32(this._pos,!0);return this._pos+=4,this.Position=this._pos,e}lineAsLong(){let e=this._view.getUint32(this._pos,!0),t=this._view.getInt32(this._pos+4,!0);return this._pos+=8,this.Position=this._pos,t*4294967296+e}lineAsHandle(){let e=this.readStringLine(),t=parseInt(e,16);return isNaN(t)?0:t}lineAsBinaryChunk(){let e=this._data[this._pos++],t=this._data.slice(this._pos,this._pos+e);return this._pos+=e,this.Position=this._pos,t}};var Dd=class extends ws{constructor(e){super(e)}readCode(){let e=this._data[this._pos++];return e===255&&(e=this._view.getInt16(this._pos,!0),this._pos+=2),e}};x();R();var Zs=class r extends k{get Vertex(){return this.CadObject}constructor(e){super(e??new r.VertexPlaceholder)}SetVertexObject(e){e.handle=this.CadObject.handle,e.owner=this.CadObject.owner,e.xDictionary=this.CadObject.xDictionary,e.color=this.CadObject.color,e.lineWeight=this.CadObject.lineWeight,e.lineTypeScale=this.CadObject.lineTypeScale,e.isInvisible=this.CadObject.isInvisible,e.transparency=this.CadObject.transparency;let t=this.CadObject;e.location=t.location,e.startWidth=t.startWidth,e.endWidth=t.endWidth,e.bulge=t.bulge,e.flags=t.flags,e.curveTangent=t.curveTangent,e.id=t.id,this.CadObject=e}};(function(r){class e extends Ue{get objectType(){return u.INVALID}get subclassMarker(){return l.PolylineVertex}}r.VertexPlaceholder=e})(Zs||(Zs={}));q();D();x();var Lr;(function(r){r[r.None=0]="None",r[r.Handle=1]="Handle",r[r.Name=2]="Name",r[r.Count=4]="Count",r[r.Optional=8]="Optional",r[r.Ignored=16]="Ignored",r[r.IsAngle=32]="IsAngle",r[r.Unprocess=64]="Unprocess"})(Lr||(Lr={}));R();wn();var Ji=class{_reader;_builder;lockPointer=!1;currentSubclass=null;constructor(e,t){this._reader=e,this._builder=t}readCommonObjectData(e){if(e!==void 0){for(;this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 0:break;case 5:e.CadObject.handle=this._reader.ValueAsHandle;break;case 102:this.readDefinedGroups(e);break;case 330:e.OwnerHandle=this._reader.ValueAsHandle;break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} at line ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}return}let t={name:null,handle:0,ownerHandle:null,xdictHandle:null,reactors:new Set};for((this._reader.DxfCode===p.Start||this._reader.DxfCode===p.Subclass)&&this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 2:t.name=this._reader.ValueAsString;break;case 5:case 105:t.handle=this._reader.ValueAsHandle;break;case 102:{let i=this.readDefinedGroupsRaw();t.xdictHandle=i.xdictHandle,t.reactors=i.reactors;break}case 330:t.ownerHandle=this._reader.ValueAsHandle;break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} at line ${this._reader.Position}.`);break}this._reader.ReadNext()}return t}readCommonCodes(e,t,i){switch(t.value=!1,this._reader.Code){case 5:e.CadObject.handle=this._reader.ValueAsHandle;break;case 100:this.currentSubclass=this._reader.ValueAsString,i&&!i.subClasses.has(this._reader.ValueAsString)&&this._builder.Notify(`[${e.CadObject.objectName}] Unidentified subclass ${this._reader.ValueAsString}`,g.Warning);break;case 102:this.readDefinedGroups(e);break;case 330:e.OwnerHandle=this._reader.ValueAsHandle;break;case 1001:t.value=!0,this.readExtendedData(e.EDataTemplateByAppName);break;default:this._builder.Notify(`[${this.currentSubclass}] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}`,g.None);break}}readEntity(){switch(this.currentSubclass="",this._reader.ValueAsString){case d.EntityAttribute:return this.readEntityCodes(new Ns(new Dt),this.readAttributeDefinition.bind(this),Dt);case d.EntityAttributeDefinition:return this.readEntityCodes(new Ns(new es),this.readAttributeDefinition.bind(this),es);case d.EntityArc:return this.readEntityCodes(new k(new Ft),this.readArc.bind(this),Ft);case d.EntityBody:return this.readEntityCodes(new k(new ts),this.readEntitySubclassMap.bind(this),ts);case d.EntityCircle:return this.readEntityCodes(new k(new dt),this.readCircle.bind(this),dt);case d.EntityDimension:{let e=this.readEntityCodes(new gr,this.readDimension.bind(this),me);return e.CadObject instanceof Wn?(this._builder.Notify(`[${d.EntityDimension}] No subtype found, object discarded.`,g.Warning),null):e}case d.Entity3DFace:return this.readEntityCodes(new k(new Yr),this.readEntitySubclassMap.bind(this),Yr);case d.EntityEllipse:return this.readEntityCodes(new k(new Ut),this.readEntitySubclassMap.bind(this),Ut);case d.EntityLeader:return this.readEntityCodes(new vn,this.readLeader.bind(this),nr);case d.EntityLine:return this.readEntityCodes(new k(new zt),this.readEntitySubclassMap.bind(this),zt);case d.EntityLwPolyline:return this.readEntityCodes(new k(new qr),this.readLwPolyline.bind(this),qr);case d.EntityMesh:return this.readEntityCodes(new Kn,this.readMesh.bind(this),ar);case d.EntityHatch:return this.readEntityCodes(new Li,this.readHatch.bind(this),Tt);case d.EntityInsert:return this.readEntityCodes(new xr,this.readInsert.bind(this),Ee);case d.EntityMText:return this.readEntityCodes(new Sr(new Ne),this.readTextEntity.bind(this),Ne);case d.EntityMLine:return this.readEntityCodes(new Xn,this.readMLine.bind(this),or);case d.EntityMultiLeader:return this.readEntityCodes(new $n,this.readMLeader.bind(this),lr);case d.EntityPdfUnderlay:return this.readEntityCodes(new ga(new Qr),this.readUnderlayEntity.bind(this),Qr);case d.EntityPoint:return this.readEntityCodes(new k(new Gt),this.readEntitySubclassMap.bind(this),Gt);case d.EntityPolyline:return this.readPolyline();case d.EntityOle2Frame:return this.readEntityCodes(new Jn,this.readOle2Frame.bind(this),dr);case d.EntityRay:return this.readEntityCodes(new k(new ei),this.readEntitySubclassMap.bind(this),ei);case d.EndSequence:return this.readEntityCodes(new k(new Le),this.readEntitySubclassMap.bind(this),Le);case d.EntityTrace:case d.EntitySolid:return this.readEntityCodes(new k(new $t),this.readModelerGeometry.bind(this),$t);case d.EntityTable:return this.readEntityCodes(new ua,this.readTableEntity.bind(this),Ti);case d.EntityText:return this.readEntityCodes(new Sr(new Je),this.readTextEntity.bind(this),Je);case d.EntityTolerance:return this.readEntityCodes(new ta(new Yt),this.readTolerance.bind(this),Yt);case d.EntityVertex:return this.readEntityCodes(new Zs,this.readVertex.bind(this),A);case d.EntityViewport:return this.readEntityCodes(new sa,this.readViewport.bind(this),fr);case d.EntityShape:return this.readEntityCodes(new qn(new ur),this.readShape.bind(this),ur);case d.EntitySpline:return this.readEntityCodes(new ea,this.readSpline.bind(this),mr);case d.Entity3DSolid:return this.readEntityCodes(new Qn,this.readSolid3d.bind(this),ti);case d.EntityRegion:return this.readEntityCodes(new k(new as),this.readModelerGeometry.bind(this),as);case d.EntityImage:return this.readEntityCodes(new mn(new ns),this.readWipeoutBase.bind(this),ns);case d.EntityWipeout:return this.readEntityCodes(new mn(new ls),this.readWipeoutBase.bind(this),ls);case d.EntityXline:return this.readEntityCodes(new k(new ii),this.readEntitySubclassMap.bind(this),ii);default:{let e=Ae.create(A),t=null,i=this._builder.DocumentToBuild.classes.tryGetByName(this._reader.ValueAsString);i?(this._builder.Notify(`Entity not supported read as an UnknownEntity: ${this._reader.ValueAsString}`,g.NotImplemented),t=new ba(new Lt(i))):this._builder.Notify(`Entity not supported: ${this._reader.ValueAsString}`,g.NotImplemented),this._reader.ReadNext();do{if(t!==null&&this._builder.KeepUnknownEntities){let s={value:!1};if(this.readCommonEntityCodes(t,s,e),s.value)continue}this._reader.ReadNext()}while(this._reader.DxfCode!==p.Start);return t}}}readEntityCodes(e,t,i){this._reader.ReadNext();let s=Ae.create(typeof i=="string"?i:i.name);for(;this._reader.DxfCode!==p.Start;){if(!t(e,s)){let n={value:!1};if(this.readCommonEntityCodes(e,n,s),n.value)continue}if(this.lockPointer){this.lockPointer=!1;continue}this._reader.Code!==p.Start&&this._reader.ReadNext()}return e}readCommonEntityCodes(e,t,i){switch(t.value=!1,this._reader.Code){case 6:e.LineTypeName=this._reader.ValueAsString;break;case 8:e.LayerName=this._reader.ValueAsString;break;case 67:break;case 92:case 160:case 310:break;case 347:e.MaterialHandle=this._reader.ValueAsHandle;break;case 430:e.bookColorName=this._reader.ValueAsString;break;default:this.tryAssignCurrentValue(e.CadObject,i.subClasses.get(l.Entity))||this.readCommonCodes(e,t,i);break}}checkObjectEnd(e,t,i){return this._reader.DxfCode===p.Start?!0:i(e,t)}checkEntityEnd(e,t,i,s){return this._reader.DxfCode===p.Start?!0:s(e,t,i)}readCircle(e,t,i){let s=e.CadObject;if(this._reader.Code===40){let n=this._reader.ValueAsDouble;return n<=0?s.radius=Q.Epsilon:s.radius=n,!0}else return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Circle))}readArc(e,t,i){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Arc))?!0:this.readCircle(e,t,l.Circle)}}readAttributeDefinition(e,t,i){let s=t.subClasses.get(e.CadObject.subclassMarker),n=e;switch(this._reader.Code){case 44:case 46:return!0;case 101:{let a=n.CadObject;a.mText=new Ne;let o=new Sr(a.mText);return n.MTextTemplate=o,this.readEntityCodes(o,this.readTextEntity.bind(this),Ne),!0}default:return this.tryAssignCurrentValue(e.CadObject,s)?!0:this.readTextEntity(e,t,l.Text)}}readTableEntity(e,t,i){let s=i||e.CadObject.subclassMarker,n=e,a=n.CadObject;switch(this._reader.Code){case 1:{let o;if(n.CurrentCell.content===null?(o=new cn,o.cadValue.valueType=W.String,n.CurrentCell.contents.push(o)):o=n.CurrentCell.content,o.cadValue.value===null)o.cadValue.setValue(this._reader.ValueAsString,W.String);else{let h=o.cadValue.value;h+=this._reader.ValueAsString,o.cadValue.setValue(h,W.String)}return!0}case 2:{if(this.currentSubclass!==null&&this.currentSubclass.toUpperCase()===l.TableEntity.toUpperCase()){let o=n.CurrentCell.content;if(o.cadValue.value===null)o.cadValue.setValue(this._reader.ValueAsString,W.String);else{let h=o.cadValue.value;h+=this._reader.ValueAsString,o.cadValue.setValue(h,W.String)}}else n.BlockName=this._reader.ValueAsString;return!0}case 177:return!0;case 279:return n.CurrentCell.styleOverride.topBorder.lineWeight=this._reader.ValueAsShort,!0;case 275:return n.CurrentCell.styleOverride.rightBorder.lineWeight=this._reader.ValueAsShort,!0;case 276:return n.CurrentCell.styleOverride.bottomBorder.lineWeight=this._reader.ValueAsShort,!0;case 278:return n.CurrentCell.styleOverride.leftBorder.lineWeight=this._reader.ValueAsShort,!0;case 69:return n.CurrentCell.styleOverride.topBorder.color=new B(this._reader.ValueAsShort),!0;case 65:return n.CurrentCell.styleOverride.rightBorder.color=new B(this._reader.ValueAsShort),!0;case 66:return n.CurrentCell.styleOverride.bottomBorder.color=new B(this._reader.ValueAsShort),!0;case 68:return n.CurrentCell.styleOverride.leftBorder.color=new B(this._reader.ValueAsShort),!0;case 40:return n.HorizontalMargin=this._reader.ValueAsDouble,!0;case 63:return n.CurrentCell.styleOverride.backgroundColor=new B(this._reader.ValueAsShort),!0;case 64:return n.CurrentCell.styleOverride.contentColor=new B(this._reader.ValueAsShort),!0;case 140:return n.CurrentCellTemplate!==null&&(n.CurrentCellTemplate.FormatTextHeight=this._reader.ValueAsDouble),!0;case 283:return n.CurrentCell.styleOverride.isFillColorOn=this._reader.ValueAsBool,!0;case 342:return n.styleHandle=this._reader.ValueAsHandle,!0;case 343:return n.BlockOwnerHandle=this._reader.ValueAsHandle,!0;case 141:{let o=new Ts;return o.height=this._reader.ValueAsDouble,a.rows.push(o),!0}case 142:{let o=new Rs;return o.width=this._reader.ValueAsDouble,a.columns.push(o),!0}case 144:return n.CurrentCellTemplate.FormatTextHeight=this._reader.ValueAsDouble,!0;case 145:return n.CurrentCell.rotation=this._reader.ValueAsDouble,!0;case 170:return!0;case 171:return n.CreateCell(this._reader.ValueAsInt),!0;case 172:return n.CurrentCell.edgeFlags=this._reader.ValueAsShort,!0;case 173:return n.CurrentCell.mergedValue=this._reader.ValueAsShort,!0;case 174:return n.CurrentCell.autoFit=this._reader.ValueAsBool,!0;case 175:return n.CurrentCell.borderWidth=this._reader.ValueAsInt,!0;case 176:return n.CurrentCell.borderHeight=this._reader.ValueAsInt,!0;case 178:return n.CurrentCell.virtualEdgeFlag=this._reader.ValueAsShort,!0;case 179:return!0;case 301:{let o=new cn,h=new fa(o);n.CurrentCell.contents.push(o);let f=this.readCadValue(o.cadValue);return h.CadValueTemplate=f,!0}case 340:return n.CurrentCellTemplate.ValueHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Insert))?!0:this.readEntitySubclassMap(e,t,l.TableEntity)}}readCadValue(e){this._reader.ReadNext();let t=new Fa(e),i=V.Create(e.constructor,"CadValue");for(;this._reader.Code!==304;){switch(this._reader.Code){case 1:e.setValue(this._reader.ValueAsString);break;case 2:e.setValue(e.value+this._reader.ValueAsString);break;case 11:{let s=new c;s.X=this._reader.ValueAsDouble,e.setValue(s);break}case 21:{let s=e.value;s[1]=this._reader.ValueAsDouble,e.setValue(s);break}case 31:{let s=e.value,n=new c(s?.x??0,s?.y??0,this._reader.ValueAsDouble);e.setValue(n);break}case 91:e.setValue(this._reader.ValueAsInt);break;case 140:e.setValue(this._reader.ValueAsDouble);break;case 330:t.ValueHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(e,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCadValue method.`,g.None);break}this._reader.ReadNext()}return t}readTextEntity(e,t,i){let s=i||e.CadObject.subclassMarker,n=e;switch(this._reader.Code){case 1:case 3:return n.CadObject instanceof Ne?(n.CadObject.value+=this._reader.ValueAsString,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s));case 50:if(n.CadObject instanceof Ne){let a=this._reader.ValueAsAngle;return n.CadObject.alignmentPoint=new c(Math.cos(a),Math.sin(a),0),!0}return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s));case 7:return n.StyleName=this._reader.ValueAsString,!0;case 101:return n.CadObject instanceof Ne?(this.readColumnData(n.CadObject),this.lockPointer=!0,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s));default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s))}}readColumnData(e){for(this._reader.ReadNext();this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 70:break;case 71:e.columnData.columnType=this._reader.ValueAsShort;break;case 72:e.columnData.columnCount=this._reader.ValueAsInt;break;case 10:case 20:case 30:case 11:case 21:case 31:case 40:case 41:case 42:case 43:break;case 44:e.columnData.width=this._reader.ValueAsDouble;break;case 45:e.columnData.gutter=this._reader.ValueAsDouble;break;case 46:e.columnData.heights.push(this._reader.ValueAsDouble);break;case 73:e.columnData.autoHeight=this._reader.ValueAsBool;break;case 74:e.columnData.flowReversed=this._reader.ValueAsBool;break;default:this._builder.Notify(`[MText.ColumnData] unknown dxf code ${this._reader.Code}.`,g.None);break}this._reader.ReadNext()}}readTolerance(e,t,i){let s=e;return this._reader.Code===3?(s.DimensionStyleName=this._reader.ValueAsString,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}readDimension(e,t,i){let s=e;switch(this._reader.Code){case 2:return s.BlockName=this._reader.ValueAsString,!0;case 3:return s.StyleName=this._reader.ValueAsString,!0;case 50:{let n=new Qe;return s.SetDimensionObject(n),n.rotation=this._reader.ValueAsAngle,t.subClasses.has(l.LinearDimension)||t.subClasses.set(l.LinearDimension,V.Create(Qe)),!0}case 70:{if(s.SetDimensionFlags(this._reader.ValueAsShort),s.CadObject instanceof Wn&&this._builder.Version<m.AC1012)switch(s.CadObject.flags){case v.Linear:s.SetDimensionObject(new Qe),t.subClasses.set(l.AlignedDimension,V.Create(je)),t.subClasses.set(l.LinearDimension,V.Create(Qe));break;case v.Aligned:s.SetDimensionObject(new je),t.subClasses.set(l.AlignedDimension,V.Create(je));break;case v.Angular:s.SetDimensionObject(new St),t.subClasses.set(l.Angular2LineDimension,V.Create(St));break;case v.Diameter:s.SetDimensionObject(new Bt),t.subClasses.set(l.DiametricDimension,V.Create(Bt));break;case v.Radius:s.SetDimensionObject(new Rt),t.subClasses.set(l.RadialDimension,V.Create(Rt));break;case v.Angular3Point:s.SetDimensionObject(new Ct),t.subClasses.set(l.Angular3PointDimension,V.Create(Ct));break;case v.Ordinate:case v.OrdinateTypeX:case v.Ordinate|v.OrdinateTypeX:s.SetDimensionObject(new yt),t.subClasses.set(l.OrdinateDimension,V.Create(yt));break;case v.BlockReference:case v.TextUserDefinedLocation:default:break}return!0}case 42:return!0;case 73:case 74:case 75:case 90:case 361:return!0;case 100:switch(this._reader.ValueAsString){case l.Dimension:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Dimension));case l.AlignedDimension:return s.SetDimensionObject(new je),t.subClasses.set(this._reader.ValueAsString,V.Create(je)),!0;case l.DiametricDimension:return s.SetDimensionObject(new Bt),t.subClasses.set(this._reader.ValueAsString,V.Create(Bt)),!0;case l.Angular2LineDimension:return s.SetDimensionObject(new St),t.subClasses.set(this._reader.ValueAsString,V.Create(St)),!0;case l.Angular3PointDimension:return s.SetDimensionObject(new Ct),t.subClasses.set(this._reader.ValueAsString,V.Create(Ct)),!0;case l.RadialDimension:return s.SetDimensionObject(new Rt),t.subClasses.set(this._reader.ValueAsString,V.Create(Rt)),!0;case l.OrdinateDimension:return s.SetDimensionObject(new yt),t.subClasses.set(this._reader.ValueAsString,V.Create(yt)),!0;case l.LinearDimension:return!0;default:return!1}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readHatch(e,t,i){let s=e,n=s.CadObject,a=new C;switch(this._reader.Code){case 2:return n.pattern.name=this._reader.ValueAsString,!0;case 10:return a.X=this._reader.ValueAsDouble,n.seedPoints.push(a),!0;case 20:return a=n.seedPoints[n.seedPoints.length-1],a.Y=this._reader.ValueAsDouble,n.seedPoints[n.seedPoints.length-1]=a,!0;case 30:return n.elevation=this._reader.ValueAsDouble,!0;case 53:return n.patternAngle=this._reader.ValueAsAngle,!0;case 90:return!0;case 75:return!0;case 78:return this.readPattern(n.pattern,this._reader.ValueAsInt),this.lockPointer=!0,!0;case 91:return this.readLoops(s,this._reader.ValueAsInt),this.lockPointer=!0,!0;case 98:return!0;case 450:return n.gradientColor.enabled=this._reader.ValueAsBool,!0;case 451:return n.gradientColor.reserved=this._reader.ValueAsInt,!0;case 452:return n.gradientColor.isSingleColorGradient=this._reader.ValueAsBool,!0;case 453:return!0;case 460:return n.gradientColor.angle=this._reader.ValueAsDouble,!0;case 461:return n.gradientColor.shift=this._reader.ValueAsDouble,!0;case 462:return n.gradientColor.colorTint=this._reader.ValueAsDouble,!0;case 463:{let o=new Sn;return o.value=this._reader.ValueAsDouble,n.gradientColor.colors.push(o),!0}case 63:{let o=n.gradientColor.colors[n.gradientColor.colors.length-1];return o&&(o.color=new B(this._reader.ValueAsUShort)),!0}case 421:return!0;case 470:return n.gradientColor.name=this._reader.ValueAsString,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}}readInsert(e,t,i){let s=e;switch(this._reader.Code){case 2:return s.BlockName=this._reader.ValueAsString,!0;case 100:return!0;case 66:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Insert))}}readPolyline(){if(this._builder.Version===m.Unknown||this._builder.Version===m.AC1009)return this.readLegacyPolyline();let e=new Kt;if(this.readEntityCodes(e,this.readPolylineCodes.bind(this),A),e.CadObject.objectType===u.INVALID)return this._builder.Notify(`[${d.EntityPolyline}] Subclass not found, entity discarded`,g.Warning),null;for(;this._reader.Code===0&&this._reader.ValueAsString===d.EntityVertex;){let t=this.readEntityCodes(new Zs,this.readVertex.bind(this),A);t.OwnerHandle===null&&(t.OwnerHandle=e.CadObject.handle),e.OwnedObjectsHandlers.add(t.CadObject.handle),this._builder.AddTemplate(t)}for(;this._reader.Code===0&&this._reader.ValueAsString===d.EndSequence;){let t=new Le,i=new k(t);this.readEntityCodes(i,this.readEntitySubclassMap.bind(this),Le),i.OwnerHandle===null&&(i.OwnerHandle=e.CadObject.handle),e.OwnedObjectsHandlers.add(i.CadObject.handle),this._builder.AddTemplate(i)}return e}readLegacyPolyline(){let e=new et,t=new Kt(e);for(this.readEntityCodes(t,this.readPolylineCodes.bind(this),et);this._reader.Code===0&&this._reader.ValueAsString===d.EntityVertex;){let i=new Xt,s=new Zs(i);this.readEntityCodes(s,this.readVertex.bind(this),Xt),s.Vertex.handle===0?e.vertices.push(i):(t.OwnedObjectsHandlers.add(s.Vertex.handle),this._builder.AddTemplate(s))}for(;this._reader.Code===0&&this._reader.ValueAsString===d.EndSequence;){let i=new Le,s=new k(i);this.readEntityCodes(s,this.readEntitySubclassMap.bind(this),Le),e.vertices.Seqend=i}return t}readPolylineCodes(e,t,i){let s=e;switch(this._reader.Code){case 10:case 20:case 66:return!0;case 100:switch(this._reader.ValueAsString){case l.Polyline:return s.SetPolyLineObject(new et),t.subClasses.set(l.Polyline,V.Create(et)),!0;case l.Polyline3d:return s.SetPolyLineObject(new tt),t.subClasses.set(l.Polyline3d,V.Create(tt)),!0;case l.PolyfaceMesh:return s.SetPolyLineObject(new ut),t.subClasses.set(l.PolyfaceMesh,V.Create(ut)),!0;case l.PolygonMesh:return s.SetPolyLineObject(new Et),t.subClasses.set(l.PolygonMesh,V.Create(Et)),!0;default:return!1}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readLeader(e,t,i){let s=e;switch(this._reader.Code){case 3:return s.DIMSTYLEName=this._reader.ValueAsString,!0;case 10:return s.CadObject.vertices.push(new c(this._reader.ValueAsDouble,0,0)),!0;case 20:{let n=s.CadObject.vertices[s.CadObject.vertices.length-1];return n.y=this._reader.ValueAsDouble,s.CadObject.vertices[s.CadObject.vertices.length-1]=n,!0}case 30:{let n=s.CadObject.vertices[s.CadObject.vertices.length-1];return n.z=this._reader.ValueAsDouble,s.CadObject.vertices[s.CadObject.vertices.length-1]=n,!0}case 340:return s.AnnotationHandle=this._reader.ValueAsHandle,!0;case 75:case 76:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readLwPolyline(e,t,i){let s=e,n=s.CadObject,a=n.vertices[n.vertices.length-1]??null;switch(this._reader.Code){case 10:return n.vertices.push(new Ci(new C(this._reader.ValueAsDouble,0))),!0;case 20:return a!==null&&(a.location=new C(a.location.x,this._reader.ValueAsDouble)),!0;case 40:return a!==null&&(a.startWidth=this._reader.ValueAsDouble),!0;case 41:return a!==null&&(a.endWidth=this._reader.ValueAsDouble),!0;case 42:return a!==null&&(a.bulge=this._reader.ValueAsDouble),!0;case 50:return a!==null&&(a.curveTangent=this._reader.ValueAsDouble),!0;case 66:case 90:return!0;case 91:return a!==null&&(a.id=this._reader.ValueAsInt),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readMesh(e,t,i){let s=e;switch(this._reader.Code){case 100:return this._reader.ValueAsString.toUpperCase()===l.Mesh.toUpperCase()&&(s.SubclassMarker=!0),!0;case 90:return!0;case 92:{if(!s.SubclassMarker)return!1;let n=this._reader.ValueAsInt;for(let a=0;a<n;a++){this._reader.ReadNext();let o=this._reader.ValueAsDouble;this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext();let f=this._reader.ValueAsDouble;s.CadObject.vertices.push(new c(o,h,f))}return!0}case 93:{let n=this._reader.ValueAsInt;this._reader.ReadNext();let a=0;for(let o=0;o<n;o+=a+1){a=this._reader.ValueAsInt,this._reader.ReadNext();let h=new Array(a);for(let f=0;f<a;f++)h[f]=this._reader.ValueAsInt,o+f+2<n&&this._reader.ReadNext();s.CadObject.faces.push(h)}return!0}case 94:{let n=this._reader.ValueAsInt;this._reader.ReadNext();for(let a=0;a<n;a++){let o=new ln(0,0);o.start=this._reader.ValueAsInt,this._reader.ReadNext(),o.end=this._reader.ValueAsInt,a<n-1&&this._reader.ReadNext(),s.CadObject.edges.push(o)}return!0}case 95:{this._reader.ReadNext();for(let n=0;n<s.CadObject.edges.length;n++){let a=s.CadObject.edges[n];a.crease=this._reader.ValueAsDouble,s.CadObject.edges[n]=a,n<s.CadObject.edges.length-1&&this._reader.ReadNext()}return!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readMLine(e,t,i){let s=e;switch(this._reader.Code){case 2:return s.MLineStyleName=this._reader.ValueAsString,!0;case 72:return s.NVertex=this._reader.ValueAsInt,!0;case 73:return s.NElements=this._reader.ValueAsInt,!0;case 340:return s.MLineStyleHandle=this._reader.ValueAsHandle,!0;default:return s.TryReadVertex(this._reader.Code,this._reader.Value)?!0:this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readMLeader(e,t,i){let s=e;switch(this._reader.Code){case 270:return!0;case 300:return this.readMultiLeaderObjectContextData(s.CadMLeaderAnnotContextTemplate),!0;case 340:return s.LeaderStyleHandle=this._reader.ValueAsHandle,!0;case 341:return s.LeaderLineTypeHandle=this._reader.ValueAsHandle,!0;case 343:return s.MTextStyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readMultiLeaderObjectContextData(e){this._reader.ReadNext();let t=V.Create(Dr),i=e.CadObject,s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 301:this._reader.ValueAsString==="}"&&(s=!0);break;case 302:this._reader.ValueAsString==="LEADER{"&&i.leaderRoots.push(this.readMultiLeaderLeader(e));break;case 340:e.TextStyleHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(i,t)||this._builder.Notify(`[AcDbMLeaderObjectContextData] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}`,g.None);break}if(s)break;this._reader.ReadNext()}}readMultiLeaderLeader(e){let t=new Gn,i=V.Create(t.constructor,"LeaderRoot");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 303:this._reader.ValueAsString==="}"&&(s=!0);break;case 304:if(this._reader.ValueAsString==="LEADER_LINE{"){let n=new ai.LeaderLineTemplate;e.leaderLineTemplates.push(n),t.lines.push(this.readMultiLeaderLine(n))}break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`[LeaderRoot] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}`,g.None);break}if(s)break;this._reader.ReadNext()}return t}readMultiLeaderLine(e){let t=e.LeaderLine,i=V.Create(t.constructor,"LeaderLine");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 10:{let n=new c(this._reader.ValueAsDouble,0,0);t.points.push(n);break}case 20:{let n=t.points[t.points.length-1];n.Y=this._reader.ValueAsDouble,t.points[t.points.length-1]=n;break}case 30:{let n=t.points[t.points.length-1];n.Z=this._reader.ValueAsDouble,t.points[t.points.length-1]=n;break}case 305:this._reader.ValueAsString==="}"&&(s=!0);break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`[LeaderLine] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}`,g.None);break}if(s)break;this._reader.ReadNext()}return t}readShape(e,t,i){let s=e;return this._reader.Code===2?(s.ShapeFileName=this._reader.ValueAsString,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}readWipeoutBase(e,t,i){let s=e,n=s.CadObject;switch(this._reader.Code){case 91:{let a=this._reader.ValueAsInt;for(let o=0;o<a;o++){this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext();let f=this._reader.ValueAsDouble;n.clipBoundaryVertices.push(new C(h,f))}return this._reader.ReadNext(),this.checkEntityEnd(e,t,i,this.readWipeoutBase.bind(this))}case 340:return s.ImgDefHandle=this._reader.ValueAsHandle,!0;case 360:return s.ImgReactorHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readOle2Frame(e,t,i){let s=e;switch(this._reader.Code){case 1:case 90:case 73:return!0;case 310:return s.Chunks.push(this._reader.ValueAsBinaryChunk),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readModelerGeometry(e,t,i){let s=e,n=i||e.CadObject.subclassMarker,a=e.CadObject;switch(this._reader.Code){case 1:case 3:return a.proprietaryData+=this._reader.ValueAsString+`
6
- `,!0;case 2:return a.guid=this._reader.ValueAsString,!0;case 290:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(n))}}readSolid3d(e,t,i){let s=e;return this._reader.Code===350?(s.HistoryHandle=this._reader.ValueAsHandle,!0):this.readModelerGeometry(e,t,l.ModelerGeometry)}readSpline(e,t,i){let s=e,n,a;switch(this._reader.Code){case 10:return n=new c(this._reader.ValueAsDouble,0,0),s.CadObject.controlPoints.push(n),!0;case 20:return n=s.CadObject.controlPoints[s.CadObject.controlPoints.length-1],n.Y=this._reader.ValueAsDouble,s.CadObject.controlPoints[s.CadObject.controlPoints.length-1]=n,!0;case 30:return n=s.CadObject.controlPoints[s.CadObject.controlPoints.length-1],n.Z=this._reader.ValueAsDouble,s.CadObject.controlPoints[s.CadObject.controlPoints.length-1]=n,!0;case 11:return a=new c(this._reader.ValueAsDouble,0,0),s.CadObject.fitPoints.push(a),!0;case 21:return a=s.CadObject.fitPoints[s.CadObject.fitPoints.length-1],a.Y=this._reader.ValueAsDouble,s.CadObject.fitPoints[s.CadObject.fitPoints.length-1]=a,!0;case 31:return a=s.CadObject.fitPoints[s.CadObject.fitPoints.length-1],a.Z=this._reader.ValueAsDouble,s.CadObject.fitPoints[s.CadObject.fitPoints.length-1]=a,!0;case 40:return s.CadObject.knots.push(this._reader.ValueAsDouble),!0;case 41:return s.CadObject.weights.push(this._reader.ValueAsDouble),!0;case 72:case 73:case 74:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readUnderlayEntity(e,t,i){let s=e;return this._reader.Code===340?(s.DefinitionHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}readVertex(e,t,i){let s=e;switch(this._reader.Code){case 100:switch(this._reader.ValueAsString){case l.Vertex:return!0;case l.PolylineVertex:return s.SetVertexObject(new Xt),t.subClasses.set(l.PolylineVertex,V.Create(Xt)),!0;case l.Polyline3dVertex:return s.SetVertexObject(new cr),t.subClasses.set(l.Polyline3dVertex,V.Create(cr)),!0;case l.PolyfaceMeshVertex:return s.SetVertexObject(new ri),t.subClasses.set(l.PolyfaceMeshVertex,V.Create(ri)),!0;case l.PolyfaceMeshFace:return s.SetVertexObject(new Zt),t.subClasses.set(l.PolyfaceMeshFace,V.Create(Zt)),!0;case l.PolygonMeshVertex:return s.SetVertexObject(new ss),t.subClasses.set(l.PolygonMeshVertex,V.Create(ss)),!0;default:return!1}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readViewport(e,t,i){let s=e;switch(this._reader.Code){case 67:case 68:return!0;case 69:return s.ViewportId=this._reader.ValueAsShort,!0;case 331:return s.FrozenLayerHandles.add(this._reader.ValueAsHandle),!0;case 348:return s.VisualStyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Viewport))}}readEntitySubclassMap(e,t,i){let s=i||e.CadObject.subclassMarker;switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s))}}readExtendedData(e){let t=[];for(e.set(this._reader.ValueAsString,t),this._reader.ReadNext();this._reader.DxfCode>=p.ExtendedDataAsciiString;){if(this._reader.DxfCode===p.ExtendedDataRegAppName){this.readExtendedData(e);break}let i=null,s=0,n=0,a=0;switch(this._reader.DxfCode){case p.ExtendedDataAsciiString:i=new Hi(this._reader.ValueAsString);break;case p.ExtendedDataControlString:i=new Pe(this._reader.ValueAsString==="}");break;case p.ExtendedDataLayerName:{let o=this._builder.Layers.get(this._reader.ValueAsString);o?i=new va(o.handle):this._builder.Notify(`[XData] Could not found the linked Layer ${this._reader.ValueAsString}.`,g.Warning);break}case p.ExtendedDataBinaryChunk:i=new Fi(this._reader.ValueAsBinaryChunk);break;case p.ExtendedDataHandle:i=new za(this._reader.ValueAsHandle);break;case p.ExtendedDataXCoordinate:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Gi(new c(s,n,a));break;case p.ExtendedDataWorldXCoordinate:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Ki(new c(s,n,a));break;case p.ExtendedDataWorldXDisp:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Ui(new c(s,n,a));break;case p.ExtendedDataWorldXDir:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new $i(new c(s,n,a));break;case p.ExtendedDataReal:i=new Zi(this._reader.ValueAsDouble);break;case p.ExtendedDataDist:i=new vi(this._reader.ValueAsDouble);break;case p.ExtendedDataScale:i=new zi(this._reader.ValueAsDouble);break;case p.ExtendedDataInteger16:i=new Yi(this._reader.ValueAsShort);break;case p.ExtendedDataInteger32:i=new Xi(this._reader.ValueAsInt);break;default:this._builder.Notify(`Unknown code for extended data: ${this._reader.DxfCode}`,g.Warning);break}i!==null&&t.push(i),this._reader.ReadNext()}}readPattern(e,t){this._reader.ReadNext();for(let i=0;i<t;i++){let s=new Cn,n=new C,a=new C,o=!1,h=new Set;for(;!o&&!h.has(this._reader.Code);){switch(h.add(this._reader.Code),this._reader.Code){case 53:s.angle=this._reader.ValueAsAngle;break;case 43:n.X=this._reader.ValueAsDouble;break;case 44:n.Y=this._reader.ValueAsDouble,s.basePoint=n;break;case 45:a.X=this._reader.ValueAsDouble,s.offset=a;break;case 46:a.Y=this._reader.ValueAsDouble,s.offset=a;break;case 79:{let f=this._reader.ValueAsInt;for(let b=0;b<f;b++)this._reader.ReadNext(),s.dashLengths.push(this._reader.ValueAsDouble);break}case 49:s.dashLengths.push(this._reader.ValueAsDouble);break;default:o=!0;break}this._reader.ReadNext()}e.lines.push(s)}}readLoops(e,t){this._reader.Code===91&&this._reader.ReadNext();for(let i=0;i<t;i++){if(this._reader.Code!==92){this._builder.Notify(`Boundary path should start with code 92 but was ${this._reader.Code}`);break}let s=this.readLoop();s!==null&&e.PathTemplates.push(s)}}readLoop(){let e=new Li.CadBoundaryPathTemplate,t=this._reader.ValueAsInt;if(e.Path.flags=t,(t&qe.Polyline)!==0){let s=this.readPolylineBoundary();s&&e.Path.edges.push(s)}else{if(this._reader.ReadNext(),this._reader.Code!==93)return this._builder.Notify(`Edge Boundary path should start with code 93 but was ${this._reader.Code}`),null;let s=this._reader.ValueAsInt;this._reader.ReadNext();for(let n=0;n<s;n++){let a=this.readEdge();a!==null&&e.Path.edges.push(a)}}let i=!1;for(;!i;){switch(this._reader.Code){case 97:break;case 330:e.Handles.add(this._reader.ValueAsHandle);break;default:i=!0;continue}this._reader.ReadNext()}return e}readPolylineBoundary(){let e=new is;if(this._reader.ReadNext(),this._reader.Code!==72)return this._builder.Notify(`Polyline Boundary path should start with code 72 but was ${this._reader.Code}`),null;let t=!1,i=!1;for(;!t;){switch(this._reader.Code){case 72:i=this._reader.ValueAsBool;break;case 73:e.isClosed=this._reader.ValueAsBool;break;case 93:{let s=this._reader.ValueAsInt;this._reader.ReadNext();for(let n=0;n<s;n++){let a=0,o=this._reader.ValueAsDouble;this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext(),i&&(a=this._reader.ValueAsDouble,this._reader.ReadNext()),e.vertices.push(new c(o,h,a))}continue}default:t=!0;continue}this._reader.ReadNext()}return e}readEdge(){if(this._reader.Code!==72)return this._builder.Notify(`Edge Boundary path should define the type with code 72 but was ${this._reader.Code}`),null;let e=this._reader.ValueAsInt;switch(this._reader.ReadNext(),e){case sr.Line:{let t=new Kr;for(;;){switch(this._reader.Code){case 10:t.start=new C(this._reader.ValueAsDouble,t.start.Y);break;case 20:t.start=new C(t.start.X,this._reader.ValueAsDouble);break;case 11:t.end=new C(this._reader.ValueAsDouble,t.end.Y);break;case 21:t.end=new C(t.end.X,this._reader.ValueAsDouble);break;default:return t}this._reader.ReadNext()}}case sr.CircularArc:{let t=new Xr;for(;;){switch(this._reader.Code){case 10:t.center=new C(this._reader.ValueAsDouble,t.center.Y);break;case 20:t.center=new C(t.center.X,this._reader.ValueAsDouble);break;case 40:t.radius=this._reader.ValueAsDouble;break;case 50:t.startAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 51:t.endAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 73:t.counterClockWise=this._reader.ValueAsBool;break;default:return t}this._reader.ReadNext()}}case sr.EllipticArc:{let t=new Zr;for(;;){switch(this._reader.Code){case 10:t.center=new C(this._reader.ValueAsDouble,t.center.Y);break;case 20:t.center=new C(t.center.X,this._reader.ValueAsDouble);break;case 11:t.majorAxisEndPoint=new C(this._reader.ValueAsDouble,t.center.Y);break;case 21:t.majorAxisEndPoint=new C(t.center.X,this._reader.ValueAsDouble);break;case 40:t.minorToMajorRatio=this._reader.ValueAsDouble;break;case 50:t.startAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 51:t.endAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 73:t.counterClockWise=this._reader.ValueAsBool;break;default:return t}this._reader.ReadNext()}}case sr.Spline:{let t=new Jr,i=0,s=0,n=0,a=new c,o=new C;for(;;){switch(this._reader.Code){case 10:a=new c(this._reader.ValueAsDouble,0,1);break;case 20:a=new c(a.X,this._reader.ValueAsDouble,a.Z),t.controlPoints.push(a);break;case 11:o=new C(this._reader.ValueAsDouble,0);break;case 21:o=new C(o.X,this._reader.ValueAsDouble),t.fitPoints.push(o);break;case 42:{let h=t.controlPoints[t.controlPoints.length-1];t.controlPoints[t.controlPoints.length-1]=new c(h.X,h.Y,this._reader.ValueAsDouble);break}case 12:t.startTangent=new C(this._reader.ValueAsDouble,t.startTangent.Y);break;case 22:t.startTangent=new C(t.startTangent.X,this._reader.ValueAsDouble);break;case 13:t.endTangent=new C(this._reader.ValueAsDouble,t.endTangent.Y);break;case 23:t.endTangent=new C(t.endTangent.X,this._reader.ValueAsDouble);break;case 94:t.degree=this._reader.ValueAsInt;break;case 73:t.isRational=this._reader.ValueAsBool;break;case 74:t.isPeriodic=this._reader.ValueAsBool;break;case 95:i=this._reader.ValueAsInt;break;case 96:s=this._reader.ValueAsInt;break;case 97:n=this._reader.ValueAsInt;break;case 40:t.knots.push(this._reader.ValueAsDouble);break;default:return t}this._reader.ReadNext()}}}return null}readDefinedGroups(e){if(e!==void 0){let{xdictHandle:t,reactors:i}=this.readDefinedGroupsRaw();t!==null&&(e.XDictHandle=t),i.forEach(s=>e.ReactorsHandles.add(s))}}readDefinedGroupsRaw(){let e=null,t=new Set;switch(this._reader.ValueAsString){case d.DictionaryToken:return this._reader.ReadNext(),e=this._reader.ValueAsHandle,this._reader.ReadNext(),{xdictHandle:e,reactors:t};case d.ReactorsToken:t=this.readReactors();break;case d.BlkRefToken:default:do this._reader.ReadNext();while(this._reader.DxfCode!==p.ControlString);return{xdictHandle:e,reactors:t}}return{xdictHandle:e,reactors:t}}readReactors(){let e=new Set;for(this._reader.ReadNext();this._reader.DxfCode!==p.ControlString;)e.add(this._reader.ValueAsHandle),this._reader.ReadNext();return e}tryAssignCurrentValue(e,t){if(t instanceof Ae){if(!this.currentSubclass)return!1;let i=t.subClasses.get(this.currentSubclass);return i?this.tryAssignCurrentValue(e,i):!1}try{let i=t.dxfProperties.get(this._reader.Code);if(i){if((i.referenceType&Lr.Count)!==0)return!0;if((i.referenceType&Lr.Handle)!==0||(i.referenceType&Lr.Name)!==0)return!1;let s=this._reader.Value;return(i.referenceType&Lr.IsAngle)!==0&&(s=Q.DegToRad(s)),i.setValue(this._reader.Code,e,s),!0}}catch(i){if(this._builder.Configuration.Failsafe)this._builder.Notify("An error occurred while assigning a property using mapper",g.Error,i);else throw i}return!1}};q();D();x();var Sd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){if(this._reader.ValueAsString===d.TableEntry)this.readTable();else throw new si(`Unexpected token at the beginning of a table: ${this._reader.ValueAsString}`,this._reader.Position);if(this._reader.ValueAsString===d.EndTable)this._reader.ReadNext();else throw new si(`Unexpected token at the end of a table: ${this._reader.ValueAsString}`,this._reader.Position)}}readTable(){this._reader.ReadNext();let e=0,t=null,i=new Map,s=this.readCommonObjectData(),{name:n,handle:a,ownerHandle:o,xdictHandle:h,reactors:f}=s;if(this._reader.DxfCode===p.Subclass)for(;this._reader.Code!==p.Start;){switch(this._reader.Code){case 70:e=this._reader.ValueAsInt;break;case 100:if(this._reader.ValueAsString===l.DimensionStyleTable){for(;this._reader.Code!==p.Start;)this._reader.ReadNext();break}break;case 1001:this.readExtendedData(i);break;default:this._builder.Notify(`[AcDbSymbolTable] Unhandled dxf code ${this._reader.Code} at line ${this._reader.Position}.`);break}if(this._reader.Code===p.Start)break;this._reader.ReadNext()}else{if(this._reader.ValueAsString===d.EndTable)return;this._reader.ReadNext()}switch(n){case d.TableAppId:t=new st(new Vr),this.readEntries(t),t.CadObject.handle=a,this._builder.AppIds=t.CadObject;break;case d.TableBlockRecord:t=new Mn(new Ir),this.readEntries(t),t.CadObject.handle=a,this._builder.BlockRecords=t.CadObject;break;case d.TableVport:t=new st(new zr),this.readEntries(t),t.CadObject.handle=a,this._builder.VPorts=t.CadObject;break;case d.TableLinetype:t=new st(new Wr),this.readEntries(t),t.CadObject.handle=a,this._builder.LineTypesTable=t.CadObject;break;case d.TableLayer:t=new st(new Mr),this.readEntries(t),t.CadObject.handle=a,this._builder.Layers=t.CadObject;break;case d.TableStyle:t=new st(new Hr),this.readEntries(t),t.CadObject.handle=a,this._builder.TextStyles=t.CadObject;break;case d.TableView:t=new st(new Ur),this.readEntries(t),t.CadObject.handle=a,this._builder.Views=t.CadObject;break;case d.TableUcs:t=new st(new Fr),this.readEntries(t),t.CadObject.handle=a,this._builder.UCSs=t.CadObject;break;case d.TableDimstyle:t=new st(new Wt),this.readEntries(t),t.CadObject.handle=a,this._builder.DimensionStyles=t.CadObject;break;default:throw new si(`Unknown table name ${n}`)}t.OwnerHandle=o??null,t.XDictHandle=h,t.ReactorsHandles=f,t.EDataTemplateByAppName=i,this._builder.AddTemplate(t)}readEntries(e){for(;this._reader.ValueAsString!==d.EndTable;){this._reader.ReadNext();let t=null;switch(e.CadObject.objectName){case d.TableAppId:t=this.readTableEntry(new fe(new gt),this.readAppId.bind(this));break;case d.TableBlockRecord:{let i=new br;t=this.readTableEntry(i,this.readBlockRecord.bind(this)),i.CadObject.name.toUpperCase()===U.ModelSpaceName.toUpperCase()&&(this._builder.ModelSpaceTemplate=i);break}case d.TableDimstyle:t=this.readTableEntry(new Hn,this.readDimensionStyle.bind(this));break;case d.TableLayer:t=this.readTableEntry(new Fn,this.readLayer.bind(this));break;case d.TableLinetype:t=this.readTableEntry(new ki,this.readLineType.bind(this));break;case d.TableStyle:t=this.readTableEntry(new fe(new te),this.readTextStyle.bind(this));break;case d.TableUcs:t=this.readTableEntry(new ra,this.readUcs.bind(this));break;case d.TableView:t=this.readTableEntry(new ia,this.readView.bind(this));break;case d.TableVport:t=this.readTableEntry(new na,this.readVPort.bind(this));break;default:break}t!==null&&(e.CadObject.contains(t.Name)&&this._builder.Configuration.Failsafe&&(this._builder.Notify(`Duplicated entry with name ${t.Name} found in ${t.CadObject.objectName}`,g.Warning),e.CadObject.remove(t.Name)),e.CadObject.add(t.CadObject),this._builder.AddTemplate(t))}}readTableEntry(e,t){let i=Ae.create(e.CadObject.constructor);for(;this._reader.DxfCode!==p.Start;){if(!t(e,i.subClasses.get(e.CadObject.SubclassMarker))){let s={value:!1};if(this.readCommonTableEntryCodes(e,s,i),s.value)continue}this._reader.Code!==p.Start&&this._reader.ReadNext()}return e}readCommonTableEntryCodes(e,t,i){switch(t.value=!1,this._reader.Code){case 2:e.CadObject.Name=this._reader.ValueAsString;break;case 70:e.CadObject.Flags=this._reader.ValueAsUShort;break;case 100:break;default:this.readCommonCodes(e,t,i);break}}readAppId(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)}}readBlockRecord(e,t){let i=e;return this._reader.Code===340?(i.LayoutHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t)}readDimensionStyle(e,t){let i=e;switch(this._reader.Code){case 3:return e.CadObject.PostFix=this._reader.ValueAsString,!0;case 4:return e.CadObject.AlternateDimensioningSuffix=this._reader.ValueAsString,!0;case 5:return i.DIMBL_Name=this._reader.ValueAsString,!0;case 6:return i.DIMBLK1_Name=this._reader.ValueAsString,!0;case 7:return i.DIMBLK2_Name=this._reader.ValueAsString,!0;case 40:try{e.CadObject.ScaleFactor=this._reader.ValueAsDouble}catch(s){e.CadObject.ScaleFactor=Q.Epsilon,this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for ScaleFactor.`,g.Warning,s)}return!0;case 41:try{e.CadObject.ArrowSize=this._reader.ValueAsDouble}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for ArrowSize.`,g.Warning,s)}return!0;case 42:return e.CadObject.ExtensionLineOffset=this._reader.ValueAsDouble,!0;case 43:return e.CadObject.DimensionLineIncrement=this._reader.ValueAsDouble,!0;case 44:return e.CadObject.ExtensionLineExtension=this._reader.ValueAsDouble,!0;case 45:return e.CadObject.Rounding=this._reader.ValueAsDouble,!0;case 46:return e.CadObject.DimensionLineExtension=this._reader.ValueAsDouble,!0;case 47:return e.CadObject.PlusTolerance=this._reader.ValueAsDouble,!0;case 48:return e.CadObject.MinusTolerance=this._reader.ValueAsDouble,!0;case 49:return e.CadObject.FixedExtensionLineLength=this._reader.ValueAsDouble,!0;case 50:try{e.CadObject.JoggedRadiusDimensionTransverseSegmentAngle=this._reader.ValueAsAngle}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for JoggedRadiusDimensionTransverseSegmentAngle.`,g.Warning,s)}return!0;case 69:return e.CadObject.TextBackgroundFillMode=this._reader.ValueAsShort,!0;case 70:if(i.DxfFlagsAssigned)this._reader.ValueAsShort>=0&&(e.CadObject.TextBackgroundColor=new B(this._reader.ValueAsShort));else return i.DxfFlagsAssigned=!0,!0;return!0;case 71:return e.CadObject.GenerateTolerances=this._reader.ValueAsBool,!0;case 72:return e.CadObject.LimitsGeneration=this._reader.ValueAsBool,!0;case 73:return e.CadObject.TextInsideHorizontal=this._reader.ValueAsBool,!0;case 74:return e.CadObject.TextOutsideHorizontal=this._reader.ValueAsBool,!0;case 75:return e.CadObject.SuppressFirstExtensionLine=this._reader.ValueAsBool,!0;case 76:return e.CadObject.SuppressSecondExtensionLine=this._reader.ValueAsBool,!0;case 77:return e.CadObject.TextVerticalAlignment=this._reader.ValueAsShort,!0;case 78:return e.CadObject.ZeroHandling=this._reader.ValueAsShort,!0;case 79:return e.CadObject.AngularZeroHandling=this._reader.ValueAsShort,!0;case 90:return e.CadObject.ArcLengthSymbolPosition=this._reader.ValueAsShort,!0;case 105:return e.CadObject.Handle=this._reader.ValueAsHandle,!0;case 140:try{e.CadObject.TextHeight=this._reader.ValueAsDouble}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for TextHeight.`,g.Warning,s)}return!0;case 141:return e.CadObject.CenterMarkSize=this._reader.ValueAsDouble,!0;case 142:return e.CadObject.TickSize=this._reader.ValueAsDouble,!0;case 143:return e.CadObject.AlternateUnitScaleFactor=this._reader.ValueAsDouble,!0;case 144:return e.CadObject.LinearScaleFactor=this._reader.ValueAsDouble,!0;case 145:return e.CadObject.TextVerticalPosition=this._reader.ValueAsDouble,!0;case 146:return e.CadObject.ToleranceScaleFactor=this._reader.ValueAsDouble,!0;case 147:return e.CadObject.DimensionLineGap=this._reader.ValueAsDouble,!0;case 148:return e.CadObject.AlternateUnitRounding=this._reader.ValueAsDouble,!0;case 170:return e.CadObject.AlternateUnitDimensioning=this._reader.ValueAsBool,!0;case 171:return e.CadObject.AlternateUnitDecimalPlaces=this._reader.ValueAsShort,!0;case 172:return e.CadObject.TextOutsideExtensions=this._reader.ValueAsBool,!0;case 173:return e.CadObject.SeparateArrowBlocks=this._reader.ValueAsBool,!0;case 174:return e.CadObject.TextInsideExtensions=this._reader.ValueAsBool,!0;case 175:return e.CadObject.SuppressOutsideExtensions=this._reader.ValueAsBool,!0;case 176:return e.CadObject.DimensionLineColor=new B(this._reader.ValueAsShort),!0;case 177:return e.CadObject.ExtensionLineColor=new B(this._reader.ValueAsShort),!0;case 178:return e.CadObject.TextColor=new B(this._reader.ValueAsShort),!0;case 179:return e.CadObject.AngularDecimalPlaces=this._reader.ValueAsShort,!0;case 270:return e.CadObject.LinearUnitFormat=this._reader.ValueAsShort,!0;case 271:return e.CadObject.DecimalPlaces=this._reader.ValueAsShort,!0;case 272:return e.CadObject.ToleranceDecimalPlaces=this._reader.ValueAsShort,!0;case 273:return e.CadObject.AlternateUnitFormat=this._reader.ValueAsShort,!0;case 274:return e.CadObject.AlternateUnitToleranceDecimalPlaces=this._reader.ValueAsShort,!0;case 275:return e.CadObject.AngularUnit=this._reader.ValueAsShort,!0;case 276:return e.CadObject.FractionFormat=this._reader.ValueAsShort,!0;case 277:return e.CadObject.LinearUnitFormat=this._reader.ValueAsShort,!0;case 278:return e.CadObject.DecimalSeparator=String.fromCharCode(this._reader.ValueAsShort),!0;case 279:return e.CadObject.TextMovement=this._reader.ValueAsShort,!0;case 280:return e.CadObject.TextHorizontalAlignment=this._reader.ValueAsShort,!0;case 281:return e.CadObject.SuppressFirstDimensionLine=this._reader.ValueAsBool,!0;case 282:return e.CadObject.SuppressSecondDimensionLine=this._reader.ValueAsBool,!0;case 283:return e.CadObject.ToleranceAlignment=this._reader.ValueAsShort,!0;case 284:return e.CadObject.ToleranceZeroHandling=this._reader.ValueAsShort,!0;case 285:return e.CadObject.AlternateUnitZeroHandling=this._reader.ValueAsShort,!0;case 286:return e.CadObject.AlternateUnitToleranceZeroHandling=this._reader.ValueAsShort,!0;case 287:return e.CadObject.DimensionFit=this._reader.ValueAsShort,!0;case 288:return e.CadObject.CursorUpdate=this._reader.ValueAsBool,!0;case 289:return e.CadObject.DimensionTextArrowFit=this._reader.ValueAsShort,!0;case 290:return e.CadObject.IsExtensionLineLengthFixed=this._reader.ValueAsBool,!0;case 340:return i.TextStyleHandle=this._reader.ValueAsHandle,!0;case 341:return i.DIMLDRBLK=this._reader.ValueAsHandle,!0;case 342:return i.DIMBLK=this._reader.ValueAsHandle,!0;case 343:return i.DIMBLK1=this._reader.ValueAsHandle,!0;case 344:return i.DIMBLK2=this._reader.ValueAsHandle,!0;case 345:return i.Dimltype=this._reader.ValueAsHandle,!0;case 346:return i.Dimltex1=this._reader.ValueAsHandle,!0;case 347:return i.Dimltex2=this._reader.ValueAsHandle,!0;case 371:return e.CadObject.DimensionLineWeight=this._reader.ValueAsShort,!0;case 372:return e.CadObject.ExtensionLineWeight=this._reader.ValueAsShort,!0;default:return!1}}readLayer(e,t){let i=e;switch(this._reader.Code){case 6:return i.LineTypeName=this._reader.ValueAsString,!0;case 62:{let s=this._reader.ValueAsShort;s<0&&(e.CadObject.IsOn=!1,s=Math.abs(s));let n=new B(s);return n.isByBlock||n.isByLayer?this._builder.Notify(`Wrong index ${s} for layer ${e.CadObject.Name}`,g.Warning):e.CadObject.Color=new B(s),!0}case 347:return i.MaterialHandle=this._reader.ValueAsHandle,!0;case 348:return!0;case 390:return e.CadObject.PlotStyleName=this._reader.ValueAsHandle,!0;case 430:return i.TrueColorName=this._reader.ValueAsString,!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}readLineType(e,t){let i=e;switch(this._reader.Code){case 40:return i.TotalLen=this._reader.ValueAsDouble,!0;case 49:do i.SegmentTemplates.push(this.readLineTypeSegment());while(this._reader.Code===49);return!0;case 73:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}readLineTypeSegment(){let e=new ki.SegmentTemplate;for(e.Segment.length=this._reader.ValueAsDouble,this._reader.ReadNext();this._reader.Code!==49&&this._reader.Code!==0;){switch(this._reader.Code){case 9:e.Segment.text=this._reader.ValueAsString;break;case 44:e.Segment.offset=new C(this._reader.ValueAsDouble,e.Segment.offset.y);break;case 45:e.Segment.offset=new C(e.Segment.offset.x,this._reader.ValueAsDouble);break;case 46:e.Segment.scale=this._reader.ValueAsDouble;break;case 50:e.Segment.rotation=this._reader.ValueAsAngle;break;case 74:e.Segment.shapeFlags=this._reader.ValueAsUShort;break;case 75:e.Segment.shapeNumber=this._reader.ValueAsInt;break;case 340:break;default:this._builder.Notify(`[LineTypeSegment] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}, position ${this._reader.Position}`,g.None);break}this._reader.ReadNext()}return e}readTextStyle(e,t){return this._reader.Code===2?(this._reader.ValueAsString&&(e.CadObject.Name=this._reader.ValueAsString),!0):this.tryAssignCurrentValue(e.CadObject,t)}readUcs(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)}}readView(e,t){let i=e;return this._reader.Code===348?(i.VisualStyleHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t)}readVPort(e,t){let i=e;switch(this._reader.Code){case 65:case 73:return!0;case 348:return i.StyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}};q();D();x();var Cd=class extends k{OwnedObjectsHandlers=new Set;constructor(e){super(e)}};var Bd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;)try{if(this._reader.ValueAsString===d.Block)this.readBlock();else throw new si(`Unexpected token at the BLOCKS table: ${this._reader.ValueAsString}`,this._reader.Position)}catch(e){if(!this._builder.Configuration.Failsafe)throw e;for(this._builder.Notify(`Error while reading a block at line ${this._reader.Position}`,g.Error,e instanceof Error?e:void 0);!(this._reader.DxfCode===p.Start&&this._reader.ValueAsString===d.EndSection)&&!(this._reader.DxfCode===p.Start&&this._reader.ValueAsString===d.Block);)this._reader.ReadNext()}}readBlock(){this._reader.ReadNext();let e=Ae.create(Pr),t=new Pr,i=new Cd(t),s=null,n=null,a=null;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 2:case 3:s=this._reader.ValueAsString,s.toUpperCase()==="$MODEL_SPACE"?s=U.ModelSpaceName:s.toUpperCase()==="$PAPER_SPACE"&&(s=U.PaperSpaceName),n===null&&(n=this._builder.TryGetTableEntry(s),n?n.blockEntity=t:this._builder.Notify(`Block record [${s}] not found at line ${this._reader.Position}`,g.Warning));break;case 330:n===null&&(n=this._builder.TryGetCadObject(this._reader.ValueAsHandle),n?n.blockEntity=t:this._builder.Notify(`Block record with handle [${this._reader.ValueAsString}] not found at line ${this._reader.Position}`,g.Warning));break;default:if(!this.tryAssignCurrentValue(i.CadObject,e.subClasses.get(l.BlockBegin))){let o={value:!1};if(this.readCommonEntityCodes(i,o,e),o.value)continue}break}this._reader.ReadNext()}for(n===null?(n=new U(s??""),n.blockEntity=t,a=new br(n),this._builder.AddTemplate(a),this._builder.BlockRecords.add(n),a.CadObject.name.toUpperCase()===U.ModelSpaceName.toUpperCase()&&(this._builder.ModelSpaceTemplate=a)):(a=this._builder.TryGetObjectTemplate(n.handle),a||(a=new br(n))),a.BlockEntityTemplate=i;this._reader.ValueAsString!==d.EndBlock;){let o=null;try{o=this.readEntity()}catch(h){if(!this._builder.Configuration.Failsafe)throw h;for(this._builder.Notify(`Error while reading a block with name ${n.name} at line ${this._reader.Position}`,g.Error,h instanceof Error?h:void 0);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}if(o!==null)if(this._builder.AddTemplate(o),o.OwnerHandle===null)a.ReferenceTemplates.add(o);else{let h=this._builder.TryGetObjectTemplate(o.OwnerHandle);h?h.OwnedObjectsHandlers.add(o.CadObject.handle):this._builder.OrphanTemplates.push(o)}}this.readBlockEnd(n.blockEnd),this._builder.AddTemplate(i)}readBlockEnd(e){let t=Ae.create(gs),i=new k(e);for(this._reader.DxfCode===p.Start&&this._reader.ReadNext();this._reader.DxfCode!==p.Start;){if(!this.tryAssignCurrentValue(i.CadObject,t.subClasses.get(l.BlockEnd))){let s={value:!1};if(this.readCommonEntityCodes(i,s,t),s.value)continue}this._reader.ReadNext()}this._builder.AddTemplate(i)}};q();D();var yd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let e=null;try{e=this.readEntity()}catch(i){if(!this._builder.Configuration.Failsafe)throw i;for(this._builder.Notify(`Error while reading an entity at line ${this._reader.Position}`,g.Error,i instanceof Error?i:void 0);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}if(e===null)continue;this._builder.AddTemplate(e);let t=this._builder.TryGetObjectTemplate(e.OwnerHandle);e.OwnerHandle===null?this._builder.ModelSpaceEntities.add(e.CadObject):t?t.OwnedObjectsHandlers.add(e.CadObject.handle):this._builder.OrphanTemplates.push(e)}}};Te();D();x();R();J();x();var dh=class extends O{get subclassMarker(){return l.LinkedData}description=""},hh=class extends dh{get subclassMarker(){return l.LinkedTableData}rows=[];columns=[]},Rd=class extends hh{get subclassMarker(){return l.FormattedTableData}mergedCellRanges=[];cellStyleOverride={}};var qo=class extends Rd{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectTableContent}get subclassMarker(){return l.TableContent}style=null;styleOverride=null};var Td=class extends G{SytleHandle=0;constructor(e){super(e??new qo)}};var Ad=class extends K{HasFrontPlane=!1;InsertTransformRead=!1;constructor(e){super(e??new qt)}};var Ed=class extends Pt{Entries=[];constructor(e){super(e??new Er)}};kr();q();D();x();var Ld=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let e=null;try{e=this.readObject()}catch(t){if(!this._builder.Configuration.Failsafe)throw t;for(this._builder.Notify(`Error while reading an object at line ${this._reader.Position}`,g.Error,t);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}e!==null&&this._builder.AddTemplate(e)}}readObject(){switch(this.currentSubclass="",this._reader.ValueAsString){case d.BlkRefObjectContextData:return this.readObjectCodes(new ms(new mi),this.readAnnotScaleObjectContextData.bind(this),mi);case d.MTextAttributeObjectContextData:return this.readObjectCodes(new ms(new ps),this.readAnnotScaleObjectContextData.bind(this),ps);case d.ObjectPlaceholder:return this.readObjectCodes(new K(new ci),this.readObjectSubclassMap.bind(this),ci);case d.ObjectDBColor:return this.readObjectCodes(new K(new ui),this.readBookColor.bind(this),ui);case d.ObjectDimensionAssociation:return this.readObjectCodes(new Ii,this.readDimensionAssociation.bind(this),Xe);case d.ObjectDictionary:return this.readObjectCodes(new Vs,this.readDictionary.bind(this),xe);case d.ObjectDictionaryWithDefault:return this.readObjectCodes(new aa,this.readDictionaryWithDefault.bind(this),Cr);case d.ObjectLayout:return this.readObjectCodes(new Un,this.readLayout.bind(this),nt);case d.ObjectPlotSettings:return this.readObjectCodes(new K(new pt),this.readPlotSettings.bind(this),pt);case d.ObjectEvalGraph:return this.readObjectCodes(new Mi,this.readEvaluationGraph.bind(this),yr);case d.ObjectImageDefinition:return this.readObjectCodes(new K(new Tr),this.readObjectSubclassMap.bind(this),Tr);case d.ObjectDictionaryVar:return this.readObjectCodes(new K(new He),this.readObjectSubclassMap.bind(this),He);case d.ObjectPdfDefinition:return this.readObjectCodes(new K(new hi),this.readObjectSubclassMap.bind(this),hi);case d.ObjectSortEntsTable:return this.readSortentsTable();case d.ObjectImageDefinitionReactor:return this.readObjectCodes(new K(new li),this.readObjectSubclassMap.bind(this),li);case d.ObjectProxyObject:return this.readObjectCodes(new Ed,this.readProxyObject.bind(this),Er);case d.ObjectRasterVariables:return this.readObjectCodes(new K(new Ar),this.readObjectSubclassMap.bind(this),Ar);case d.ObjectGroup:return this.readObjectCodes(new ha,this.readGroup.bind(this),Ot);case d.ObjectGeoData:return this.readObjectCodes(new da,this.readGeoData.bind(this),Jt);case d.ObjectMaterial:return this.readObjectCodes(new Zn,this.readMaterial.bind(this),at);case d.ObjectScale:return this.readObjectCodes(new K(new Ge),this.readScale.bind(this),Ge);case d.ObjectTableContent:return this.readObjectCodes(new Td,this.readTableContent.bind(this),qo);case d.ObjectVisualStyle:return this.readObjectCodes(new K(new di),this.readVisualStyle.bind(this),di);case d.ObjectSpatialFilter:return this.readObjectCodes(new Ad,this.readSpatialFilter.bind(this),qt);case d.ObjectMLineStyle:return this.readObjectCodes(new Pi,this.readMLineStyle.bind(this),wt);case d.ObjectMLeaderStyle:return this.readObjectCodes(new Yn,this.readMLeaderStyle.bind(this),$e);case d.ObjectTableStyle:return this.readObjectCodes(new pa,this.readTableStyle.bind(this),Ye);case d.ObjectXRecord:return this.readObjectCodes(new wa,this.readXRecord.bind(this),_t);case d.ObjectBlockRepresentationData:return this.readObjectCodes(new Pa,this.readBlockRepresentationData.bind(this),Rr);case d.ObjectBlockGripLocationComponent:return this.readObjectCodes(new Ma,this.readBlockGripExpression.bind(this),zs);case d.ObjectBlockVisibilityGrip:return this.readObjectCodes(new Ia,this.readBlockVisibilityGrip.bind(this),Va);case d.ObjectBlockVisibilityParameter:return this.readObjectCodes(new Wi,this.readBlockVisibilityParameter.bind(this),Fs);case d.ObjectBlockRotationParameter:return this.readObjectCodes(new Ta,this.readBlockRotationParameter.bind(this),Hs);case d.ObjectBlockRotationGrip:return this.readObjectCodes(new Na,this.readBlockRotationGrip.bind(this),Oa);case d.ObjectBlockRotateAction:return this.readObjectCodes(new ka,this.readBlockRotationAction.bind(this),Us);case d.ObjectField:return this.readObjectCodes(new Wa(new fi),this.readField.bind(this),fi);case d.ObjectFieldList:return this.readObjectCodes(new Ha(new pi),this.readFieldList.bind(this),pi);default:{let e=Ae.create(I),t=null,i=this._builder.DocumentToBuild.classes.tryGetByName(this._reader.ValueAsString);i?(this._builder.Notify(`NonGraphicalObject not supported read as an UnknownNonGraphicalObject: ${this._reader.ValueAsString}`,g.NotImplemented),t=new _a(new pr(i))):this._builder.Notify(`UnknownNonGraphicalObject not supported: ${this._reader.ValueAsString}`,g.NotImplemented),this._reader.ReadNext();do{if(t!==null&&this._builder.KeepUnknownEntities){let s={value:!1};if(this.readCommonCodes(t,s,e),s.value)continue}this._reader.ReadNext()}while(this._reader.DxfCode!==p.Start);return t}}}readObjectCodes(e,t,i){this._reader.ReadNext();let s=Ae.create(typeof i=="string"?i:i.name);for(;this._reader.DxfCode!==p.Start;){if(!t(e,s)){let n={value:!1};if(this.readCommonCodes(e,n,s),n.value)continue}if(this.lockPointer){this.lockPointer=!1;continue}this._reader.Code!==p.Start&&this._reader.ReadNext()}return e}readFieldList(e,t){let i=e;switch(this._reader.Code){case 100:return this._reader.ValueAsString===l.IdSet?(this.currentSubclass=this._reader.ValueAsString,!0):!1;case 90:return this.currentSubclass===l.IdSet;case 330:return this.currentSubclass===l.IdSet?(i.OwnedObjectsHandlers.add(this._reader.ValueAsHandle),!0):!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.FieldList))}}readField(e,t){let i=e;switch(this._reader.Code){case 3:return i.CadObject.fieldCode+=this._reader.ValueAsString,!0;case 98:return!0;case 6:{let s=this._reader.ValueAsString,n=this.readCadValue(new Ht);return i.CadObject.values.set(s,n.CadValue),i.CadValueTemplates.push(n),!0}case 7:{let s=this.readCadValue(new Ht);return i.CadObject.value=s.CadValue,i.CadValueTemplates.push(s),!0}case 331:return i.CadObjectsHandles.push(this._reader.ValueAsHandle),!0;case 360:return i.ChildrenHandles.push(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Field))}}readProxyObject(e,t){let i=e,s=e.CadObject;switch(this._reader.Code){case 90:case 94:case 97:case 71:return!0;case 95:{let n=this._reader.ValueAsInt;return s.version=n&65535,s.maintenanceVersion=n>>16,!0}case 91:{let n=this._reader.ValueAsShort,a=this._builder.DocumentToBuild.classes.tryGetByClassNumber(n);return a&&(s.dxfClass=a),!0}case 161:case 162:return!0;case 310:return s.binaryData===null&&(s.binaryData=new Uint8Array(0)),s.binaryData=this.appendBinaryChunk(s.binaryData,this._reader.ValueAsBinaryChunk),!0;case 311:return s.data===null&&(s.data=new Uint8Array(0)),s.data=this.appendBinaryChunk(s.data,this._reader.ValueAsBinaryChunk),!0;case 330:case 340:case 350:case 360:return i.Entries.push(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.ProxyObject))}}readObjectSubclassMap(e,t){switch(this._reader.Code){default:return this.currentSubclass?this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(this.currentSubclass)):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}}readAnnotScaleObjectContextData(e,t){let i=e;return this._reader.Code===340?(i.scaleHandle=this._reader.ValueAsHandle,!0):this.currentSubclass?this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(this.currentSubclass)):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}readPlotSettings(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.PlotSettings))}}readEvaluationGraph(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 91:for(;this._reader.Code===91;){let n=new Mi.GraphNodeTemplate,a=n.Node;a.index=this._reader.ValueAsInt,this._reader.ExpectedCode(93),a.flags=this._reader.ValueAsInt,this._reader.ExpectedCode(95),a.nextNodeIndex=this._reader.ValueAsInt,this._reader.ExpectedCode(360),n.ExpressionHandle=this._reader.ValueAsHandle,this._reader.ExpectedCode(92),a.data1=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data2=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data3=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data4=this._reader.ValueAsInt,this._reader.ReadNext(),i.NodeTemplates.push(n)}return this.lockPointer=!0,!0;case 92:for(;this._reader.Code===92;)this._reader.ExpectedCode(93),this._reader.ExpectedCode(94),this._reader.ExpectedCode(91),this._reader.ExpectedCode(91),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ReadNext();return this.lockPointer=!0,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.EvalGraph))}}readLayout(e,t){let i=e;switch(this._reader.Code){case 330:return e.OwnerHandle!==null?(i.PaperSpaceBlockHandle=this._reader.ValueAsHandle,!0):!1;case 331:return i.LasActiveViewportHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Layout))?!0:this.readPlotSettings(e,t)}}readGroup(e,t){let i=e;switch(this._reader.Code){case 70:return!0;case 340:return i.Handles.add(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}}readGeoData(e,t){let i=e;switch(this._reader.Code){case 40:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(i.CadObject.referencePoint.x,this._reader.ValueAsDouble,i.CadObject.referencePoint.z),!0):!1;case 41:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(this._reader.ValueAsDouble,i.CadObject.referencePoint.y,i.CadObject.referencePoint.z),!0):!1;case 42:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(i.CadObject.referencePoint.x,i.CadObject.referencePoint.y,this._reader.ValueAsDouble),!0):!1;case 46:return i.CadObject.version===We.R2009?(i.CadObject.horizontalUnitScale=this._reader.ValueAsDouble,!0):!1;case 52:if(i.CadObject.version===We.R2009){let s=Math.PI/2-this._reader.ValueAsAngle;return i.CadObject.northDirection=new C(Math.cos(s),Math.sin(s)),!0}return!1;case 93:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++){this._reader.ReadNext();let a=this._reader.ValueAsDouble;this._reader.ReadNext();let o=this._reader.ValueAsDouble;this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext();let f=this._reader.ValueAsDouble,b=new la;b.source=new C(a,o),b.destination=new C(h,f),i.CadObject.points.push(b)}return!0}case 96:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++){this._reader.ReadNext();let a=this._reader.ValueAsInt;this._reader.ReadNext();let o=this._reader.ValueAsInt;this._reader.ReadNext();let h=this._reader.ValueAsInt,f=new oa;f.index1=a,f.index2=o,f.index3=h,i.CadObject.faces.push(f)}return!0}case 303:return i.CadObject.coordinateSystemDefinition+=this._reader.ValueAsString,!0;case 3:case 4:case 14:case 24:case 15:case 25:case 43:case 44:case 45:case 94:case 293:case 16:case 26:case 17:case 27:case 54:case 140:case 304:case 292:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readMaterial(e,t){let i=e,s=(n,a)=>{let o=[];for(let h=0;h<16;h++)o.push(this._reader.ValueAsDouble),this._reader.ReadNext();return a(o),this.checkObjectEnd(e,t,this.readMaterial.bind(this))};switch(this._reader.Code){case 43:return s(43,n=>i.CadObject.diffuseMatrix=n);case 47:return s(47,n=>i.CadObject.specularMatrix=n);case 49:return s(49,n=>i.CadObject.reflectionMatrix=n);case 142:return s(142,n=>i.CadObject.opacityMatrix=n);case 144:return s(144,n=>i.CadObject.bumpMatrix=n);case 147:return s(147,n=>i.CadObject.refractionMatrix=n);default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readScale(e,t){return this._reader.Code===70?!0:this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Scale))}readLinkedData(e,t){let s=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){default:this.tryAssignCurrentValue(s,t.subClasses.get(l.LinkedData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedData ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readTableContent(e,t){return this._reader.Code===100?this._reader.ValueAsString.toUpperCase()===l.TableContent.toUpperCase()?(this.readTableContentSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.FormattedTableData.toUpperCase()?(this.readFormattedTableDataSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.LinkedTableData.toUpperCase()?(this.readLinkedTableDataSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.LinkedData.toUpperCase()?(this.readLinkedData(e,t),this.lockPointer=!0,!0):!1:!1}readTableContentSubclass(e,t){let i=e,s=i.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;)this._reader.Code===340?i.SytleHandle=this._reader.ValueAsHandle:this.tryAssignCurrentValue(s,t.subClasses.get(l.TableContent))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableContentSubclass ${this._reader.Position}.`,g.None),this._reader.ReadNext()}readFormattedTableDataSubclass(e,t){let s=e.CadObject;this._reader.ReadNext();let n=null;for(;this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 90:break;case 91:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.topRowIndex=this._reader.ValueAsInt;break;case 92:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.leftColumnIndex=this._reader.ValueAsInt;break;case 93:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.bottomRowIndex=this._reader.ValueAsInt;break;case 94:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.rightColumnIndex=this._reader.ValueAsInt,n=null;break;case 300:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT"&&this.readStyleOverride(new jt(s.cellStyleOverride));break;default:this.tryAssignCurrentValue(s,t.subClasses.get(l.FormattedTableData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableDataSubclass ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readLinkedTableDataSubclass(e,t){let s=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 90:case 91:case 92:break;case 300:this._reader.ValueAsString.toUpperCase()===d.ObjectTableColumn.toUpperCase()&&this.readTableColumn();break;case 301:this._reader.ValueAsString.toUpperCase()===d.ObjectTableRow.toUpperCase()&&this.readTableRow();break;default:this.tryAssignCurrentValue(s,t.subClasses.get(l.LinkedTableData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableDataSubclass ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readTableColumn(){this._reader.ReadNext();let e=new Rs,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_BEGIN.toUpperCase()?this.readLinkedTableColumn(e):this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataColumn_BEGIN.toUpperCase()?this.readFormattedTableColumn(e):this._reader.ValueAsString.toUpperCase()===d.ObjectTableColumnBegin.toUpperCase()&&(this.readTableColumnData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableColumn method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableRow(){this._reader.ReadNext();let e=new Ts,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_BEGIN.toUpperCase()?this.readLinkedTableRow(e):this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataRow_BEGIN.toUpperCase()?this.readFormattedTableRow(e):this._reader.ValueAsString.toUpperCase()===d.ObjectTableRowBegin.toUpperCase()&&(this.readTableRowData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableRow method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableRowData(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 40:e.height=this._reader.ValueAsDouble;break;case 90:break;case 309:t=this._reader.ValueAsString.toUpperCase()==="TABLEROW_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableRowData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readFormattedTableRow(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:break;case 1:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"&&this.readStyleOverride(new jt(e.cellStyleOverride));break;case 309:t=this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATAROW_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableRow method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readTableColumnData(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()==="TABLECOLUMN_BEGIN")break;t=!0;break;case 40:e.width=this._reader.ValueAsDouble;break;case 90:break;case 309:t=this._reader.ValueAsString.toUpperCase()==="TABLECOLUMN_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableColumnData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readLinkedTableColumn(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_BEGIN.toUpperCase())break;t=!0;break;case 91:e.customData=this._reader.ValueAsInt;break;case 300:e.name=this._reader.ValueAsString;break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableColumn method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readLinkedTableRow(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_BEGIN.toUpperCase())break;break;case 90:break;case 91:e.customData=this._reader.ValueAsInt;break;case 300:this._reader.ValueAsString.toUpperCase()===d.ObjectCell.toUpperCase()&&this.readCell();break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableRow method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readCell(){this._reader.ReadNext();let e=new ys,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()==="LINKEDTABLEDATACELL_BEGIN"?this.readLinkedTableCell(e):this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATACELL_BEGIN"?this.readFormattedTableCell(e):this._reader.ValueAsString.toUpperCase()==="TABLECELL_BEGIN"&&(this.readTableCellData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCell method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableCellData(e){let t=V.Create(e.constructor,"TABLECELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 40:case 41:break;case 309:i=this._reader.ValueAsString.toUpperCase()==="TABLECELL_END";break;case 330:break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableCellData ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readFormattedTableCell(e){let t=V.Create(e.constructor,"FORMATTEDTABLEDATACELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:if(this._reader.ValueAsString.toUpperCase()==="CELLTABLEFORMAT"){this.readCellTableFormat(e);continue}break;case 309:i=this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATACELL_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableCell ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readCellTableFormat(e){let t=V.Create(e.constructor,"CELLTABLEFORMAT");this._reader.ReadNext();let i=!1;for(;this._reader.Code===1&&(this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"?this.readStyleOverride(new jt(e.styleOverride)):this._reader.ValueAsString.toUpperCase()==="CELLSTYLE_BEGIN"?this.readCellStyle(new jt):this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellTableFormat ${this._reader.Position}.`,g.None),!i);)this._reader.ReadNext()}readCellStyle(e){this._reader.ReadNext();let t=!1;for(;this._reader.Code!==1&&(this._reader.Code===309?t=this._reader.ValueAsString.toUpperCase()==="CELLSTYLE_END":this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellStyle ${this._reader.Position}.`,g.None),!t);)this._reader.ReadNext()}readLinkedTableCell(e){let t=V.Create(e.constructor,"LINKEDTABLEDATACELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 95:break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 302:this._reader.ValueAsString.toUpperCase()==="CONTENT"&&this.readLinkedTableCellContent();break;case 309:i=this._reader.ValueAsString.toUpperCase()==="LINKEDTABLEDATACELL_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableCell ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readLinkedTableCellContent(){let e=new cn,t=new fa(e),i=V.Create(e.constructor,"CONTENT");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start&&(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()==="FORMATTEDCELLCONTENT_BEGIN"?(this.readFormattedCellContent(),s=!0):this._reader.ValueAsString.toUpperCase()==="CELLCONTENT_BEGIN"&&this.readCellContent(t):this.tryAssignCurrentValue(e,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableCellContent ${this._reader.Position}.`,g.None),!s);)this._reader.ReadNext();return t}readCellContent(e){let t=e.Content,i=V.Create(t.constructor,"CELLCONTENT_BEGIN");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 91:break;case 300:if(this._reader.ValueAsString.toUpperCase()==="VALUE"){let n=this.readCadValue(t.cadValue);e.CadValueTemplate=n}break;case 309:s=this._reader.ValueAsString.toUpperCase()==="CELLCONTENT_END";break;case 340:e.BlockRecordHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellContent ${this._reader.Position}.`,g.None);break}if(s)break;this._reader.ReadNext()}}readFormattedCellContent(){let e=new Bs,t=new ma(e),i=V.Create(e.constructor,"FORMATTEDCELLCONTENT");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT"&&this.readContentFormat(t);break;case 309:s=this._reader.ValueAsString.toUpperCase()==="FORMATTEDCELLCONTENT_END";break;default:this.tryAssignCurrentValue(e,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedCellContent method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readContentFormat(e){let t=e.Format,i=V.Create(t.constructor,"CONTENTFORMAT_BEGIN");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT_BEGIN")break;break;case 309:s=this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT_END";break;case 340:e.TextStyleHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readContentFormat method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readFormattedTableColumn(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:break;case 1:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"&&this.readStyleOverride(new jt(e.cellStyleOverride));break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataColumn_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableColumn method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readStyleOverride(e){let t=e.Format,i=V.Create(t.constructor,"TABLEFORMAT_STYLE"),s=V.Create(Bs,"TABLEFORMAT_BEGIN");this._reader.ReadNext();let n=!1,a=yi.Unknown;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 95:a=this._reader.ValueAsInt;break;case 1:break;case 300:this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT"&&this.readContentFormat(new ma(new Bs));break;case 301:this._reader.ValueAsString.toUpperCase()==="MARGIN"&&this.readCellMargin(e);break;case 302:if(this._reader.ValueAsString.toUpperCase()==="GRIDFORMAT"){let o=new Ri(a);this.readGridFormat(e,o)}break;case 309:n=this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_END";break;default:!this.tryAssignCurrentValue(t,i)&&!this.tryAssignCurrentValue(t,s)&&this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readStyleOverride method.`,g.None);break}if(n)break;this._reader.ReadNext()}}readGridFormat(e,t){let i=V.Create(t.constructor,"CellBorder");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 62:t.color=new B(this._reader.ValueAsShort);break;case 92:t.lineWeight=this._reader.ValueAsInt;break;case 93:t.isInvisible=this._reader.ValueAsBool;break;case 340:e.BorderLinetypePairs.push([t,this._reader.ValueAsHandle]);break;case 309:s=this._reader.ValueAsString.toUpperCase()==="GRIDFORMAT_END";break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readGridFormat method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readCellMargin(e){let t=e.Format;this._reader.ReadNext();let i=!1,s=0;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 40:switch(s){case 0:t.verticalMargin=this._reader.ValueAsDouble;break;case 1:t.horizontalMargin=this._reader.ValueAsDouble;break;case 2:t.bottomMargin=this._reader.ValueAsDouble;break;case 3:t.rightMargin=this._reader.ValueAsDouble;break;case 4:t.marginHorizontalSpacing=this._reader.ValueAsDouble;break;case 5:t.marginVerticalSpacing=this._reader.ValueAsDouble;break}s++;break;case 309:i=this._reader.ValueAsString.toUpperCase()==="CELLMARGIN_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellMargin method.`,g.None);break}if(i)break;this._reader.ReadNext()}}readCustomData(){this._reader.ReadNext();let e=0,t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 90:e=this._reader.ValueAsInt;break;case 300:break;case 301:this._reader.ValueAsString.toUpperCase()==="DATAMAP_VALUE"&&this.readDataMapValue();break;case 309:t=this._reader.ValueAsString.toUpperCase()==="DATAMAP_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCustomData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readDataMapValue(){let e=new Ht,t=V.Create(e.constructor,"DATAMAP_VALUE");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 11:case 21:case 31:case 91:case 92:case 140:case 310:break;case 304:i=this._reader.ValueAsString.toUpperCase()==="ACVALUE_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readDataMapValue method.`,g.None);break}if(i)break;this._reader.ReadNext()}}readVisualStyle(e,t){switch(this._reader.Code){case 176:case 177:case 420:return!0;default:return!0}}readSpatialFilter(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 10:return s.boundaryPoints.push(new C(this._reader.ValueAsDouble,0)),!0;case 20:{let n=s.boundaryPoints[s.boundaryPoints.length-1];return s.boundaryPoints.push(new C(n.x,this._reader.ValueAsDouble)),!0}case 40:{s.clipFrontPlane&&!i.HasFrontPlane&&(s.frontDistance=this._reader.ValueAsDouble,i.HasFrontPlane=!0);let n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];for(let a=0;a<12;a++)n[a]=this._reader.ValueAsDouble,a<11&&this._reader.ReadNext();return i.InsertTransformRead?(s.insertTransform=new it(n),i.InsertTransformRead=!0):s.inverseInsertTransform=new it(n),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.SpatialFilter))}}readMLineStyle(e,t){let i=e,s=e.CadObject;switch(this._reader.Code){case 6:{let n=i.ElementTemplates[i.ElementTemplates.length-1];return n&&(n.LineTypeName=this._reader.ValueAsString),!0}case 49:{let n=new js,a=new Pi.ElementTemplate(n);return n.offset=this._reader.ValueAsDouble,i.ElementTemplates.push(a),s.addElement(n),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readTableStyle(e,t){let i=e,s=i.CadObject,n=i.CurrentCellStyleTemplate?.CellStyle??null;switch(this._reader.Code){case 7:return i.CreateCurrentCellStyleTemplate(),i.CurrentCellStyleTemplate.TextStyleName=this._reader.ValueAsString,!0;case 94:return n&&(n.alignment=this._reader.ValueAsInt),!0;case 62:return n&&(n.color=new B(this._reader.ValueAsShort)),!0;case 63:return n&&(n.backgroundColor=new B(this._reader.ValueAsShort)),!0;case 140:return n&&(n.textHeight=this._reader.ValueAsDouble),!0;case 170:return n&&(n.cellAlignment=this._reader.ValueAsShort),!0;case 283:return n&&(n.isFillColorOn=this._reader.ValueAsBool),!0;case 90:return n&&(n.cellStyleType=this._reader.ValueAsShort),!0;case 91:return n&&(n.styleClass=this._reader.ValueAsShort),!0;case 1:return!0;case 274:return n&&(n.topBorder.lineWeight=this._reader.ValueAsInt),!0;case 275:return n&&(n.horizontalInsideBorder.lineWeight=this._reader.ValueAsInt),!0;case 276:return n&&(n.bottomBorder.lineWeight=this._reader.ValueAsInt),!0;case 277:return n&&(n.leftBorder.lineWeight=this._reader.ValueAsInt),!0;case 278:return n&&(n.verticalInsideBorder.lineWeight=this._reader.ValueAsInt),!0;case 279:return n&&(n.rightBorder.lineWeight=this._reader.ValueAsInt),!0;case 284:return n&&(n.topBorder.isInvisible=this._reader.ValueAsBool),!0;case 285:return n&&(n.horizontalInsideBorder.isInvisible=this._reader.ValueAsBool),!0;case 286:return n&&(n.bottomBorder.isInvisible=this._reader.ValueAsBool),!0;case 287:return n&&(n.leftBorder.isInvisible=this._reader.ValueAsBool),!0;case 288:return n&&(n.verticalInsideBorder.isInvisible=this._reader.ValueAsBool),!0;case 289:return n&&(n.rightBorder.isInvisible=this._reader.ValueAsBool),!0;case 64:return n&&(n.topBorder.color=new B(this._reader.ValueAsShort)),!0;case 65:return n&&(n.horizontalInsideBorder.color=new B(this._reader.ValueAsShort)),!0;case 66:return n&&(n.bottomBorder.color=new B(this._reader.ValueAsShort)),!0;case 67:return n&&(n.leftBorder.color=new B(this._reader.ValueAsShort)),!0;case 68:return n&&(n.verticalInsideBorder.color=new B(this._reader.ValueAsShort)),!0;case 69:return n&&(n.rightBorder.color=new B(this._reader.ValueAsShort)),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readMLeaderStyle(e,t){let i=e;switch(this._reader.Code){case 179:return!0;case 340:return i.LeaderLineTypeHandle=this._reader.ValueAsHandle,!0;case 342:return i.MTextStyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readEvaluationExpression(e,t){let i=e;return this._reader.Code===1?(this._reader.ExpectedCode(70),this._reader.ExpectedCode(140),!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.EvalGraphExpr))}readBlockElement(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockElement))?!0:this.readEvaluationExpression(e,t)}}readBlockAction(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockAction))?!0:this.readBlockElement(e,t)}}readBlockActionBasePt(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockActionBasePt))?!0:this.readBlockAction(e,t)}}readBlockRotationAction(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockRotationAction))?!0:this.readBlockActionBasePt(e,t)}}readBlockParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockParameter))?!0:this.readBlockElement(e,t)}}readBlock1PtParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Block1PtParameter))?!0:this.readBlockParameter(e,t)}}readBlock2PtParameter(e,t){return this._reader.Code===91||this.tryAssignCurrentValue(e.CadObject,t)?!0:this.readBlockParameter(e,t)}readBlockVisibilityParameter(e,t){let i=e;switch(this._reader.Code){case 92:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++)this._reader.ReadNext(),i.StateTemplates.push(this.readState());return!0}case 93:if(this.currentSubclass===l.BlockVisibilityParameter){let s=this._reader.ValueAsInt;for(let n=0;n<s;n++)this._reader.ReadNext(),i.entityHandles.push(this._reader.ValueAsHandle);return!0}return!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockVisibilityParameter))?!0:this.readBlock1PtParameter(e,t)}}readBlockRotationParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)?!0:this.readBlock2PtParameter(e,t)}}readState(){let e=new Ea,t=new Wi.StateTemplate(e),i=[303,94,95];for(;this._reader.DxfCode!==p.Start;){let s=i.indexOf(this._reader.Code);switch(s>=0&&i.splice(s,1),this._reader.Code){case 303:e.name=this._reader.ValueAsString;break;case 94:{let n=this._reader.ValueAsInt;for(let a=0;a<n;a++)this._reader.ReadNext(),t.entityHandles.add(this._reader.ValueAsHandle);break}case 95:{let n=this._reader.ValueAsInt;for(let a=0;a<n;a++)this._reader.ReadNext(),t.expressionHandles.add(this._reader.ValueAsHandle);break}default:return t}if(i.length===0)break;this._reader.ReadNext()}return t}readBlockGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockGrip))?!0:this.readBlockElement(e,t)}}readBlockRotationGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockRotationGrip))?!0:this.readBlockGrip(e,t)}}readBlockVisibilityGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockVisibilityGrip))?!0:this.readBlockGrip(e,t)}}readBlockRepresentationData(e,t){let i=e;return this._reader.Code===340?(i.BlockHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}readBlockGripExpression(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockGripExpression))?!0:this.readEvaluationExpression(e,t)}}readXRecord(e,t){let i=e;return this._reader.Code===100?this._reader.ValueAsString===l.XRecord?(this.readXRecordEntries(i),!0):!1:this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.XRecord))}readXRecordEntries(e){let t=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start;){switch(this._reader.GroupCodeValue){case _.Point3D:{let i=this._reader.Code,s=this._reader.ValueAsDouble;this._reader.ReadNext();let n=this._reader.ValueAsDouble;this._reader.ReadNext();let a=this._reader.ValueAsDouble,o=new c(s,n,a);t.CreateEntry(i,o);break}case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:e.AddHandleReference(this._reader.Code,this._reader.ValueAsHandle);break;default:t.CreateEntry(this._reader.Code,this._reader.Value);break}this._reader.ReadNext()}}readBookColor(e,t){let s=e.CadObject;return this._reader.Code===430?(s.name=this._reader.ValueAsString,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.DbColor))}readDimensionAssociation(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 1:return this._reader.ValueAsString===Xe.OsnapPointRefClassName?(s.associativityFlags&he.FirstPointReference)!==0&&s.firstPointRef===null?(s.firstPointRef=new fs,this.readOsnapPointRef(s.firstPointRef),this.lockPointer=!0,!0):(s.associativityFlags&he.SecondPointReference)!==0&&s.secondPointRef===null?(s.secondPointRef=new fs,this.readOsnapPointRef(s.secondPointRef),this.lockPointer=!0,!0):(s.associativityFlags&he.ThirdPointReference)!==0&&s.thirdPointRef===null?(s.thirdPointRef=new fs,this.readOsnapPointRef(s.thirdPointRef),this.lockPointer=!0,!0):((s.associativityFlags&he.FourthPointReference)!==0&&s.fourthPointRef===null&&(s.fourthPointRef=new fs,this.readOsnapPointRef(s.fourthPointRef),this.lockPointer=!0),!0):!1;case 330:return e.OwnerHandle!==null?(i.DimensionHandle=this._reader.ValueAsHandle,!0):!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readOsnapPointRef(e){let t=new Ii.OsnapPointRefTemplate(e);this._reader.ReadNext();let i=!1;for(;!i;){switch(this._reader.Code){case 10:e.osnapPoint=new c(this._reader.ValueAsDouble,e.osnapPoint.Y,e.osnapPoint.Z);break;case 20:e.osnapPoint=new c(e.osnapPoint.X,this._reader.ValueAsDouble,e.osnapPoint.Z);break;case 30:e.osnapPoint=new c(e.osnapPoint.X,e.osnapPoint.Y,this._reader.ValueAsDouble);break;case 40:e.geometryParameter=this._reader.ValueAsDouble;break;case 72:e.objectOsnapType=this._reader.ValueAsShort;break;case 73:e.subentType=this._reader.ValueAsShort;break;case 74:e.intersectionSubType=this._reader.ValueAsShort;break;case 75:e.hasLastPointRef=this._reader.ValueAsBool;break;case 91:e.gsMarker=this._reader.ValueAsInt;break;case 92:e.intersectionGsMarker=this._reader.ValueAsInt;break;case 331:t.ObjectHandle=this._reader.ValueAsHandle;break;case 302:case 332:break;default:i=!0;continue}this._reader.ReadNext()}return t}readDictionary(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 280:return s.hardOwnerFlag=this._reader.ValueAsBool,!0;case 281:return s.clonningFlags=this._reader.Value,!0;case 3:return i.Entries.set(this._reader.ValueAsString,null),!0;case 350:case 360:{let n=Array.from(i.Entries.keys()),a=n[n.length-1];return i.Entries.set(a,this._reader.ValueAsHandle),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Dictionary))}}readDictionaryWithDefault(e,t){let i=e;return this._reader.Code===340?(i.DefaultEntryHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.DictionaryWithDefault))?!0:this.readDictionary(e,t)}readSortentsTable(){let e=new Br,t=new ca(e);this._reader.ReadNext(),this.readCommonObjectData(t),this._reader.ReadNext();let i={item1:null,item2:null};for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 5:i.item1=this._reader.ValueAsHandle;break;case 330:t.BlockOwnerHandle=this._reader.ValueAsHandle;break;case 331:i.item2=this._reader.ValueAsHandle;break;default:this._builder.Notify(`Group Code not handled ${this._reader.GroupCodeValue} for SortEntitiesTable, code : ${this._reader.Code} | value : ${this._reader.ValueAsString}`);break}i.item1!==null&&i.item2!==null&&(t.Values.push([i.item1,i.item2]),i={item1:null,item2:null}),this._reader.ReadNext()}return t}appendBinaryChunk(e,t){if(e===null||e.length===0)return new Uint8Array(t);let i=new Uint8Array(e.length+t.length);return i.set(e,0),i.set(t,e.length),i}};q();D();var Jh=class r extends Ln{_version=m.Unknown;_builder;_reader;get fileStream(){return this._fileStream instanceof Uint8Array?this._fileStream:new Uint8Array(this._fileStream)}constructor(e,t){super(e,t),this.Configuration=new gd}IsBinary(){return r.IsBinaryStream(this.fileStream)}static IsBinaryStream(e,t=!1){let i=ws.SentinelBytes;if(e.length<i.length)return!1;for(let s=0;s<i.length;s++)if(e[s]!==i[s])return!1;return!0}static ReadFromStream(e,t){let i=new r(e,t),s=i.Read();return i.Dispose(),s}static ReadFromStreamWithConfig(e,t,i){let s=new r(e,i);s.Configuration=t;let n=s.Read();return s.Dispose(),n}Read(){for(this._document=new xs,this._document.summaryInfo=new Or,this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this);this._reader.ValueAsString!==d.EndOfFile;){if(this._reader.ValueAsString!==d.BeginSection){this._reader.ReadNext();continue}else this._reader.ReadNext();switch(this._reader.ValueAsString){case d.HeaderSection:this._document.header=this.ReadHeader(),this._document.header.Document=this._document,this._builder.InitialHandSeed=this._document.header.HandleSeed;break;case d.ClassesSection:this._document.classes=this.readClasses();break;case d.TablesSection:this.readTables();break;case d.BlocksSection:this.readBlocks();break;case d.EntitiesSection:this.readEntities();break;case d.ObjectsSection:this.readObjects();break;default:this.triggerNotification(`Section not implemented ${this._reader.ValueAsString}`,g.NotImplemented);break}this._reader.ReadNext()}return this._document.header===null&&(this._document.header=new lt(this._document)),this._builder.BuildDocument(),this._document}ReadHeader(){this._reader=this.goToSection(d.HeaderSection);let e=new lt,t=lt.GetHeaderMap();for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let i=this._reader.ValueAsString;if(i==null||!t.has(i)){this._reader.ReadNext();continue}let s=t.get(i),n=new Array(s.DxfCodes.length);for(let a=0;a<s.DxfCodes.length;a++){if(this._reader.ReadNext(),this._reader.DxfCode===p.CLShapeText){let o=s.DxfCodes[a];switch(Be.transformValue(o)){case _.Bool:n[a]=!1;break;case _.Byte:case _.Int16:case _.Int32:case _.Int64:case _.Double:case _.Point3D:n[a]=0;break;case _.None:case _.String:default:n[a]=void 0;break}break}n[a]=this._reader.Value}try{e.SetValue(i,n)}catch(a){this.triggerNotification(`Invalid value for header variable ${i} | ${n[0]}`,g.Warning,a instanceof Error?a:void 0)}this._reader.DxfCode!==p.CLShapeText&&this._reader.ReadNext()}return e}ReadTables(){return this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this),this.readTables(),this._document.header=new lt(this._document),this._builder.RegisterTables(),this._builder.BuildTables(),this._document}ReadEntities(){return this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this),this.readEntities(),this._builder.BuildEntities()}Dispose(){super.Dispose(),this.Configuration.ClearCache&&Ae.clearCache()}readClasses(){this._reader=this.goToSection(d.ClassesSection);let e=new gi;for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;)if(this._reader.ValueAsString===d.ClassEntry){let t=this.readClass();t.classNumber<500&&(t.classNumber=500+e.count),e.addOrUpdate(t)}else this._reader.ReadNext();return e}readClass(){let e=new F;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:e.dxfName=this._reader.ValueAsString;break;case 2:e.cppClassName=this._reader.ValueAsString;break;case 3:e.applicationName=this._reader.ValueAsString;break;case 90:e.proxyFlags=this._reader.ValueAsInt;break;case 91:e.instanceCount=this._reader.ValueAsInt;break;case 280:e.wasZombie=this._reader.ValueAsBool;break;case 281:e.isAnEntity=this._reader.ValueAsBool;break;default:break}this._reader.ReadNext()}return e}readTables(){this._reader=this.goToSection(d.TablesSection),new Sd(this._reader,this._builder).Read()}readBlocks(){this._reader=this.goToSection(d.BlocksSection),new Bd(this._reader,this._builder).Read()}readEntities(){this._reader=this.goToSection(d.EntitiesSection),new yd(this._reader,this._builder).Read()}readObjects(){this._reader=this.goToSection(d.ObjectsSection),new Ld(this._reader,this._builder).Read()}getReader(){this._version=m.Unknown;let e=this.fileStream,t=r.IsBinaryStream(e),i=!1;if(t&&e.length>ws.SentinelBytes.length){let n=e[ws.SentinelBytes.length];n!==void 0&&n!==0&&(i=!0)}let s=this.createReader(t,i);if(!s.Find(d.HeaderSection))return this.triggerNotification("Header section not found, using a generic reader.",g.Warning),this._version=m.Unknown,s.Start(),s;for(;s.ValueAsString!==d.EndSection;){if(s.ValueAsString==="$ACADVER"){if(s.ReadNext(),this._version=Z.getVersionFromName(s.ValueAsString),this._version>=m.AC1021)break;if(this._version<m.AC1002)throw this._version===m.Unknown?new Me:new Me(this._version)}s.ReadNext()}return this._version===m.Unknown&&this.triggerNotification("Dxf version not found, using a generic reader.",g.Warning),this.createReader(t,i)}goToSection(e){return this._reader=this._reader??this.getReader(),this._reader.ValueAsString===e?this._reader:(this._reader.Find(e),this._reader)}createReader(e,t){let i=this.fileStream;return e?t?new Dd(i):new ws(i):new xd(i)}createDefaultConfiguration(){return{}}};var ro=class{WriteOptional=!1;Write(e,t,i){if(t==null)return;let s=e;if(i&&i.dxfProperties.has(s)){let n=i.dxfProperties.get(s);if((n.referenceType&Lr.Optional)!==0&&!this.WriteOptional)return;(n.referenceType&Lr.IsAngle)!==0&&(t=Q.RadToDeg(t))}if(this.writeDxfCode(s),typeof t=="string"){let n=t.replace(/\^/g,"^ ").replace(/\n/g,"^J").replace(/\r/g,"^M").replace(/\t/g,"^I");this.writeValue(s,n)}else this.writeValue(s,t)}WriteVector(e,t,i){let s=e;for(let n=0;n<t.dimension;n++)this.Write(s+n*10,t[n],i)}WriteCmColor(e,t,i){if(Be.transformValue(e)===_.Int16)this.Write(e,t.getApproxIndex()&65535);else{let s=new Uint8Array(4);t.isTrueColor?(s[0]=t.b,s[1]=t.g,s[2]=t.r,s[3]=194):(s[3]=193,s[0]=t.index);let n=new DataView(s.buffer);this.Write(e,n.getInt32(0,!0),i)}}WriteHandle(e,t,i){t!=null&&this.Write(e,t.handle,i)}WriteIfNotDefault(e,t,i,s){t!==i&&this.Write(e,t,s)}WriteName(e,t,i){t!=null&&this.Write(e,t.name,i)}WriteTrueColor(e,t,i){let s=new Uint8Array(4);s[0]=t.b,s[1]=t.g,s[2]=t.r,s[3]=0;let n=new DataView(s.buffer);this.Write(e,n.getInt32(0,!0),i)}};var kd=class extends ro{_writer;_lines=[];constructor(e){super(),this._writer=e}Close(){this._writer.close&&this._writer.close()}Dispose(){this.Close()}Flush(){this._writer.flush&&this._writer.flush()}writeDxfCode(e){let t;e<10?t=` ${e}`:e<100?t=` ${e}`:t=`${e}`,this._writer.write(t+`
6
+ `,!0;case 2:return a.guid=this._reader.ValueAsString,!0;case 290:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(n))}}readSolid3d(e,t,i){let s=e;return this._reader.Code===350?(s.HistoryHandle=this._reader.ValueAsHandle,!0):this.readModelerGeometry(e,t,l.ModelerGeometry)}readSpline(e,t,i){let s=e,n,a;switch(this._reader.Code){case 10:return n=new c(this._reader.ValueAsDouble,0,0),s.CadObject.controlPoints.push(n),!0;case 20:return n=s.CadObject.controlPoints[s.CadObject.controlPoints.length-1],n.Y=this._reader.ValueAsDouble,s.CadObject.controlPoints[s.CadObject.controlPoints.length-1]=n,!0;case 30:return n=s.CadObject.controlPoints[s.CadObject.controlPoints.length-1],n.Z=this._reader.ValueAsDouble,s.CadObject.controlPoints[s.CadObject.controlPoints.length-1]=n,!0;case 11:return a=new c(this._reader.ValueAsDouble,0,0),s.CadObject.fitPoints.push(a),!0;case 21:return a=s.CadObject.fitPoints[s.CadObject.fitPoints.length-1],a.Y=this._reader.ValueAsDouble,s.CadObject.fitPoints[s.CadObject.fitPoints.length-1]=a,!0;case 31:return a=s.CadObject.fitPoints[s.CadObject.fitPoints.length-1],a.Z=this._reader.ValueAsDouble,s.CadObject.fitPoints[s.CadObject.fitPoints.length-1]=a,!0;case 40:return s.CadObject.knots.push(this._reader.ValueAsDouble),!0;case 41:return s.CadObject.weights.push(this._reader.ValueAsDouble),!0;case 72:case 73:case 74:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readUnderlayEntity(e,t,i){let s=e;return this._reader.Code===340?(s.DefinitionHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}readVertex(e,t,i){let s=e;switch(this._reader.Code){case 100:switch(this._reader.ValueAsString){case l.Vertex:return!0;case l.PolylineVertex:return s.SetVertexObject(new Xt),t.subClasses.set(l.PolylineVertex,V.Create(Xt)),!0;case l.Polyline3dVertex:return s.SetVertexObject(new cr),t.subClasses.set(l.Polyline3dVertex,V.Create(cr)),!0;case l.PolyfaceMeshVertex:return s.SetVertexObject(new ri),t.subClasses.set(l.PolyfaceMeshVertex,V.Create(ri)),!0;case l.PolyfaceMeshFace:return s.SetVertexObject(new Zt),t.subClasses.set(l.PolyfaceMeshFace,V.Create(Zt)),!0;case l.PolygonMeshVertex:return s.SetVertexObject(new ss),t.subClasses.set(l.PolygonMeshVertex,V.Create(ss)),!0;default:return!1}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s.CadObject.subclassMarker))}}readViewport(e,t,i){let s=e;switch(this._reader.Code){case 67:case 68:return!0;case 69:return s.ViewportId=this._reader.ValueAsShort,!0;case 331:return s.FrozenLayerHandles.add(this._reader.ValueAsHandle),!0;case 348:return s.VisualStyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Viewport))}}readEntitySubclassMap(e,t,i){let s=i||e.CadObject.subclassMarker;switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(s))}}readExtendedData(e){let t=[];for(e.set(this._reader.ValueAsString,t),this._reader.ReadNext();this._reader.DxfCode>=p.ExtendedDataAsciiString;){if(this._reader.DxfCode===p.ExtendedDataRegAppName){this.readExtendedData(e);break}let i=null,s=0,n=0,a=0;switch(this._reader.DxfCode){case p.ExtendedDataAsciiString:i=new Hi(this._reader.ValueAsString);break;case p.ExtendedDataControlString:i=new Pe(this._reader.ValueAsString==="}");break;case p.ExtendedDataLayerName:{let o=this._builder.Layers.get(this._reader.ValueAsString);o?i=new va(o.handle):this._builder.Notify(`[XData] Could not found the linked Layer ${this._reader.ValueAsString}.`,g.Warning);break}case p.ExtendedDataBinaryChunk:i=new Fi(this._reader.ValueAsBinaryChunk);break;case p.ExtendedDataHandle:i=new za(this._reader.ValueAsHandle);break;case p.ExtendedDataXCoordinate:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Gi(new c(s,n,a));break;case p.ExtendedDataWorldXCoordinate:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Ki(new c(s,n,a));break;case p.ExtendedDataWorldXDisp:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new Ui(new c(s,n,a));break;case p.ExtendedDataWorldXDir:s=this._reader.ValueAsDouble,this._reader.ReadNext(),n=this._reader.ValueAsDouble,this._reader.ReadNext(),a=this._reader.ValueAsDouble,i=new $i(new c(s,n,a));break;case p.ExtendedDataReal:i=new Zi(this._reader.ValueAsDouble);break;case p.ExtendedDataDist:i=new vi(this._reader.ValueAsDouble);break;case p.ExtendedDataScale:i=new zi(this._reader.ValueAsDouble);break;case p.ExtendedDataInteger16:i=new Yi(this._reader.ValueAsShort);break;case p.ExtendedDataInteger32:i=new Xi(this._reader.ValueAsInt);break;default:this._builder.Notify(`Unknown code for extended data: ${this._reader.DxfCode}`,g.Warning);break}i!==null&&t.push(i),this._reader.ReadNext()}}readPattern(e,t){this._reader.ReadNext();for(let i=0;i<t;i++){let s=new Cn,n=new C,a=new C,o=!1,h=new Set;for(;!o&&!h.has(this._reader.Code);){switch(h.add(this._reader.Code),this._reader.Code){case 53:s.angle=this._reader.ValueAsAngle;break;case 43:n.X=this._reader.ValueAsDouble;break;case 44:n.Y=this._reader.ValueAsDouble,s.basePoint=n;break;case 45:a.X=this._reader.ValueAsDouble,s.offset=a;break;case 46:a.Y=this._reader.ValueAsDouble,s.offset=a;break;case 79:{let f=this._reader.ValueAsInt;for(let b=0;b<f;b++)this._reader.ReadNext(),s.dashLengths.push(this._reader.ValueAsDouble);break}case 49:s.dashLengths.push(this._reader.ValueAsDouble);break;default:o=!0;break}this._reader.ReadNext()}e.lines.push(s)}}readLoops(e,t){this._reader.Code===91&&this._reader.ReadNext();for(let i=0;i<t;i++){if(this._reader.Code!==92){this._builder.Notify(`Boundary path should start with code 92 but was ${this._reader.Code}`);break}let s=this.readLoop();s!==null&&e.PathTemplates.push(s)}}readLoop(){let e=new Li.CadBoundaryPathTemplate,t=this._reader.ValueAsInt;if(e.Path.flags=t,(t&qe.Polyline)!==0){let s=this.readPolylineBoundary();s&&e.Path.edges.push(s)}else{if(this._reader.ReadNext(),this._reader.Code!==93)return this._builder.Notify(`Edge Boundary path should start with code 93 but was ${this._reader.Code}`),null;let s=this._reader.ValueAsInt;this._reader.ReadNext();for(let n=0;n<s;n++){let a=this.readEdge();a!==null&&e.Path.edges.push(a)}}let i=!1;for(;!i;){switch(this._reader.Code){case 97:break;case 330:e.Handles.add(this._reader.ValueAsHandle);break;default:i=!0;continue}this._reader.ReadNext()}return e}readPolylineBoundary(){let e=new is;if(this._reader.ReadNext(),this._reader.Code!==72)return this._builder.Notify(`Polyline Boundary path should start with code 72 but was ${this._reader.Code}`),null;let t=!1,i=!1;for(;!t;){switch(this._reader.Code){case 72:i=this._reader.ValueAsBool;break;case 73:e.isClosed=this._reader.ValueAsBool;break;case 93:{let s=this._reader.ValueAsInt;this._reader.ReadNext();for(let n=0;n<s;n++){let a=0,o=this._reader.ValueAsDouble;this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext(),i&&(a=this._reader.ValueAsDouble,this._reader.ReadNext()),e.vertices.push(new c(o,h,a))}continue}default:t=!0;continue}this._reader.ReadNext()}return e}readEdge(){if(this._reader.Code!==72)return this._builder.Notify(`Edge Boundary path should define the type with code 72 but was ${this._reader.Code}`),null;let e=this._reader.ValueAsInt;switch(this._reader.ReadNext(),e){case sr.Line:{let t=new Kr;for(;;){switch(this._reader.Code){case 10:t.start=new C(this._reader.ValueAsDouble,t.start.Y);break;case 20:t.start=new C(t.start.X,this._reader.ValueAsDouble);break;case 11:t.end=new C(this._reader.ValueAsDouble,t.end.Y);break;case 21:t.end=new C(t.end.X,this._reader.ValueAsDouble);break;default:return t}this._reader.ReadNext()}}case sr.CircularArc:{let t=new Xr;for(;;){switch(this._reader.Code){case 10:t.center=new C(this._reader.ValueAsDouble,t.center.Y);break;case 20:t.center=new C(t.center.X,this._reader.ValueAsDouble);break;case 40:t.radius=this._reader.ValueAsDouble;break;case 50:t.startAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 51:t.endAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 73:t.counterClockWise=this._reader.ValueAsBool;break;default:return t}this._reader.ReadNext()}}case sr.EllipticArc:{let t=new Zr;for(;;){switch(this._reader.Code){case 10:t.center=new C(this._reader.ValueAsDouble,t.center.Y);break;case 20:t.center=new C(t.center.X,this._reader.ValueAsDouble);break;case 11:t.majorAxisEndPoint=new C(this._reader.ValueAsDouble,t.center.Y);break;case 21:t.majorAxisEndPoint=new C(t.center.X,this._reader.ValueAsDouble);break;case 40:t.minorToMajorRatio=this._reader.ValueAsDouble;break;case 50:t.startAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 51:t.endAngle=Q.DegToRad(this._reader.ValueAsDouble);break;case 73:t.counterClockWise=this._reader.ValueAsBool;break;default:return t}this._reader.ReadNext()}}case sr.Spline:{let t=new Jr,i=0,s=0,n=0,a=new c,o=new C;for(;;){switch(this._reader.Code){case 10:a=new c(this._reader.ValueAsDouble,0,1);break;case 20:a=new c(a.X,this._reader.ValueAsDouble,a.Z),t.controlPoints.push(a);break;case 11:o=new C(this._reader.ValueAsDouble,0);break;case 21:o=new C(o.X,this._reader.ValueAsDouble),t.fitPoints.push(o);break;case 42:{let h=t.controlPoints[t.controlPoints.length-1];t.controlPoints[t.controlPoints.length-1]=new c(h.X,h.Y,this._reader.ValueAsDouble);break}case 12:t.startTangent=new C(this._reader.ValueAsDouble,t.startTangent.Y);break;case 22:t.startTangent=new C(t.startTangent.X,this._reader.ValueAsDouble);break;case 13:t.endTangent=new C(this._reader.ValueAsDouble,t.endTangent.Y);break;case 23:t.endTangent=new C(t.endTangent.X,this._reader.ValueAsDouble);break;case 94:t.degree=this._reader.ValueAsInt;break;case 73:t.isRational=this._reader.ValueAsBool;break;case 74:t.isPeriodic=this._reader.ValueAsBool;break;case 95:i=this._reader.ValueAsInt;break;case 96:s=this._reader.ValueAsInt;break;case 97:n=this._reader.ValueAsInt;break;case 40:t.knots.push(this._reader.ValueAsDouble);break;default:return t}this._reader.ReadNext()}}}return null}readDefinedGroups(e){if(e!==void 0){let{xdictHandle:t,reactors:i}=this.readDefinedGroupsRaw();t!==null&&(e.XDictHandle=t),i.forEach(s=>e.ReactorsHandles.add(s))}}readDefinedGroupsRaw(){let e=null,t=new Set;switch(this._reader.ValueAsString){case d.DictionaryToken:return this._reader.ReadNext(),e=this._reader.ValueAsHandle,this._reader.ReadNext(),{xdictHandle:e,reactors:t};case d.ReactorsToken:t=this.readReactors();break;case d.BlkRefToken:default:do this._reader.ReadNext();while(this._reader.DxfCode!==p.ControlString);return{xdictHandle:e,reactors:t}}return{xdictHandle:e,reactors:t}}readReactors(){let e=new Set;for(this._reader.ReadNext();this._reader.DxfCode!==p.ControlString;)e.add(this._reader.ValueAsHandle),this._reader.ReadNext();return e}tryAssignCurrentValue(e,t){if(t instanceof Ae){if(!this.currentSubclass)return!1;let i=t.subClasses.get(this.currentSubclass);return i?this.tryAssignCurrentValue(e,i):!1}try{let i=t.dxfProperties.get(this._reader.Code);if(i){if((i.referenceType&Lr.Count)!==0)return!0;if((i.referenceType&Lr.Handle)!==0||(i.referenceType&Lr.Name)!==0)return!1;let s=this._reader.Value;return(i.referenceType&Lr.IsAngle)!==0&&(s=Q.DegToRad(s)),i.setValue(this._reader.Code,e,s),!0}}catch(i){if(this._builder.Configuration.Failsafe)this._builder.Notify("An error occurred while assigning a property using mapper",g.Error,i);else throw i}return!1}};q();D();x();var Sd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){if(this._reader.ValueAsString===d.TableEntry)this.readTable();else throw new si(`Unexpected token at the beginning of a table: ${this._reader.ValueAsString}`,this._reader.Position);if(this._reader.ValueAsString===d.EndTable)this._reader.ReadNext();else throw new si(`Unexpected token at the end of a table: ${this._reader.ValueAsString}`,this._reader.Position)}}readTable(){this._reader.ReadNext();let e=0,t=null,i=new Map,s=this.readCommonObjectData(),{name:n,handle:a,ownerHandle:o,xdictHandle:h,reactors:f}=s;if(this._reader.DxfCode===p.Subclass)for(;this._reader.Code!==p.Start;){switch(this._reader.Code){case 70:e=this._reader.ValueAsInt;break;case 100:if(this._reader.ValueAsString===l.DimensionStyleTable){for(;this._reader.Code!==p.Start;)this._reader.ReadNext();break}break;case 1001:this.readExtendedData(i);break;default:this._builder.Notify(`[AcDbSymbolTable] Unhandled dxf code ${this._reader.Code} at line ${this._reader.Position}.`);break}if(this._reader.Code===p.Start)break;this._reader.ReadNext()}else{if(this._reader.ValueAsString===d.EndTable)return;this._reader.ReadNext()}switch(n){case d.TableAppId:t=new st(new Vr),this.readEntries(t),t.CadObject.handle=a,this._builder.AppIds=t.CadObject;break;case d.TableBlockRecord:t=new Mn(new Ir),this.readEntries(t),t.CadObject.handle=a,this._builder.BlockRecords=t.CadObject;break;case d.TableVport:t=new st(new zr),this.readEntries(t),t.CadObject.handle=a,this._builder.VPorts=t.CadObject;break;case d.TableLinetype:t=new st(new Wr),this.readEntries(t),t.CadObject.handle=a,this._builder.LineTypesTable=t.CadObject;break;case d.TableLayer:t=new st(new Mr),this.readEntries(t),t.CadObject.handle=a,this._builder.Layers=t.CadObject;break;case d.TableStyle:t=new st(new Hr),this.readEntries(t),t.CadObject.handle=a,this._builder.TextStyles=t.CadObject;break;case d.TableView:t=new st(new Ur),this.readEntries(t),t.CadObject.handle=a,this._builder.Views=t.CadObject;break;case d.TableUcs:t=new st(new Fr),this.readEntries(t),t.CadObject.handle=a,this._builder.UCSs=t.CadObject;break;case d.TableDimstyle:t=new st(new Wt),this.readEntries(t),t.CadObject.handle=a,this._builder.DimensionStyles=t.CadObject;break;default:throw new si(`Unknown table name ${n}`)}t.OwnerHandle=o??null,t.XDictHandle=h,t.ReactorsHandles=f,t.EDataTemplateByAppName=i,this._builder.AddTemplate(t)}readEntries(e){for(;this._reader.ValueAsString!==d.EndTable;){this._reader.ReadNext();let t=null;switch(e.CadObject.objectName){case d.TableAppId:t=this.readTableEntry(new fe(new gt),this.readAppId.bind(this));break;case d.TableBlockRecord:{let i=new br;t=this.readTableEntry(i,this.readBlockRecord.bind(this)),i.CadObject.name.toUpperCase()===U.ModelSpaceName.toUpperCase()&&(this._builder.ModelSpaceTemplate=i);break}case d.TableDimstyle:t=this.readTableEntry(new Hn,this.readDimensionStyle.bind(this));break;case d.TableLayer:t=this.readTableEntry(new Fn,this.readLayer.bind(this));break;case d.TableLinetype:t=this.readTableEntry(new ki,this.readLineType.bind(this));break;case d.TableStyle:t=this.readTableEntry(new fe(new te),this.readTextStyle.bind(this));break;case d.TableUcs:t=this.readTableEntry(new ra,this.readUcs.bind(this));break;case d.TableView:t=this.readTableEntry(new ia,this.readView.bind(this));break;case d.TableVport:t=this.readTableEntry(new na,this.readVPort.bind(this));break;default:break}t!==null&&(e.CadObject.contains(t.Name)&&this._builder.Configuration.Failsafe&&(this._builder.Notify(`Duplicated entry with name ${t.Name} found in ${t.CadObject.objectName}`,g.Warning),e.CadObject.remove(t.Name)),e.CadObject.add(t.CadObject),this._builder.AddTemplate(t))}}readTableEntry(e,t){let i=Ae.create(e.CadObject.constructor);for(;this._reader.DxfCode!==p.Start;){if(!t(e,i.subClasses.get(e.CadObject.SubclassMarker))){let s={value:!1};if(this.readCommonTableEntryCodes(e,s,i),s.value)continue}this._reader.Code!==p.Start&&this._reader.ReadNext()}return e}readCommonTableEntryCodes(e,t,i){switch(t.value=!1,this._reader.Code){case 2:e.CadObject.Name=this._reader.ValueAsString;break;case 70:e.CadObject.Flags=this._reader.ValueAsUShort;break;case 100:break;default:this.readCommonCodes(e,t,i);break}}readAppId(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)}}readBlockRecord(e,t){let i=e;return this._reader.Code===340?(i.LayoutHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t)}readDimensionStyle(e,t){let i=e;switch(this._reader.Code){case 3:return e.CadObject.PostFix=this._reader.ValueAsString,!0;case 4:return e.CadObject.AlternateDimensioningSuffix=this._reader.ValueAsString,!0;case 5:return i.DIMBL_Name=this._reader.ValueAsString,!0;case 6:return i.DIMBLK1_Name=this._reader.ValueAsString,!0;case 7:return i.DIMBLK2_Name=this._reader.ValueAsString,!0;case 40:try{e.CadObject.ScaleFactor=this._reader.ValueAsDouble}catch(s){e.CadObject.ScaleFactor=Q.Epsilon,this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for ScaleFactor.`,g.Warning,s)}return!0;case 41:try{e.CadObject.ArrowSize=this._reader.ValueAsDouble}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for ArrowSize.`,g.Warning,s)}return!0;case 42:return e.CadObject.ExtensionLineOffset=this._reader.ValueAsDouble,!0;case 43:return e.CadObject.DimensionLineIncrement=this._reader.ValueAsDouble,!0;case 44:return e.CadObject.ExtensionLineExtension=this._reader.ValueAsDouble,!0;case 45:return e.CadObject.Rounding=this._reader.ValueAsDouble,!0;case 46:return e.CadObject.DimensionLineExtension=this._reader.ValueAsDouble,!0;case 47:return e.CadObject.PlusTolerance=this._reader.ValueAsDouble,!0;case 48:return e.CadObject.MinusTolerance=this._reader.ValueAsDouble,!0;case 49:return e.CadObject.FixedExtensionLineLength=this._reader.ValueAsDouble,!0;case 50:try{e.CadObject.JoggedRadiusDimensionTransverseSegmentAngle=this._reader.ValueAsAngle}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for JoggedRadiusDimensionTransverseSegmentAngle.`,g.Warning,s)}return!0;case 69:return e.CadObject.TextBackgroundFillMode=this._reader.ValueAsShort,!0;case 70:if(i.DxfFlagsAssigned)this._reader.ValueAsShort>=0&&(e.CadObject.TextBackgroundColor=new B(this._reader.ValueAsShort));else return i.DxfFlagsAssigned=!0,!0;return!0;case 71:return e.CadObject.GenerateTolerances=this._reader.ValueAsBool,!0;case 72:return e.CadObject.LimitsGeneration=this._reader.ValueAsBool,!0;case 73:return e.CadObject.TextInsideHorizontal=this._reader.ValueAsBool,!0;case 74:return e.CadObject.TextOutsideHorizontal=this._reader.ValueAsBool,!0;case 75:return e.CadObject.SuppressFirstExtensionLine=this._reader.ValueAsBool,!0;case 76:return e.CadObject.SuppressSecondExtensionLine=this._reader.ValueAsBool,!0;case 77:return e.CadObject.TextVerticalAlignment=this._reader.ValueAsShort,!0;case 78:return e.CadObject.ZeroHandling=this._reader.ValueAsShort,!0;case 79:return e.CadObject.AngularZeroHandling=this._reader.ValueAsShort,!0;case 90:return e.CadObject.ArcLengthSymbolPosition=this._reader.ValueAsShort,!0;case 105:return e.CadObject.Handle=this._reader.ValueAsHandle,!0;case 140:try{e.CadObject.TextHeight=this._reader.ValueAsDouble}catch(s){this._builder.Notify(`[${e.CadObject.SubclassMarker}] Assignation error for TextHeight.`,g.Warning,s)}return!0;case 141:return e.CadObject.CenterMarkSize=this._reader.ValueAsDouble,!0;case 142:return e.CadObject.TickSize=this._reader.ValueAsDouble,!0;case 143:return e.CadObject.AlternateUnitScaleFactor=this._reader.ValueAsDouble,!0;case 144:return e.CadObject.LinearScaleFactor=this._reader.ValueAsDouble,!0;case 145:return e.CadObject.TextVerticalPosition=this._reader.ValueAsDouble,!0;case 146:return e.CadObject.ToleranceScaleFactor=this._reader.ValueAsDouble,!0;case 147:return e.CadObject.DimensionLineGap=this._reader.ValueAsDouble,!0;case 148:return e.CadObject.AlternateUnitRounding=this._reader.ValueAsDouble,!0;case 170:return e.CadObject.AlternateUnitDimensioning=this._reader.ValueAsBool,!0;case 171:return e.CadObject.AlternateUnitDecimalPlaces=this._reader.ValueAsShort,!0;case 172:return e.CadObject.TextOutsideExtensions=this._reader.ValueAsBool,!0;case 173:return e.CadObject.SeparateArrowBlocks=this._reader.ValueAsBool,!0;case 174:return e.CadObject.TextInsideExtensions=this._reader.ValueAsBool,!0;case 175:return e.CadObject.SuppressOutsideExtensions=this._reader.ValueAsBool,!0;case 176:return e.CadObject.DimensionLineColor=new B(this._reader.ValueAsShort),!0;case 177:return e.CadObject.ExtensionLineColor=new B(this._reader.ValueAsShort),!0;case 178:return e.CadObject.TextColor=new B(this._reader.ValueAsShort),!0;case 179:return e.CadObject.AngularDecimalPlaces=this._reader.ValueAsShort,!0;case 270:return e.CadObject.LinearUnitFormat=this._reader.ValueAsShort,!0;case 271:return e.CadObject.DecimalPlaces=this._reader.ValueAsShort,!0;case 272:return e.CadObject.ToleranceDecimalPlaces=this._reader.ValueAsShort,!0;case 273:return e.CadObject.AlternateUnitFormat=this._reader.ValueAsShort,!0;case 274:return e.CadObject.AlternateUnitToleranceDecimalPlaces=this._reader.ValueAsShort,!0;case 275:return e.CadObject.AngularUnit=this._reader.ValueAsShort,!0;case 276:return e.CadObject.FractionFormat=this._reader.ValueAsShort,!0;case 277:return e.CadObject.LinearUnitFormat=this._reader.ValueAsShort,!0;case 278:return e.CadObject.DecimalSeparator=String.fromCharCode(this._reader.ValueAsShort),!0;case 279:return e.CadObject.TextMovement=this._reader.ValueAsShort,!0;case 280:return e.CadObject.TextHorizontalAlignment=this._reader.ValueAsShort,!0;case 281:return e.CadObject.SuppressFirstDimensionLine=this._reader.ValueAsBool,!0;case 282:return e.CadObject.SuppressSecondDimensionLine=this._reader.ValueAsBool,!0;case 283:return e.CadObject.ToleranceAlignment=this._reader.ValueAsShort,!0;case 284:return e.CadObject.ToleranceZeroHandling=this._reader.ValueAsShort,!0;case 285:return e.CadObject.AlternateUnitZeroHandling=this._reader.ValueAsShort,!0;case 286:return e.CadObject.AlternateUnitToleranceZeroHandling=this._reader.ValueAsShort,!0;case 287:return e.CadObject.DimensionFit=this._reader.ValueAsShort,!0;case 288:return e.CadObject.CursorUpdate=this._reader.ValueAsBool,!0;case 289:return e.CadObject.DimensionTextArrowFit=this._reader.ValueAsShort,!0;case 290:return e.CadObject.IsExtensionLineLengthFixed=this._reader.ValueAsBool,!0;case 340:return i.TextStyleHandle=this._reader.ValueAsHandle,!0;case 341:return i.DIMLDRBLK=this._reader.ValueAsHandle,!0;case 342:return i.DIMBLK=this._reader.ValueAsHandle,!0;case 343:return i.DIMBLK1=this._reader.ValueAsHandle,!0;case 344:return i.DIMBLK2=this._reader.ValueAsHandle,!0;case 345:return i.Dimltype=this._reader.ValueAsHandle,!0;case 346:return i.Dimltex1=this._reader.ValueAsHandle,!0;case 347:return i.Dimltex2=this._reader.ValueAsHandle,!0;case 371:return e.CadObject.DimensionLineWeight=this._reader.ValueAsShort,!0;case 372:return e.CadObject.ExtensionLineWeight=this._reader.ValueAsShort,!0;default:return!1}}readLayer(e,t){let i=e;switch(this._reader.Code){case 6:return i.LineTypeName=this._reader.ValueAsString,!0;case 62:{let s=this._reader.ValueAsShort;s<0&&(e.CadObject.IsOn=!1,s=Math.abs(s));let n=new B(s);return n.isByBlock||n.isByLayer?this._builder.Notify(`Wrong index ${s} for layer ${e.CadObject.Name}`,g.Warning):e.CadObject.Color=new B(s),!0}case 347:return i.MaterialHandle=this._reader.ValueAsHandle,!0;case 348:return!0;case 390:return e.CadObject.PlotStyleName=this._reader.ValueAsHandle,!0;case 430:return i.TrueColorName=this._reader.ValueAsString,!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}readLineType(e,t){let i=e;switch(this._reader.Code){case 40:return i.TotalLen=this._reader.ValueAsDouble,!0;case 49:do i.SegmentTemplates.push(this.readLineTypeSegment());while(this._reader.Code===49);return!0;case 73:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}readLineTypeSegment(){let e=new ki.SegmentTemplate;for(e.Segment.length=this._reader.ValueAsDouble,this._reader.ReadNext();this._reader.Code!==49&&this._reader.Code!==0;){switch(this._reader.Code){case 9:e.Segment.text=this._reader.ValueAsString;break;case 44:e.Segment.offset=new C(this._reader.ValueAsDouble,e.Segment.offset.y);break;case 45:e.Segment.offset=new C(e.Segment.offset.x,this._reader.ValueAsDouble);break;case 46:e.Segment.scale=this._reader.ValueAsDouble;break;case 50:e.Segment.rotation=this._reader.ValueAsAngle;break;case 74:e.Segment.shapeFlags=this._reader.ValueAsUShort;break;case 75:e.Segment.shapeNumber=this._reader.ValueAsInt;break;case 340:break;default:this._builder.Notify(`[LineTypeSegment] Unhandled dxf code ${this._reader.Code} with value ${this._reader.ValueAsString}, position ${this._reader.Position}`,g.None);break}this._reader.ReadNext()}return e}readTextStyle(e,t){return this._reader.Code===2?(this._reader.ValueAsString&&(e.CadObject.Name=this._reader.ValueAsString),!0):this.tryAssignCurrentValue(e.CadObject,t)}readUcs(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)}}readView(e,t){let i=e;return this._reader.Code===348?(i.VisualStyleHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t)}readVPort(e,t){let i=e;switch(this._reader.Code){case 65:case 73:return!0;case 348:return i.StyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t)}}};q();D();x();var Cd=class extends k{OwnedObjectsHandlers=new Set;constructor(e){super(e)}};var Bd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;)try{if(this._reader.ValueAsString===d.Block)this.readBlock();else throw new si(`Unexpected token at the BLOCKS table: ${this._reader.ValueAsString}`,this._reader.Position)}catch(e){if(!this._builder.Configuration.Failsafe)throw e;for(this._builder.Notify(`Error while reading a block at line ${this._reader.Position}`,g.Error,e instanceof Error?e:void 0);!(this._reader.DxfCode===p.Start&&this._reader.ValueAsString===d.EndSection)&&!(this._reader.DxfCode===p.Start&&this._reader.ValueAsString===d.Block);)this._reader.ReadNext()}}readBlock(){this._reader.ReadNext();let e=Ae.create(Pr),t=new Pr,i=new Cd(t),s=null,n=null,a=null;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 2:case 3:s=this._reader.ValueAsString,s.toUpperCase()==="$MODEL_SPACE"?s=U.ModelSpaceName:s.toUpperCase()==="$PAPER_SPACE"&&(s=U.PaperSpaceName),n===null&&(n=this._builder.TryGetTableEntry(s),n?n.blockEntity=t:this._builder.Notify(`Block record [${s}] not found at line ${this._reader.Position}`,g.Warning));break;case 330:n===null&&(n=this._builder.TryGetCadObject(this._reader.ValueAsHandle),n?n.blockEntity=t:this._builder.Notify(`Block record with handle [${this._reader.ValueAsString}] not found at line ${this._reader.Position}`,g.Warning));break;default:if(!this.tryAssignCurrentValue(i.CadObject,e.subClasses.get(l.BlockBegin))){let o={value:!1};if(this.readCommonEntityCodes(i,o,e),o.value)continue}break}this._reader.ReadNext()}for(n===null?(n=new U(s??""),n.blockEntity=t,a=new br(n),this._builder.AddTemplate(a),this._builder.BlockRecords.add(n),a.CadObject.name.toUpperCase()===U.ModelSpaceName.toUpperCase()&&(this._builder.ModelSpaceTemplate=a)):(a=this._builder.TryGetObjectTemplate(n.handle),a||(a=new br(n))),a.BlockEntityTemplate=i;this._reader.ValueAsString!==d.EndBlock;){let o=null;try{o=this.readEntity()}catch(h){if(!this._builder.Configuration.Failsafe)throw h;for(this._builder.Notify(`Error while reading a block with name ${n.name} at line ${this._reader.Position}`,g.Error,h instanceof Error?h:void 0);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}if(o!==null)if(this._builder.AddTemplate(o),o.OwnerHandle===null)a.ReferenceTemplates.add(o);else{let h=this._builder.TryGetObjectTemplate(o.OwnerHandle);h?h.OwnedObjectsHandlers.add(o.CadObject.handle):this._builder.OrphanTemplates.push(o)}}this.readBlockEnd(n.blockEnd),this._builder.AddTemplate(i)}readBlockEnd(e){let t=Ae.create(gs),i=new k(e);for(this._reader.DxfCode===p.Start&&this._reader.ReadNext();this._reader.DxfCode!==p.Start;){if(!this.tryAssignCurrentValue(i.CadObject,t.subClasses.get(l.BlockEnd))){let s={value:!1};if(this.readCommonEntityCodes(i,s,t),s.value)continue}this._reader.ReadNext()}this._builder.AddTemplate(i)}};q();D();var yd=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let e=null;try{e=this.readEntity()}catch(i){if(!this._builder.Configuration.Failsafe)throw i;for(this._builder.Notify(`Error while reading an entity at line ${this._reader.Position}`,g.Error,i instanceof Error?i:void 0);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}if(e===null)continue;this._builder.AddTemplate(e);let t=this._builder.TryGetObjectTemplate(e.OwnerHandle);e.OwnerHandle===null?this._builder.ModelSpaceEntities.add(e.CadObject):t?t.OwnedObjectsHandlers.add(e.CadObject.handle):this._builder.OrphanTemplates.push(e)}}};Te();D();x();R();J();x();var dh=class extends O{get subclassMarker(){return l.LinkedData}description=""},hh=class extends dh{get subclassMarker(){return l.LinkedTableData}rows=[];columns=[]},Rd=class extends hh{get subclassMarker(){return l.FormattedTableData}mergedCellRanges=[];cellStyleOverride={}};var qo=class extends Rd{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectTableContent}get subclassMarker(){return l.TableContent}style=null;styleOverride=null};var Td=class extends G{SytleHandle=0;constructor(e){super(e??new qo)}};var Ad=class extends K{HasFrontPlane=!1;InsertTransformRead=!1;constructor(e){super(e??new qt)}};var Ed=class extends Pt{Entries=[];constructor(e){super(e??new Er)}};kr();q();D();x();var Ld=class extends Ji{constructor(e,t){super(e,t)}Read(){for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let e=null;try{e=this.readObject()}catch(t){if(!this._builder.Configuration.Failsafe)throw t;for(this._builder.Notify(`Error while reading an object at line ${this._reader.Position}`,g.Error,t);this._reader.DxfCode!==p.Start;)this._reader.ReadNext()}e!==null&&this._builder.AddTemplate(e)}}readObject(){switch(this.currentSubclass="",this._reader.ValueAsString){case d.BlkRefObjectContextData:return this.readObjectCodes(new ms(new mi),this.readAnnotScaleObjectContextData.bind(this),mi);case d.MTextAttributeObjectContextData:return this.readObjectCodes(new ms(new ps),this.readAnnotScaleObjectContextData.bind(this),ps);case d.ObjectPlaceholder:return this.readObjectCodes(new K(new ci),this.readObjectSubclassMap.bind(this),ci);case d.ObjectDBColor:return this.readObjectCodes(new K(new ui),this.readBookColor.bind(this),ui);case d.ObjectDimensionAssociation:return this.readObjectCodes(new Ii,this.readDimensionAssociation.bind(this),Xe);case d.ObjectDictionary:return this.readObjectCodes(new Vs,this.readDictionary.bind(this),xe);case d.ObjectDictionaryWithDefault:return this.readObjectCodes(new aa,this.readDictionaryWithDefault.bind(this),Cr);case d.ObjectLayout:return this.readObjectCodes(new Un,this.readLayout.bind(this),nt);case d.ObjectPlotSettings:return this.readObjectCodes(new K(new pt),this.readPlotSettings.bind(this),pt);case d.ObjectEvalGraph:return this.readObjectCodes(new Mi,this.readEvaluationGraph.bind(this),yr);case d.ObjectImageDefinition:return this.readObjectCodes(new K(new Tr),this.readObjectSubclassMap.bind(this),Tr);case d.ObjectDictionaryVar:return this.readObjectCodes(new K(new He),this.readObjectSubclassMap.bind(this),He);case d.ObjectPdfDefinition:return this.readObjectCodes(new K(new hi),this.readObjectSubclassMap.bind(this),hi);case d.ObjectSortEntsTable:return this.readSortentsTable();case d.ObjectImageDefinitionReactor:return this.readObjectCodes(new K(new li),this.readObjectSubclassMap.bind(this),li);case d.ObjectProxyObject:return this.readObjectCodes(new Ed,this.readProxyObject.bind(this),Er);case d.ObjectRasterVariables:return this.readObjectCodes(new K(new Ar),this.readObjectSubclassMap.bind(this),Ar);case d.ObjectGroup:return this.readObjectCodes(new ha,this.readGroup.bind(this),Ot);case d.ObjectGeoData:return this.readObjectCodes(new da,this.readGeoData.bind(this),Jt);case d.ObjectMaterial:return this.readObjectCodes(new Zn,this.readMaterial.bind(this),at);case d.ObjectScale:return this.readObjectCodes(new K(new Ge),this.readScale.bind(this),Ge);case d.ObjectTableContent:return this.readObjectCodes(new Td,this.readTableContent.bind(this),qo);case d.ObjectVisualStyle:return this.readObjectCodes(new K(new di),this.readVisualStyle.bind(this),di);case d.ObjectSpatialFilter:return this.readObjectCodes(new Ad,this.readSpatialFilter.bind(this),qt);case d.ObjectMLineStyle:return this.readObjectCodes(new Pi,this.readMLineStyle.bind(this),wt);case d.ObjectMLeaderStyle:return this.readObjectCodes(new Yn,this.readMLeaderStyle.bind(this),$e);case d.ObjectTableStyle:return this.readObjectCodes(new pa,this.readTableStyle.bind(this),Ye);case d.ObjectXRecord:return this.readObjectCodes(new wa,this.readXRecord.bind(this),_t);case d.ObjectBlockRepresentationData:return this.readObjectCodes(new Pa,this.readBlockRepresentationData.bind(this),Rr);case d.ObjectBlockGripLocationComponent:return this.readObjectCodes(new Ma,this.readBlockGripExpression.bind(this),zs);case d.ObjectBlockVisibilityGrip:return this.readObjectCodes(new Ia,this.readBlockVisibilityGrip.bind(this),Va);case d.ObjectBlockVisibilityParameter:return this.readObjectCodes(new Wi,this.readBlockVisibilityParameter.bind(this),Fs);case d.ObjectBlockRotationParameter:return this.readObjectCodes(new Ta,this.readBlockRotationParameter.bind(this),Hs);case d.ObjectBlockRotationGrip:return this.readObjectCodes(new Na,this.readBlockRotationGrip.bind(this),Oa);case d.ObjectBlockRotateAction:return this.readObjectCodes(new ka,this.readBlockRotationAction.bind(this),Us);case d.ObjectField:return this.readObjectCodes(new Wa(new fi),this.readField.bind(this),fi);case d.ObjectFieldList:return this.readObjectCodes(new Ha(new pi),this.readFieldList.bind(this),pi);default:{let e=Ae.create(I),t=null,i=this._builder.DocumentToBuild.classes.tryGetByName(this._reader.ValueAsString);i?(this._builder.Notify(`NonGraphicalObject not supported read as an UnknownNonGraphicalObject: ${this._reader.ValueAsString}`,g.NotImplemented),t=new _a(new pr(i))):this._builder.Notify(`UnknownNonGraphicalObject not supported: ${this._reader.ValueAsString}`,g.NotImplemented),this._reader.ReadNext();do{if(t!==null&&this._builder.KeepUnknownEntities){let s={value:!1};if(this.readCommonCodes(t,s,e),s.value)continue}this._reader.ReadNext()}while(this._reader.DxfCode!==p.Start);return t}}}readObjectCodes(e,t,i){this._reader.ReadNext();let s=Ae.create(typeof i=="string"?i:i.name);for(;this._reader.DxfCode!==p.Start;){if(!t(e,s)){let n={value:!1};if(this.readCommonCodes(e,n,s),n.value)continue}if(this.lockPointer){this.lockPointer=!1;continue}this._reader.Code!==p.Start&&this._reader.ReadNext()}return e}readFieldList(e,t){let i=e;switch(this._reader.Code){case 100:return this._reader.ValueAsString===l.IdSet?(this.currentSubclass=this._reader.ValueAsString,!0):!1;case 90:return this.currentSubclass===l.IdSet;case 330:return this.currentSubclass===l.IdSet?(i.OwnedObjectsHandlers.add(this._reader.ValueAsHandle),!0):!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.FieldList))}}readField(e,t){let i=e;switch(this._reader.Code){case 3:return i.CadObject.fieldCode+=this._reader.ValueAsString,!0;case 98:return!0;case 6:{let s=this._reader.ValueAsString,n=this.readCadValue(new Ht);return i.CadObject.values.set(s,n.CadValue),i.CadValueTemplates.push(n),!0}case 7:{let s=this.readCadValue(new Ht);return i.CadObject.value=s.CadValue,i.CadValueTemplates.push(s),!0}case 331:return i.CadObjectsHandles.push(this._reader.ValueAsHandle),!0;case 360:return i.ChildrenHandles.push(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Field))}}readProxyObject(e,t){let i=e,s=e.CadObject;switch(this._reader.Code){case 90:case 94:case 97:case 71:return!0;case 95:{let n=this._reader.ValueAsInt;return s.version=n&65535,s.maintenanceVersion=n>>16,!0}case 91:{let n=this._reader.ValueAsShort,a=this._builder.DocumentToBuild.classes.tryGetByClassNumber(n);return a&&(s.dxfClass=a),!0}case 161:case 162:return!0;case 310:return s.binaryData===null&&(s.binaryData=new Uint8Array(0)),s.binaryData=this.appendBinaryChunk(s.binaryData,this._reader.ValueAsBinaryChunk),!0;case 311:return s.data===null&&(s.data=new Uint8Array(0)),s.data=this.appendBinaryChunk(s.data,this._reader.ValueAsBinaryChunk),!0;case 330:case 340:case 350:case 360:return i.Entries.push(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.ProxyObject))}}readObjectSubclassMap(e,t){switch(this._reader.Code){default:return this.currentSubclass?this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(this.currentSubclass)):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}}readAnnotScaleObjectContextData(e,t){let i=e;return this._reader.Code===340?(i.scaleHandle=this._reader.ValueAsHandle,!0):this.currentSubclass?this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(this.currentSubclass)):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}readPlotSettings(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.PlotSettings))}}readEvaluationGraph(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 91:for(;this._reader.Code===91;){let n=new Mi.GraphNodeTemplate,a=n.Node;a.index=this._reader.ValueAsInt,this._reader.ExpectedCode(93),a.flags=this._reader.ValueAsInt,this._reader.ExpectedCode(95),a.nextNodeIndex=this._reader.ValueAsInt,this._reader.ExpectedCode(360),n.ExpressionHandle=this._reader.ValueAsHandle,this._reader.ExpectedCode(92),a.data1=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data2=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data3=this._reader.ValueAsInt,this._reader.ExpectedCode(92),a.data4=this._reader.ValueAsInt,this._reader.ReadNext(),i.NodeTemplates.push(n)}return this.lockPointer=!0,!0;case 92:for(;this._reader.Code===92;)this._reader.ExpectedCode(93),this._reader.ExpectedCode(94),this._reader.ExpectedCode(91),this._reader.ExpectedCode(91),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ExpectedCode(92),this._reader.ReadNext();return this.lockPointer=!0,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.EvalGraph))}}readLayout(e,t){let i=e;switch(this._reader.Code){case 330:return e.OwnerHandle!==null?(i.PaperSpaceBlockHandle=this._reader.ValueAsHandle,!0):!1;case 331:return i.LasActiveViewportHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Layout))?!0:this.readPlotSettings(e,t)}}readGroup(e,t){let i=e;switch(this._reader.Code){case 70:return!0;case 340:return i.Handles.add(this._reader.ValueAsHandle),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(e.CadObject.subclassMarker))}}readGeoData(e,t){let i=e;switch(this._reader.Code){case 40:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(i.CadObject.referencePoint.x,this._reader.ValueAsDouble,i.CadObject.referencePoint.z),!0):!1;case 41:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(this._reader.ValueAsDouble,i.CadObject.referencePoint.y,i.CadObject.referencePoint.z),!0):!1;case 42:return i.CadObject.version===We.R2009?(i.CadObject.referencePoint=new c(i.CadObject.referencePoint.x,i.CadObject.referencePoint.y,this._reader.ValueAsDouble),!0):!1;case 46:return i.CadObject.version===We.R2009?(i.CadObject.horizontalUnitScale=this._reader.ValueAsDouble,!0):!1;case 52:if(i.CadObject.version===We.R2009){let s=Math.PI/2-this._reader.ValueAsAngle;return i.CadObject.northDirection=new C(Math.cos(s),Math.sin(s)),!0}return!1;case 93:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++){this._reader.ReadNext();let a=this._reader.ValueAsDouble;this._reader.ReadNext();let o=this._reader.ValueAsDouble;this._reader.ReadNext();let h=this._reader.ValueAsDouble;this._reader.ReadNext();let f=this._reader.ValueAsDouble,b=new la;b.source=new C(a,o),b.destination=new C(h,f),i.CadObject.points.push(b)}return!0}case 96:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++){this._reader.ReadNext();let a=this._reader.ValueAsInt;this._reader.ReadNext();let o=this._reader.ValueAsInt;this._reader.ReadNext();let h=this._reader.ValueAsInt,f=new oa;f.index1=a,f.index2=o,f.index3=h,i.CadObject.faces.push(f)}return!0}case 303:return i.CadObject.coordinateSystemDefinition+=this._reader.ValueAsString,!0;case 3:case 4:case 14:case 24:case 15:case 25:case 43:case 44:case 45:case 94:case 293:case 16:case 26:case 17:case 27:case 54:case 140:case 304:case 292:return!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readMaterial(e,t){let i=e,s=(n,a)=>{let o=[];for(let h=0;h<16;h++)o.push(this._reader.ValueAsDouble),this._reader.ReadNext();return a(o),this.checkObjectEnd(e,t,this.readMaterial.bind(this))};switch(this._reader.Code){case 43:return s(43,n=>i.CadObject.diffuseMatrix=n);case 47:return s(47,n=>i.CadObject.specularMatrix=n);case 49:return s(49,n=>i.CadObject.reflectionMatrix=n);case 142:return s(142,n=>i.CadObject.opacityMatrix=n);case 144:return s(144,n=>i.CadObject.bumpMatrix=n);case 147:return s(147,n=>i.CadObject.refractionMatrix=n);default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readScale(e,t){return this._reader.Code===70?!0:this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Scale))}readLinkedData(e,t){let s=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){default:this.tryAssignCurrentValue(s,t.subClasses.get(l.LinkedData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedData ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readTableContent(e,t){return this._reader.Code===100?this._reader.ValueAsString.toUpperCase()===l.TableContent.toUpperCase()?(this.readTableContentSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.FormattedTableData.toUpperCase()?(this.readFormattedTableDataSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.LinkedTableData.toUpperCase()?(this.readLinkedTableDataSubclass(e,t),this.lockPointer=!0,!0):this._reader.ValueAsString.toUpperCase()===l.LinkedData.toUpperCase()?(this.readLinkedData(e,t),this.lockPointer=!0,!0):!1:!1}readTableContentSubclass(e,t){let i=e,s=i.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;)this._reader.Code===340?i.SytleHandle=this._reader.ValueAsHandle:this.tryAssignCurrentValue(s,t.subClasses.get(l.TableContent))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableContentSubclass ${this._reader.Position}.`,g.None),this._reader.ReadNext()}readFormattedTableDataSubclass(e,t){let s=e.CadObject;this._reader.ReadNext();let n=null;for(;this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 90:break;case 91:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.topRowIndex=this._reader.ValueAsInt;break;case 92:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.leftColumnIndex=this._reader.ValueAsInt;break;case 93:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.bottomRowIndex=this._reader.ValueAsInt;break;case 94:n===null&&(n=new hn,s.mergedCellRanges.push(n)),n.rightColumnIndex=this._reader.ValueAsInt,n=null;break;case 300:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT"&&this.readStyleOverride(new jt(s.cellStyleOverride));break;default:this.tryAssignCurrentValue(s,t.subClasses.get(l.FormattedTableData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableDataSubclass ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readLinkedTableDataSubclass(e,t){let s=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start&&this._reader.DxfCode!==p.Subclass;){switch(this._reader.Code){case 90:case 91:case 92:break;case 300:this._reader.ValueAsString.toUpperCase()===d.ObjectTableColumn.toUpperCase()&&this.readTableColumn();break;case 301:this._reader.ValueAsString.toUpperCase()===d.ObjectTableRow.toUpperCase()&&this.readTableRow();break;default:this.tryAssignCurrentValue(s,t.subClasses.get(l.LinkedTableData))||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableDataSubclass ${this._reader.Position}.`,g.None);break}this._reader.ReadNext()}}readTableColumn(){this._reader.ReadNext();let e=new Rs,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_BEGIN.toUpperCase()?this.readLinkedTableColumn(e):this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataColumn_BEGIN.toUpperCase()?this.readFormattedTableColumn(e):this._reader.ValueAsString.toUpperCase()===d.ObjectTableColumnBegin.toUpperCase()&&(this.readTableColumnData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableColumn method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableRow(){this._reader.ReadNext();let e=new Ts,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_BEGIN.toUpperCase()?this.readLinkedTableRow(e):this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataRow_BEGIN.toUpperCase()?this.readFormattedTableRow(e):this._reader.ValueAsString.toUpperCase()===d.ObjectTableRowBegin.toUpperCase()&&(this.readTableRowData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableRow method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableRowData(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 40:e.height=this._reader.ValueAsDouble;break;case 90:break;case 309:t=this._reader.ValueAsString.toUpperCase()==="TABLEROW_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableRowData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readFormattedTableRow(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:break;case 1:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"&&this.readStyleOverride(new jt(e.cellStyleOverride));break;case 309:t=this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATAROW_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableRow method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readTableColumnData(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()==="TABLECOLUMN_BEGIN")break;t=!0;break;case 40:e.width=this._reader.ValueAsDouble;break;case 90:break;case 309:t=this._reader.ValueAsString.toUpperCase()==="TABLECOLUMN_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableColumnData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readLinkedTableColumn(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_BEGIN.toUpperCase())break;t=!0;break;case 91:e.customData=this._reader.ValueAsInt;break;case 300:e.name=this._reader.ValueAsString;break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataColumn_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableColumn method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readLinkedTableRow(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_BEGIN.toUpperCase())break;break;case 90:break;case 91:e.customData=this._reader.ValueAsInt;break;case 300:this._reader.ValueAsString.toUpperCase()===d.ObjectCell.toUpperCase()&&this.readCell();break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.LinkedTableDataRow_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableRow method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readCell(){this._reader.ReadNext();let e=new ys,t=!1;for(;this._reader.DxfCode!==p.Start;){if(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()==="LINKEDTABLEDATACELL_BEGIN"?this.readLinkedTableCell(e):this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATACELL_BEGIN"?this.readFormattedTableCell(e):this._reader.ValueAsString.toUpperCase()==="TABLECELL_BEGIN"&&(this.readTableCellData(e),t=!0):this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCell method.`,g.None),t)return e;this._reader.ReadNext()}return e}readTableCellData(e){let t=V.Create(e.constructor,"TABLECELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 40:case 41:break;case 309:i=this._reader.ValueAsString.toUpperCase()==="TABLECELL_END";break;case 330:break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readTableCellData ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readFormattedTableCell(e){let t=V.Create(e.constructor,"FORMATTEDTABLEDATACELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:if(this._reader.ValueAsString.toUpperCase()==="CELLTABLEFORMAT"){this.readCellTableFormat(e);continue}break;case 309:i=this._reader.ValueAsString.toUpperCase()==="FORMATTEDTABLEDATACELL_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableCell ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readCellTableFormat(e){let t=V.Create(e.constructor,"CELLTABLEFORMAT");this._reader.ReadNext();let i=!1;for(;this._reader.Code===1&&(this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"?this.readStyleOverride(new jt(e.styleOverride)):this._reader.ValueAsString.toUpperCase()==="CELLSTYLE_BEGIN"?this.readCellStyle(new jt):this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellTableFormat ${this._reader.Position}.`,g.None),!i);)this._reader.ReadNext()}readCellStyle(e){this._reader.ReadNext();let t=!1;for(;this._reader.Code!==1&&(this._reader.Code===309?t=this._reader.ValueAsString.toUpperCase()==="CELLSTYLE_END":this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellStyle ${this._reader.Position}.`,g.None),!t);)this._reader.ReadNext()}readLinkedTableCell(e){let t=V.Create(e.constructor,"LINKEDTABLEDATACELL_BEGIN");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 95:break;case 301:this._reader.ValueAsString.toUpperCase()===d.CustomData.toUpperCase()&&this.readCustomData();break;case 302:this._reader.ValueAsString.toUpperCase()==="CONTENT"&&this.readLinkedTableCellContent();break;case 309:i=this._reader.ValueAsString.toUpperCase()==="LINKEDTABLEDATACELL_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableCell ${this._reader.Position}.`,g.None);break}if(i)break;this._reader.ReadNext()}}readLinkedTableCellContent(){let e=new cn,t=new fa(e),i=V.Create(e.constructor,"CONTENT");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start&&(this._reader.Code===1?this._reader.ValueAsString.toUpperCase()==="FORMATTEDCELLCONTENT_BEGIN"?(this.readFormattedCellContent(),s=!0):this._reader.ValueAsString.toUpperCase()==="CELLCONTENT_BEGIN"&&this.readCellContent(t):this.tryAssignCurrentValue(e,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readLinkedTableCellContent ${this._reader.Position}.`,g.None),!s);)this._reader.ReadNext();return t}readCellContent(e){let t=e.Content,i=V.Create(t.constructor,"CELLCONTENT_BEGIN");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 91:break;case 300:if(this._reader.ValueAsString.toUpperCase()==="VALUE"){let n=this.readCadValue(t.cadValue);e.CadValueTemplate=n}break;case 309:s=this._reader.ValueAsString.toUpperCase()==="CELLCONTENT_END";break;case 340:e.BlockRecordHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellContent ${this._reader.Position}.`,g.None);break}if(s)break;this._reader.ReadNext()}}readFormattedCellContent(){let e=new Bs,t=new ma(e),i=V.Create(e.constructor,"FORMATTEDCELLCONTENT");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT"&&this.readContentFormat(t);break;case 309:s=this._reader.ValueAsString.toUpperCase()==="FORMATTEDCELLCONTENT_END";break;default:this.tryAssignCurrentValue(e,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedCellContent method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readContentFormat(e){let t=e.Format,i=V.Create(t.constructor,"CONTENTFORMAT_BEGIN");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:if(this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT_BEGIN")break;break;case 309:s=this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT_END";break;case 340:e.TextStyleHandle=this._reader.ValueAsHandle;break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readContentFormat method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readFormattedTableColumn(e){this._reader.ReadNext();let t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 300:break;case 1:this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_BEGIN"&&this.readStyleOverride(new jt(e.cellStyleOverride));break;case 309:t=this._reader.ValueAsString.toUpperCase()===d.FormattedTableDataColumn_END.toUpperCase();break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readFormattedTableColumn method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readStyleOverride(e){let t=e.Format,i=V.Create(t.constructor,"TABLEFORMAT_STYLE"),s=V.Create(Bs,"TABLEFORMAT_BEGIN");this._reader.ReadNext();let n=!1,a=yi.Unknown;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 95:a=this._reader.ValueAsInt;break;case 1:break;case 300:this._reader.ValueAsString.toUpperCase()==="CONTENTFORMAT"&&this.readContentFormat(new ma(new Bs));break;case 301:this._reader.ValueAsString.toUpperCase()==="MARGIN"&&this.readCellMargin(e);break;case 302:if(this._reader.ValueAsString.toUpperCase()==="GRIDFORMAT"){let o=new Ri(a);this.readGridFormat(e,o)}break;case 309:n=this._reader.ValueAsString.toUpperCase()==="TABLEFORMAT_END";break;default:!this.tryAssignCurrentValue(t,i)&&!this.tryAssignCurrentValue(t,s)&&this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readStyleOverride method.`,g.None);break}if(n)break;this._reader.ReadNext()}}readGridFormat(e,t){let i=V.Create(t.constructor,"CellBorder");this._reader.ReadNext();let s=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 62:t.color=new B(this._reader.ValueAsShort);break;case 92:t.lineWeight=this._reader.ValueAsInt;break;case 93:t.isInvisible=this._reader.ValueAsBool;break;case 340:e.BorderLinetypePairs.push([t,this._reader.ValueAsHandle]);break;case 309:s=this._reader.ValueAsString.toUpperCase()==="GRIDFORMAT_END";break;default:this.tryAssignCurrentValue(t,i)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readGridFormat method.`,g.None);break}if(s)break;this._reader.ReadNext()}}readCellMargin(e){let t=e.Format;this._reader.ReadNext();let i=!1,s=0;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 40:switch(s){case 0:t.verticalMargin=this._reader.ValueAsDouble;break;case 1:t.horizontalMargin=this._reader.ValueAsDouble;break;case 2:t.bottomMargin=this._reader.ValueAsDouble;break;case 3:t.rightMargin=this._reader.ValueAsDouble;break;case 4:t.marginHorizontalSpacing=this._reader.ValueAsDouble;break;case 5:t.marginVerticalSpacing=this._reader.ValueAsDouble;break}s++;break;case 309:i=this._reader.ValueAsString.toUpperCase()==="CELLMARGIN_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCellMargin method.`,g.None);break}if(i)break;this._reader.ReadNext()}}readCustomData(){this._reader.ReadNext();let e=0,t=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:break;case 90:e=this._reader.ValueAsInt;break;case 300:break;case 301:this._reader.ValueAsString.toUpperCase()==="DATAMAP_VALUE"&&this.readDataMapValue();break;case 309:t=this._reader.ValueAsString.toUpperCase()==="DATAMAP_END";break;default:this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readCustomData method.`,g.None);break}if(t)break;this._reader.ReadNext()}}readDataMapValue(){let e=new Ht,t=V.Create(e.constructor,"DATAMAP_VALUE");this._reader.ReadNext();let i=!1;for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 11:case 21:case 31:case 91:case 92:case 140:case 310:break;case 304:i=this._reader.ValueAsString.toUpperCase()==="ACVALUE_END";break;default:this.tryAssignCurrentValue(e,t)||this._builder.Notify(`Unhandled dxf code ${this._reader.Code} value ${this._reader.ValueAsString} at readDataMapValue method.`,g.None);break}if(i)break;this._reader.ReadNext()}}readVisualStyle(e,t){switch(this._reader.Code){case 176:case 177:case 420:return!0;default:return!0}}readSpatialFilter(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 10:return s.boundaryPoints.push(new C(this._reader.ValueAsDouble,0)),!0;case 20:{let n=s.boundaryPoints[s.boundaryPoints.length-1];return s.boundaryPoints.push(new C(n.x,this._reader.ValueAsDouble)),!0}case 40:{s.clipFrontPlane&&!i.HasFrontPlane&&(s.frontDistance=this._reader.ValueAsDouble,i.HasFrontPlane=!0);let n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];for(let a=0;a<12;a++)n[a]=this._reader.ValueAsDouble,a<11&&this._reader.ReadNext();return i.InsertTransformRead?(s.insertTransform=new it(n),i.InsertTransformRead=!0):s.inverseInsertTransform=new it(n),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.SpatialFilter))}}readMLineStyle(e,t){let i=e,s=e.CadObject;switch(this._reader.Code){case 6:{let n=i.ElementTemplates[i.ElementTemplates.length-1];return n&&(n.LineTypeName=this._reader.ValueAsString),!0}case 49:{let n=new js,a=new Pi.ElementTemplate(n);return n.offset=this._reader.ValueAsDouble,i.ElementTemplates.push(a),s.addElement(n),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readTableStyle(e,t){let i=e,s=i.CadObject,n=i.CurrentCellStyleTemplate?.CellStyle??null;switch(this._reader.Code){case 7:return i.CreateCurrentCellStyleTemplate(),i.CurrentCellStyleTemplate.TextStyleName=this._reader.ValueAsString,!0;case 94:return n&&(n.alignment=this._reader.ValueAsInt),!0;case 62:return n&&(n.color=new B(this._reader.ValueAsShort)),!0;case 63:return n&&(n.backgroundColor=new B(this._reader.ValueAsShort)),!0;case 140:return n&&(n.textHeight=this._reader.ValueAsDouble),!0;case 170:return n&&(n.cellAlignment=this._reader.ValueAsShort),!0;case 283:return n&&(n.isFillColorOn=this._reader.ValueAsBool),!0;case 90:return n&&(n.cellStyleType=this._reader.ValueAsShort),!0;case 91:return n&&(n.styleClass=this._reader.ValueAsShort),!0;case 1:return!0;case 274:return n&&(n.topBorder.lineWeight=this._reader.ValueAsInt),!0;case 275:return n&&(n.horizontalInsideBorder.lineWeight=this._reader.ValueAsInt),!0;case 276:return n&&(n.bottomBorder.lineWeight=this._reader.ValueAsInt),!0;case 277:return n&&(n.leftBorder.lineWeight=this._reader.ValueAsInt),!0;case 278:return n&&(n.verticalInsideBorder.lineWeight=this._reader.ValueAsInt),!0;case 279:return n&&(n.rightBorder.lineWeight=this._reader.ValueAsInt),!0;case 284:return n&&(n.topBorder.isInvisible=this._reader.ValueAsBool),!0;case 285:return n&&(n.horizontalInsideBorder.isInvisible=this._reader.ValueAsBool),!0;case 286:return n&&(n.bottomBorder.isInvisible=this._reader.ValueAsBool),!0;case 287:return n&&(n.leftBorder.isInvisible=this._reader.ValueAsBool),!0;case 288:return n&&(n.verticalInsideBorder.isInvisible=this._reader.ValueAsBool),!0;case 289:return n&&(n.rightBorder.isInvisible=this._reader.ValueAsBool),!0;case 64:return n&&(n.topBorder.color=new B(this._reader.ValueAsShort)),!0;case 65:return n&&(n.horizontalInsideBorder.color=new B(this._reader.ValueAsShort)),!0;case 66:return n&&(n.bottomBorder.color=new B(this._reader.ValueAsShort)),!0;case 67:return n&&(n.leftBorder.color=new B(this._reader.ValueAsShort)),!0;case 68:return n&&(n.verticalInsideBorder.color=new B(this._reader.ValueAsShort)),!0;case 69:return n&&(n.rightBorder.color=new B(this._reader.ValueAsShort)),!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readMLeaderStyle(e,t){let i=e;switch(this._reader.Code){case 179:return!0;case 340:return i.LeaderLineTypeHandle=this._reader.ValueAsHandle,!0;case 342:return i.MTextStyleHandle=this._reader.ValueAsHandle,!0;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readEvaluationExpression(e,t){let i=e;return this._reader.Code===1?(this._reader.ExpectedCode(70),this._reader.ExpectedCode(140),!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.EvalGraphExpr))}readBlockElement(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockElement))?!0:this.readEvaluationExpression(e,t)}}readBlockAction(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockAction))?!0:this.readBlockElement(e,t)}}readBlockActionBasePt(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockActionBasePt))?!0:this.readBlockAction(e,t)}}readBlockRotationAction(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockRotationAction))?!0:this.readBlockActionBasePt(e,t)}}readBlockParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockParameter))?!0:this.readBlockElement(e,t)}}readBlock1PtParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Block1PtParameter))?!0:this.readBlockParameter(e,t)}}readBlock2PtParameter(e,t){return this._reader.Code===91||this.tryAssignCurrentValue(e.CadObject,t)?!0:this.readBlockParameter(e,t)}readBlockVisibilityParameter(e,t){let i=e;switch(this._reader.Code){case 92:{let s=this._reader.ValueAsInt;for(let n=0;n<s;n++)this._reader.ReadNext(),i.StateTemplates.push(this.readState());return!0}case 93:if(this.currentSubclass===l.BlockVisibilityParameter){let s=this._reader.ValueAsInt;for(let n=0;n<s;n++)this._reader.ReadNext(),i.entityHandles.push(this._reader.ValueAsHandle);return!0}return!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockVisibilityParameter))?!0:this.readBlock1PtParameter(e,t)}}readBlockRotationParameter(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t)?!0:this.readBlock2PtParameter(e,t)}}readState(){let e=new Ea,t=new Wi.StateTemplate(e),i=[303,94,95];for(;this._reader.DxfCode!==p.Start;){let s=i.indexOf(this._reader.Code);switch(s>=0&&i.splice(s,1),this._reader.Code){case 303:e.name=this._reader.ValueAsString;break;case 94:{let n=this._reader.ValueAsInt;for(let a=0;a<n;a++)this._reader.ReadNext(),t.entityHandles.add(this._reader.ValueAsHandle);break}case 95:{let n=this._reader.ValueAsInt;for(let a=0;a<n;a++)this._reader.ReadNext(),t.expressionHandles.add(this._reader.ValueAsHandle);break}default:return t}if(i.length===0)break;this._reader.ReadNext()}return t}readBlockGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockGrip))?!0:this.readBlockElement(e,t)}}readBlockRotationGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockRotationGrip))?!0:this.readBlockGrip(e,t)}}readBlockVisibilityGrip(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockVisibilityGrip))?!0:this.readBlockGrip(e,t)}}readBlockRepresentationData(e,t){let i=e;return this._reader.Code===340?(i.BlockHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}readBlockGripExpression(e,t){switch(this._reader.Code){default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.BlockGripExpression))?!0:this.readEvaluationExpression(e,t)}}readXRecord(e,t){let i=e;return this._reader.Code===100?this._reader.ValueAsString===l.XRecord?(this.readXRecordEntries(i),!0):!1:this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.XRecord))}readXRecordEntries(e){let t=e.CadObject;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start;){switch(this._reader.GroupCodeValue){case _.Point3D:{let i=this._reader.Code,s=this._reader.ValueAsDouble;this._reader.ReadNext();let n=this._reader.ValueAsDouble;this._reader.ReadNext();let a=this._reader.ValueAsDouble,o=new c(s,n,a);t.CreateEntry(i,o);break}case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:e.AddHandleReference(this._reader.Code,this._reader.ValueAsHandle);break;default:t.CreateEntry(this._reader.Code,this._reader.Value);break}this._reader.ReadNext()}}readBookColor(e,t){let s=e.CadObject;return this._reader.Code===430?(s.name=this._reader.ValueAsString,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.DbColor))}readDimensionAssociation(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 1:return this._reader.ValueAsString===Xe.OsnapPointRefClassName?(s.associativityFlags&he.FirstPointReference)!==0&&s.firstPointRef===null?(s.firstPointRef=new fs,this.readOsnapPointRef(s.firstPointRef),this.lockPointer=!0,!0):(s.associativityFlags&he.SecondPointReference)!==0&&s.secondPointRef===null?(s.secondPointRef=new fs,this.readOsnapPointRef(s.secondPointRef),this.lockPointer=!0,!0):(s.associativityFlags&he.ThirdPointReference)!==0&&s.thirdPointRef===null?(s.thirdPointRef=new fs,this.readOsnapPointRef(s.thirdPointRef),this.lockPointer=!0,!0):((s.associativityFlags&he.FourthPointReference)!==0&&s.fourthPointRef===null&&(s.fourthPointRef=new fs,this.readOsnapPointRef(s.fourthPointRef),this.lockPointer=!0),!0):!1;case 330:return e.OwnerHandle!==null?(i.DimensionHandle=this._reader.ValueAsHandle,!0):!1;default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(i.CadObject.subclassMarker))}}readOsnapPointRef(e){let t=new Ii.OsnapPointRefTemplate(e);this._reader.ReadNext();let i=!1;for(;!i;){switch(this._reader.Code){case 10:e.osnapPoint=new c(this._reader.ValueAsDouble,e.osnapPoint.Y,e.osnapPoint.Z);break;case 20:e.osnapPoint=new c(e.osnapPoint.X,this._reader.ValueAsDouble,e.osnapPoint.Z);break;case 30:e.osnapPoint=new c(e.osnapPoint.X,e.osnapPoint.Y,this._reader.ValueAsDouble);break;case 40:e.geometryParameter=this._reader.ValueAsDouble;break;case 72:e.objectOsnapType=this._reader.ValueAsShort;break;case 73:e.subentType=this._reader.ValueAsShort;break;case 74:e.intersectionSubType=this._reader.ValueAsShort;break;case 75:e.hasLastPointRef=this._reader.ValueAsBool;break;case 91:e.gsMarker=this._reader.ValueAsInt;break;case 92:e.intersectionGsMarker=this._reader.ValueAsInt;break;case 331:t.ObjectHandle=this._reader.ValueAsHandle;break;case 302:case 332:break;default:i=!0;continue}this._reader.ReadNext()}return t}readDictionary(e,t){let i=e,s=i.CadObject;switch(this._reader.Code){case 280:return s.hardOwnerFlag=this._reader.ValueAsBool,!0;case 281:return s.clonningFlags=this._reader.Value,!0;case 3:return i.Entries.set(this._reader.ValueAsString,null),!0;case 350:case 360:{let n=Array.from(i.Entries.keys()),a=n[n.length-1];return i.Entries.set(a,this._reader.ValueAsHandle),!0}default:return this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.Dictionary))}}readDictionaryWithDefault(e,t){let i=e;return this._reader.Code===340?(i.DefaultEntryHandle=this._reader.ValueAsHandle,!0):this.tryAssignCurrentValue(e.CadObject,t.subClasses.get(l.DictionaryWithDefault))?!0:this.readDictionary(e,t)}readSortentsTable(){let e=new Br,t=new ca(e);this._reader.ReadNext(),this.readCommonObjectData(t),this._reader.ReadNext();let i={item1:null,item2:null};for(;this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 5:i.item1=this._reader.ValueAsHandle;break;case 330:t.BlockOwnerHandle=this._reader.ValueAsHandle;break;case 331:i.item2=this._reader.ValueAsHandle;break;default:this._builder.Notify(`Group Code not handled ${this._reader.GroupCodeValue} for SortEntitiesTable, code : ${this._reader.Code} | value : ${this._reader.ValueAsString}`);break}i.item1!==null&&i.item2!==null&&(t.Values.push([i.item1,i.item2]),i={item1:null,item2:null}),this._reader.ReadNext()}return t}appendBinaryChunk(e,t){if(e===null||e.length===0)return new Uint8Array(t);let i=new Uint8Array(e.length+t.length);return i.set(e,0),i.set(t,e.length),i}};q();D();var Kh=class r extends Ln{_version=m.Unknown;_builder;_reader;get fileStream(){return this._fileStream instanceof Uint8Array?this._fileStream:new Uint8Array(this._fileStream)}constructor(e,t){super(e,t),this.Configuration=new gd}IsBinary(){return r.IsBinaryStream(this.fileStream)}static IsBinaryStream(e,t=!1){let i=ws.SentinelBytes;if(e.length<i.length)return!1;for(let s=0;s<i.length;s++)if(e[s]!==i[s])return!1;return!0}static ReadFromStream(e,t){let i=new r(e,t),s=i.Read();return i.Dispose(),s}static ReadFromStreamWithConfig(e,t,i){let s=new r(e,i);s.Configuration=t;let n=s.Read();return s.Dispose(),n}Read(){for(this._document=new xs,this._document.summaryInfo=new Or,this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this);this._reader.ValueAsString!==d.EndOfFile;){if(this._reader.ValueAsString!==d.BeginSection){this._reader.ReadNext();continue}else this._reader.ReadNext();switch(this._reader.ValueAsString){case d.HeaderSection:this._document.header=this.ReadHeader(),this._document.header.Document=this._document,this._builder.InitialHandSeed=this._document.header.HandleSeed;break;case d.ClassesSection:this._document.classes=this.readClasses();break;case d.TablesSection:this.readTables();break;case d.BlocksSection:this.readBlocks();break;case d.EntitiesSection:this.readEntities();break;case d.ObjectsSection:this.readObjects();break;default:this.triggerNotification(`Section not implemented ${this._reader.ValueAsString}`,g.NotImplemented);break}this._reader.ReadNext()}return this._document.header===null&&(this._document.header=new lt(this._document)),this._builder.BuildDocument(),this._document}ReadHeader(){this._reader=this.goToSection(d.HeaderSection);let e=new lt,t=lt.GetHeaderMap();for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;){let i=this._reader.ValueAsString;if(i==null||!t.has(i)){this._reader.ReadNext();continue}let s=t.get(i),n=new Array(s.DxfCodes.length);for(let a=0;a<s.DxfCodes.length;a++){if(this._reader.ReadNext(),this._reader.DxfCode===p.CLShapeText){let o=s.DxfCodes[a];switch(Be.transformValue(o)){case _.Bool:n[a]=!1;break;case _.Byte:case _.Int16:case _.Int32:case _.Int64:case _.Double:case _.Point3D:n[a]=0;break;case _.None:case _.String:default:n[a]=void 0;break}break}n[a]=this._reader.Value}try{e.SetValue(i,n)}catch(a){this.triggerNotification(`Invalid value for header variable ${i} | ${n[0]}`,g.Warning,a instanceof Error?a:void 0)}this._reader.DxfCode!==p.CLShapeText&&this._reader.ReadNext()}return e}ReadTables(){return this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this),this.readTables(),this._document.header=new lt(this._document),this._builder.RegisterTables(),this._builder.BuildTables(),this._document}ReadEntities(){return this._reader=this._reader??this.getReader(),this._builder=new eo(this._version,this._document,this.Configuration),this._builder.OnNotification=this.onNotificationEvent.bind(this),this.readEntities(),this._builder.BuildEntities()}Dispose(){super.Dispose(),this.Configuration.ClearCache&&Ae.clearCache()}readClasses(){this._reader=this.goToSection(d.ClassesSection);let e=new gi;for(this._reader.ReadNext();this._reader.ValueAsString!==d.EndSection;)if(this._reader.ValueAsString===d.ClassEntry){let t=this.readClass();t.classNumber<500&&(t.classNumber=500+e.count),e.addOrUpdate(t)}else this._reader.ReadNext();return e}readClass(){let e=new F;for(this._reader.ReadNext();this._reader.DxfCode!==p.Start;){switch(this._reader.Code){case 1:e.dxfName=this._reader.ValueAsString;break;case 2:e.cppClassName=this._reader.ValueAsString;break;case 3:e.applicationName=this._reader.ValueAsString;break;case 90:e.proxyFlags=this._reader.ValueAsInt;break;case 91:e.instanceCount=this._reader.ValueAsInt;break;case 280:e.wasZombie=this._reader.ValueAsBool;break;case 281:e.isAnEntity=this._reader.ValueAsBool;break;default:break}this._reader.ReadNext()}return e}readTables(){this._reader=this.goToSection(d.TablesSection),new Sd(this._reader,this._builder).Read()}readBlocks(){this._reader=this.goToSection(d.BlocksSection),new Bd(this._reader,this._builder).Read()}readEntities(){this._reader=this.goToSection(d.EntitiesSection),new yd(this._reader,this._builder).Read()}readObjects(){this._reader=this.goToSection(d.ObjectsSection),new Ld(this._reader,this._builder).Read()}getReader(){this._version=m.Unknown;let e=this.fileStream,t=r.IsBinaryStream(e),i=!1;if(t&&e.length>ws.SentinelBytes.length){let n=e[ws.SentinelBytes.length];n!==void 0&&n!==0&&(i=!0)}let s=this.createReader(t,i);if(!s.Find(d.HeaderSection))return this.triggerNotification("Header section not found, using a generic reader.",g.Warning),this._version=m.Unknown,s.Start(),s;for(;s.ValueAsString!==d.EndSection;){if(s.ValueAsString==="$ACADVER"){if(s.ReadNext(),this._version=Z.getVersionFromName(s.ValueAsString),this._version>=m.AC1021)break;if(this._version<m.AC1002)throw this._version===m.Unknown?new Me:new Me(this._version)}s.ReadNext()}return this._version===m.Unknown&&this.triggerNotification("Dxf version not found, using a generic reader.",g.Warning),this.createReader(t,i)}goToSection(e){return this._reader=this._reader??this.getReader(),this._reader.ValueAsString===e?this._reader:(this._reader.Find(e),this._reader)}createReader(e,t){let i=this.fileStream;return e?t?new Dd(i):new ws(i):new xd(i)}createDefaultConfiguration(){return{}}};var ro=class{WriteOptional=!1;Write(e,t,i){if(t==null)return;let s=e;if(i&&i.dxfProperties.has(s)){let n=i.dxfProperties.get(s);if((n.referenceType&Lr.Optional)!==0&&!this.WriteOptional)return;(n.referenceType&Lr.IsAngle)!==0&&(t=Q.RadToDeg(t))}if(this.writeDxfCode(s),typeof t=="string"){let n=t.replace(/\^/g,"^ ").replace(/\n/g,"^J").replace(/\r/g,"^M").replace(/\t/g,"^I");this.writeValue(s,n)}else this.writeValue(s,t)}WriteVector(e,t,i){let s=e;for(let n=0;n<t.dimension;n++)this.Write(s+n*10,t[n],i)}WriteCmColor(e,t,i){if(Be.transformValue(e)===_.Int16)this.Write(e,t.getApproxIndex()&65535);else{let s=new Uint8Array(4);t.isTrueColor?(s[0]=t.b,s[1]=t.g,s[2]=t.r,s[3]=194):(s[3]=193,s[0]=t.index);let n=new DataView(s.buffer);this.Write(e,n.getInt32(0,!0),i)}}WriteHandle(e,t,i){t!=null&&this.Write(e,t.handle,i)}WriteIfNotDefault(e,t,i,s){t!==i&&this.Write(e,t,s)}WriteName(e,t,i){t!=null&&this.Write(e,t.name,i)}WriteTrueColor(e,t,i){let s=new Uint8Array(4);s[0]=t.b,s[1]=t.g,s[2]=t.r,s[3]=0;let n=new DataView(s.buffer);this.Write(e,n.getInt32(0,!0),i)}};var kd=class extends ro{_writer;_lines=[];constructor(e){super(),this._writer=e}Close(){this._writer.close&&this._writer.close()}Dispose(){this.Close()}Flush(){this._writer.flush&&this._writer.flush()}writeDxfCode(e){let t;e<10?t=` ${e}`:e<100?t=` ${e}`:t=`${e}`,this._writer.write(t+`
7
7
  `)}writeValue(e,t){let i=Be.transformValue(e),s;switch(i){case _.String:case _.Comment:case _.ExtendedDataString:s=`${t}`;break;case _.Point3D:case _.Double:case _.ExtendedDataDouble:s=this.formatDouble(t);break;case _.Byte:case _.Int16:case _.ExtendedDataInt16:s=`${Math.trunc(t)&65535}`,t<0&&i===_.Int16&&(s=`${Math.trunc(t)}`);break;case _.Int32:case _.ExtendedDataInt32:s=`${Math.trunc(t)}`;break;case _.Int64:s=`${t}`;break;case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:s=t.toString(16).toUpperCase();break;case _.Bool:s=t?"1":"0";break;case _.Chunk:case _.ExtendedDataChunk:{let n=t,a="";for(let o=0;o<n.length;o++)a+=n[o].toString(16).toUpperCase().padStart(2,"0");s=a;break}default:s=`${t}`;break}this._writer.write(s+`
8
- `)}formatDouble(e){if(typeof e!="number"||isNaN(e))return"0.0";let t=e.toFixed(16);return t.includes(".")&&(t=t.replace(/0+$/,""),t.endsWith(".")&&(t+="0")),t}};var Pd=class r extends ro{static SentinelBytes=new Uint8Array([65,117,116,111,67,65,68,32,66,105,110,97,114,121,32,68,88,70,13,10,26,0]);_writer;_buffer;_position=0;_stream;constructor(e){super(),this._stream=e,this._buffer=new Uint8Array(65536),this._writer=new DataView(this._buffer.buffer),this._stream.write(r.SentinelBytes)}Close(){this.flushBuffer(),this._stream.close&&this._stream.close()}Dispose(){this.Close()}Flush(){this.flushBuffer(),this._stream.flush&&this._stream.flush()}writeDxfCode(e){this.ensureCapacity(2),this._writer.setInt16(this._position,e,!0),this._position+=2}writeValue(e,t){switch(Be.transformValue(e)){case _.String:case _.Comment:case _.ExtendedDataString:{let s=`${t}`,n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}case _.Point3D:case _.Double:case _.ExtendedDataDouble:this.ensureCapacity(8),this._writer.setFloat64(this._position,t,!0),this._position+=8;break;case _.Byte:this.ensureCapacity(1),this._buffer[this._position++]=t&255;break;case _.Int16:case _.ExtendedDataInt16:this.ensureCapacity(2),this._writer.setInt16(this._position,t,!0),this._position+=2;break;case _.Int32:case _.ExtendedDataInt32:this.ensureCapacity(4),this._writer.setInt32(this._position,t,!0),this._position+=4;break;case _.Int64:this.ensureCapacity(8),this._writer.setInt32(this._position,t&4294967295,!0),this._writer.setInt32(this._position+4,Math.floor(t/4294967296),!0),this._position+=8;break;case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:{let s=t.toString(16).toUpperCase(),n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}case _.Bool:this.ensureCapacity(1),this._buffer[this._position++]=t?1:0;break;case _.Chunk:case _.ExtendedDataChunk:{let s=t;this.ensureCapacity(1+s.length),this._buffer[this._position++]=s.length,this._buffer.set(s,this._position),this._position+=s.length;break}default:{let s=`${t}`,n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}}}ensureCapacity(e){this._position+e>this._buffer.length&&(this.flushBuffer(),e>this._buffer.length&&(this._buffer=new Uint8Array(e*2),this._writer=new DataView(this._buffer.buffer)))}flushBuffer(){this._position>0&&(this._stream.write(this._buffer.slice(0,this._position)),this._position=0)}};q();D();x();wn();var Nt=class{OnNotification=null;get Version(){return this._document.header.Version}Holder;Configuration;_writer;_document;constructor(e,t,i,s){this._writer=e,this._document=t,this.Holder=i,this.Configuration=s}Write(){this._writer.Write(p.Start,d.BeginSection),this._writer.Write(p.SymbolTableName,this.SectionName),this.writeSection(),this._writer.Write(p.Start,d.EndSection)}writeCadValue(e){switch(this._writer.Write(93,e.flags),this._writer.Write(90,e.valueType),e.valueType){case W.Unknown:this._writer.Write(91,0);break;case W.Double:this._writer.Write(140,Number(e.value));break;case W.Date:this._writer.Write(91,0);break;case W.General:case W.String:this.writeLongTextValue(1,2,e.value);break;case W.Point2D:case W.Point3D:this._writer.WriteVector(11,e.value);break;case W.Long:this._writer.Write(91,Number(e.value));break;case W.Handle:{let t=e.value;t&&this._writer.WriteHandle(330,t);break}case W.Buffer:case W.ResultBuffer:this._writer.Write(91,0);break}}writeCommonObjectData(e){if(e instanceof re?this._writer.Write(p.DimVarHandle,e.handle):this._writer.Write(p.Handle,e.handle),e.xDictionary!==null&&(this._writer.Write(p.ControlString,d.DictionaryToken),this._writer.Write(p.HardOwnershipId,e.xDictionary.handle),this._writer.Write(p.ControlString,"}"),this.Holder.Objects.push(e.xDictionary)),e.cleanReactors(),e.reactors.length>0){this._writer.Write(p.ControlString,d.ReactorsToken);for(let t of e.reactors)this._writer.Write(p.SoftPointerId,t.handle);this._writer.Write(p.ControlString,"}")}this._writer.Write(p.SoftPointerId,e.owner.handle)}writeExtendedData(e){if(!(e===null||!this.Configuration.WriteXData))for(let[t,i]of e){this._writer.Write(p.ExtendedDataRegAppName,t.name);for(let s of i.records)if(s instanceof Fi)this._writer.Write(s.code,s.value);else if(s instanceof Pe)this._writer.Write(s.code,s.value);else if(s instanceof Yi)this._writer.Write(s.code,s.value);else if(s instanceof Xi)this._writer.Write(s.code,s.value);else if(s instanceof Zi)this._writer.Write(s.code,s.value);else if(s instanceof zi)this._writer.Write(s.code,s.value);else if(s instanceof vi)this._writer.Write(s.code,s.value);else if(s instanceof Ui)this._writer.Write(s.code,s.value);else if(s instanceof $i)this._writer.WriteVector(s.code,s.value);else if(s instanceof Gi)this._writer.WriteVector(s.code,s.value);else if(s instanceof Ki)this._writer.WriteVector(s.code,s.value);else if(s.ResolveReference){let n=s,a=n.value;n.resolveReference(this._document)===null&&(a=0),this._writer.Write(p.ExtendedDataHandle,a)}else if(s instanceof Hi)this._writer.Write(s.code,s.value);else throw new Error(`ExtendedDataRecord of type ${s.constructor.name} not supported.`)}}writeCommonEntityData(e){let t=V.Create(A);if(this._writer.Write(p.Subclass,l.Entity),this._writer.Write(8,e.layer?.name??"0"),this._writer.Write(6,e.lineType?.name??"ByLayer"),e.bookColor!==null?(this._writer.Write(62,e.bookColor.Color.GetApproxIndex()),this._writer.WriteTrueColor(420,e.bookColor.Color),this._writer.Write(430,e.bookColor.Name)):e.color.isTrueColor?this._writer.WriteTrueColor(420,e.color):this._writer.Write(62,e.color.index),e.transparency.value>=0&&this._writer.Write(440,Ke.toAlphaValue(e.transparency)),this._writer.Write(48,e.lineTypeScale,t),this._writer.Write(60,e.isInvisible?1:0,t),e.owner instanceof U){let i=e.owner;i.layout!==null&&this._writer.Write(67,i.layout.IsPaperSpace?1:0)}this._writer.Write(370,e.lineWeight)}writeLongTextValue(e,t,i){for(;i.length>250;)this._writer.Write(t,i.substring(0,250)),i=i.substring(250);this._writer.Write(e,i)}notify(e,t=g.None,i){this.OnNotification&&this.OnNotification(this,new kt(e,t,i))}writeEntity(e){if(!this.isEntitySupported(e))return;this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e);let t=Ae.create(e.constructor.name);e instanceof Ft?this.writeArc(e,t):e instanceof dt?this.writeCircle(e,t):e instanceof Qe?this.writeDimension(e,t):e instanceof je?this.writeDimension(e,t):e instanceof Rt?this.writeDimension(e,t):e instanceof Bt?this.writeDimension(e,t):e instanceof St?this.writeDimension(e,t):e instanceof Ct?this.writeDimension(e,t):e instanceof yt?this.writeDimension(e,t):e instanceof Ut?this.writeEllipse(e,t):e instanceof Yr?this.writeFace3D(e,t):e instanceof Tt?this.writeHatch(e,t):e instanceof Ee?this.writeInsert(e,t):e instanceof nr?this.writeLeader(e,t):e instanceof zt?this.writeLine(e,t):e instanceof qr?this.writeLwPolyline(e,t):e instanceof ar?this.writeMesh(e,t):e instanceof or?this.writeMLine(e,t):e instanceof Ne?this.writeMText(e,t):e instanceof lr?this.writeMultiLeader(e,t):e instanceof dr?this.writeOle2Frame(e,t):e instanceof Qr?this.writePdfUnderlay(e,t):e instanceof Gt?this.writePoint(e,t):e instanceof et?this.writePolyline(e,t):e instanceof tt?this.writePolyline(e,t):e instanceof ut?this.writePolyline(e,t):e instanceof Et?this.writePolyline(e,t):e instanceof ei?this.writeRay(e,t):e instanceof ur?this.writeShape(e,t):e instanceof $t?this.writeSolid(e,t):e instanceof mr?this.writeSpline(e,t):e instanceof Je?this.writeTextEntity(e,t):e instanceof Yt?this.writeTolerance(e,t):e instanceof fr?this.writeViewport(e,t):e instanceof ii?this.writeXLine(e,t):e instanceof ns||e instanceof ls?this.writeCadImage(e,t):e instanceof Le?this.writeSeqend(e,t):this.notify(`Entity not implemented: ${e.constructor.name}`,g.NotImplemented),this.writeExtendedData(e.extendedData)}isEntitySupported(e){return!(e instanceof Lt)}writeArc(e,t){this.writeCircle(e,t);let i=t.subClasses.get(l.Arc);this._writer.Write(p.Subclass,l.Arc),this._writer.Write(50,e.startAngle,i),this._writer.Write(51,e.endAngle,i)}writeCircle(e,t){let i=t.subClasses.get(l.Circle);this._writer.Write(p.Subclass,l.Circle),this._writer.WriteVector(10,e.center,i),this._writer.Write(40,e.radius,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeDimension(e,t){let i=t.subClasses.get(l.Dimension);this._writer.Write(p.Subclass,l.Dimension),this._writer.Write(2,e.block?.name??"",i),this._writer.WriteVector(10,e.definitionPoint,i),this._writer.WriteVector(11,e.textMiddlePoint,i),this._writer.Write(70,e.flags,i),this._writer.Write(71,e.attachmentPoint,i),this._writer.Write(72,e.lineSpacingStyle,i),this._writer.Write(41,e.lineSpacingFactor,i),this._writer.Write(42,e.measurement,i),this._writer.Write(1,e.text,i),this._writer.Write(53,e.textRotation,i),this._writer.Write(51,e.horizontalDirection,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(3,e.style?.name??"",i),e instanceof je&&this.writeDimensionAligned(e,t),e instanceof Qe&&this.writeDimensionLinear(e,t),e instanceof Rt&&this.writeDimensionRadius(e,t),e instanceof Bt&&this.writeDimensionDiameter(e,t),e instanceof St&&this.writeDimensionAngular2Line(e,t),e instanceof Ct&&this.writeDimensionAngular3Pt(e,t),e instanceof yt&&this.writeDimensionOrdinate(e,t)}writeDimensionAligned(e,t){let i=t.subClasses.get(l.AlignedDimension);this._writer.Write(p.Subclass,l.AlignedDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i)}writeDimensionLinear(e,t){this.writeDimensionAligned(e,t);let i=t.subClasses.get(l.LinearDimension);this._writer.Write(p.Subclass,l.LinearDimension),this._writer.Write(50,e.rotation,i)}writeDimensionRadius(e,t){let i=t.subClasses.get(l.RadialDimension);this._writer.Write(p.Subclass,l.RadialDimension),this._writer.WriteVector(15,e.angleVertex,i),this._writer.Write(40,e.leaderLength,i)}writeDimensionDiameter(e,t){let i=t.subClasses.get(l.DiametricDimension);this._writer.Write(p.Subclass,l.DiametricDimension),this._writer.WriteVector(15,e.angleVertex,i),this._writer.Write(40,e.leaderLength,i)}writeDimensionAngular2Line(e,t){let i=t.subClasses.get(l.Angular2LineDimension);this._writer.Write(p.Subclass,l.Angular2LineDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i),this._writer.WriteVector(15,e.angleVertex,i),this._writer.WriteVector(16,e.dimensionArc,i)}writeDimensionAngular3Pt(e,t){let i=t.subClasses.get(l.Angular3PointDimension);this._writer.Write(p.Subclass,l.Angular3PointDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i),this._writer.WriteVector(15,e.angleVertex,i)}writeDimensionOrdinate(e,t){let i=t.subClasses.get(l.OrdinateDimension);this._writer.Write(p.Subclass,l.OrdinateDimension),this._writer.WriteVector(13,e.featureLocation,i),this._writer.WriteVector(14,e.leaderEndpoint,i)}writeEllipse(e,t){let i=t.subClasses.get(l.Ellipse);this._writer.Write(p.Subclass,l.Ellipse),this._writer.WriteVector(10,e.center,i),this._writer.WriteVector(11,e.majorAxisEndPoint,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(40,e.radiusRatio,i),this._writer.Write(41,e.startParameter,i),this._writer.Write(42,e.endParameter,i)}writeFace3D(e,t){let i=t.subClasses.get(l.Face3d);this._writer.Write(p.Subclass,l.Face3d),this._writer.WriteVector(10,e.firstCorner,i),this._writer.WriteVector(11,e.secondCorner,i),this._writer.WriteVector(12,e.thirdCorner,i),this._writer.WriteVector(13,e.fourthCorner,i),this._writer.Write(70,e.flags,i)}writeHatch(e,t){let i=t.subClasses.get(l.Hatch);this._writer.Write(p.Subclass,l.Hatch),this._writer.Write(30,e.elevation,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(2,e.pattern.name,i),this._writer.Write(70,e.isSolid?1:0,i),this._writer.Write(71,e.isAssociative?1:0,i),this._writer.Write(91,e.paths.length);for(let s of e.paths)this.writeBoundaryPath(s);if(this._writer.Write(75,e.style,i),this._writer.Write(76,e.patternType,i),!e.isSolid){this._writer.Write(52,e.patternAngle,i),this._writer.Write(41,e.patternScale,i),this._writer.Write(77,e.isDouble?1:0,i),this._writer.Write(78,e.pattern.lines.length);for(let s of e.pattern.lines){this._writer.Write(53,s.angle),this._writer.Write(43,s.basePoint.x),this._writer.Write(44,s.basePoint.y),this._writer.Write(45,s.offset.x),this._writer.Write(46,s.offset.y),this._writer.Write(79,s.dashLengths.length);for(let n of s.dashLengths)this._writer.Write(49,n)}}this._writer.Write(47,e.pixelSize,i),this._writer.Write(98,e.seedPoints.length);for(let s of e.seedPoints)this._writer.Write(10,s.x),this._writer.Write(20,s.y);if(e.gradientColor.enabled){this._writer.Write(450,e.gradientColor.enabled?1:0),this._writer.Write(451,e.gradientColor.reserved),this._writer.Write(452,e.gradientColor.isSingleColorGradient?1:0),this._writer.Write(453,e.gradientColor.colors.length);for(let s of e.gradientColor.colors)this._writer.Write(463,s.value),this._writer.Write(63,s.color.index),this._writer.Write(421,s.color.trueColor);this._writer.Write(460,e.gradientColor.angle),this._writer.Write(461,e.gradientColor.shift),this._writer.Write(462,e.gradientColor.colorTint),this._writer.Write(470,e.gradientColor.name)}}writeBoundaryPath(e){if(this._writer.Write(92,e.flags),(e.flags&qe.Polyline)!==0)for(let t of e.edges)t instanceof is&&this.writePolylineBoundary(t);else{this._writer.Write(93,e.edges.length);for(let t of e.edges)this.writeBoundaryEdge(t)}this._writer.Write(97,e.entities.length);for(let t of e.entities)this._writer.Write(330,t.handle)}writePolylineBoundary(e){let t=e.vertices.some(i=>i.Z!==0);this._writer.Write(72,t?1:0),this._writer.Write(73,e.isClosed?1:0),this._writer.Write(93,e.vertices.length);for(let i of e.vertices)this._writer.Write(10,i.X),this._writer.Write(20,i.Y),t&&this._writer.Write(42,i.Z)}writeBoundaryEdge(e){if(e instanceof Kr)this._writer.Write(72,1),this._writer.Write(10,e.start.X),this._writer.Write(20,e.start.Y),this._writer.Write(11,e.end.X),this._writer.Write(21,e.end.Y);else if(e instanceof Xr)this._writer.Write(72,2),this._writer.Write(10,e.center.X),this._writer.Write(20,e.center.Y),this._writer.Write(40,e.radius),this._writer.Write(50,Q.RadToDeg(e.startAngle)),this._writer.Write(51,Q.RadToDeg(e.endAngle)),this._writer.Write(73,e.counterClockWise?1:0);else if(e instanceof Zr)this._writer.Write(72,3),this._writer.Write(10,e.center.X),this._writer.Write(20,e.center.Y),this._writer.Write(11,e.majorAxisEndPoint.X),this._writer.Write(21,e.majorAxisEndPoint.Y),this._writer.Write(40,e.minorToMajorRatio),this._writer.Write(50,Q.RadToDeg(e.startAngle)),this._writer.Write(51,Q.RadToDeg(e.endAngle)),this._writer.Write(73,e.counterClockWise?1:0);else if(e instanceof Jr){this._writer.Write(72,4),this._writer.Write(94,e.degree),this._writer.Write(73,e.isRational?1:0),this._writer.Write(74,e.isPeriodic?1:0),this._writer.Write(95,e.knots.length),this._writer.Write(96,e.controlPoints.length);for(let t of e.knots)this._writer.Write(40,t);for(let t of e.controlPoints)this._writer.Write(10,t.X),this._writer.Write(20,t.Y),e.isRational&&this._writer.Write(42,t.Z);if(e.fitPoints.length>0){this._writer.Write(97,e.fitPoints.length);for(let t of e.fitPoints)this._writer.Write(11,t.X),this._writer.Write(21,t.Y)}this._writer.Write(12,e.startTangent.X),this._writer.Write(22,e.startTangent.Y),this._writer.Write(13,e.endTangent.X),this._writer.Write(23,e.endTangent.Y)}}writeInsert(e,t){let i=t.subClasses.get(l.Insert);this._writer.Write(p.Subclass,l.Insert),this._writer.Write(66,e.hasAttributes?1:0),this._writer.Write(2,e.block?.name??"",i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(41,e.xScale,i),this._writer.Write(42,e.yScale,i),this._writer.Write(43,e.zScale,i),this._writer.Write(50,e.rotation,i),this._writer.Write(70,e.columnCount,i),this._writer.Write(71,e.rowCount,i),this._writer.Write(44,e.columnSpacing,i),this._writer.Write(45,e.rowSpacing,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.attributes)this.writeEntity(s);e.hasAttributes&&e.attributes.Seqend&&this.writeEntity(e.attributes.Seqend)}writeLeader(e,t){let i=t.subClasses.get(l.Leader);this._writer.Write(p.Subclass,l.Leader),this._writer.Write(3,e.style?.name??"",i),this._writer.Write(71,e.arrowHeadEnabled?1:0,i),this._writer.Write(72,e.pathType,i),this._writer.Write(73,e.creationType,i),this._writer.Write(74,e.hookLineDirection?1:0,i),this._writer.Write(75,e.hasHookline?1:0,i),this._writer.Write(40,e.textHeight,i),this._writer.Write(41,e.textWidth,i),this._writer.Write(76,e.vertices.length);for(let s of e.vertices)this._writer.WriteVector(10,s);this._writer.Write(77,e.color?1:0,i),this._writer.WriteHandle(340,e.associatedAnnotation),this._writer.WriteVector(210,e.normal,i),this._writer.WriteVector(211,e.horizontalDirection,i),this._writer.WriteVector(212,e.blockOffset,i),this._writer.WriteVector(213,e.annotationOffset,i)}writeLine(e,t){let i=t.subClasses.get(l.Line);this._writer.Write(p.Subclass,l.Line),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(11,e.endPoint,i),this._writer.WriteVector(210,e.normal,i)}writeLwPolyline(e,t){let i=t.subClasses.get(l.LwPolyline);this._writer.Write(p.Subclass,l.LwPolyline),this._writer.Write(90,e.vertices.length),this._writer.Write(70,e.flags,i),this._writer.Write(43,e.constantWidth,i),this._writer.Write(38,e.elevation,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.vertices)this._writer.Write(10,s.location.x),this._writer.Write(20,s.location.y),this._writer.Write(40,s.startWidth),this._writer.Write(41,s.endWidth),this._writer.Write(42,s.bulge),s.id!==0&&this._writer.Write(91,s.id)}writeMesh(e,t){let i=t.subClasses.get(l.Mesh);this._writer.Write(p.Subclass,l.Mesh),this._writer.Write(71,e.subdivisionLevel,i),this._writer.Write(72,0),this._writer.Write(91,0),this._writer.Write(92,e.vertices.length);for(let n of e.vertices)this._writer.WriteVector(10,n);let s=0;for(let n of e.faces)s+=1+n.length;this._writer.Write(93,s);for(let n of e.faces){this._writer.Write(90,n.length);for(let a of n)this._writer.Write(90,a)}this._writer.Write(94,e.edges.length);for(let n of e.edges)this._writer.Write(90,n.start),this._writer.Write(90,n.end);this._writer.Write(95,e.edges.length);for(let n of e.edges)this._writer.Write(140,n.crease)}writeMLine(e,t){let i=t.subClasses.get(l.MLine);this._writer.Write(p.Subclass,l.MLine),this._writer.WriteHandle(340,e.style,i),this._writer.Write(40,e.scaleFactor,i),this._writer.Write(70,e.justification,i),this._writer.Write(71,e.flags,i),this._writer.Write(72,e.vertices.length),this._writer.Write(73,e.style?.Elements?.length??0),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.vertices){this._writer.WriteVector(11,s.position),this._writer.WriteVector(12,s.direction),this._writer.WriteVector(13,s.miter);for(let n of s.segments){this._writer.Write(74,n.parameters.length);for(let a of n.parameters)this._writer.Write(41,a);this._writer.Write(75,n.areaFillParameters.length);for(let a of n.areaFillParameters)this._writer.Write(42,a)}}}writeMText(e,t){let i=t.subClasses.get(l.MText);this._writer.Write(p.Subclass,l.MText),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(40,e.height,i),this._writer.Write(41,e.rectangleWidth,i),this._writer.Write(46,e.rectangleHeight,i),this._writer.Write(71,e.attachmentPoint,i),this._writer.Write(72,e.drawingDirection,i),this.writeLongTextValue(1,3,e.value??""),this._writer.Write(7,e.style?.name??"",i),this._writer.WriteVector(210,e.normal,i),this._writer.WriteVector(11,e.alignmentPoint,i),this._writer.Write(73,e.lineSpacingStyle,i),this._writer.Write(44,e.lineSpacing,i),this._writer.Write(90,e.backgroundFillFlags,i),e.backgroundFillFlags>0&&(this._writer.Write(63,e.backgroundColor.index),this._writer.Write(45,e.backgroundScale,i),this._writer.WriteTrueColor(420,e.backgroundColor),this._writer.Write(441,e.backgroundTransparency))}writeMultiLeader(e,t){let i=t.subClasses.get(l.Leader);this._writer.Write(p.Subclass,l.Leader),this._writer.Write(270,e.contentType,i),this._writer.WriteHandle(340,e.style),this._writer.WriteHandle(341,e.leaderLineType),this._writer.WriteCmColor(91,e.lineColor,i),this._writer.Write(170,e.pathType,i),this._writer.Write(171,e.lineColor,i),this._writer.WriteHandle(343,e.textStyle),this._writer.Write(173,e.textLeftAttachment,i),this._writer.Write(95,e.textRightAttachment,i),e.contextData&&(this._writer.Write(300,"CONTEXT_DATA{"),this.writeAnnotContext(e.contextData,t),this._writer.Write(301,"}")),this._writer.Write(44,e.scaleFactor,i),this._writer.Write(294,e.textDirectionNegative,i),this._writer.Write(274,e.textAligninIPE,i),this._writer.Write(178,e.textAttachmentDirection,i),this._writer.Write(175,e.textAttachmentDirection,i),this._writer.Write(176,e.textAttachmentDirection,i)}writeAnnotContext(e,t){let i=V.Create(Dr);this._writer.WriteVector(10,e.contentBasePoint,i),this._writer.Write(41,e.textHeight,i),this._writer.Write(140,e.arrowheadSize,i),this._writer.Write(145,e.landingGap,i),this._writer.Write(174,e.textLeftAttachment,i),this._writer.Write(175,e.textRightAttachment,i),this._writer.Write(176,e.textAlignment,i),this._writer.Write(177,e.blockContentConnection,i),this._writer.Write(290,e.hasTextContents,i),this._writer.WriteVector(110,e.contentBasePoint,i),this._writer.WriteVector(111,e.baseDirection,i),this._writer.WriteVector(112,e.baseVertical,i),this._writer.Write(297,e.normalReversed,i),this._writer.WriteVector(12,e.textLocation,i),this._writer.WriteVector(13,e.direction,i);for(let s of e.leaderRoots)this._writer.Write(302,"LEADER{"),this.writeLeaderRoot(s),this._writer.Write(303,"}");this._writer.WriteHandle(340,e.textStyle)}writeLeaderRoot(e){let t=V.Create(e.constructor.name);this._writer.Write(290,e.contentValid,t),this._writer.WriteVector(10,e.connectionPoint,t),this._writer.WriteVector(11,e.direction,t);for(let i of e.lines)this._writer.Write(304,"LEADER_LINE{"),this.writeLeaderLine(i),this._writer.Write(305,"}");this._writer.Write(271,e.textAttachmentDirection,t)}writeLeaderLine(e){for(let t of e.points)this._writer.WriteVector(10,t);this._writer.Write(91,e.breakInfoCount)}writeOle2Frame(e,t){let i=t.subClasses.get(l.Ole2Frame);this._writer.Write(p.Subclass,l.Ole2Frame),this._writer.Write(70,e.oleObjectType,i),this._writer.Write(3,e.sourceApplication,i),this._writer.WriteVector(10,e.upperLeftCorner,i),this._writer.WriteVector(11,e.lowerRightCorner,i)}writePdfUnderlay(e,t){let i=t.subClasses.get(l.Underlay);this._writer.Write(p.Subclass,l.Underlay),this._writer.WriteHandle(340,e.definition,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(41,e.xScale,i),this._writer.Write(42,e.yScale,i),this._writer.Write(43,e.zScale,i),this._writer.Write(50,e.rotation,i),this._writer.Write(280,e.flags,i),this._writer.Write(281,e.contrast,i),this._writer.Write(282,e.fade,i)}writePoint(e,t){let i=t.subClasses.get(l.Point);this._writer.Write(p.Subclass,l.Point),this._writer.WriteVector(10,e.location,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(50,e.rotation,i)}writePolyline(e,t){this._writer.Write(p.Subclass,e.subclassMarker),this._writer.Write(66,1),this._writer.Write(70,e.flags),this._writer.WriteVector(210,e.normal);for(let i of e.vertices)i instanceof Ue&&this.writeVertex(i,t);this.writeSeqend(e.vertices.Seqend,t)}writeVertex(e,t){this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e),this._writer.Write(p.Subclass,l.Vertex),this._writer.Write(p.Subclass,e.subclassMarker),this._writer.WriteVector(10,e.location),this._writer.Write(70,e.flags),e instanceof Xt?(this._writer.Write(40,e.startWidth),this._writer.Write(41,e.endWidth),this._writer.Write(42,e.bulge),this._writer.Write(50,e.curveTangent)):e instanceof Zt&&(this._writer.Write(71,e.index1),this._writer.Write(72,e.index2),this._writer.Write(73,e.index3),this._writer.Write(74,e.index4))}writeRay(e,t){let i=t.subClasses.get(l.Ray);this._writer.Write(p.Subclass,l.Ray),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(11,e.direction,i)}writeShape(e,t){let i=t.subClasses.get(l.Shape);this._writer.Write(p.Subclass,l.Shape),this._writer.WriteVector(10,e.insertionPoint,i),this._writer.Write(40,e.size,i),this._writer.Write(2,e.shapeIndex,i),this._writer.Write(50,e.rotation,i),this._writer.Write(41,e.relativeXScale,i),this._writer.Write(51,e.obliqueAngle,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeSolid(e,t){let i=t.subClasses.get(l.Solid);this._writer.Write(p.Subclass,l.Solid),this._writer.WriteVector(10,e.firstCorner,i),this._writer.WriteVector(11,e.secondCorner,i),this._writer.WriteVector(12,e.thirdCorner,i),this._writer.WriteVector(13,e.fourthCorner,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeSpline(e,t){let i=t.subClasses.get(l.Spline);this._writer.Write(p.Subclass,l.Spline),this._writer.WriteVector(210,e.normal,i),this._writer.Write(70,e.flags,i),this._writer.Write(71,e.degree,i),this._writer.Write(72,e.knots.length),this._writer.Write(73,e.controlPoints.length),this._writer.Write(74,e.fitPoints.length),this._writer.Write(42,e.knotTolerance,i),this._writer.Write(43,e.controlPointTolerance,i),this._writer.Write(44,e.fitTolerance,i),e.startTangent&&this._writer.WriteVector(12,e.startTangent),e.endTangent&&this._writer.WriteVector(13,e.endTangent);for(let s of e.knots)this._writer.Write(40,s);for(let s=0;s<e.controlPoints.length;s++)this._writer.WriteVector(10,e.controlPoints[s]),s<e.weights.length&&this._writer.Write(41,e.weights[s]);for(let s of e.fitPoints)this._writer.WriteVector(11,s)}writeTextEntity(e,t){let i=t.subClasses.get(l.Text);this._writer.Write(p.Subclass,l.Text),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(40,e.height,i),this._writer.Write(1,e.value??"",i),this._writer.Write(50,e.rotation,i),this._writer.Write(41,e.widthFactor,i),this._writer.Write(51,e.obliqueAngle,i),this._writer.Write(7,e.style?.name??"",i),this._writer.Write(71,e.mirror,i),this._writer.Write(72,e.horizontalAlignment,i),this._writer.WriteVector(11,e.alignmentPoint,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(p.Subclass,l.Text),this._writer.Write(73,e.verticalAlignment,i)}writeTolerance(e,t){let i=t.subClasses.get(l.Tolerance);this._writer.Write(p.Subclass,l.Tolerance),this._writer.Write(3,e.style?.name??"",i),this._writer.WriteVector(10,e.insertionPoint,i),this._writer.Write(1,e.text??"",i),this._writer.WriteVector(11,e.direction,i),this._writer.WriteVector(210,e.normal,i)}writeViewport(e,t){let i=t.subClasses.get(l.Viewport);this._writer.Write(p.Subclass,l.Viewport),this._writer.WriteVector(10,e.center,i),this._writer.Write(40,e.width,i),this._writer.Write(41,e.height,i),this._writer.Write(68,e.id,i),this._writer.WriteVector(12,e.viewCenter,i),this._writer.WriteVector(13,e.snapBase,i),this._writer.WriteVector(14,e.snapSpacing,i),this._writer.WriteVector(15,e.gridSpacing,i),this._writer.WriteVector(16,e.viewDirection,i),this._writer.WriteVector(17,e.viewTarget,i),this._writer.Write(42,e.lensLength,i),this._writer.Write(43,e.frontClipPlane,i),this._writer.Write(44,e.backClipPlane,i),this._writer.Write(45,e.viewHeight,i),this._writer.Write(50,e.twistAngle,i),this._writer.Write(51,e.circleZoomPercent,i),this._writer.Write(72,e.displayUcsIcon,i),this._writer.Write(90,e.status,i),this._writer.Write(110,e.ucsOrigin,i),this._writer.Write(111,e.ucsXAxis,i),this._writer.Write(112,e.ucsYAxis,i),this._writer.Write(281,e.renderMode,i);for(let s of e.frozenLayers)this._writer.WriteHandle(331,s)}writeXLine(e,t){let i=t.subClasses.get(l.XLine);this._writer.Write(p.Subclass,l.XLine),this._writer.WriteVector(10,e.firstPoint,i),this._writer.WriteVector(11,e.direction,i)}writeCadImage(e,t){let i=t.subClasses.get(l.RasterImage);this._writer.Write(p.Subclass,l.RasterImage),this._writer.Write(90,e.classVersion,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.WriteVector(11,e.uVector,i),this._writer.WriteVector(12,e.vVector,i),this._writer.WriteVector(13,e.size,i),this._writer.WriteHandle(340,e.definition,i),this._writer.Write(70,e.flags,i),this._writer.Write(280,e.clippingState,i),this._writer.Write(281,e.brightness,i),this._writer.Write(282,e.contrast,i),this._writer.Write(283,e.fade,i),this._writer.WriteHandle(360,e.definitionReactor,i),this._writer.Write(71,e.clipType,i),this._writer.Write(91,e.clipBoundaryVertices.length);for(let s of e.clipBoundaryVertices)this._writer.Write(14,s.X),this._writer.Write(24,s.Y)}writeSeqend(e,t){e&&(this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e))}writeAttributeBase(e,t){this._writer.Write(p.Subclass,e.subclassMarker),this._writer.Write(2,e.tag),this._writer.Write(70,e.flags),this._writer.WriteVector(10,e.insertPoint),this._writer.Write(40,e.height),this._writer.Write(1,e.value??""),this._writer.Write(7,e.style?.name??""),this._writer.Write(41,e.widthFactor),this._writer.Write(50,e.rotation),this._writer.Write(51,e.obliqueAngle),this._writer.WriteVector(11,e.alignmentPoint),this._writer.Write(71,e.mirror),this._writer.Write(72,e.horizontalAlignment),this._writer.Write(73,e.verticalAlignment),this._writer.WriteVector(210,e.normal)}};D();q();x();var Od=class extends Nt{get SectionName(){return d.BlocksSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){for(let e of this._document.blockRecords)this.writeBlock(e.blockEntity),this.processEntities(e),this.writeBlockEnd(e.blockEnd)}writeBlock(e){let t=V.Create(Pr);this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e),this._writer.Write(p.Subclass,l.BlockBegin),e.xRefPath&&this._writer.Write(1,e.xRefPath,t),this._writer.Write(2,e.name,t),this._writer.Write(70,e.flags,t),this.Version>=m.AC1015&&e.isUnloaded&&this._writer.Write(71,e.isUnloaded?1:0,t),this._writer.WriteVector(10,e.basePoint,t),this._writer.Write(3,e.name,t),this._writer.Write(4,e.comments,t)}processEntities(e){if(e.name===U.ModelSpaceName||e.name===U.PaperSpaceName)for(let t of e.entities)t instanceof Le,this.Holder.Entities.push(t);else for(let t of e.entities)this.writeEntity(t)}writeBlockEnd(e){this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.Entity),this._writer.Write(8,e.layer.name),this._writer.Write(p.Subclass,l.BlockEnd)}};D();var jd=class extends Nt{get SectionName(){return d.ClassesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){let e=this._document.classes;if(!(e==null||typeof e[Symbol.iterator]!="function"))for(let t of e)this._writer.Write(0,d.ClassEntry),this._writer.Write(1,t.dxfName),this._writer.Write(2,t.cppClassName),this._writer.Write(3,t.applicationName),this._writer.Write(90,t.proxyFlags),this.Version>m.AC1015&&this._writer.Write(91,t.instanceCount),this._writer.Write(280,t.wasZombie),this._writer.Write(281,t.isAnEntity)}};D();var Nd=class extends Nt{get SectionName(){return d.EntitiesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){for(;this.Holder.Entities.length>0;){let e=this.Holder.Entities.shift();this.writeEntity(e)}}};D();q();var Vd=class extends Nt{get SectionName(){return d.HeaderSection}get Header(){return this._document.header}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){let e=lt.GetHeaderMap();for(let[t,i]of e)if(!(!this.Configuration.WriteAllHeaderVariables&&!this.Configuration.HeaderVariables.has(t))&&(i.referenceType&Lr.Ignored)===0&&!(i.getValue(this.Header)===null||i.getValue(this.Header)===void 0)){if(this._writer.Write(p.CLShapeText,t),t==="$HANDSEED"){this._writer.Write(p.Handle,this._document.header.handleSeed);continue}if(t==="$CECOLOR"){this._writer.Write(62,this._document.header.currentEntityColor.getApproxIndex());continue}for(let s of i.DxfCodes){let n=i.getSystemValue(s,this._document.header);n!=null&&this._writer.Write(s,n)}}}};D();q();x();kr();var Id=class extends Nt{get SectionName(){return d.ObjectsSection}constructor(e,t,i,s){super(e,t,i,s)}writeBookColor(e){this._writer.Write(p.Subclass,l.DbColor),this._writer.Write(62,e.color.getApproxIndex()),this._writer.WriteTrueColor(420,e.color),this._writer.Write(430,`${e.name}$${e.bookName}`)}writeDictionary(e){this._writer.Write(p.Subclass,l.Dictionary),this._writer.Write(280,e.hardOwnerFlag),this._writer.Write(281,e.clonningFlags);for(let t of e)t instanceof _t&&!this.Configuration.WriteXRecords||(this._writer.Write(3,t.name),this._writer.Write(350,t.handle),this.Holder.Objects.push(t));e instanceof Cr&&(this._writer.Write(100,l.DictionaryWithDefault),this._writer.WriteHandle(340,e.defaultEntry))}writeDictionaryVariable(e){let t=V.Create(He);this._writer.Write(100,l.DictionaryVariables),this._writer.Write(1,e.value,t),this._writer.Write(280,e.objectSchemaNumber,t)}writeGeoData(e){let t=V.Create(Jt);switch(this._writer.Write(100,l.GeoData,t),this.Version){case m.Unknown:case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:case m.AC1012:case m.AC1014:case m.AC1015:case m.AC1018:case m.AC1021:this._writer.Write(90,1,t);break;case m.AC1024:this._writer.Write(90,2,t);break;case m.AC1027:case m.AC1032:this._writer.Write(90,3,t);break}if(e.hostBlock!==null&&this._writer.Write(330,e.hostBlock.Handle,t),this._writer.Write(70,e.coordinatesType,t),this.Version<=m.AC1021){this._writer.Write(40,e.referencePoint.y,t),this._writer.Write(41,e.referencePoint.x,t),this._writer.Write(42,e.referencePoint.z,t),this._writer.Write(91,e.horizontalUnits,t),this._writer.WriteVector(10,e.designPoint,t),this._writer.WriteVector(11,c.Zero,t),this._writer.WriteVector(210,e.upDirection,t),this._writer.Write(52,Q.RadToDeg(Math.PI/2-e.northDirection.getAngle()),t),this._writer.Write(43,1,t),this._writer.Write(44,1,t),this._writer.Write(45,1,t),this._writer.Write(301,e.coordinateSystemDefinition,t),this._writer.Write(302,e.geoRssTag,t),this._writer.Write(46,e.userSpecifiedScaleFactor,t),this._writer.Write(303,"",t),this._writer.Write(304,"",t),this._writer.Write(305,e.observationFromTag,t),this._writer.Write(306,e.observationToTag,t),this._writer.Write(307,e.observationCoverageTag,t),this._writer.Write(93,e.points.length,t);for(let i of e.points)this._writer.WriteVector(12,i.source,t),this._writer.WriteVector(13,i.destination,t);this._writer.Write(96,e.faces.length,t);for(let i of e.faces)this._writer.Write(97,i.index1,t),this._writer.Write(98,i.index2,t),this._writer.Write(99,i.index3,t);this._writer.Write(3,"CIVIL3D_DATA_BEGIN",t),this._writer.Write(292,!1,t),this._writer.WriteVector(14,new C(e.referencePoint.x,e.referencePoint.y),t),this._writer.WriteVector(15,new C(e.referencePoint.x,e.referencePoint.y),t),this._writer.Write(93,0,t),this._writer.Write(94,0,t),this._writer.Write(293,!1,t),this._writer.WriteVector(16,C.Zero,t),this._writer.WriteVector(17,C.Zero,t),this._writer.Write(54,Q.RadToDeg(Math.PI/2-e.northDirection.getAngle()),t),this._writer.Write(140,Math.PI/2-e.northDirection.getAngle(),t),this._writer.Write(95,e.scaleEstimationMethod,t),this._writer.Write(141,e.userSpecifiedScaleFactor,t),this._writer.Write(294,e.enableSeaLevelCorrection,t),this._writer.Write(142,e.seaLevelElevation,t),this._writer.Write(143,e.coordinateProjectionRadius,t),this._writer.Write(4,"CIVIL3D_DATA_END",t)}else{this._writer.WriteVector(10,e.designPoint,t),this._writer.WriteVector(11,e.referencePoint,t),this._writer.Write(40,e.verticalUnitScale,t),this._writer.Write(91,e.horizontalUnits,t),this._writer.Write(41,e.verticalUnitScale,t),this._writer.Write(92,e.verticalUnits,t),this._writer.WriteVector(210,e.upDirection,t),this._writer.WriteVector(12,e.northDirection,t),this._writer.Write(95,e.scaleEstimationMethod,t),this._writer.Write(141,e.userSpecifiedScaleFactor,t),this._writer.Write(294,e.enableSeaLevelCorrection,t),this._writer.Write(142,e.seaLevelElevation,t),this._writer.Write(143,e.coordinateProjectionRadius,t),this.writeLongTextValue(301,303,e.coordinateSystemDefinition),this._writer.Write(302,e.geoRssTag,t),this._writer.Write(305,e.observationFromTag,t),this._writer.Write(306,e.observationToTag,t),this._writer.Write(307,e.observationCoverageTag,t),this._writer.Write(93,e.points.length,t);for(let i of e.points)this._writer.WriteVector(13,i.source,t),this._writer.WriteVector(14,i.destination,t);this._writer.Write(96,e.faces.length,t);for(let i of e.faces)this._writer.Write(97,i.index1,t),this._writer.Write(98,i.index2,t),this._writer.Write(99,i.index3,t)}}writeGroup(e){this._writer.Write(100,l.Group),this._writer.Write(300,e.description),this._writer.Write(70,e.isUnnamed?1:0),this._writer.Write(71,e.selectable?1:0);for(let t of e.entities)this._writer.WriteHandle(340,t)}writeImageDefinition(e){let t=V.Create(Tr);this._writer.Write(100,l.RasterImageDef),this._writer.Write(90,e.classVersion,t),this._writer.Write(1,e.fileName,t),this._writer.WriteVector(10,e.size,t),this._writer.Write(280,e.isLoaded?1:0,t),this._writer.Write(281,e.units,t)}writeLayout(e){let t=V.Create(nt);this.writePlotSettings(e),this._writer.Write(100,l.Layout),this._writer.Write(1,e.name,t),this._writer.Write(71,e.tabOrder,t),this._writer.WriteVector(10,e.minLimits,t),this._writer.WriteVector(11,e.maxLimits,t),this._writer.WriteVector(12,e.insertionBasePoint,t),this._writer.WriteVector(13,e.origin,t),this._writer.WriteVector(14,e.minExtents,t),this._writer.WriteVector(15,e.maxExtents,t),this._writer.WriteVector(16,e.xAxis,t),this._writer.WriteVector(17,e.yAxis,t),this._writer.Write(146,e.elevation,t),this._writer.Write(76,0,t),this._writer.WriteHandle(330,e.associatedBlock,t)}writeMLineStyle(e){let t=V.Create(wt);this._writer.Write(100,l.MLineStyle),this._writer.Write(2,e.name,t),this._writer.Write(70,e.flags,t),this._writer.Write(3,e.description,t),this._writer.Write(62,e.fillColor.getApproxIndex(),t),this._writer.Write(51,e.startAngle,t),this._writer.Write(52,e.endAngle,t),this._writer.Write(71,e.elements.length,t);for(let i of e.elements)this._writer.Write(49,i.offset,t),this._writer.Write(62,i.color.index,t),this._writer.Write(6,i.lineType.Name,t)}writeMultiLeaderStyle(e){let t=V.Create($e);this._writer.Write(100,l.MLeaderStyle),this._writer.Write(179,2),this._writer.Write(170,e.contentType,t),this._writer.Write(171,e.multiLeaderDrawOrder,t),this._writer.Write(172,e.leaderDrawOrder,t),this._writer.Write(90,e.maxLeaderSegmentsPoints,t),this._writer.Write(40,e.firstSegmentAngleConstraint,t),this._writer.Write(41,e.secondSegmentAngleConstraint,t),this._writer.Write(173,e.pathType,t),this._writer.WriteCmColor(91,e.lineColor,t),this._writer.WriteHandle(340,e.leaderLineType),this._writer.Write(92,e.leaderLineWeight,t),this._writer.Write(290,e.enableLanding,t),this._writer.Write(42,e.landingGap,t),this._writer.Write(291,e.enableDogleg,t),this._writer.Write(43,e.landingDistance,t),this._writer.Write(3,e.description,t),this._writer.WriteHandle(341,e.arrowhead),this._writer.Write(44,e.arrowheadSize,t),this._writer.Write(300,e.defaultTextContents,t),this._writer.WriteHandle(342,e.textStyle),this._writer.Write(174,e.textLeftAttachment,t),this._writer.Write(178,e.textRightAttachment,t),this._writer.Write(175,e.textAngle,t),this._writer.Write(176,e.textAlignment,t),this._writer.WriteCmColor(93,e.textColor,t),this._writer.Write(45,e.textHeight,t),this._writer.Write(292,e.textFrame,t),this._writer.Write(297,e.textAlignAlwaysLeft,t),this._writer.Write(46,e.alignSpace,t),this._writer.WriteHandle(343,e.blockContent),this._writer.WriteCmColor(94,e.blockContentColor,t),this._writer.Write(47,e.blockContentScale.x,t),this._writer.Write(49,e.blockContentScale.y,t),this._writer.Write(140,e.blockContentScale.z,t),this._writer.Write(293,e.enableBlockContentScale,t),this._writer.Write(141,e.blockContentRotation,t),this._writer.Write(294,e.enableBlockContentRotation,t),this._writer.Write(177,e.blockContentConnection,t),this._writer.Write(142,e.scaleFactor,t),this._writer.Write(295,e.overwritePropertyValue,t),this._writer.Write(296,e.isAnnotative,t),this._writer.Write(143,e.breakGapSize,t),this._writer.Write(271,e.textAttachmentDirection,t),this._writer.Write(272,e.textBottomAttachment,t),this._writer.Write(273,e.textTopAttachment,t),this._writer.Write(298,!1)}writeObject(e){if(this.isObjectSupported(e)&&!(e instanceof _t&&!this.Configuration.WriteXRecords)){if(this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),e instanceof ci){this.writeAcdbPlaceHolder(e);return}else if(e instanceof ui){this.writeBookColor(e);return}else if(e instanceof xe){this.writeDictionary(e);return}else if(e instanceof He)this.writeDictionaryVariable(e);else if(e instanceof Xe)this.writeDimensionAssociation(e);else if(e instanceof Jt)this.writeGeoData(e);else if(e instanceof Ot)this.writeGroup(e);else if(e instanceof Tr){this.writeImageDefinition(e);return}else if(e instanceof li){this.writeImageDefinitionReactor(e);return}else if(e instanceof nt)this.writeLayout(e);else if(e instanceof fi)this.writeField(e);else if(e instanceof pi)this.writeFieldList(e);else if(e instanceof wt)this.writeMLineStyle(e);else if(e instanceof $e)this.writeMultiLeaderStyle(e);else if(e instanceof pt)this.writePlotSettings(e);else if(e instanceof hi)this.writePdfUnderlayDefinition(e);else if(e instanceof Ar)this.writeRasterVariables(e);else if(e instanceof Ge)this.writeScale(e);else if(e instanceof qt)this.writeSpatialFilter(e);else if(e instanceof Br)this.writeSortentsTable(e);else if(e instanceof _t)this.writeXRecord(e);else throw new Error(`Object not implemented : ${e.constructor.name}`);this.writeExtendedData(e.extendedData)}}writePdfUnderlayDefinition(e){let t=V.Create(pt);this._writer.Write(100,l.UnderlayDefinition),this._writer.Write(1,e.file,t),this._writer.Write(2,e.page,t)}writePlotSettings(e){let t=V.Create(pt);this._writer.Write(100,l.PlotSettings),this._writer.Write(1,e.pageName,t),this._writer.Write(2,e.systemPrinterName,t),this._writer.Write(4,e.paperSize,t),this._writer.Write(6,e.plotViewName,t),this._writer.Write(7,e.styleSheet,t),this._writer.Write(40,e.unprintableMargin.left,t),this._writer.Write(41,e.unprintableMargin.bottom,t),this._writer.Write(42,e.unprintableMargin.right,t),this._writer.Write(43,e.unprintableMargin.top,t),this._writer.Write(44,e.paperWidth,t),this._writer.Write(45,e.paperHeight,t),this._writer.Write(46,e.plotOriginX,t),this._writer.Write(47,e.plotOriginY,t),this._writer.Write(48,e.windowLowerLeftX,t),this._writer.Write(49,e.windowLowerLeftY,t),this._writer.Write(140,e.windowUpperLeftX,t),this._writer.Write(141,e.windowUpperLeftY,t),this._writer.Write(142,e.numeratorScale,t),this._writer.Write(143,e.denominatorScale,t),this._writer.Write(70,e.flags,t),this._writer.Write(72,e.paperUnits,t),this._writer.Write(73,e.paperRotation,t),this._writer.Write(74,e.plotType,t),this._writer.Write(75,e.scaledFit,t),this._writer.Write(76,e.shadePlotMode,t),this._writer.Write(77,e.shadePlotResolutionMode,t),this._writer.Write(78,e.shadePlotDPI,t),this._writer.Write(147,e.printScale,t),this._writer.Write(148,e.paperImageOrigin.x,t),this._writer.Write(149,e.paperImageOrigin.y,t)}writeRasterVariables(e){let t=V.Create(Ar);this._writer.Write(100,l.RasterVariables),this._writer.Write(90,e.classVersion,t),this._writer.Write(70,e.isDisplayFrameShown?1:0,t),this._writer.Write(71,e.displayQuality,t),this._writer.Write(72,e.displayQuality,t)}writeScale(e){this._writer.Write(100,l.Scale),this._writer.Write(70,0),this._writer.Write(300,e.name),this._writer.Write(140,e.paperUnits),this._writer.Write(141,e.drawingUnits),this._writer.Write(290,e.isUnitScale?1:0)}writeSection(){for(;this.Holder.Objects.length>0;){let e=this.Holder.Objects.shift();this.writeObject(e)}}writeXRecord(e){this._writer.Write(p.Subclass,l.XRecord),this._writer.Write(280,e.cloningFlags);for(let t of e.entries)switch(t.groupCode){case _.None:break;case _.Point3D:t.value&&typeof t.value.X=="number"&&typeof t.value.Y=="number"?this._writer.WriteVector(t.code,t.value):this._writer.Write(t.code,t.value);break;case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:{let i=t.value;this._writer.Write(t.code,i.handle);break}default:this._writer.Write(t.code,t.value);break}}isObjectSupported(e){return e instanceof pr?!1:e instanceof $s||e instanceof Gs||e instanceof Ys||e instanceof Xe||e instanceof yr||e instanceof at||e instanceof Dr||e instanceof di||e instanceof Ye||e instanceof Er||e instanceof Rr||e instanceof ps||e instanceof mi?(this.notify(`Object not implemented : ${e.constructor.name}`,g.NotImplemented),!1):!0}writeAcdbPlaceHolder(e){}writeDimensionAssociation(e){let t=V.Create(Xe);this._writer.Write(100,l.DimensionAssociation),this._writer.WriteHandle(330,e.dimension,t),this._writer.Write(90,e.associativityFlags,t),this._writer.Write(70,e.isTransSpace,t),this._writer.Write(71,e.rotatedDimensionType,t),(e.associativityFlags&he.FirstPointReference)!==0&&this.writeOsnapPointRef(e.firstPointRef),(e.associativityFlags&he.SecondPointReference)!==0&&this.writeOsnapPointRef(e.secondPointRef),(e.associativityFlags&he.ThirdPointReference)!==0&&this.writeOsnapPointRef(e.thirdPointRef),(e.associativityFlags&he.FourthPointReference)!==0&&this.writeOsnapPointRef(e.fourthPointRef)}writeField(e){this._writer.Write(p.Subclass,l.Field),this._writer.Write(1,e.evaluatorId),this.writeLongTextValue(2,3,e.fieldCode),this._writer.Write(90,e.children.length);for(let t of e.children)this._writer.WriteHandle(360,t);this._writer.Write(97,e.cadObjects.length);for(let t of e.cadObjects)this._writer.WriteHandle(331,t);this._writer.Write(91,e.evaluationOptionFlags),this._writer.Write(92,e.filingOptionFlags),this._writer.Write(94,e.fieldStateFlags),this._writer.Write(95,e.evaluationStatusFlags),this._writer.Write(96,e.evaluationErrorCode),this._writer.Write(300,e.evaluationErrorMessage),this._writer.Write(93,e.values.size);for(let[t,i]of e.values)this._writer.Write(6,t),this.writeCadValue(i);this._writer.Write(7,"ACFD_FIELD_VALUE"),this.writeCadValue(e.value),this.writeLongTextValue(301,9,e.formatString),this._writer.Write(98,e.formatString.length)}writeFieldList(e){this._writer.Write(p.Subclass,l.IdSet),this._writer.Write(90,e.fields.length);for(let t of e.fields)this._writer.WriteHandle(330,t),this.Holder.Objects.push(t);this._writer.Write(p.Subclass,l.FieldList)}writeImageDefinitionReactor(e){this._writer.Write(p.Subclass,l.RasterImageDefReactor),this._writer.Write(90,e.classVersion),this._writer.WriteHandle(330,e.image)}writeOsnapPointRef(e){e!==null&&(this._writer.Write(1,Xe.OsnapPointRefClassName),this._writer.Write(72,e.objectOsnapType),this._writer.WriteHandle(331,e.geometry),this._writer.Write(73,e.subentType),this._writer.Write(91,e.gsMarker),this._writer.Write(40,e.geometryParameter),this._writer.WriteVector(10,e.osnapPoint),this._writer.Write(75,e.hasLastPointRef?1:0))}writeSortentsTable(e){this._writer.Write(p.Subclass,l.SortentsTable),this._writer.WriteHandle(330,e.blockOwner);for(let t of e)this._writer.WriteHandle(331,t.entity),this._writer.Write(5,t.sortHandle)}writeSpatialFilter(e){let t=V.Create(qt);this._writer.Write(100,l.Filter),this._writer.Write(100,l.SpatialFilter),this._writer.Write(70,e.boundaryPoints.length,t);for(let s of e.boundaryPoints)this._writer.WriteVector(10,s,t);this._writer.WriteVector(210,e.normal,t),this._writer.WriteVector(11,e.origin,t),this._writer.Write(71,e.displayBoundary?1:0,t),this._writer.Write(72,e.clipFrontPlane?1:0,t),e.clipFrontPlane&&this._writer.Write(40,e.frontDistance,t),this._writer.Write(73,e.clipBackPlane?1:0,t),e.clipBackPlane&&this._writer.Write(41,e.backDistance,t);let i=[e.inverseInsertTransform.M00,e.inverseInsertTransform.M01,e.inverseInsertTransform.M02,e.inverseInsertTransform.M03,e.inverseInsertTransform.M10,e.inverseInsertTransform.M11,e.inverseInsertTransform.M12,e.inverseInsertTransform.M13,e.inverseInsertTransform.M20,e.inverseInsertTransform.M21,e.inverseInsertTransform.M22,e.inverseInsertTransform.M23,e.insertTransform.M00,e.insertTransform.M01,e.insertTransform.M02,e.insertTransform.M03,e.insertTransform.M10,e.insertTransform.M11,e.insertTransform.M12,e.insertTransform.M13,e.insertTransform.M20,e.insertTransform.M21,e.insertTransform.M22,e.insertTransform.M23];for(let s=0;s<i.length;s++)this._writer.Write(40,i[s])}};D();q();x();var Md=class extends Nt{get SectionName(){return d.TablesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){this.writeTable(this._document.vPorts),this.writeTable(this._document.lineTypes),this.writeTable(this._document.layers),this.writeTable(this._document.textStyles),this.writeTable(this._document.views),this.writeTable(this._document.uCSs),this.writeTable(this._document.appIds),this.writeTable(this._document.dimensionStyles,l.DimensionStyleTable),this.writeTable(this._document.blockRecords)}writeTable(e,t){this._writer.Write(p.Start,d.TableEntry),this._writer.Write(p.SymbolTableName,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.Table),this._writer.Write(70,e.count),t&&this._writer.Write(p.Subclass,t);for(let i of e)this.writeEntry(i);this._writer.Write(p.Start,d.EndTable)}writeEntry(e){let t=Ae.create(e.constructor.name);this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.TableRecord),this._writer.Write(p.Subclass,e.subclassMarker),e instanceof te&&e.isShapeFile?this._writer.Write(p.SymbolTableName,""):this._writer.Write(p.SymbolTableName,e.name),this._writer.Write(70,e.flags),e instanceof gt||(e instanceof U?this.writeBlockRecord(e,t.subClasses.get(e.subclassMarker)):e instanceof re?this.writeDimensionStyle(e,t.subClasses.get(e.subclassMarker)):e instanceof Se?this.writeLayer(e,t.subClasses.get(e.subclassMarker)):e instanceof H?this.writeLineType(e,t.subClasses.get(e.subclassMarker)):e instanceof te?this.writeTextStyle(e,t.subClasses.get(e.subclassMarker)):e instanceof ot?this.writeUcs(e,t.subClasses.get(e.subclassMarker)):e instanceof Vi?this.writeView(e,t.subClasses.get(e.subclassMarker)):e instanceof xt&&this.writeVPort(e,t.subClasses.get(e.subclassMarker))),this.writeExtendedData(e.extendedData)}writeBlockRecord(e,t){this._writer.WriteHandle(340,e.layout,t),this._writer.Write(70,e.units,t),this._writer.Write(280,e.isExplodable?1:0,t),this._writer.Write(281,e.canScale?1:0,t)}writeDimensionStyle(e,t){this._writer.Write(3,e.postFix,t),this._writer.Write(4,e.alternateDimensioningSuffix,t),this._writer.Write(40,e.scaleFactor,t),this._writer.Write(41,e.arrowSize,t),this._writer.Write(42,e.extensionLineOffset,t),this._writer.Write(43,e.dimensionLineIncrement,t),this._writer.Write(44,e.extensionLineExtension,t),this._writer.Write(45,e.rounding,t),this._writer.Write(46,e.dimensionLineExtension,t),this._writer.Write(47,e.plusTolerance,t),this._writer.Write(48,e.minusTolerance,t),this._writer.Write(49,e.fixedExtensionLineLength,t),this._writer.Write(50,e.joggedRadiusDimensionTransverseSegmentAngle,t),e.textBackgroundFillMode!==0?(this._writer.Write(69,e.textBackgroundFillMode,t),this._writer.Write(70,e.textBackgroundColor.getApproxIndex(),t)):this._writer.Write(70,0,t),e.arcLengthSymbolPosition!==qs.AboveDimensionText&&this._writer.Write(90,e.arcLengthSymbolPosition),this._writer.Write(140,e.textHeight),this._writer.Write(141,e.centerMarkSize),this._writer.Write(142,e.tickSize),this._writer.Write(143,e.alternateUnitScaleFactor),this._writer.Write(144,e.linearScaleFactor),this._writer.Write(145,e.textVerticalPosition),this._writer.Write(146,e.toleranceScaleFactor),this._writer.Write(147,e.dimensionLineGap),this._writer.Write(148,e.alternateUnitRounding),this._writer.Write(71,e.generateTolerances?1:0),this._writer.Write(72,e.limitsGeneration?1:0),this._writer.Write(73,e.textInsideHorizontal?1:0),this._writer.Write(74,e.textOutsideHorizontal?1:0),this._writer.Write(75,e.suppressFirstExtensionLine?1:0),this._writer.Write(76,e.suppressSecondExtensionLine?1:0),this._writer.Write(77,e.textVerticalAlignment),this._writer.Write(78,e.zeroHandling),this._writer.Write(79,e.angularZeroHandling),this._writer.Write(170,e.alternateUnitDimensioning?1:0),this._writer.Write(171,e.alternateUnitDecimalPlaces),this._writer.Write(172,e.textOutsideExtensions?1:0),this._writer.Write(173,e.separateArrowBlocks?1:0),this._writer.Write(174,e.textInsideExtensions?1:0),this._writer.Write(175,e.suppressOutsideExtensions?1:0),this._writer.Write(176,e.dimensionLineColor.getApproxIndex(),t),this._writer.Write(177,e.extensionLineColor.getApproxIndex(),t),this._writer.Write(178,e.textColor.getApproxIndex(),t),this._writer.Write(179,e.angularDecimalPlaces),this._writer.Write(271,e.decimalPlaces),this._writer.Write(272,e.toleranceDecimalPlaces),this._writer.Write(273,e.alternateUnitFormat),this._writer.Write(274,e.alternateUnitToleranceDecimalPlaces),this._writer.Write(275,e.angularUnit),this._writer.Write(276,e.fractionFormat),this._writer.Write(277,e.linearUnitFormat),this._writer.Write(278,(e.decimalSeparator||".").charCodeAt(0)),this._writer.Write(279,e.textMovement),this._writer.Write(280,e.textHorizontalAlignment),this._writer.Write(281,e.suppressFirstDimensionLine),this._writer.Write(282,e.suppressSecondDimensionLine),this._writer.Write(283,e.toleranceAlignment),this._writer.Write(284,e.toleranceZeroHandling),this._writer.Write(285,e.alternateUnitZeroHandling),this._writer.Write(286,e.alternateUnitToleranceZeroHandling),this._writer.Write(287,e.dimensionFit),this._writer.Write(288,e.cursorUpdate),this._writer.Write(289,e.dimensionTextArrowFit),this._writer.Write(290,e.isExtensionLineLengthFixed),this._writer.WriteHandle(340,e.style,t),this._writer.WriteHandle(341,e.leaderArrow,t),this._writer.WriteHandle(342,e.arrowBlock,t),this._writer.WriteHandle(343,e.dimArrow1,t),this._writer.WriteHandle(344,e.dimArrow2,t),this._writer.Write(371,e.dimensionLineWeight),this._writer.Write(372,e.extensionLineWeight)}writeLayer(e,t){let i=e.color.isTrueColor?e.color.getApproxIndex():e.color.index;e.isOn?this._writer.Write(62,i,t):this._writer.Write(62,-i,t),e.color.isTrueColor&&this._writer.Write(420,e.color.trueColor,t),this._writer.Write(6,e.lineType?.name??"Continuous",t),this._writer.Write(290,e.plotFlag,t),this._writer.Write(370,e.lineWeight,t),this._writer.Write(390,0,t)}writeLineType(e,t){this._writer.Write(3,e.description,t),this._writer.Write(72,e.alignment,t),this._writer.Write(73,e.segments.length,t),this._writer.Write(40,e.patternLength);for(let i of e.segments)this._writer.Write(49,i.length),this._writer.Write(74,i.shapeFlags),i.shapeFlags!==Ze.None&&((i.shapeFlags&Ze.Shape)!==0&&this._writer.Write(75,i.shapeNumber),(i.shapeFlags&Ze.Text)!==0&&this._writer.Write(75,0),i.style===null?this._writer.Write(340,0):this._writer.Write(340,i.style.handle),this._writer.Write(46,i.scale),this._writer.Write(50,Q.RadToDeg(i.rotation)),this._writer.Write(44,i.offset.x),this._writer.Write(45,i.offset.y),this._writer.Write(9,i.text))}writeTextStyle(e,t){e.filename&&this._writer.Write(3,e.filename,t),e.bigFontFilename&&this._writer.Write(4,e.bigFontFilename),this._writer.Write(40,e.height,t),this._writer.Write(41,e.width,t),this._writer.Write(42,e.lastHeight,t),this._writer.Write(50,e.obliqueAngle,t),this._writer.Write(71,e.mirrorFlag,t)}writeUcs(e,t){this._writer.Write(10,e.origin.x,t),this._writer.Write(20,e.origin.y,t),this._writer.Write(30,e.origin.z,t),this._writer.Write(11,e.xAxis.x,t),this._writer.Write(21,e.xAxis.y,t),this._writer.Write(31,e.xAxis.z,t),this._writer.Write(12,e.yAxis.x,t),this._writer.Write(22,e.yAxis.y,t),this._writer.Write(32,e.yAxis.z,t),this._writer.Write(71,e.orthographicType,t),this._writer.Write(79,e.orthographicViewType,t),this._writer.Write(146,e.elevation,t)}writeView(e,t){this._writer.Write(40,e.height,t),this._writer.Write(41,e.width,t),this._writer.Write(42,e.lensLength,t),this._writer.Write(43,e.frontClipping,t),this._writer.Write(44,e.backClipping,t),this._writer.WriteVector(10,e.center,t),this._writer.WriteVector(11,e.direction,t),this._writer.WriteVector(12,e.target,t),this._writer.Write(50,e.angle,t),this._writer.Write(71,e.viewMode),this._writer.Write(72,e.isUcsAssociated,t),this._writer.Write(79,e.ucsOrthographicType),this._writer.Write(281,e.renderMode),this._writer.WriteVector(110,e.ucsOrigin),this._writer.WriteVector(111,e.ucsXAxis),this._writer.WriteVector(112,e.ucsYAxis),this._writer.Write(146,e.ucsElevation)}writeVPort(e,t){this._writer.WriteVector(10,e.bottomLeft,t),this._writer.WriteVector(11,e.topRight,t),this._writer.WriteVector(12,e.center,t),this._writer.WriteVector(13,e.snapBasePoint,t),this._writer.WriteVector(14,e.snapSpacing,t),this._writer.WriteVector(15,e.gridSpacing,t),this._writer.WriteVector(16,e.direction,t),this._writer.WriteVector(17,e.target,t),this._writer.Write(40,e.viewHeight),this._writer.Write(41,e.aspectRatio),this._writer.Write(75,e.snapOn?1:0),this._writer.Write(76,e.showGrid?1:0)}};var Qo=class r extends Ls{static Variables=["$ACADVER","$DWGCODEPAGE","$LASTSAVEDBY","$HANDSEED","$ANGBASE","$ANGDIR","$ATTMODE","$AUNITS","$AUPREC","$CECOLOR","$CELTSCALE","$CELTYPE","$CELWEIGHT","$CLAYER","$CMLJUST","$CMLSCALE","$CMLSTYLE","$DIMSTYLE","$TEXTSIZE","$TEXTSTYLE","$LUNITS","$LUPREC","$MIRRTEXT","$EXTNAMES","$INSBASE","$INSUNITS","$LTSCALE","$LWDISPLAY","$PDMODE","$PDSIZE","$PLINEGEN","$PSLTSCALE","$SPLINESEGS","$SURFU","$SURFV","$TDCREATE","$TDUCREATE","$TDUPDATE","$TDUUPDATE","$TDINDWG"];WriteAllHeaderVariables=!1;WriteOptionalValues=!0;get HeaderVariables(){return this._headerVariables}_headerVariables;constructor(){super(),this._headerVariables=new Set(r.Variables)}AddHeaderVariable(e){if(!lt.GetHeaderMap().has(e))throw new Error(`The variable ${e} does not exist in the header`);this._headerVariables.add(e)}RemoveHeaderVariable(e){if(r.Variables.map(t=>t.toLowerCase()).includes(e.toLowerCase()))throw new Error(`The variable ${e} cannot be removed from the set`);return this._headerVariables.delete(e)}};q();D();var qh=class{_stream;_encoder=new TextEncoder;_position=0;constructor(e){this._stream=e}write(e){let t=this._encoder.encode(e);this.ensureCapacity(t.length),this._stream.set(t,this._position),this._position+=t.length}flush(){}close(){}ensureCapacity(e){if(this._position+e>this._stream.length)throw new Error("DXF output buffer is too small.")}},Qh=class{_stream;_position=0;constructor(e){this._stream=e}write(e){this.ensureCapacity(e.length),this._stream.set(e,this._position),this._position+=e.length}flush(){}close(){}ensureCapacity(e){if(this._position+e>this._stream.length)throw new Error("DXF output buffer is too small.")}},ec=class r extends Es{IsBinary;_writer;_objectHolder=new bd;constructor(e,t,i=!1){super(e,t),this.IsBinary=i,this.Configuration=new Qo}Write(){super.Write(),this.createStreamWriter(),this._objectHolder.Objects.push(this._document.rootDictionary),this.writeHeader(),this.writeDxfClasses(),this.writeTables(),this.writeBlocks(),this.writeEntities(),this.writeObjects(),this.writeACDSData(),this._writer.Write(p.Start,d.EndOfFile),this._writer.Flush(),this.Configuration.CloseStream&&this._writer.Close()}Dispose(){this._writer.Dispose()}static WriteToStream(e,t,i=!1,s,n){let a=new r(e,t,i);s&&(a.Configuration=s),a.OnNotification=n??null,a.Write(),a.Dispose()}createStreamWriter(){this.IsBinary?this._writer=new Pd(this.createBinaryTarget()):this._writer=new kd(this.createTextTarget()),this._writer.WriteOptional=this.Configuration.WriteOptionalValues}createTextTarget(){return this._stream instanceof Uint8Array?new qh(this._stream):this._stream}createBinaryTarget(){return this._stream instanceof Uint8Array?new Qh(this._stream):this._stream}writeHeader(){let e=new Vd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeDxfClasses(){let e=new jd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeTables(){let e=new Md(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeBlocks(){let e=new Od(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeEntities(){let e=new Nd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeObjects(){let e=new Id(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeACDSData(){}createDefaultConfiguration(){return new Qo}};var tc=class r{static _maxChunkSize=1048576*1024;static _maxChunkShift=30;static _maxChunkMask=1048576*1024-1;_currentChunk;_currentInChunk=0;_length;_position=0;_chunks;static Create(e){return e<=2147483647?new Uint8Array(e):new r(e)}constructor(e){if(typeof e=="number"){let t=e;this._length=t,this._position=0,this._chunks=[];let i=t;for(;i>0;){let s=Math.min(i,r._maxChunkSize);this._chunks.push(new Uint8Array(s)),i-=s}this.Position=0}else this._chunks=e,this._length=e.reduce((t,i)=>t+i.length,0),this.Position=0}get CanRead(){return!0}get CanSeek(){return!0}get CanWrite(){return!0}get Length(){return this._length}get Position(){return this._position}set Position(e){this._position=e,this._currentChunk=this._chunks[e>>r._maxChunkShift],this._currentInChunk=e&r._maxChunkMask}Read(e,t,i){if(i===1)return e[t]=this._currentChunk[this._currentInChunk],this.Position++,1;if(this._currentInChunk+i>r._maxChunkSize){let s=r._maxChunkSize-this._currentInChunk;return e.set(this._currentChunk.subarray(this._currentInChunk,this._currentInChunk+s),t),this.Position+=s,s+this.Read(e,t+s,i-s)}else return e.set(this._currentChunk.subarray(this._currentInChunk,this._currentInChunk+i),t),this.Position+=i,i}ReadByte(){let e=this._currentChunk[this._currentInChunk];return this.Position++,e}Write(e,t,i){if(i===1){this._currentChunk[this._currentInChunk]=e[t],this.Position++;return}if(this._currentInChunk+i>r._maxChunkSize){let s=r._maxChunkSize-this._currentInChunk;this._currentChunk.set(e.subarray(t,t+s),this._currentInChunk),this.Position+=s,this.Write(e,t+s,i-s)}else this._currentChunk.set(e.subarray(t,t+i),this._currentInChunk),this.Position+=i}WriteByte(e){this._currentChunk[this._currentInChunk]=e,this.Position++}Clone(){return new r(this._chunks)}static CloneStream(e){if(e instanceof r)return e.Clone();if(e instanceof Uint8Array)return new Uint8Array(e);throw new Error("The provided stream type is not supported for cloning.")}};var Wd=class extends Ls{LineWeightRatio=100;DefaultLineWeight=.01;PointRadius=.1;ArcPoints=256;GetLineWeightValue(e,t){let i=Math.abs(e);if(t===ie.Unitless)return i/this.LineWeightRatio;switch(e){case M.Default:return this.DefaultLineWeight;case M.W0:return .001}return Rl.getLineWeightValue(e)}};var P=class r{static toSvg(e){return e.toString()}static toSvgWithUnits(e,t){let i="";switch(t){case ie.Centimeters:i="cm";break;case ie.Millimeters:i="mm";break;case ie.Inches:i="in";break}return`${e.toString()}${i}`}static vectorToSvg(e){return`${r.toSvg(e.x)},${r.toSvg(e.y)}`}static vectorToSvgWithUnits(e,t){return`${r.toSvgWithUnits(e.x,t)},${r.toSvgWithUnits(e.y,t)}`}static toPixelSize(e,t){switch(t){case ie.Inches:return e*96;case ie.Millimeters:return e*96/25.4;case ie.Unitless:return e;default:throw new Error(`Invalid units value: ${t}`)}}static vectorToPixelSize(e,t){let i={...e};return i.x=r.toPixelSize(i.x,t),i.y=r.toPixelSize(i.y,t),i.z!==void 0&&(i.z=r.toPixelSize(i.z,t)),i}};var el=class{Translation=new c(0,0,0);Scale=new c(1,1,1);EulerRotation=new c(0,0,0);Matrix=null;constructor(e,t,i){e&&(this.Translation=e),t&&(this.Scale=t),i&&(this.EulerRotation=i)}ApplyTransform(e){return new c(e.x+this.Translation.x,e.y+this.Translation.y,e.z+this.Translation.z)}},fn=class{OnNotification=null;Configuration;Layout=null;Units=ie.Unitless;Formatting="Indented";_output="";_indent=0;_elementStack=[];_inAttribute=!1;_attrName="";_attrValue="";_currentElementOpen=!1;_stream;_encoding;constructor(e,t,i){this._stream=e,i!==void 0?(this._encoding=t,this.Configuration=i):(this._encoding=null,this.Configuration=t)}WriteBlock(e){this.Units=e.units;let t=this.getBlockBoundingBox(e);this.startDocument(t,t,this.Units);for(let i of e.entities)this.writeEntity(i);this.endDocument()}WriteLayout(e){this.Layout=e,this.Units=An.toUnits(e.paperUnits);let t=e.paperWidth,i=e.paperHeight;switch(e.paperRotation){case ni.Degrees90:case ni.Degrees270:t=e.paperHeight,i=e.paperWidth;break}let s=new c(0,0,0),n=new c(t,i,0),a={Min:s,Max:n,Width:t,Height:i},o=new c(e.unprintableMargin?.bottomLeftCorner?.x??0,e.unprintableMargin?.bottomLeftCorner?.y??0,0);this.startDocument(a,null,ie.Millimeters);let h=new el(P.vectorToPixelSize(o,ie.Millimeters),new c(e.printScale,e.printScale,e.printScale),new c(0,0,0));for(let f of e.associatedBlock.Entities)this.writeEntity(f,h);this.endDocument()}WriteStartDocument(){this._output+=`<?xml version="1.0" encoding="utf-8"?>
8
+ `)}formatDouble(e){if(typeof e!="number"||isNaN(e))return"0.0";let t=e.toFixed(16);return t.includes(".")&&(t=t.replace(/0+$/,""),t.endsWith(".")&&(t+="0")),t}};var Pd=class r extends ro{static SentinelBytes=new Uint8Array([65,117,116,111,67,65,68,32,66,105,110,97,114,121,32,68,88,70,13,10,26,0]);_writer;_buffer;_position=0;_stream;constructor(e){super(),this._stream=e,this._buffer=new Uint8Array(65536),this._writer=new DataView(this._buffer.buffer),this._stream.write(r.SentinelBytes)}Close(){this.flushBuffer(),this._stream.close&&this._stream.close()}Dispose(){this.Close()}Flush(){this.flushBuffer(),this._stream.flush&&this._stream.flush()}writeDxfCode(e){this.ensureCapacity(2),this._writer.setInt16(this._position,e,!0),this._position+=2}writeValue(e,t){switch(Be.transformValue(e)){case _.String:case _.Comment:case _.ExtendedDataString:{let s=`${t}`,n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}case _.Point3D:case _.Double:case _.ExtendedDataDouble:this.ensureCapacity(8),this._writer.setFloat64(this._position,t,!0),this._position+=8;break;case _.Byte:this.ensureCapacity(1),this._buffer[this._position++]=t&255;break;case _.Int16:case _.ExtendedDataInt16:this.ensureCapacity(2),this._writer.setInt16(this._position,t,!0),this._position+=2;break;case _.Int32:case _.ExtendedDataInt32:this.ensureCapacity(4),this._writer.setInt32(this._position,t,!0),this._position+=4;break;case _.Int64:this.ensureCapacity(8),this._writer.setInt32(this._position,t&4294967295,!0),this._writer.setInt32(this._position+4,Math.floor(t/4294967296),!0),this._position+=8;break;case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:{let s=t.toString(16).toUpperCase(),n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}case _.Bool:this.ensureCapacity(1),this._buffer[this._position++]=t?1:0;break;case _.Chunk:case _.ExtendedDataChunk:{let s=t;this.ensureCapacity(1+s.length),this._buffer[this._position++]=s.length,this._buffer.set(s,this._position),this._position+=s.length;break}default:{let s=`${t}`,n=new TextEncoder().encode(s);this.ensureCapacity(n.length+1),this._buffer.set(n,this._position),this._position+=n.length,this._buffer[this._position++]=0;break}}}ensureCapacity(e){this._position+e>this._buffer.length&&(this.flushBuffer(),e>this._buffer.length&&(this._buffer=new Uint8Array(e*2),this._writer=new DataView(this._buffer.buffer)))}flushBuffer(){this._position>0&&(this._stream.write(this._buffer.slice(0,this._position)),this._position=0)}};q();D();x();wn();var Nt=class{OnNotification=null;get Version(){return this._document.header.Version}Holder;Configuration;_writer;_document;constructor(e,t,i,s){this._writer=e,this._document=t,this.Holder=i,this.Configuration=s}Write(){this._writer.Write(p.Start,d.BeginSection),this._writer.Write(p.SymbolTableName,this.SectionName),this.writeSection(),this._writer.Write(p.Start,d.EndSection)}writeCadValue(e){switch(this._writer.Write(93,e.flags),this._writer.Write(90,e.valueType),e.valueType){case W.Unknown:this._writer.Write(91,0);break;case W.Double:this._writer.Write(140,Number(e.value));break;case W.Date:this._writer.Write(91,0);break;case W.General:case W.String:this.writeLongTextValue(1,2,e.value);break;case W.Point2D:case W.Point3D:this._writer.WriteVector(11,e.value);break;case W.Long:this._writer.Write(91,Number(e.value));break;case W.Handle:{let t=e.value;t&&this._writer.WriteHandle(330,t);break}case W.Buffer:case W.ResultBuffer:this._writer.Write(91,0);break}}writeCommonObjectData(e){if(e instanceof re?this._writer.Write(p.DimVarHandle,e.handle):this._writer.Write(p.Handle,e.handle),e.xDictionary!==null&&(this._writer.Write(p.ControlString,d.DictionaryToken),this._writer.Write(p.HardOwnershipId,e.xDictionary.handle),this._writer.Write(p.ControlString,"}"),this.Holder.Objects.push(e.xDictionary)),e.cleanReactors(),e.reactors.length>0){this._writer.Write(p.ControlString,d.ReactorsToken);for(let t of e.reactors)this._writer.Write(p.SoftPointerId,t.handle);this._writer.Write(p.ControlString,"}")}this._writer.Write(p.SoftPointerId,e.owner.handle)}writeExtendedData(e){if(!(e===null||!this.Configuration.WriteXData))for(let[t,i]of e){this._writer.Write(p.ExtendedDataRegAppName,t.name);for(let s of i.records)if(s instanceof Fi)this._writer.Write(s.code,s.value);else if(s instanceof Pe)this._writer.Write(s.code,s.value);else if(s instanceof Yi)this._writer.Write(s.code,s.value);else if(s instanceof Xi)this._writer.Write(s.code,s.value);else if(s instanceof Zi)this._writer.Write(s.code,s.value);else if(s instanceof zi)this._writer.Write(s.code,s.value);else if(s instanceof vi)this._writer.Write(s.code,s.value);else if(s instanceof Ui)this._writer.Write(s.code,s.value);else if(s instanceof $i)this._writer.WriteVector(s.code,s.value);else if(s instanceof Gi)this._writer.WriteVector(s.code,s.value);else if(s instanceof Ki)this._writer.WriteVector(s.code,s.value);else if(s.ResolveReference){let n=s,a=n.value;n.resolveReference(this._document)===null&&(a=0),this._writer.Write(p.ExtendedDataHandle,a)}else if(s instanceof Hi)this._writer.Write(s.code,s.value);else throw new Error(`ExtendedDataRecord of type ${s.constructor.name} not supported.`)}}writeCommonEntityData(e){let t=V.Create(A);if(this._writer.Write(p.Subclass,l.Entity),this._writer.Write(8,e.layer?.name??"0"),this._writer.Write(6,e.lineType?.name??"ByLayer"),e.bookColor!==null?(this._writer.Write(62,e.bookColor.Color.GetApproxIndex()),this._writer.WriteTrueColor(420,e.bookColor.Color),this._writer.Write(430,e.bookColor.Name)):e.color.isTrueColor?this._writer.WriteTrueColor(420,e.color):this._writer.Write(62,e.color.index),e.transparency.value>=0&&this._writer.Write(440,Ke.toAlphaValue(e.transparency)),this._writer.Write(48,e.lineTypeScale,t),this._writer.Write(60,e.isInvisible?1:0,t),e.owner instanceof U){let i=e.owner;i.layout!==null&&this._writer.Write(67,i.layout.IsPaperSpace?1:0)}this._writer.Write(370,e.lineWeight)}writeLongTextValue(e,t,i){for(;i.length>250;)this._writer.Write(t,i.substring(0,250)),i=i.substring(250);this._writer.Write(e,i)}notify(e,t=g.None,i){this.OnNotification&&this.OnNotification(this,new kt(e,t,i))}writeEntity(e){if(!this.isEntitySupported(e))return;this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e);let t=Ae.create(e.constructor.name);e instanceof Ft?this.writeArc(e,t):e instanceof dt?this.writeCircle(e,t):e instanceof Qe?this.writeDimension(e,t):e instanceof je?this.writeDimension(e,t):e instanceof Rt?this.writeDimension(e,t):e instanceof Bt?this.writeDimension(e,t):e instanceof St?this.writeDimension(e,t):e instanceof Ct?this.writeDimension(e,t):e instanceof yt?this.writeDimension(e,t):e instanceof Ut?this.writeEllipse(e,t):e instanceof Yr?this.writeFace3D(e,t):e instanceof Tt?this.writeHatch(e,t):e instanceof Ee?this.writeInsert(e,t):e instanceof nr?this.writeLeader(e,t):e instanceof zt?this.writeLine(e,t):e instanceof qr?this.writeLwPolyline(e,t):e instanceof ar?this.writeMesh(e,t):e instanceof or?this.writeMLine(e,t):e instanceof Ne?this.writeMText(e,t):e instanceof lr?this.writeMultiLeader(e,t):e instanceof dr?this.writeOle2Frame(e,t):e instanceof Qr?this.writePdfUnderlay(e,t):e instanceof Gt?this.writePoint(e,t):e instanceof et?this.writePolyline(e,t):e instanceof tt?this.writePolyline(e,t):e instanceof ut?this.writePolyline(e,t):e instanceof Et?this.writePolyline(e,t):e instanceof ei?this.writeRay(e,t):e instanceof ur?this.writeShape(e,t):e instanceof $t?this.writeSolid(e,t):e instanceof mr?this.writeSpline(e,t):e instanceof Je?this.writeTextEntity(e,t):e instanceof Yt?this.writeTolerance(e,t):e instanceof fr?this.writeViewport(e,t):e instanceof ii?this.writeXLine(e,t):e instanceof ns||e instanceof ls?this.writeCadImage(e,t):e instanceof Le?this.writeSeqend(e,t):this.notify(`Entity not implemented: ${e.constructor.name}`,g.NotImplemented),this.writeExtendedData(e.extendedData)}isEntitySupported(e){return!(e instanceof Lt)}writeArc(e,t){this.writeCircle(e,t);let i=t.subClasses.get(l.Arc);this._writer.Write(p.Subclass,l.Arc),this._writer.Write(50,e.startAngle,i),this._writer.Write(51,e.endAngle,i)}writeCircle(e,t){let i=t.subClasses.get(l.Circle);this._writer.Write(p.Subclass,l.Circle),this._writer.WriteVector(10,e.center,i),this._writer.Write(40,e.radius,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeDimension(e,t){let i=t.subClasses.get(l.Dimension);this._writer.Write(p.Subclass,l.Dimension),this._writer.Write(2,e.block?.name??"",i),this._writer.WriteVector(10,e.definitionPoint,i),this._writer.WriteVector(11,e.textMiddlePoint,i),this._writer.Write(70,e.flags,i),this._writer.Write(71,e.attachmentPoint,i),this._writer.Write(72,e.lineSpacingStyle,i),this._writer.Write(41,e.lineSpacingFactor,i),this._writer.Write(42,e.measurement,i),this._writer.Write(1,e.text,i),this._writer.Write(53,e.textRotation,i),this._writer.Write(51,e.horizontalDirection,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(3,e.style?.name??"",i),e instanceof je&&this.writeDimensionAligned(e,t),e instanceof Qe&&this.writeDimensionLinear(e,t),e instanceof Rt&&this.writeDimensionRadius(e,t),e instanceof Bt&&this.writeDimensionDiameter(e,t),e instanceof St&&this.writeDimensionAngular2Line(e,t),e instanceof Ct&&this.writeDimensionAngular3Pt(e,t),e instanceof yt&&this.writeDimensionOrdinate(e,t)}writeDimensionAligned(e,t){let i=t.subClasses.get(l.AlignedDimension);this._writer.Write(p.Subclass,l.AlignedDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i)}writeDimensionLinear(e,t){this.writeDimensionAligned(e,t);let i=t.subClasses.get(l.LinearDimension);this._writer.Write(p.Subclass,l.LinearDimension),this._writer.Write(50,e.rotation,i)}writeDimensionRadius(e,t){let i=t.subClasses.get(l.RadialDimension);this._writer.Write(p.Subclass,l.RadialDimension),this._writer.WriteVector(15,e.angleVertex,i),this._writer.Write(40,e.leaderLength,i)}writeDimensionDiameter(e,t){let i=t.subClasses.get(l.DiametricDimension);this._writer.Write(p.Subclass,l.DiametricDimension),this._writer.WriteVector(15,e.angleVertex,i),this._writer.Write(40,e.leaderLength,i)}writeDimensionAngular2Line(e,t){let i=t.subClasses.get(l.Angular2LineDimension);this._writer.Write(p.Subclass,l.Angular2LineDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i),this._writer.WriteVector(15,e.angleVertex,i),this._writer.WriteVector(16,e.dimensionArc,i)}writeDimensionAngular3Pt(e,t){let i=t.subClasses.get(l.Angular3PointDimension);this._writer.Write(p.Subclass,l.Angular3PointDimension),this._writer.WriteVector(13,e.firstPoint,i),this._writer.WriteVector(14,e.secondPoint,i),this._writer.WriteVector(15,e.angleVertex,i)}writeDimensionOrdinate(e,t){let i=t.subClasses.get(l.OrdinateDimension);this._writer.Write(p.Subclass,l.OrdinateDimension),this._writer.WriteVector(13,e.featureLocation,i),this._writer.WriteVector(14,e.leaderEndpoint,i)}writeEllipse(e,t){let i=t.subClasses.get(l.Ellipse);this._writer.Write(p.Subclass,l.Ellipse),this._writer.WriteVector(10,e.center,i),this._writer.WriteVector(11,e.majorAxisEndPoint,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(40,e.radiusRatio,i),this._writer.Write(41,e.startParameter,i),this._writer.Write(42,e.endParameter,i)}writeFace3D(e,t){let i=t.subClasses.get(l.Face3d);this._writer.Write(p.Subclass,l.Face3d),this._writer.WriteVector(10,e.firstCorner,i),this._writer.WriteVector(11,e.secondCorner,i),this._writer.WriteVector(12,e.thirdCorner,i),this._writer.WriteVector(13,e.fourthCorner,i),this._writer.Write(70,e.flags,i)}writeHatch(e,t){let i=t.subClasses.get(l.Hatch);this._writer.Write(p.Subclass,l.Hatch),this._writer.Write(30,e.elevation,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(2,e.pattern.name,i),this._writer.Write(70,e.isSolid?1:0,i),this._writer.Write(71,e.isAssociative?1:0,i),this._writer.Write(91,e.paths.length);for(let s of e.paths)this.writeBoundaryPath(s);if(this._writer.Write(75,e.style,i),this._writer.Write(76,e.patternType,i),!e.isSolid){this._writer.Write(52,e.patternAngle,i),this._writer.Write(41,e.patternScale,i),this._writer.Write(77,e.isDouble?1:0,i),this._writer.Write(78,e.pattern.lines.length);for(let s of e.pattern.lines){this._writer.Write(53,s.angle),this._writer.Write(43,s.basePoint.x),this._writer.Write(44,s.basePoint.y),this._writer.Write(45,s.offset.x),this._writer.Write(46,s.offset.y),this._writer.Write(79,s.dashLengths.length);for(let n of s.dashLengths)this._writer.Write(49,n)}}this._writer.Write(47,e.pixelSize,i),this._writer.Write(98,e.seedPoints.length);for(let s of e.seedPoints)this._writer.Write(10,s.x),this._writer.Write(20,s.y);if(e.gradientColor.enabled){this._writer.Write(450,e.gradientColor.enabled?1:0),this._writer.Write(451,e.gradientColor.reserved),this._writer.Write(452,e.gradientColor.isSingleColorGradient?1:0),this._writer.Write(453,e.gradientColor.colors.length);for(let s of e.gradientColor.colors)this._writer.Write(463,s.value),this._writer.Write(63,s.color.index),this._writer.Write(421,s.color.trueColor);this._writer.Write(460,e.gradientColor.angle),this._writer.Write(461,e.gradientColor.shift),this._writer.Write(462,e.gradientColor.colorTint),this._writer.Write(470,e.gradientColor.name)}}writeBoundaryPath(e){if(this._writer.Write(92,e.flags),(e.flags&qe.Polyline)!==0)for(let t of e.edges)t instanceof is&&this.writePolylineBoundary(t);else{this._writer.Write(93,e.edges.length);for(let t of e.edges)this.writeBoundaryEdge(t)}this._writer.Write(97,e.entities.length);for(let t of e.entities)this._writer.Write(330,t.handle)}writePolylineBoundary(e){let t=e.vertices.some(i=>i.Z!==0);this._writer.Write(72,t?1:0),this._writer.Write(73,e.isClosed?1:0),this._writer.Write(93,e.vertices.length);for(let i of e.vertices)this._writer.Write(10,i.X),this._writer.Write(20,i.Y),t&&this._writer.Write(42,i.Z)}writeBoundaryEdge(e){if(e instanceof Kr)this._writer.Write(72,1),this._writer.Write(10,e.start.X),this._writer.Write(20,e.start.Y),this._writer.Write(11,e.end.X),this._writer.Write(21,e.end.Y);else if(e instanceof Xr)this._writer.Write(72,2),this._writer.Write(10,e.center.X),this._writer.Write(20,e.center.Y),this._writer.Write(40,e.radius),this._writer.Write(50,Q.RadToDeg(e.startAngle)),this._writer.Write(51,Q.RadToDeg(e.endAngle)),this._writer.Write(73,e.counterClockWise?1:0);else if(e instanceof Zr)this._writer.Write(72,3),this._writer.Write(10,e.center.X),this._writer.Write(20,e.center.Y),this._writer.Write(11,e.majorAxisEndPoint.X),this._writer.Write(21,e.majorAxisEndPoint.Y),this._writer.Write(40,e.minorToMajorRatio),this._writer.Write(50,Q.RadToDeg(e.startAngle)),this._writer.Write(51,Q.RadToDeg(e.endAngle)),this._writer.Write(73,e.counterClockWise?1:0);else if(e instanceof Jr){this._writer.Write(72,4),this._writer.Write(94,e.degree),this._writer.Write(73,e.isRational?1:0),this._writer.Write(74,e.isPeriodic?1:0),this._writer.Write(95,e.knots.length),this._writer.Write(96,e.controlPoints.length);for(let t of e.knots)this._writer.Write(40,t);for(let t of e.controlPoints)this._writer.Write(10,t.X),this._writer.Write(20,t.Y),e.isRational&&this._writer.Write(42,t.Z);if(e.fitPoints.length>0){this._writer.Write(97,e.fitPoints.length);for(let t of e.fitPoints)this._writer.Write(11,t.X),this._writer.Write(21,t.Y)}this._writer.Write(12,e.startTangent.X),this._writer.Write(22,e.startTangent.Y),this._writer.Write(13,e.endTangent.X),this._writer.Write(23,e.endTangent.Y)}}writeInsert(e,t){let i=t.subClasses.get(l.Insert);this._writer.Write(p.Subclass,l.Insert),this._writer.Write(66,e.hasAttributes?1:0),this._writer.Write(2,e.block?.name??"",i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(41,e.xScale,i),this._writer.Write(42,e.yScale,i),this._writer.Write(43,e.zScale,i),this._writer.Write(50,e.rotation,i),this._writer.Write(70,e.columnCount,i),this._writer.Write(71,e.rowCount,i),this._writer.Write(44,e.columnSpacing,i),this._writer.Write(45,e.rowSpacing,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.attributes)this.writeEntity(s);e.hasAttributes&&e.attributes.Seqend&&this.writeEntity(e.attributes.Seqend)}writeLeader(e,t){let i=t.subClasses.get(l.Leader);this._writer.Write(p.Subclass,l.Leader),this._writer.Write(3,e.style?.name??"",i),this._writer.Write(71,e.arrowHeadEnabled?1:0,i),this._writer.Write(72,e.pathType,i),this._writer.Write(73,e.creationType,i),this._writer.Write(74,e.hookLineDirection?1:0,i),this._writer.Write(75,e.hasHookline?1:0,i),this._writer.Write(40,e.textHeight,i),this._writer.Write(41,e.textWidth,i),this._writer.Write(76,e.vertices.length);for(let s of e.vertices)this._writer.WriteVector(10,s);this._writer.Write(77,e.color?1:0,i),this._writer.WriteHandle(340,e.associatedAnnotation),this._writer.WriteVector(210,e.normal,i),this._writer.WriteVector(211,e.horizontalDirection,i),this._writer.WriteVector(212,e.blockOffset,i),this._writer.WriteVector(213,e.annotationOffset,i)}writeLine(e,t){let i=t.subClasses.get(l.Line);this._writer.Write(p.Subclass,l.Line),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(11,e.endPoint,i),this._writer.WriteVector(210,e.normal,i)}writeLwPolyline(e,t){let i=t.subClasses.get(l.LwPolyline);this._writer.Write(p.Subclass,l.LwPolyline),this._writer.Write(90,e.vertices.length),this._writer.Write(70,e.flags,i),this._writer.Write(43,e.constantWidth,i),this._writer.Write(38,e.elevation,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.vertices)this._writer.Write(10,s.location.x),this._writer.Write(20,s.location.y),this._writer.Write(40,s.startWidth),this._writer.Write(41,s.endWidth),this._writer.Write(42,s.bulge),s.id!==0&&this._writer.Write(91,s.id)}writeMesh(e,t){let i=t.subClasses.get(l.Mesh);this._writer.Write(p.Subclass,l.Mesh),this._writer.Write(71,e.subdivisionLevel,i),this._writer.Write(72,0),this._writer.Write(91,0),this._writer.Write(92,e.vertices.length);for(let n of e.vertices)this._writer.WriteVector(10,n);let s=0;for(let n of e.faces)s+=1+n.length;this._writer.Write(93,s);for(let n of e.faces){this._writer.Write(90,n.length);for(let a of n)this._writer.Write(90,a)}this._writer.Write(94,e.edges.length);for(let n of e.edges)this._writer.Write(90,n.start),this._writer.Write(90,n.end);this._writer.Write(95,e.edges.length);for(let n of e.edges)this._writer.Write(140,n.crease)}writeMLine(e,t){let i=t.subClasses.get(l.MLine);this._writer.Write(p.Subclass,l.MLine),this._writer.WriteHandle(340,e.style,i),this._writer.Write(40,e.scaleFactor,i),this._writer.Write(70,e.justification,i),this._writer.Write(71,e.flags,i),this._writer.Write(72,e.vertices.length),this._writer.Write(73,e.style?.Elements?.length??0),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(210,e.normal,i);for(let s of e.vertices){this._writer.WriteVector(11,s.position),this._writer.WriteVector(12,s.direction),this._writer.WriteVector(13,s.miter);for(let n of s.segments){this._writer.Write(74,n.parameters.length);for(let a of n.parameters)this._writer.Write(41,a);this._writer.Write(75,n.areaFillParameters.length);for(let a of n.areaFillParameters)this._writer.Write(42,a)}}}writeMText(e,t){let i=t.subClasses.get(l.MText);this._writer.Write(p.Subclass,l.MText),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(40,e.height,i),this._writer.Write(41,e.rectangleWidth,i),this._writer.Write(46,e.rectangleHeight,i),this._writer.Write(71,e.attachmentPoint,i),this._writer.Write(72,e.drawingDirection,i),this.writeLongTextValue(1,3,e.value??""),this._writer.Write(7,e.style?.name??"",i),this._writer.WriteVector(210,e.normal,i),this._writer.WriteVector(11,e.alignmentPoint,i),this._writer.Write(73,e.lineSpacingStyle,i),this._writer.Write(44,e.lineSpacing,i),this._writer.Write(90,e.backgroundFillFlags,i),e.backgroundFillFlags>0&&(this._writer.Write(63,e.backgroundColor.index),this._writer.Write(45,e.backgroundScale,i),this._writer.WriteTrueColor(420,e.backgroundColor),this._writer.Write(441,e.backgroundTransparency))}writeMultiLeader(e,t){let i=t.subClasses.get(l.Leader);this._writer.Write(p.Subclass,l.Leader),this._writer.Write(270,e.contentType,i),this._writer.WriteHandle(340,e.style),this._writer.WriteHandle(341,e.leaderLineType),this._writer.WriteCmColor(91,e.lineColor,i),this._writer.Write(170,e.pathType,i),this._writer.Write(171,e.lineColor,i),this._writer.WriteHandle(343,e.textStyle),this._writer.Write(173,e.textLeftAttachment,i),this._writer.Write(95,e.textRightAttachment,i),e.contextData&&(this._writer.Write(300,"CONTEXT_DATA{"),this.writeAnnotContext(e.contextData,t),this._writer.Write(301,"}")),this._writer.Write(44,e.scaleFactor,i),this._writer.Write(294,e.textDirectionNegative,i),this._writer.Write(274,e.textAligninIPE,i),this._writer.Write(178,e.textAttachmentDirection,i),this._writer.Write(175,e.textAttachmentDirection,i),this._writer.Write(176,e.textAttachmentDirection,i)}writeAnnotContext(e,t){let i=V.Create(Dr);this._writer.WriteVector(10,e.contentBasePoint,i),this._writer.Write(41,e.textHeight,i),this._writer.Write(140,e.arrowheadSize,i),this._writer.Write(145,e.landingGap,i),this._writer.Write(174,e.textLeftAttachment,i),this._writer.Write(175,e.textRightAttachment,i),this._writer.Write(176,e.textAlignment,i),this._writer.Write(177,e.blockContentConnection,i),this._writer.Write(290,e.hasTextContents,i),this._writer.WriteVector(110,e.contentBasePoint,i),this._writer.WriteVector(111,e.baseDirection,i),this._writer.WriteVector(112,e.baseVertical,i),this._writer.Write(297,e.normalReversed,i),this._writer.WriteVector(12,e.textLocation,i),this._writer.WriteVector(13,e.direction,i);for(let s of e.leaderRoots)this._writer.Write(302,"LEADER{"),this.writeLeaderRoot(s),this._writer.Write(303,"}");this._writer.WriteHandle(340,e.textStyle)}writeLeaderRoot(e){let t=V.Create(e.constructor.name);this._writer.Write(290,e.contentValid,t),this._writer.WriteVector(10,e.connectionPoint,t),this._writer.WriteVector(11,e.direction,t);for(let i of e.lines)this._writer.Write(304,"LEADER_LINE{"),this.writeLeaderLine(i),this._writer.Write(305,"}");this._writer.Write(271,e.textAttachmentDirection,t)}writeLeaderLine(e){for(let t of e.points)this._writer.WriteVector(10,t);this._writer.Write(91,e.breakInfoCount)}writeOle2Frame(e,t){let i=t.subClasses.get(l.Ole2Frame);this._writer.Write(p.Subclass,l.Ole2Frame),this._writer.Write(70,e.oleObjectType,i),this._writer.Write(3,e.sourceApplication,i),this._writer.WriteVector(10,e.upperLeftCorner,i),this._writer.WriteVector(11,e.lowerRightCorner,i)}writePdfUnderlay(e,t){let i=t.subClasses.get(l.Underlay);this._writer.Write(p.Subclass,l.Underlay),this._writer.WriteHandle(340,e.definition,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(41,e.xScale,i),this._writer.Write(42,e.yScale,i),this._writer.Write(43,e.zScale,i),this._writer.Write(50,e.rotation,i),this._writer.Write(280,e.flags,i),this._writer.Write(281,e.contrast,i),this._writer.Write(282,e.fade,i)}writePoint(e,t){let i=t.subClasses.get(l.Point);this._writer.Write(p.Subclass,l.Point),this._writer.WriteVector(10,e.location,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(50,e.rotation,i)}writePolyline(e,t){this._writer.Write(p.Subclass,e.subclassMarker),this._writer.Write(66,1),this._writer.Write(70,e.flags),this._writer.WriteVector(210,e.normal);for(let i of e.vertices)i instanceof Ue&&this.writeVertex(i,t);this.writeSeqend(e.vertices.Seqend,t)}writeVertex(e,t){this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e),this._writer.Write(p.Subclass,l.Vertex),this._writer.Write(p.Subclass,e.subclassMarker),this._writer.WriteVector(10,e.location),this._writer.Write(70,e.flags),e instanceof Xt?(this._writer.Write(40,e.startWidth),this._writer.Write(41,e.endWidth),this._writer.Write(42,e.bulge),this._writer.Write(50,e.curveTangent)):e instanceof Zt&&(this._writer.Write(71,e.index1),this._writer.Write(72,e.index2),this._writer.Write(73,e.index3),this._writer.Write(74,e.index4))}writeRay(e,t){let i=t.subClasses.get(l.Ray);this._writer.Write(p.Subclass,l.Ray),this._writer.WriteVector(10,e.startPoint,i),this._writer.WriteVector(11,e.direction,i)}writeShape(e,t){let i=t.subClasses.get(l.Shape);this._writer.Write(p.Subclass,l.Shape),this._writer.WriteVector(10,e.insertionPoint,i),this._writer.Write(40,e.size,i),this._writer.Write(2,e.shapeIndex,i),this._writer.Write(50,e.rotation,i),this._writer.Write(41,e.relativeXScale,i),this._writer.Write(51,e.obliqueAngle,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeSolid(e,t){let i=t.subClasses.get(l.Solid);this._writer.Write(p.Subclass,l.Solid),this._writer.WriteVector(10,e.firstCorner,i),this._writer.WriteVector(11,e.secondCorner,i),this._writer.WriteVector(12,e.thirdCorner,i),this._writer.WriteVector(13,e.fourthCorner,i),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(210,e.normal,i)}writeSpline(e,t){let i=t.subClasses.get(l.Spline);this._writer.Write(p.Subclass,l.Spline),this._writer.WriteVector(210,e.normal,i),this._writer.Write(70,e.flags,i),this._writer.Write(71,e.degree,i),this._writer.Write(72,e.knots.length),this._writer.Write(73,e.controlPoints.length),this._writer.Write(74,e.fitPoints.length),this._writer.Write(42,e.knotTolerance,i),this._writer.Write(43,e.controlPointTolerance,i),this._writer.Write(44,e.fitTolerance,i),e.startTangent&&this._writer.WriteVector(12,e.startTangent),e.endTangent&&this._writer.WriteVector(13,e.endTangent);for(let s of e.knots)this._writer.Write(40,s);for(let s=0;s<e.controlPoints.length;s++)this._writer.WriteVector(10,e.controlPoints[s]),s<e.weights.length&&this._writer.Write(41,e.weights[s]);for(let s of e.fitPoints)this._writer.WriteVector(11,s)}writeTextEntity(e,t){let i=t.subClasses.get(l.Text);this._writer.Write(p.Subclass,l.Text),this._writer.Write(39,e.thickness,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.Write(40,e.height,i),this._writer.Write(1,e.value??"",i),this._writer.Write(50,e.rotation,i),this._writer.Write(41,e.widthFactor,i),this._writer.Write(51,e.obliqueAngle,i),this._writer.Write(7,e.style?.name??"",i),this._writer.Write(71,e.mirror,i),this._writer.Write(72,e.horizontalAlignment,i),this._writer.WriteVector(11,e.alignmentPoint,i),this._writer.WriteVector(210,e.normal,i),this._writer.Write(p.Subclass,l.Text),this._writer.Write(73,e.verticalAlignment,i)}writeTolerance(e,t){let i=t.subClasses.get(l.Tolerance);this._writer.Write(p.Subclass,l.Tolerance),this._writer.Write(3,e.style?.name??"",i),this._writer.WriteVector(10,e.insertionPoint,i),this._writer.Write(1,e.text??"",i),this._writer.WriteVector(11,e.direction,i),this._writer.WriteVector(210,e.normal,i)}writeViewport(e,t){let i=t.subClasses.get(l.Viewport);this._writer.Write(p.Subclass,l.Viewport),this._writer.WriteVector(10,e.center,i),this._writer.Write(40,e.width,i),this._writer.Write(41,e.height,i),this._writer.Write(68,e.id,i),this._writer.WriteVector(12,e.viewCenter,i),this._writer.WriteVector(13,e.snapBase,i),this._writer.WriteVector(14,e.snapSpacing,i),this._writer.WriteVector(15,e.gridSpacing,i),this._writer.WriteVector(16,e.viewDirection,i),this._writer.WriteVector(17,e.viewTarget,i),this._writer.Write(42,e.lensLength,i),this._writer.Write(43,e.frontClipPlane,i),this._writer.Write(44,e.backClipPlane,i),this._writer.Write(45,e.viewHeight,i),this._writer.Write(50,e.twistAngle,i),this._writer.Write(51,e.circleZoomPercent,i),this._writer.Write(72,e.displayUcsIcon,i),this._writer.Write(90,e.status,i),this._writer.Write(110,e.ucsOrigin,i),this._writer.Write(111,e.ucsXAxis,i),this._writer.Write(112,e.ucsYAxis,i),this._writer.Write(281,e.renderMode,i);for(let s of e.frozenLayers)this._writer.WriteHandle(331,s)}writeXLine(e,t){let i=t.subClasses.get(l.XLine);this._writer.Write(p.Subclass,l.XLine),this._writer.WriteVector(10,e.firstPoint,i),this._writer.WriteVector(11,e.direction,i)}writeCadImage(e,t){let i=t.subClasses.get(l.RasterImage);this._writer.Write(p.Subclass,l.RasterImage),this._writer.Write(90,e.classVersion,i),this._writer.WriteVector(10,e.insertPoint,i),this._writer.WriteVector(11,e.uVector,i),this._writer.WriteVector(12,e.vVector,i),this._writer.WriteVector(13,e.size,i),this._writer.WriteHandle(340,e.definition,i),this._writer.Write(70,e.flags,i),this._writer.Write(280,e.clippingState,i),this._writer.Write(281,e.brightness,i),this._writer.Write(282,e.contrast,i),this._writer.Write(283,e.fade,i),this._writer.WriteHandle(360,e.definitionReactor,i),this._writer.Write(71,e.clipType,i),this._writer.Write(91,e.clipBoundaryVertices.length);for(let s of e.clipBoundaryVertices)this._writer.Write(14,s.X),this._writer.Write(24,s.Y)}writeSeqend(e,t){e&&(this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e))}writeAttributeBase(e,t){this._writer.Write(p.Subclass,e.subclassMarker),this._writer.Write(2,e.tag),this._writer.Write(70,e.flags),this._writer.WriteVector(10,e.insertPoint),this._writer.Write(40,e.height),this._writer.Write(1,e.value??""),this._writer.Write(7,e.style?.name??""),this._writer.Write(41,e.widthFactor),this._writer.Write(50,e.rotation),this._writer.Write(51,e.obliqueAngle),this._writer.WriteVector(11,e.alignmentPoint),this._writer.Write(71,e.mirror),this._writer.Write(72,e.horizontalAlignment),this._writer.Write(73,e.verticalAlignment),this._writer.WriteVector(210,e.normal)}};D();q();x();var Od=class extends Nt{get SectionName(){return d.BlocksSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){for(let e of this._document.blockRecords)this.writeBlock(e.blockEntity),this.processEntities(e),this.writeBlockEnd(e.blockEnd)}writeBlock(e){let t=V.Create(Pr);this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this.writeCommonEntityData(e),this._writer.Write(p.Subclass,l.BlockBegin),e.xRefPath&&this._writer.Write(1,e.xRefPath,t),this._writer.Write(2,e.name,t),this._writer.Write(70,e.flags,t),this.Version>=m.AC1015&&e.isUnloaded&&this._writer.Write(71,e.isUnloaded?1:0,t),this._writer.WriteVector(10,e.basePoint,t),this._writer.Write(3,e.name,t),this._writer.Write(4,e.comments,t)}processEntities(e){if(e.name===U.ModelSpaceName||e.name===U.PaperSpaceName)for(let t of e.entities)t instanceof Le,this.Holder.Entities.push(t);else for(let t of e.entities)this.writeEntity(t)}writeBlockEnd(e){this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.Entity),this._writer.Write(8,e.layer.name),this._writer.Write(p.Subclass,l.BlockEnd)}};D();var jd=class extends Nt{get SectionName(){return d.ClassesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){let e=this._document.classes;if(!(e==null||typeof e[Symbol.iterator]!="function"))for(let t of e)this._writer.Write(0,d.ClassEntry),this._writer.Write(1,t.dxfName),this._writer.Write(2,t.cppClassName),this._writer.Write(3,t.applicationName),this._writer.Write(90,t.proxyFlags),this.Version>m.AC1015&&this._writer.Write(91,t.instanceCount),this._writer.Write(280,t.wasZombie),this._writer.Write(281,t.isAnEntity)}};D();var Nd=class extends Nt{get SectionName(){return d.EntitiesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){for(;this.Holder.Entities.length>0;){let e=this.Holder.Entities.shift();this.writeEntity(e)}}};D();q();var Vd=class extends Nt{get SectionName(){return d.HeaderSection}get Header(){return this._document.header}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){let e=lt.GetHeaderMap();for(let[t,i]of e)if(!(!this.Configuration.WriteAllHeaderVariables&&!this.Configuration.HeaderVariables.has(t))&&(i.referenceType&Lr.Ignored)===0&&!(i.getValue(this.Header)===null||i.getValue(this.Header)===void 0)){if(this._writer.Write(p.CLShapeText,t),t==="$HANDSEED"){this._writer.Write(p.Handle,this._document.header.handleSeed);continue}if(t==="$CECOLOR"){this._writer.Write(62,this._document.header.currentEntityColor.getApproxIndex());continue}for(let s of i.DxfCodes){let n=i.getSystemValue(s,this._document.header);n!=null&&this._writer.Write(s,n)}}}};D();q();x();kr();var Id=class extends Nt{get SectionName(){return d.ObjectsSection}constructor(e,t,i,s){super(e,t,i,s)}writeBookColor(e){this._writer.Write(p.Subclass,l.DbColor),this._writer.Write(62,e.color.getApproxIndex()),this._writer.WriteTrueColor(420,e.color),this._writer.Write(430,`${e.name}$${e.bookName}`)}writeDictionary(e){this._writer.Write(p.Subclass,l.Dictionary),this._writer.Write(280,e.hardOwnerFlag),this._writer.Write(281,e.clonningFlags);for(let t of e)t instanceof _t&&!this.Configuration.WriteXRecords||(this._writer.Write(3,t.name),this._writer.Write(350,t.handle),this.Holder.Objects.push(t));e instanceof Cr&&(this._writer.Write(100,l.DictionaryWithDefault),this._writer.WriteHandle(340,e.defaultEntry))}writeDictionaryVariable(e){let t=V.Create(He);this._writer.Write(100,l.DictionaryVariables),this._writer.Write(1,e.value,t),this._writer.Write(280,e.objectSchemaNumber,t)}writeGeoData(e){let t=V.Create(Jt);switch(this._writer.Write(100,l.GeoData,t),this.Version){case m.Unknown:case m.MC0_0:case m.AC1_2:case m.AC1_4:case m.AC1_50:case m.AC2_10:case m.AC1002:case m.AC1003:case m.AC1004:case m.AC1006:case m.AC1009:case m.AC1012:case m.AC1014:case m.AC1015:case m.AC1018:case m.AC1021:this._writer.Write(90,1,t);break;case m.AC1024:this._writer.Write(90,2,t);break;case m.AC1027:case m.AC1032:this._writer.Write(90,3,t);break}if(e.hostBlock!==null&&this._writer.Write(330,e.hostBlock.Handle,t),this._writer.Write(70,e.coordinatesType,t),this.Version<=m.AC1021){this._writer.Write(40,e.referencePoint.y,t),this._writer.Write(41,e.referencePoint.x,t),this._writer.Write(42,e.referencePoint.z,t),this._writer.Write(91,e.horizontalUnits,t),this._writer.WriteVector(10,e.designPoint,t),this._writer.WriteVector(11,c.Zero,t),this._writer.WriteVector(210,e.upDirection,t),this._writer.Write(52,Q.RadToDeg(Math.PI/2-e.northDirection.getAngle()),t),this._writer.Write(43,1,t),this._writer.Write(44,1,t),this._writer.Write(45,1,t),this._writer.Write(301,e.coordinateSystemDefinition,t),this._writer.Write(302,e.geoRssTag,t),this._writer.Write(46,e.userSpecifiedScaleFactor,t),this._writer.Write(303,"",t),this._writer.Write(304,"",t),this._writer.Write(305,e.observationFromTag,t),this._writer.Write(306,e.observationToTag,t),this._writer.Write(307,e.observationCoverageTag,t),this._writer.Write(93,e.points.length,t);for(let i of e.points)this._writer.WriteVector(12,i.source,t),this._writer.WriteVector(13,i.destination,t);this._writer.Write(96,e.faces.length,t);for(let i of e.faces)this._writer.Write(97,i.index1,t),this._writer.Write(98,i.index2,t),this._writer.Write(99,i.index3,t);this._writer.Write(3,"CIVIL3D_DATA_BEGIN",t),this._writer.Write(292,!1,t),this._writer.WriteVector(14,new C(e.referencePoint.x,e.referencePoint.y),t),this._writer.WriteVector(15,new C(e.referencePoint.x,e.referencePoint.y),t),this._writer.Write(93,0,t),this._writer.Write(94,0,t),this._writer.Write(293,!1,t),this._writer.WriteVector(16,C.Zero,t),this._writer.WriteVector(17,C.Zero,t),this._writer.Write(54,Q.RadToDeg(Math.PI/2-e.northDirection.getAngle()),t),this._writer.Write(140,Math.PI/2-e.northDirection.getAngle(),t),this._writer.Write(95,e.scaleEstimationMethod,t),this._writer.Write(141,e.userSpecifiedScaleFactor,t),this._writer.Write(294,e.enableSeaLevelCorrection,t),this._writer.Write(142,e.seaLevelElevation,t),this._writer.Write(143,e.coordinateProjectionRadius,t),this._writer.Write(4,"CIVIL3D_DATA_END",t)}else{this._writer.WriteVector(10,e.designPoint,t),this._writer.WriteVector(11,e.referencePoint,t),this._writer.Write(40,e.verticalUnitScale,t),this._writer.Write(91,e.horizontalUnits,t),this._writer.Write(41,e.verticalUnitScale,t),this._writer.Write(92,e.verticalUnits,t),this._writer.WriteVector(210,e.upDirection,t),this._writer.WriteVector(12,e.northDirection,t),this._writer.Write(95,e.scaleEstimationMethod,t),this._writer.Write(141,e.userSpecifiedScaleFactor,t),this._writer.Write(294,e.enableSeaLevelCorrection,t),this._writer.Write(142,e.seaLevelElevation,t),this._writer.Write(143,e.coordinateProjectionRadius,t),this.writeLongTextValue(301,303,e.coordinateSystemDefinition),this._writer.Write(302,e.geoRssTag,t),this._writer.Write(305,e.observationFromTag,t),this._writer.Write(306,e.observationToTag,t),this._writer.Write(307,e.observationCoverageTag,t),this._writer.Write(93,e.points.length,t);for(let i of e.points)this._writer.WriteVector(13,i.source,t),this._writer.WriteVector(14,i.destination,t);this._writer.Write(96,e.faces.length,t);for(let i of e.faces)this._writer.Write(97,i.index1,t),this._writer.Write(98,i.index2,t),this._writer.Write(99,i.index3,t)}}writeGroup(e){this._writer.Write(100,l.Group),this._writer.Write(300,e.description),this._writer.Write(70,e.isUnnamed?1:0),this._writer.Write(71,e.selectable?1:0);for(let t of e.entities)this._writer.WriteHandle(340,t)}writeImageDefinition(e){let t=V.Create(Tr);this._writer.Write(100,l.RasterImageDef),this._writer.Write(90,e.classVersion,t),this._writer.Write(1,e.fileName,t),this._writer.WriteVector(10,e.size,t),this._writer.Write(280,e.isLoaded?1:0,t),this._writer.Write(281,e.units,t)}writeLayout(e){let t=V.Create(nt);this.writePlotSettings(e),this._writer.Write(100,l.Layout),this._writer.Write(1,e.name,t),this._writer.Write(71,e.tabOrder,t),this._writer.WriteVector(10,e.minLimits,t),this._writer.WriteVector(11,e.maxLimits,t),this._writer.WriteVector(12,e.insertionBasePoint,t),this._writer.WriteVector(13,e.origin,t),this._writer.WriteVector(14,e.minExtents,t),this._writer.WriteVector(15,e.maxExtents,t),this._writer.WriteVector(16,e.xAxis,t),this._writer.WriteVector(17,e.yAxis,t),this._writer.Write(146,e.elevation,t),this._writer.Write(76,0,t),this._writer.WriteHandle(330,e.associatedBlock,t)}writeMLineStyle(e){let t=V.Create(wt);this._writer.Write(100,l.MLineStyle),this._writer.Write(2,e.name,t),this._writer.Write(70,e.flags,t),this._writer.Write(3,e.description,t),this._writer.Write(62,e.fillColor.getApproxIndex(),t),this._writer.Write(51,e.startAngle,t),this._writer.Write(52,e.endAngle,t),this._writer.Write(71,e.elements.length,t);for(let i of e.elements)this._writer.Write(49,i.offset,t),this._writer.Write(62,i.color.index,t),this._writer.Write(6,i.lineType.Name,t)}writeMultiLeaderStyle(e){let t=V.Create($e);this._writer.Write(100,l.MLeaderStyle),this._writer.Write(179,2),this._writer.Write(170,e.contentType,t),this._writer.Write(171,e.multiLeaderDrawOrder,t),this._writer.Write(172,e.leaderDrawOrder,t),this._writer.Write(90,e.maxLeaderSegmentsPoints,t),this._writer.Write(40,e.firstSegmentAngleConstraint,t),this._writer.Write(41,e.secondSegmentAngleConstraint,t),this._writer.Write(173,e.pathType,t),this._writer.WriteCmColor(91,e.lineColor,t),this._writer.WriteHandle(340,e.leaderLineType),this._writer.Write(92,e.leaderLineWeight,t),this._writer.Write(290,e.enableLanding,t),this._writer.Write(42,e.landingGap,t),this._writer.Write(291,e.enableDogleg,t),this._writer.Write(43,e.landingDistance,t),this._writer.Write(3,e.description,t),this._writer.WriteHandle(341,e.arrowhead),this._writer.Write(44,e.arrowheadSize,t),this._writer.Write(300,e.defaultTextContents,t),this._writer.WriteHandle(342,e.textStyle),this._writer.Write(174,e.textLeftAttachment,t),this._writer.Write(178,e.textRightAttachment,t),this._writer.Write(175,e.textAngle,t),this._writer.Write(176,e.textAlignment,t),this._writer.WriteCmColor(93,e.textColor,t),this._writer.Write(45,e.textHeight,t),this._writer.Write(292,e.textFrame,t),this._writer.Write(297,e.textAlignAlwaysLeft,t),this._writer.Write(46,e.alignSpace,t),this._writer.WriteHandle(343,e.blockContent),this._writer.WriteCmColor(94,e.blockContentColor,t),this._writer.Write(47,e.blockContentScale.x,t),this._writer.Write(49,e.blockContentScale.y,t),this._writer.Write(140,e.blockContentScale.z,t),this._writer.Write(293,e.enableBlockContentScale,t),this._writer.Write(141,e.blockContentRotation,t),this._writer.Write(294,e.enableBlockContentRotation,t),this._writer.Write(177,e.blockContentConnection,t),this._writer.Write(142,e.scaleFactor,t),this._writer.Write(295,e.overwritePropertyValue,t),this._writer.Write(296,e.isAnnotative,t),this._writer.Write(143,e.breakGapSize,t),this._writer.Write(271,e.textAttachmentDirection,t),this._writer.Write(272,e.textBottomAttachment,t),this._writer.Write(273,e.textTopAttachment,t),this._writer.Write(298,!1)}writeObject(e){if(this.isObjectSupported(e)&&!(e instanceof _t&&!this.Configuration.WriteXRecords)){if(this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),e instanceof ci){this.writeAcdbPlaceHolder(e);return}else if(e instanceof ui){this.writeBookColor(e);return}else if(e instanceof xe){this.writeDictionary(e);return}else if(e instanceof He)this.writeDictionaryVariable(e);else if(e instanceof Xe)this.writeDimensionAssociation(e);else if(e instanceof Jt)this.writeGeoData(e);else if(e instanceof Ot)this.writeGroup(e);else if(e instanceof Tr){this.writeImageDefinition(e);return}else if(e instanceof li){this.writeImageDefinitionReactor(e);return}else if(e instanceof nt)this.writeLayout(e);else if(e instanceof fi)this.writeField(e);else if(e instanceof pi)this.writeFieldList(e);else if(e instanceof wt)this.writeMLineStyle(e);else if(e instanceof $e)this.writeMultiLeaderStyle(e);else if(e instanceof pt)this.writePlotSettings(e);else if(e instanceof hi)this.writePdfUnderlayDefinition(e);else if(e instanceof Ar)this.writeRasterVariables(e);else if(e instanceof Ge)this.writeScale(e);else if(e instanceof qt)this.writeSpatialFilter(e);else if(e instanceof Br)this.writeSortentsTable(e);else if(e instanceof _t)this.writeXRecord(e);else throw new Error(`Object not implemented : ${e.constructor.name}`);this.writeExtendedData(e.extendedData)}}writePdfUnderlayDefinition(e){let t=V.Create(pt);this._writer.Write(100,l.UnderlayDefinition),this._writer.Write(1,e.file,t),this._writer.Write(2,e.page,t)}writePlotSettings(e){let t=V.Create(pt);this._writer.Write(100,l.PlotSettings),this._writer.Write(1,e.pageName,t),this._writer.Write(2,e.systemPrinterName,t),this._writer.Write(4,e.paperSize,t),this._writer.Write(6,e.plotViewName,t),this._writer.Write(7,e.styleSheet,t),this._writer.Write(40,e.unprintableMargin.left,t),this._writer.Write(41,e.unprintableMargin.bottom,t),this._writer.Write(42,e.unprintableMargin.right,t),this._writer.Write(43,e.unprintableMargin.top,t),this._writer.Write(44,e.paperWidth,t),this._writer.Write(45,e.paperHeight,t),this._writer.Write(46,e.plotOriginX,t),this._writer.Write(47,e.plotOriginY,t),this._writer.Write(48,e.windowLowerLeftX,t),this._writer.Write(49,e.windowLowerLeftY,t),this._writer.Write(140,e.windowUpperLeftX,t),this._writer.Write(141,e.windowUpperLeftY,t),this._writer.Write(142,e.numeratorScale,t),this._writer.Write(143,e.denominatorScale,t),this._writer.Write(70,e.flags,t),this._writer.Write(72,e.paperUnits,t),this._writer.Write(73,e.paperRotation,t),this._writer.Write(74,e.plotType,t),this._writer.Write(75,e.scaledFit,t),this._writer.Write(76,e.shadePlotMode,t),this._writer.Write(77,e.shadePlotResolutionMode,t),this._writer.Write(78,e.shadePlotDPI,t),this._writer.Write(147,e.printScale,t),this._writer.Write(148,e.paperImageOrigin.x,t),this._writer.Write(149,e.paperImageOrigin.y,t)}writeRasterVariables(e){let t=V.Create(Ar);this._writer.Write(100,l.RasterVariables),this._writer.Write(90,e.classVersion,t),this._writer.Write(70,e.isDisplayFrameShown?1:0,t),this._writer.Write(71,e.displayQuality,t),this._writer.Write(72,e.displayQuality,t)}writeScale(e){this._writer.Write(100,l.Scale),this._writer.Write(70,0),this._writer.Write(300,e.name),this._writer.Write(140,e.paperUnits),this._writer.Write(141,e.drawingUnits),this._writer.Write(290,e.isUnitScale?1:0)}writeSection(){for(;this.Holder.Objects.length>0;){let e=this.Holder.Objects.shift();this.writeObject(e)}}writeXRecord(e){this._writer.Write(p.Subclass,l.XRecord),this._writer.Write(280,e.cloningFlags);for(let t of e.entries)switch(t.groupCode){case _.None:break;case _.Point3D:t.value&&typeof t.value.X=="number"&&typeof t.value.Y=="number"?this._writer.WriteVector(t.code,t.value):this._writer.Write(t.code,t.value);break;case _.Handle:case _.ObjectId:case _.ExtendedDataHandle:{let i=t.value;this._writer.Write(t.code,i.handle);break}default:this._writer.Write(t.code,t.value);break}}isObjectSupported(e){return e instanceof pr?!1:e instanceof $s||e instanceof Gs||e instanceof Ys||e instanceof Xe||e instanceof yr||e instanceof at||e instanceof Dr||e instanceof di||e instanceof Ye||e instanceof Er||e instanceof Rr||e instanceof ps||e instanceof mi?(this.notify(`Object not implemented : ${e.constructor.name}`,g.NotImplemented),!1):!0}writeAcdbPlaceHolder(e){}writeDimensionAssociation(e){let t=V.Create(Xe);this._writer.Write(100,l.DimensionAssociation),this._writer.WriteHandle(330,e.dimension,t),this._writer.Write(90,e.associativityFlags,t),this._writer.Write(70,e.isTransSpace,t),this._writer.Write(71,e.rotatedDimensionType,t),(e.associativityFlags&he.FirstPointReference)!==0&&this.writeOsnapPointRef(e.firstPointRef),(e.associativityFlags&he.SecondPointReference)!==0&&this.writeOsnapPointRef(e.secondPointRef),(e.associativityFlags&he.ThirdPointReference)!==0&&this.writeOsnapPointRef(e.thirdPointRef),(e.associativityFlags&he.FourthPointReference)!==0&&this.writeOsnapPointRef(e.fourthPointRef)}writeField(e){this._writer.Write(p.Subclass,l.Field),this._writer.Write(1,e.evaluatorId),this.writeLongTextValue(2,3,e.fieldCode),this._writer.Write(90,e.children.length);for(let t of e.children)this._writer.WriteHandle(360,t);this._writer.Write(97,e.cadObjects.length);for(let t of e.cadObjects)this._writer.WriteHandle(331,t);this._writer.Write(91,e.evaluationOptionFlags),this._writer.Write(92,e.filingOptionFlags),this._writer.Write(94,e.fieldStateFlags),this._writer.Write(95,e.evaluationStatusFlags),this._writer.Write(96,e.evaluationErrorCode),this._writer.Write(300,e.evaluationErrorMessage),this._writer.Write(93,e.values.size);for(let[t,i]of e.values)this._writer.Write(6,t),this.writeCadValue(i);this._writer.Write(7,"ACFD_FIELD_VALUE"),this.writeCadValue(e.value),this.writeLongTextValue(301,9,e.formatString),this._writer.Write(98,e.formatString.length)}writeFieldList(e){this._writer.Write(p.Subclass,l.IdSet),this._writer.Write(90,e.fields.length);for(let t of e.fields)this._writer.WriteHandle(330,t),this.Holder.Objects.push(t);this._writer.Write(p.Subclass,l.FieldList)}writeImageDefinitionReactor(e){this._writer.Write(p.Subclass,l.RasterImageDefReactor),this._writer.Write(90,e.classVersion),this._writer.WriteHandle(330,e.image)}writeOsnapPointRef(e){e!==null&&(this._writer.Write(1,Xe.OsnapPointRefClassName),this._writer.Write(72,e.objectOsnapType),this._writer.WriteHandle(331,e.geometry),this._writer.Write(73,e.subentType),this._writer.Write(91,e.gsMarker),this._writer.Write(40,e.geometryParameter),this._writer.WriteVector(10,e.osnapPoint),this._writer.Write(75,e.hasLastPointRef?1:0))}writeSortentsTable(e){this._writer.Write(p.Subclass,l.SortentsTable),this._writer.WriteHandle(330,e.blockOwner);for(let t of e)this._writer.WriteHandle(331,t.entity),this._writer.Write(5,t.sortHandle)}writeSpatialFilter(e){let t=V.Create(qt);this._writer.Write(100,l.Filter),this._writer.Write(100,l.SpatialFilter),this._writer.Write(70,e.boundaryPoints.length,t);for(let s of e.boundaryPoints)this._writer.WriteVector(10,s,t);this._writer.WriteVector(210,e.normal,t),this._writer.WriteVector(11,e.origin,t),this._writer.Write(71,e.displayBoundary?1:0,t),this._writer.Write(72,e.clipFrontPlane?1:0,t),e.clipFrontPlane&&this._writer.Write(40,e.frontDistance,t),this._writer.Write(73,e.clipBackPlane?1:0,t),e.clipBackPlane&&this._writer.Write(41,e.backDistance,t);let i=[e.inverseInsertTransform.M00,e.inverseInsertTransform.M01,e.inverseInsertTransform.M02,e.inverseInsertTransform.M03,e.inverseInsertTransform.M10,e.inverseInsertTransform.M11,e.inverseInsertTransform.M12,e.inverseInsertTransform.M13,e.inverseInsertTransform.M20,e.inverseInsertTransform.M21,e.inverseInsertTransform.M22,e.inverseInsertTransform.M23,e.insertTransform.M00,e.insertTransform.M01,e.insertTransform.M02,e.insertTransform.M03,e.insertTransform.M10,e.insertTransform.M11,e.insertTransform.M12,e.insertTransform.M13,e.insertTransform.M20,e.insertTransform.M21,e.insertTransform.M22,e.insertTransform.M23];for(let s=0;s<i.length;s++)this._writer.Write(40,i[s])}};D();q();x();var Md=class extends Nt{get SectionName(){return d.TablesSection}constructor(e,t,i,s){super(e,t,i,s)}writeSection(){this.writeTable(this._document.vPorts),this.writeTable(this._document.lineTypes),this.writeTable(this._document.layers),this.writeTable(this._document.textStyles),this.writeTable(this._document.views),this.writeTable(this._document.uCSs),this.writeTable(this._document.appIds),this.writeTable(this._document.dimensionStyles,l.DimensionStyleTable),this.writeTable(this._document.blockRecords)}writeTable(e,t){this._writer.Write(p.Start,d.TableEntry),this._writer.Write(p.SymbolTableName,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.Table),this._writer.Write(70,e.count),t&&this._writer.Write(p.Subclass,t);for(let i of e)this.writeEntry(i);this._writer.Write(p.Start,d.EndTable)}writeEntry(e){let t=Ae.create(e.constructor.name);this._writer.Write(p.Start,e.objectName),this.writeCommonObjectData(e),this._writer.Write(p.Subclass,l.TableRecord),this._writer.Write(p.Subclass,e.subclassMarker),e instanceof te&&e.isShapeFile?this._writer.Write(p.SymbolTableName,""):this._writer.Write(p.SymbolTableName,e.name),this._writer.Write(70,e.flags),e instanceof gt||(e instanceof U?this.writeBlockRecord(e,t.subClasses.get(e.subclassMarker)):e instanceof re?this.writeDimensionStyle(e,t.subClasses.get(e.subclassMarker)):e instanceof Se?this.writeLayer(e,t.subClasses.get(e.subclassMarker)):e instanceof H?this.writeLineType(e,t.subClasses.get(e.subclassMarker)):e instanceof te?this.writeTextStyle(e,t.subClasses.get(e.subclassMarker)):e instanceof ot?this.writeUcs(e,t.subClasses.get(e.subclassMarker)):e instanceof Vi?this.writeView(e,t.subClasses.get(e.subclassMarker)):e instanceof xt&&this.writeVPort(e,t.subClasses.get(e.subclassMarker))),this.writeExtendedData(e.extendedData)}writeBlockRecord(e,t){this._writer.WriteHandle(340,e.layout,t),this._writer.Write(70,e.units,t),this._writer.Write(280,e.isExplodable?1:0,t),this._writer.Write(281,e.canScale?1:0,t)}writeDimensionStyle(e,t){this._writer.Write(3,e.postFix,t),this._writer.Write(4,e.alternateDimensioningSuffix,t),this._writer.Write(40,e.scaleFactor,t),this._writer.Write(41,e.arrowSize,t),this._writer.Write(42,e.extensionLineOffset,t),this._writer.Write(43,e.dimensionLineIncrement,t),this._writer.Write(44,e.extensionLineExtension,t),this._writer.Write(45,e.rounding,t),this._writer.Write(46,e.dimensionLineExtension,t),this._writer.Write(47,e.plusTolerance,t),this._writer.Write(48,e.minusTolerance,t),this._writer.Write(49,e.fixedExtensionLineLength,t),this._writer.Write(50,e.joggedRadiusDimensionTransverseSegmentAngle,t),e.textBackgroundFillMode!==0?(this._writer.Write(69,e.textBackgroundFillMode,t),this._writer.Write(70,e.textBackgroundColor.getApproxIndex(),t)):this._writer.Write(70,0,t),e.arcLengthSymbolPosition!==qs.AboveDimensionText&&this._writer.Write(90,e.arcLengthSymbolPosition),this._writer.Write(140,e.textHeight),this._writer.Write(141,e.centerMarkSize),this._writer.Write(142,e.tickSize),this._writer.Write(143,e.alternateUnitScaleFactor),this._writer.Write(144,e.linearScaleFactor),this._writer.Write(145,e.textVerticalPosition),this._writer.Write(146,e.toleranceScaleFactor),this._writer.Write(147,e.dimensionLineGap),this._writer.Write(148,e.alternateUnitRounding),this._writer.Write(71,e.generateTolerances?1:0),this._writer.Write(72,e.limitsGeneration?1:0),this._writer.Write(73,e.textInsideHorizontal?1:0),this._writer.Write(74,e.textOutsideHorizontal?1:0),this._writer.Write(75,e.suppressFirstExtensionLine?1:0),this._writer.Write(76,e.suppressSecondExtensionLine?1:0),this._writer.Write(77,e.textVerticalAlignment),this._writer.Write(78,e.zeroHandling),this._writer.Write(79,e.angularZeroHandling),this._writer.Write(170,e.alternateUnitDimensioning?1:0),this._writer.Write(171,e.alternateUnitDecimalPlaces),this._writer.Write(172,e.textOutsideExtensions?1:0),this._writer.Write(173,e.separateArrowBlocks?1:0),this._writer.Write(174,e.textInsideExtensions?1:0),this._writer.Write(175,e.suppressOutsideExtensions?1:0),this._writer.Write(176,e.dimensionLineColor.getApproxIndex(),t),this._writer.Write(177,e.extensionLineColor.getApproxIndex(),t),this._writer.Write(178,e.textColor.getApproxIndex(),t),this._writer.Write(179,e.angularDecimalPlaces),this._writer.Write(271,e.decimalPlaces),this._writer.Write(272,e.toleranceDecimalPlaces),this._writer.Write(273,e.alternateUnitFormat),this._writer.Write(274,e.alternateUnitToleranceDecimalPlaces),this._writer.Write(275,e.angularUnit),this._writer.Write(276,e.fractionFormat),this._writer.Write(277,e.linearUnitFormat),this._writer.Write(278,(e.decimalSeparator||".").charCodeAt(0)),this._writer.Write(279,e.textMovement),this._writer.Write(280,e.textHorizontalAlignment),this._writer.Write(281,e.suppressFirstDimensionLine),this._writer.Write(282,e.suppressSecondDimensionLine),this._writer.Write(283,e.toleranceAlignment),this._writer.Write(284,e.toleranceZeroHandling),this._writer.Write(285,e.alternateUnitZeroHandling),this._writer.Write(286,e.alternateUnitToleranceZeroHandling),this._writer.Write(287,e.dimensionFit),this._writer.Write(288,e.cursorUpdate),this._writer.Write(289,e.dimensionTextArrowFit),this._writer.Write(290,e.isExtensionLineLengthFixed),this._writer.WriteHandle(340,e.style,t),this._writer.WriteHandle(341,e.leaderArrow,t),this._writer.WriteHandle(342,e.arrowBlock,t),this._writer.WriteHandle(343,e.dimArrow1,t),this._writer.WriteHandle(344,e.dimArrow2,t),this._writer.Write(371,e.dimensionLineWeight),this._writer.Write(372,e.extensionLineWeight)}writeLayer(e,t){let i=e.color.isTrueColor?e.color.getApproxIndex():e.color.index;e.isOn?this._writer.Write(62,i,t):this._writer.Write(62,-i,t),e.color.isTrueColor&&this._writer.Write(420,e.color.trueColor,t),this._writer.Write(6,e.lineType?.name??"Continuous",t),this._writer.Write(290,e.plotFlag,t),this._writer.Write(370,e.lineWeight,t),this._writer.Write(390,0,t)}writeLineType(e,t){this._writer.Write(3,e.description,t),this._writer.Write(72,e.alignment,t),this._writer.Write(73,e.segments.length,t),this._writer.Write(40,e.patternLength);for(let i of e.segments)this._writer.Write(49,i.length),this._writer.Write(74,i.shapeFlags),i.shapeFlags!==Ze.None&&((i.shapeFlags&Ze.Shape)!==0&&this._writer.Write(75,i.shapeNumber),(i.shapeFlags&Ze.Text)!==0&&this._writer.Write(75,0),i.style===null?this._writer.Write(340,0):this._writer.Write(340,i.style.handle),this._writer.Write(46,i.scale),this._writer.Write(50,Q.RadToDeg(i.rotation)),this._writer.Write(44,i.offset.x),this._writer.Write(45,i.offset.y),this._writer.Write(9,i.text))}writeTextStyle(e,t){e.filename&&this._writer.Write(3,e.filename,t),e.bigFontFilename&&this._writer.Write(4,e.bigFontFilename),this._writer.Write(40,e.height,t),this._writer.Write(41,e.width,t),this._writer.Write(42,e.lastHeight,t),this._writer.Write(50,e.obliqueAngle,t),this._writer.Write(71,e.mirrorFlag,t)}writeUcs(e,t){this._writer.Write(10,e.origin.x,t),this._writer.Write(20,e.origin.y,t),this._writer.Write(30,e.origin.z,t),this._writer.Write(11,e.xAxis.x,t),this._writer.Write(21,e.xAxis.y,t),this._writer.Write(31,e.xAxis.z,t),this._writer.Write(12,e.yAxis.x,t),this._writer.Write(22,e.yAxis.y,t),this._writer.Write(32,e.yAxis.z,t),this._writer.Write(71,e.orthographicType,t),this._writer.Write(79,e.orthographicViewType,t),this._writer.Write(146,e.elevation,t)}writeView(e,t){this._writer.Write(40,e.height,t),this._writer.Write(41,e.width,t),this._writer.Write(42,e.lensLength,t),this._writer.Write(43,e.frontClipping,t),this._writer.Write(44,e.backClipping,t),this._writer.WriteVector(10,e.center,t),this._writer.WriteVector(11,e.direction,t),this._writer.WriteVector(12,e.target,t),this._writer.Write(50,e.angle,t),this._writer.Write(71,e.viewMode),this._writer.Write(72,e.isUcsAssociated,t),this._writer.Write(79,e.ucsOrthographicType),this._writer.Write(281,e.renderMode),this._writer.WriteVector(110,e.ucsOrigin),this._writer.WriteVector(111,e.ucsXAxis),this._writer.WriteVector(112,e.ucsYAxis),this._writer.Write(146,e.ucsElevation)}writeVPort(e,t){this._writer.WriteVector(10,e.bottomLeft,t),this._writer.WriteVector(11,e.topRight,t),this._writer.WriteVector(12,e.center,t),this._writer.WriteVector(13,e.snapBasePoint,t),this._writer.WriteVector(14,e.snapSpacing,t),this._writer.WriteVector(15,e.gridSpacing,t),this._writer.WriteVector(16,e.direction,t),this._writer.WriteVector(17,e.target,t),this._writer.Write(40,e.viewHeight),this._writer.Write(41,e.aspectRatio),this._writer.Write(75,e.snapOn?1:0),this._writer.Write(76,e.showGrid?1:0)}};var Qo=class r extends Ls{static Variables=["$ACADVER","$DWGCODEPAGE","$LASTSAVEDBY","$HANDSEED","$ANGBASE","$ANGDIR","$ATTMODE","$AUNITS","$AUPREC","$CECOLOR","$CELTSCALE","$CELTYPE","$CELWEIGHT","$CLAYER","$CMLJUST","$CMLSCALE","$CMLSTYLE","$DIMSTYLE","$TEXTSIZE","$TEXTSTYLE","$LUNITS","$LUPREC","$MIRRTEXT","$EXTNAMES","$INSBASE","$INSUNITS","$LTSCALE","$LWDISPLAY","$PDMODE","$PDSIZE","$PLINEGEN","$PSLTSCALE","$SPLINESEGS","$SURFU","$SURFV","$TDCREATE","$TDUCREATE","$TDUPDATE","$TDUUPDATE","$TDINDWG"];WriteAllHeaderVariables=!1;WriteOptionalValues=!0;get HeaderVariables(){return this._headerVariables}_headerVariables;constructor(){super(),this._headerVariables=new Set(r.Variables)}AddHeaderVariable(e){if(!lt.GetHeaderMap().has(e))throw new Error(`The variable ${e} does not exist in the header`);this._headerVariables.add(e)}RemoveHeaderVariable(e){if(r.Variables.map(t=>t.toLowerCase()).includes(e.toLowerCase()))throw new Error(`The variable ${e} cannot be removed from the set`);return this._headerVariables.delete(e)}};q();D();var Jh=class{_stream;_encoder=new TextEncoder;_position=0;constructor(e){this._stream=e}write(e){let t=this._encoder.encode(e);this.ensureCapacity(t.length),this._stream.set(t,this._position),this._position+=t.length}flush(){}close(){}ensureCapacity(e){if(this._position+e>this._stream.length)throw new Error("DXF output buffer is too small.")}},qh=class{_stream;_position=0;constructor(e){this._stream=e}write(e){this.ensureCapacity(e.length),this._stream.set(e,this._position),this._position+=e.length}flush(){}close(){}ensureCapacity(e){if(this._position+e>this._stream.length)throw new Error("DXF output buffer is too small.")}},Qh=class r extends Es{IsBinary;_writer;_objectHolder=new bd;constructor(e,t,i=!1){super(e,t),this.IsBinary=i,this.Configuration=new Qo}Write(){super.Write(),this.createStreamWriter(),this._objectHolder.Objects.push(this._document.rootDictionary),this.writeHeader(),this.writeDxfClasses(),this.writeTables(),this.writeBlocks(),this.writeEntities(),this.writeObjects(),this.writeACDSData(),this._writer.Write(p.Start,d.EndOfFile),this._writer.Flush(),this.Configuration.CloseStream&&this._writer.Close()}Dispose(){this._writer.Dispose()}static WriteToStream(e,t,i=!1,s,n){let a=new r(e,t,i);s&&(a.Configuration=s),a.OnNotification=n??null,a.Write(),a.Dispose()}createStreamWriter(){this.IsBinary?this._writer=new Pd(this.createBinaryTarget()):this._writer=new kd(this.createTextTarget()),this._writer.WriteOptional=this.Configuration.WriteOptionalValues}createTextTarget(){return this._stream instanceof Uint8Array?new Jh(this._stream):this._stream}createBinaryTarget(){return this._stream instanceof Uint8Array?new qh(this._stream):this._stream}writeHeader(){let e=new Vd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeDxfClasses(){let e=new jd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeTables(){let e=new Md(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeBlocks(){let e=new Od(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeEntities(){let e=new Nd(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeObjects(){let e=new Id(this._writer,this._document,this._objectHolder,this.Configuration);e.OnNotification=this.triggerNotification.bind(this),e.Write()}writeACDSData(){}createDefaultConfiguration(){return new Qo}};var ec=class r{static _maxChunkSize=1048576*1024;static _maxChunkShift=30;static _maxChunkMask=1048576*1024-1;_currentChunk;_currentInChunk=0;_length;_position=0;_chunks;static Create(e){return e<=2147483647?new Uint8Array(e):new r(e)}constructor(e){if(typeof e=="number"){let t=e;this._length=t,this._position=0,this._chunks=[];let i=t;for(;i>0;){let s=Math.min(i,r._maxChunkSize);this._chunks.push(new Uint8Array(s)),i-=s}this.Position=0}else this._chunks=e,this._length=e.reduce((t,i)=>t+i.length,0),this.Position=0}get CanRead(){return!0}get CanSeek(){return!0}get CanWrite(){return!0}get Length(){return this._length}get Position(){return this._position}set Position(e){this._position=e,this._currentChunk=this._chunks[e>>r._maxChunkShift],this._currentInChunk=e&r._maxChunkMask}Read(e,t,i){if(i===1)return e[t]=this._currentChunk[this._currentInChunk],this.Position++,1;if(this._currentInChunk+i>r._maxChunkSize){let s=r._maxChunkSize-this._currentInChunk;return e.set(this._currentChunk.subarray(this._currentInChunk,this._currentInChunk+s),t),this.Position+=s,s+this.Read(e,t+s,i-s)}else return e.set(this._currentChunk.subarray(this._currentInChunk,this._currentInChunk+i),t),this.Position+=i,i}ReadByte(){let e=this._currentChunk[this._currentInChunk];return this.Position++,e}Write(e,t,i){if(i===1){this._currentChunk[this._currentInChunk]=e[t],this.Position++;return}if(this._currentInChunk+i>r._maxChunkSize){let s=r._maxChunkSize-this._currentInChunk;this._currentChunk.set(e.subarray(t,t+s),this._currentInChunk),this.Position+=s,this.Write(e,t+s,i-s)}else this._currentChunk.set(e.subarray(t,t+i),this._currentInChunk),this.Position+=i}WriteByte(e){this._currentChunk[this._currentInChunk]=e,this.Position++}Clone(){return new r(this._chunks)}static CloneStream(e){if(e instanceof r)return e.Clone();if(e instanceof Uint8Array)return new Uint8Array(e);throw new Error("The provided stream type is not supported for cloning.")}};var Wd=class extends Ls{LineWeightRatio=100;DefaultLineWeight=.01;PointRadius=.1;ArcPoints=256;GetLineWeightValue(e,t){let i=Math.abs(e);if(t===ie.Unitless)return i/this.LineWeightRatio;switch(e){case M.Default:return this.DefaultLineWeight;case M.W0:return .001}return Rl.getLineWeightValue(e)}};var P=class r{static toSvg(e){return e.toString()}static toSvgWithUnits(e,t){let i="";switch(t){case ie.Centimeters:i="cm";break;case ie.Millimeters:i="mm";break;case ie.Inches:i="in";break}return`${e.toString()}${i}`}static vectorToSvg(e){return`${r.toSvg(e.x)},${r.toSvg(e.y)}`}static vectorToSvgWithUnits(e,t){return`${r.toSvgWithUnits(e.x,t)},${r.toSvgWithUnits(e.y,t)}`}static toPixelSize(e,t){switch(t){case ie.Inches:return e*96;case ie.Millimeters:return e*96/25.4;case ie.Unitless:return e;default:throw new Error(`Invalid units value: ${t}`)}}static vectorToPixelSize(e,t){let i={...e};return i.x=r.toPixelSize(i.x,t),i.y=r.toPixelSize(i.y,t),i.z!==void 0&&(i.z=r.toPixelSize(i.z,t)),i}};var el=class{Translation=new c(0,0,0);Scale=new c(1,1,1);EulerRotation=new c(0,0,0);Matrix=null;constructor(e,t,i){e&&(this.Translation=e),t&&(this.Scale=t),i&&(this.EulerRotation=i)}ApplyTransform(e){return new c(e.x+this.Translation.x,e.y+this.Translation.y,e.z+this.Translation.z)}},fn=class{OnNotification=null;Configuration;Layout=null;Units=ie.Unitless;Formatting="Indented";_output="";_indent=0;_elementStack=[];_inAttribute=!1;_attrName="";_attrValue="";_currentElementOpen=!1;_stream;_encoding;constructor(e,t,i){this._stream=e,i!==void 0?(this._encoding=t,this.Configuration=i):(this._encoding=null,this.Configuration=t)}WriteBlock(e){this.Units=e.units;let t=this.getBlockBoundingBox(e);this.startDocument(t,t,this.Units);for(let i of e.entities)this.writeEntity(i);this.endDocument()}WriteLayout(e){this.Layout=e,this.Units=An.toUnits(e.paperUnits);let t=e.paperWidth,i=e.paperHeight;switch(e.paperRotation){case ni.Degrees90:case ni.Degrees270:t=e.paperHeight,i=e.paperWidth;break}let s=new c(0,0,0),n=new c(t,i,0),a={Min:s,Max:n,Width:t,Height:i},o=new c(e.unprintableMargin?.bottomLeftCorner?.x??0,e.unprintableMargin?.bottomLeftCorner?.y??0,0);this.startDocument(a,null,ie.Millimeters);let h=new el(P.vectorToPixelSize(o,ie.Millimeters),new c(e.printScale,e.printScale,e.printScale),new c(0,0,0));for(let f of e.associatedBlock.Entities)this.writeEntity(f,h);this.endDocument()}WriteStartDocument(){this._output+=`<?xml version="1.0" encoding="utf-8"?>
9
9
  `}WriteEndDocument(){}WriteStartElement(e){this.closeOpenElement(),this._output+=`${this.getIndent()}<${e}`,this._elementStack.push(e),this._currentElementOpen=!0,this._indent++}WriteEndElement(){if(this._indent--,this._currentElementOpen)this._output+=` />
10
10
  `,this._currentElementOpen=!1,this._elementStack.pop();else{this._elementStack.pop(),this._output+=`${this.getIndent()}</${this._elementStack.length>=0,""}`,this._output=this._output.slice(0,this._output.lastIndexOf(`${this.getIndent()}<`));let e=(this._elementStack.length>=0,"");this._output+=`${this.getIndent()}</${this.getClosingTag()}>
11
11
  `}}WriteAttributeString(e,t){typeof t=="number"?this._output+=` ${e}="${P.toSvgWithUnits(t,this.Units)}"`:this._output+=` ${e}="${this.escapeXml(t)}"`}WriteStartAttribute(e){this._inAttribute=!0,this._attrName=e,this._attrValue=""}WriteEndAttribute(){this._output+=` ${this._attrName}="${this.escapeXml(this._attrValue)}"`,this._inAttribute=!1}WriteValue(e){this._inAttribute?this._attrValue+=typeof e=="number"?e.toString():e:(this.closeOpenElement(),this._output+=this.escapeXml(typeof e=="number"?e.toString():e))}WriteComment(e){this.closeOpenElement(),this._output+=`${this.getIndent()}<!-- ${e} -->
12
12
  `}WriteString(e){this.closeOpenElement(),this._output+=this.escapeXml(e)}Close(){let t=new TextEncoder().encode(this._output);this._stream instanceof Uint8Array&&this._stream.set(t)}getOutput(){return this._output}notify(e,t,i=null){this.OnNotification&&this.OnNotification(this,new kt(e,t,i))}triggerNotification(e,t){this.OnNotification&&this.OnNotification(e,t)}writeEntity(e,t){t||(t=new el),this.WriteComment(`${e.objectName} | ${e.handle}`),e instanceof Ft?this.writeArc(e,t):e instanceof me?this.writeDimension(e,t):e instanceof zt?this.writeLine(e,t):e instanceof Gt?this.writePoint(e,t):e instanceof dt?this.writeCircle(e,t):e instanceof Ut?this.writeEllipse(e,t):e instanceof Tt?this.writeHatch(e,t):e instanceof Ee?this.writeInsert(e,t):"isClosed"in e&&"vertices"in e?this.writePolyline(e,t):"Value"in e&&"InsertPoint"in e?this.writeText(e,t):e instanceof $t?this.writeSolid(e,t):this.notify(`[${e.objectName}] Entity not implemented.`,g.NotImplemented)}closeOpenElement(){this._currentElementOpen&&(this._output+=`>
13
- `,this._currentElementOpen=!1)}getIndent(){return" ".repeat(this._indent)}getClosingTag(){return""}escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}colorSvg(e){return this.Layout!==null&&e.equals(B.Default)&&(e=B.Black),`rgb(${e.r},${e.g},${e.b})`}getBlockBoundingBox(e){let t=1/0,i=1/0,s=1/0,n=-1/0,a=-1/0,o=-1/0;for(let b of e.entities){if(!(b instanceof A))continue;let S=this.normalizeBoundingBox(b.getBoundingBox());S&&(t=Math.min(t,S.Min.x),i=Math.min(i,S.Min.y),s=Math.min(s,S.Min.z),n=Math.max(n,S.Max.x),a=Math.max(a,S.Max.y),o=Math.max(o,S.Max.z))}if(!Number.isFinite(t)||!Number.isFinite(n))return{Min:new c(0,0,0),Max:new c(0,0,0),Width:0,Height:0};let h=new c(t,i,s),f=new c(n,a,o);return{Min:h,Max:f,Width:f.x-h.x,Height:f.y-h.y}}normalizeBoundingBox(e){if(!e)return null;let t=e.Min??e.min,i=e.Max??e.max;if(!t||!i)return null;let s=new c(t.x??0,t.y??0,t.z??0),n=new c(i.x??0,i.y??0,i.z??0);return{Min:s,Max:n,Width:n.x-s.x,Height:n.y-s.y}}getPolylinePoints(e){if(typeof e.getPoints=="function")return e.getPoints(this.Configuration.ArcPoints);let t=[];for(let i of e.vertices??[]){if(i==null||typeof i!="object")continue;let s=typeof i.getLocation3D=="function"?i.getLocation3D():i.location;s&&t.push(s)}return t}createPath(...e){let t="";for(let i of e){let s=this.getPolylinePoints(i);if(!s||s.length===0)continue;let n=P.vectorToPixelSize(s[0],this.Units);t+=`M ${P.vectorToSvg(n)} `;for(let a=1;a<s.length;a++){let o=P.vectorToPixelSize(s[a],this.Units);t+=`L ${P.vectorToSvg(o)} `}i.isClosed&&(t+="Z")}return t}drawableLineType(e){return e.isComplex&&!e.hasShapes}getPointSize(e){let t=e.getActiveLineWeightType?e.getActiveLineWeightType():M.Default;return P.toPixelSize(this.Configuration.GetLineWeightValue(t,this.Units),this.Units)}startDocument(e,t,i){if(this.WriteStartDocument(),this.WriteStartElement("svg"),this.WriteAttributeString("xmlns","http://www.w3.org/2000/svg"),this.WriteAttributeString("width",P.toSvgWithUnits(e.Max.x-e.Min.x,i)),this.WriteAttributeString("height",P.toSvgWithUnits(e.Max.y-e.Min.y,i)),t){let s=t;this.WriteStartAttribute("viewBox"),this.WriteValue(P.toPixelSize(s.Min.x,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Min.y,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Width,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Height,i)),this.WriteEndAttribute()}this.WriteAttributeString("transform","scale(1,-1)"),this.Layout!==null&&this.WriteAttributeString("style","background-color:white")}endDocument(){this.WriteEndElement(),this.WriteEndDocument(),this.Close()}svgPoints(e,t){if(!e||e.length===0)return"";let i=P.vectorToSvg(P.vectorToPixelSize(e[0],this.Units));for(let s=1;s<e.length;s++)i+=" ",i+=P.vectorToSvg(P.vectorToPixelSize(e[s],this.Units));return i}writeArc(e,t){this.WriteStartElement("path"),this.writeEntityHeader(e,t);let i=e.getEndVertices(),s=i.start,n=i.end,a=e.endAngle-e.startAngle,o=Math.abs(a)>Math.PI?1:0,h="";h+=`M ${P.vectorToSvg(P.vectorToPixelSize(s,this.Units))}`,h+=" ",h+=`A ${P.toPixelSize(e.radius,this.Units)} ${P.toPixelSize(e.radius,this.Units)}`,h+=" ",h+=`0 ${o} 1 ${P.vectorToSvg(P.vectorToPixelSize(n,this.Units))}`,this.WriteAttributeString("d",h),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeDimension(e,t){if(this.WriteStartElement("g"),e.block&&e.block.entities)for(let i of e.block.entities)this.writeEntity(i,t);this.WriteEndElement()}writeCircle(e,t){let i=t.ApplyTransform(e.center);this.WriteStartElement("circle"),this.writeEntityHeader(e,t),this.WriteAttributeString("r",P.toSvgWithUnits(e.radius,this.Units)),this.WriteAttributeString("cx",P.toSvgWithUnits(i.x,this.Units)),this.WriteAttributeString("cy",P.toSvgWithUnits(i.y,this.Units)),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeDashes(e){let t="";for(let i of e)t+=Math.abs(P.toPixelSize(i,this.Units)).toString(),t+=" ";this.WriteAttributeString("stroke-dasharray",t.trim())}writeDashesFromLineType(e,t){let i="";for(let s of e.segments)s.length===0?i+=P.toPixelSize(t,this.Units).toString():i+=Math.abs(P.toPixelSize(s.length,this.Units)).toString(),i+=" ";this.WriteAttributeString("stroke-dasharray",i.trim())}writeEllipse(e,t){if(e.isFullEllipse){this.WriteStartElement("path"),this.writeEntityHeader(e,t);let i="",s=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(0):new c(0,0,0),n=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI):new c(0,0,0);i+=`M ${P.vectorToSvg(P.vectorToPixelSize(s,this.Units))} `,i+=`A ${e.majorAxis/2} ${e.minorAxis/2} ${e.rotation*180/Math.PI} 0 1 ${P.vectorToSvg(P.vectorToPixelSize(n,this.Units))} `;let a=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI):new c(0,0,0),o=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI*2):new c(0,0,0);i+=`A ${e.majorAxis/2} ${e.minorAxis/2} ${e.rotation*180/Math.PI} 0 1 ${P.vectorToSvg(P.vectorToPixelSize(o,this.Units))}`,this.WriteAttributeString("d",i),this.WriteAttributeString("fill","none"),this.WriteEndElement()}else{this.WriteStartElement("polyline"),this.writeEntityHeader(e,t);let i=e.polygonalVertexes?e.polygonalVertexes(256):[],s=this.svgPoints(i,t);this.WriteAttributeString("points",s),this.WriteAttributeString("fill","none"),this.WriteEndElement()}}writeEntityHeader(e,t,i=!0){let s=e.getActiveColor?e.getActiveColor():e.Color??B.Default;this.WriteAttributeString("vector-effect","non-scaling-stroke"),i?this.WriteAttributeString("stroke",this.colorSvg(s)):this.WriteAttributeString("stroke","none");let n=e.getActiveLineWeightType?e.getActiveLineWeightType():M.Default;this.WriteAttributeString("stroke-width",`${P.toSvgWithUnits(this.Configuration.GetLineWeightValue(n,this.Units),ie.Millimeters)}`),this.writeTransformObj(t);let a=e.getActiveLineType?e.getActiveLineType():null;a&&this.drawableLineType(a)&&this.writeDashesFromLineType(a,this.getPointSize(e))}writeHatch(e,t){this.WriteStartElement("g");let i=this.writePattern(e),s=[];for(let n of e.paths){let a=n.getPoints?n.getPoints(this.Configuration.ArcPoints):[],o=new tt(a);s.push(o)}this.WriteStartElement("path"),this.writeEntityHeader(e,t,!1),this.WriteAttributeString("d",this.createPath(...s)),this.WriteAttributeString("fill",`url(#${i})`),this.WriteEndElement(),this.WriteEndElement()}writePatternHeader(e){let t=`${e.pattern.name}_pattern`;return this.WriteStartElement("pattern"),this.WriteAttributeString("id",t),this.WriteAttributeString("patternUnits","userSpaceOnUse"),t}writeSolidPattern(e){let t=this.writePatternHeader(e);return this.WriteAttributeString("width","100%"),this.WriteAttributeString("height","100%"),this.WriteStartElement("rect"),this.WriteAttributeString("width","100%"),this.WriteAttributeString("height","100%"),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement(),this.WriteEndElement(),t}writePattern(e){if(e.isSolid)return this.writeSolidPattern(e);let t=new Map;for(let[a,o]of e.pattern.lines.entries()){let h=`${e.pattern.name}_${a}_line`;t.set(h,{Min:new c(0,0,0),Max:new c(o.lineOffset,o.lineOffset,0),Width:o.lineOffset,Height:o.lineOffset}),this.WriteStartElement("pattern"),this.WriteAttributeString("id",h),this.WriteAttributeString("patternUnits","userSpaceOnUse"),this.WriteAttributeString("width",P.toSvgWithUnits(o.lineOffset,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(o.lineOffset,this.Units)),this.writeTransformValues("patternTransform",P.vectorToPixelSize(new c(o.basePoint.x,o.basePoint.y,0),this.Units)),this.WriteStartElement("line");let f=Math.cos(o.angle)*10,b=Math.sin(o.angle)*10;this.WriteAttributeString("x1",P.toSvgWithUnits(0,this.Units)),this.WriteAttributeString("y1",P.toSvgWithUnits(0,this.Units)),this.WriteAttributeString("x2",P.toSvgWithUnits(f,this.Units)),this.WriteAttributeString("y2",P.toSvgWithUnits(b,this.Units)),this.WriteAttributeString("stroke",this.colorSvg(e.color)),this.WriteAttributeString("stroke-width",`${P.toSvgWithUnits(this.Configuration.GetLineWeightValue(e.lineWeight??M.Default,this.Units),ie.Millimeters)}`),o.dashLengths&&o.dashLengths.length>0&&this.writeDashes(o.dashLengths),this.WriteEndElement(),this.WriteEndElement()}let i=this.writePatternHeader(e),s=0,n=0;for(let[,a]of t)a.Width>s&&(s=a.Width),a.Height>n&&(n=a.Height);this.WriteAttributeString("width",P.toSvgWithUnits(s,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(n,this.Units));for(let[a,o]of t)this.WriteStartElement("rect"),this.WriteAttributeString("width",P.toSvgWithUnits(o.Width,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(o.Height,this.Units)),this.WriteAttributeString("fill",`url(#${a})`),this.WriteEndElement();return this.WriteEndElement(),i}writeInsert(e,t){let i=e.getTransform?e.getTransform():new el,s=new el(new c(t.Translation.x+i.Translation.x,t.Translation.y+i.Translation.y,t.Translation.z+i.Translation.z));this.WriteStartElement("g"),this.writeTransformObj(s);for(let n of e.block.entities)this.writeEntity(n);this.WriteEndElement()}writeLine(e,t){this.WriteStartElement("line"),this.writeEntityHeader(e,t),this.WriteAttributeString("x1",P.toSvgWithUnits(e.startPoint.x,this.Units)),this.WriteAttributeString("y1",P.toSvgWithUnits(e.startPoint.y,this.Units)),this.WriteAttributeString("x2",P.toSvgWithUnits(e.endPoint.x,this.Units)),this.WriteAttributeString("y2",P.toSvgWithUnits(e.endPoint.y,this.Units)),this.WriteEndElement()}writePoint(e,t){this.WriteStartElement("circle"),this.writeEntityHeader(e,t),this.WriteAttributeString("r",P.toSvgWithUnits(this.Configuration.PointRadius,ie.Unitless)),this.WriteAttributeString("cx",P.toSvgWithUnits(e.location.x,this.Units)),this.WriteAttributeString("cy",P.toSvgWithUnits(e.location.y,this.Units)),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement()}writePolyline(e,t){e.isClosed?this.WriteStartElement("polygon"):this.WriteStartElement("polyline"),this.writeEntityHeader(e,t);let i=this.getPolylinePoints(e),s=this.svgPoints(i,t);this.WriteAttributeString("points",s),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeText(e,t){let i;e instanceof Je&&(e.horizontalAlignment!==ht.Left||e.verticalAlignment!==ct.Baseline)&&!(e.horizontalAlignment===ht.Fit||e.horizontalAlignment===ht.Aligned)?i=e.alignmentPoint:i=e.InsertPoint,this.WriteStartElement("g"),this.writeTransformObj(t),this.WriteStartElement("text"),this.writeTransformValues("transform",P.vectorToPixelSize(i,this.Units),new c(1,-1,0),e.Rotation!==0?e.Rotation:void 0),this.WriteAttributeString("fill",this.colorSvg(e.Color??B.Default));let s="font:";if(s+=P.toSvgWithUnits(e.Height,this.Units),this.Units===ie.Unitless&&(s+="px"),e.Style?.TrueType!==void 0&&(e.Style.TrueType&Qs.Bold&&(s+="bold"),e.Style.TrueType&Qs.Italic&&(s+="italic")),s+=" ",e.Style?.Filename){let a=e.Style.Filename.replace(/\.[^/.]+$/,"");s+=a}if(this.WriteAttributeString("style",s),e instanceof Ne){let n=e;switch(n.attachmentPoint){case Oe.TopLeft:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","start");break;case Oe.TopCenter:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","middle");break;case Oe.TopRight:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","end");break;case Oe.MiddleLeft:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","start");break;case Oe.MiddleCenter:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","middle");break;case Oe.MiddleRight:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","end");break;case Oe.BottomLeft:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","start");break;case Oe.BottomCenter:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","middle");break;case Oe.BottomRight:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","end");break}let a=n.getPlainTextLines?n.getPlainTextLines():[n.value];for(let o of a)this.WriteStartElement("tspan"),this.WriteAttributeString("x","0"),this.WriteAttributeString("dy","1em"),this.WriteString(o),this.WriteEndElement();this.WriteStartElement("tspan"),this.WriteAttributeString("x","0"),this.WriteAttributeString("dy","1em"),this.WriteAttributeString("visibility","hidden"),this.WriteString("."),this.WriteEndElement()}else if(e instanceof Je){let n=e;switch(n.horizontalAlignment){case ht.Left:this.WriteAttributeString("text-anchor","start");break;case ht.Middle:case ht.Center:this.WriteAttributeString("text-anchor","middle");break;case ht.Right:this.WriteAttributeString("text-anchor","end");break}switch(n.verticalAlignment){case ct.Baseline:case ct.Bottom:this.WriteAttributeString("alignment-baseline","baseline");break;case ct.Middle:this.WriteAttributeString("alignment-baseline","middle");break;case ct.Top:this.WriteAttributeString("alignment-baseline","hanging");break}this.WriteString(e.value)}this.WriteEndElement(),this.WriteEndElement()}writeSolid(e,t){this.WriteStartElement("polygon"),this.writeEntityHeader(e,t);let i=this.svgPoints([e.firstCorner,e.secondCorner,e.thirdCorner,e.fourthCorner],t);this.WriteAttributeString("points",i),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement()}writeTransformObj(e){let t=e.Translation.x!==0||e.Translation.y!==0||e.Translation.z!==0?e.Translation:void 0,i=e.Scale.x!==1||e.Scale.y!==1?e.Scale:void 0,s=e.EulerRotation.z!==0?e.EulerRotation.z:void 0;this.writeTransformValues("transform",t,i,s)}writeTransformValues(e="transform",t,i,s){let n="";if(t&&(n+=`translate(${t.x.toString()},${t.y.toString()})`),i&&(n+=`scale(${i.x.toString()},${i.y.toString()})`),s!==void 0){let a=-(s*180/Math.PI);n+=`rotate(${a.toString()})`}n&&this.WriteAttributeString(e,n)}};var rc=class extends fn{EntitiesWriter=null;LineTypeWriters=new Map;constructor(e,t,i){super(e,t,i)}WriteLayout(e){this.Units=An.toUnits(e.paperUnits);let t=e.paperWidth,i=e.paperHeight;switch(e.paperRotation){case ni.Degrees90:case ni.Degrees270:t=e.paperHeight,i=e.paperWidth;break}let s=new c(0,0,0),n=new c(t,i,0),a={Min:s,Max:n,Width:t,Height:i},o=new c(e.unprintableMargin?.bottomLeftCorner?.x??0,e.unprintableMargin?.bottomLeftCorner?.y??0,0);this.startDocumentInternal(a);let h=P.vectorToPixelSize(o,this.Units),f=new c(e.printScale,e.printScale,e.printScale);for(let b of e.associatedBlock.Entities)this.writeEntity(b);this.endDocumentInternal()}startDocumentInternal(e){this.WriteStartDocument(),this.WriteStartElement("svg"),this.WriteAttributeString("xmlns","http://www.w3.org/2000/svg"),this.WriteAttributeString("width",P.toSvgWithUnits(e.Max.x-e.Min.x,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(e.Max.y-e.Min.y,this.Units)),this.WriteStartAttribute("viewBox"),this.WriteValue(P.toSvgWithUnits(e.Min.x,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Min.y,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Max.x-e.Min.x,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Max.y-e.Min.y,this.Units)),this.WriteEndAttribute(),this.WriteAttributeString("transform","scale(1,-1)"),this.Layout!==null&&this.WriteAttributeString("style","background-color:white")}endDocumentInternal(){this.WriteEndElement(),this.WriteEndDocument(),this.Close()}createWriter(){let e=new fn(new Uint8Array(0),this.Configuration);return e.Formatting="Indented",e.OnNotification=(t,i)=>this.triggerNotification(t,i),e}};var ic=class extends Es{_writer;constructor(e,t){super(e,t)}createDefaultConfiguration(){return new Wd}Dispose(){}Write(){this.WriteBlock(this._document.modelSpace)}WriteBlock(e){this.createWriter(),this._writer.WriteBlock(e)}WriteLayout(e){this.createWriter(),this._writer.WriteLayout(e)}createWriter(){this._writer=new fn(this._stream,this._encoding,this.Configuration),this._writer.OnNotification=(e,t)=>this.triggerNotification(e,t)}};var sc;(function(r){r[r.AtLeast=1]="AtLeast",r[r.Exactly=2]="Exactly"})(sc||(sc={}));kr();var pe=class{onAdd=null;onRemove=null;get handle(){return this._dictionary.handle}_dictionary;constructor(e){if(!e)throw new Error("dictionary cannot be null");this._dictionary=e}add(e){this._dictionary.add(e)}clear(){this._dictionary.clear()}containsKey(e){return this._dictionary.containsKey(e)}remove(e){return this._dictionary.remove(e)}tryAdd(e){let t=this.tryGet(e.name);return t||(this.add(e),e)}tryGet(e){return this._dictionary.getEntry(e)}get(e){return this._dictionary.getEntry(e)}[Symbol.iterator](){let e=[];for(let t of this._dictionary)e.push(t);return e[Symbol.iterator]()}};var nc=class extends pe{constructor(e){super(e)}};var ac=class extends pe{constructor(e){super(e)}addOrUpdateVariable(e,t){let i=this.tryGet(e);i?i.value=t:this.add(new He(e,t))}addVariable(e,t){this.containsKey(e)||this.add(new He(e,t))}createDefaults(){this.addVariable(He.CurrentMultiLeaderStyle,$e.DefaultName),this.addVariable(He.CurrentAnnotationScale,Ge.DefaultName),this.addVariable(He.CurrentTableStyle,Ye.DefaultName),this.addVariable(He.WipeoutFrame,"0"),this.addVariable("CVIEWDETAILSTYLE","Metric50"),this.addVariable("CVIEWSECTIONSTYLE","Metric50")}getValue(e){let t=this.tryGet(e);return t?t.value:null}};var oc=class extends pe{constructor(e){super(e),this._dictionary=e}add(e){super.add(e)}createGroup(e,t=""){let i=new Ot(t);return this.add(i),i}};var lc=class extends pe{constructor(e){super(e)}};var dc=class extends pe{constructor(e){super(e),this._dictionary=e}remove(e){if(e.toLowerCase()===nt.ModelLayoutName.toLowerCase()||e.toLowerCase()===nt.PaperLayoutName.toLowerCase())throw new Error(`The Layout ${e} cannot be removed.`);return super.remove(e)}};var hc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(new at("Global")),this._dictionary.tryAdd(new at("ByLayer")),this._dictionary.tryAdd(new at("ByBlock"))}};var cc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd($e.default_)}};var uc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(wt.default_)}};var mc=class extends pe{constructor(e){super(e)}};var fc=class extends pe{constructor(e){super(e)}createDefaults(){let e=[{name:"1:1",paper:1,drawing:1,isUnit:!0},{name:"1:2",paper:1,drawing:2,isUnit:!1},{name:"1:4",paper:1,drawing:4,isUnit:!1},{name:"1:5",paper:1,drawing:5,isUnit:!1},{name:"1:8",paper:1,drawing:8,isUnit:!1},{name:"1:10",paper:1,drawing:10,isUnit:!1},{name:"1:16",paper:1,drawing:16,isUnit:!1},{name:"1:20",paper:1,drawing:20,isUnit:!1},{name:"1:30",paper:1,drawing:30,isUnit:!1},{name:"1:40",paper:1,drawing:40,isUnit:!1},{name:"1:50",paper:1,drawing:50,isUnit:!1},{name:"1:100",paper:1,drawing:100,isUnit:!1},{name:"2:1",paper:2,drawing:1,isUnit:!1},{name:"4:1",paper:4,drawing:1,isUnit:!1},{name:"8:1",paper:8,drawing:1,isUnit:!1},{name:"10:1",paper:10,drawing:1,isUnit:!1},{name:"100:1",paper:100,drawing:1,isUnit:!1}];for(let t of e){let i=new Ge;i.name=t.name,i.paperUnits=t.paper,i.drawingUnits=t.drawing,i.isUnitScale=t.isUnit,this._dictionary.tryAdd(i)}}};var pc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(Ye.default_)}};il();D();x();var wc=class extends Aa{get objectName(){return d.ObjectBlockBasePointParameter}get subclassMarker(){return l.BlockBasePointParameter}point1010=new c(0,0,0);point1012=new c(0,0,0)};x();var _c=class extends vs{get subclassMarker(){return l.BlockFlipGrip}value140=0;value141=0;value142=0;value93N=0};D();x();R();var bc=class extends Ws{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectBlockLinearParameter}get subclassMarker(){return l.BlockLinearParameter}label="";description="";labelOffset=0};var gc;(function(r){r[r.None=0]="None",r[r.PathType=1]="PathType",r[r.LineColor=2]="LineColor",r[r.LineType=4]="LineType",r[r.LineWeight=8]="LineWeight",r[r.ArrowheadSize=16]="ArrowheadSize",r[r.Arrowhead=32]="Arrowhead"})(gc||(gc={}));J();var Hd=class{cache=new Map;constructor(e){}getProperty(e){return this.cache.get(e)}};(function(r){class e{getter=null;setter=null;attribute=null;propertyName=""}r.Prop=e})(Hd||(Hd={}));var xc;(function(r){r[r.BlockExtents=0]="BlockExtents",r[r.BasePoint=1]="BasePoint"})(xc||(xc={}));R();var Dc=class extends Ce{get objectType(){return u.VP_ENT_HDR_CTRL_OBJ}get defaultEntries(){return[]}constructor(){super()}};var Sc;(function(r){r[r.None=0]="None",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Sc||(Sc={}));var Cc=class r{static parse(e){let t=[];if(!e)return{result:e,groups:t};let i="",s=0,n=!1;for(;s<e.length;){let a=s>0?e[s-1]:void 0,o=e[s],h=s+1<e.length?e[s+1]:void 0;if(o==="\\"&&h!==void 0)switch(h){case"}":case"{":case"\\":i+=h,s+=2;break;case"A":s=r.jump(e,s);break;case"c":case"C":s=r.processColor(e,s);break;case"f":case"F":s=r.processFont(e,s);break;case"h":case"H":s=r.processHeight(e,s);break;case"p":s=r.processJustification(e,s);break;case"P":case"n":i+=`
13
+ `,this._currentElementOpen=!1)}getIndent(){return" ".repeat(this._indent)}getClosingTag(){return""}escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}colorSvg(e){return this.Layout!==null&&e.equals(B.Default)&&(e=B.Black),`rgb(${e.r},${e.g},${e.b})`}getBlockBoundingBox(e){let t=1/0,i=1/0,s=1/0,n=-1/0,a=-1/0,o=-1/0;for(let b of e.entities){if(!(b instanceof A))continue;let S=this.normalizeBoundingBox(b.getBoundingBox());S&&(t=Math.min(t,S.Min.x),i=Math.min(i,S.Min.y),s=Math.min(s,S.Min.z),n=Math.max(n,S.Max.x),a=Math.max(a,S.Max.y),o=Math.max(o,S.Max.z))}if(!Number.isFinite(t)||!Number.isFinite(n))return{Min:new c(0,0,0),Max:new c(0,0,0),Width:0,Height:0};let h=new c(t,i,s),f=new c(n,a,o);return{Min:h,Max:f,Width:f.x-h.x,Height:f.y-h.y}}normalizeBoundingBox(e){if(!e)return null;let t=e.Min??e.min,i=e.Max??e.max;if(!t||!i)return null;let s=new c(t.x??0,t.y??0,t.z??0),n=new c(i.x??0,i.y??0,i.z??0);return{Min:s,Max:n,Width:n.x-s.x,Height:n.y-s.y}}getPolylinePoints(e){if(typeof e.getPoints=="function")return e.getPoints(this.Configuration.ArcPoints);let t=[];for(let i of e.vertices??[]){if(i==null||typeof i!="object")continue;let s=typeof i.getLocation3D=="function"?i.getLocation3D():i.location;s&&t.push(s)}return t}createPath(...e){let t="";for(let i of e){let s=this.getPolylinePoints(i);if(!s||s.length===0)continue;let n=P.vectorToPixelSize(s[0],this.Units);t+=`M ${P.vectorToSvg(n)} `;for(let a=1;a<s.length;a++){let o=P.vectorToPixelSize(s[a],this.Units);t+=`L ${P.vectorToSvg(o)} `}i.isClosed&&(t+="Z")}return t}drawableLineType(e){return e.isComplex&&!e.hasShapes}getPointSize(e){let t=e.getActiveLineWeightType?e.getActiveLineWeightType():M.Default;return P.toPixelSize(this.Configuration.GetLineWeightValue(t,this.Units),this.Units)}startDocument(e,t,i){if(this.WriteStartDocument(),this.WriteStartElement("svg"),this.WriteAttributeString("xmlns","http://www.w3.org/2000/svg"),this.WriteAttributeString("width",P.toSvgWithUnits(e.Max.x-e.Min.x,i)),this.WriteAttributeString("height",P.toSvgWithUnits(e.Max.y-e.Min.y,i)),t){let s=t;this.WriteStartAttribute("viewBox"),this.WriteValue(P.toPixelSize(s.Min.x,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Min.y,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Width,i)),this.WriteValue(" "),this.WriteValue(P.toPixelSize(s.Height,i)),this.WriteEndAttribute()}this.WriteAttributeString("transform","scale(1,-1)"),this.Layout!==null&&this.WriteAttributeString("style","background-color:white")}endDocument(){this.WriteEndElement(),this.WriteEndDocument(),this.Close()}svgPoints(e,t){if(!e||e.length===0)return"";let i=P.vectorToSvg(P.vectorToPixelSize(e[0],this.Units));for(let s=1;s<e.length;s++)i+=" ",i+=P.vectorToSvg(P.vectorToPixelSize(e[s],this.Units));return i}writeArc(e,t){this.WriteStartElement("path"),this.writeEntityHeader(e,t);let i=e.getEndVertices(),s=i.start,n=i.end,a=e.endAngle-e.startAngle,o=Math.abs(a)>Math.PI?1:0,h="";h+=`M ${P.vectorToSvg(P.vectorToPixelSize(s,this.Units))}`,h+=" ",h+=`A ${P.toPixelSize(e.radius,this.Units)} ${P.toPixelSize(e.radius,this.Units)}`,h+=" ",h+=`0 ${o} 1 ${P.vectorToSvg(P.vectorToPixelSize(n,this.Units))}`,this.WriteAttributeString("d",h),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeDimension(e,t){if(this.WriteStartElement("g"),e.block&&e.block.entities)for(let i of e.block.entities)this.writeEntity(i,t);this.WriteEndElement()}writeCircle(e,t){let i=t.ApplyTransform(e.center);this.WriteStartElement("circle"),this.writeEntityHeader(e,t),this.WriteAttributeString("r",P.toSvgWithUnits(e.radius,this.Units)),this.WriteAttributeString("cx",P.toSvgWithUnits(i.x,this.Units)),this.WriteAttributeString("cy",P.toSvgWithUnits(i.y,this.Units)),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeDashes(e){let t="";for(let i of e)t+=Math.abs(P.toPixelSize(i,this.Units)).toString(),t+=" ";this.WriteAttributeString("stroke-dasharray",t.trim())}writeDashesFromLineType(e,t){let i="";for(let s of e.segments)s.length===0?i+=P.toPixelSize(t,this.Units).toString():i+=Math.abs(P.toPixelSize(s.length,this.Units)).toString(),i+=" ";this.WriteAttributeString("stroke-dasharray",i.trim())}writeEllipse(e,t){if(e.isFullEllipse){this.WriteStartElement("path"),this.writeEntityHeader(e,t);let i="",s=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(0):new c(0,0,0),n=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI):new c(0,0,0);i+=`M ${P.vectorToSvg(P.vectorToPixelSize(s,this.Units))} `,i+=`A ${e.majorAxis/2} ${e.minorAxis/2} ${e.rotation*180/Math.PI} 0 1 ${P.vectorToSvg(P.vectorToPixelSize(n,this.Units))} `;let a=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI):new c(0,0,0),o=e.polarCoordinateRelativeToCenter?e.polarCoordinateRelativeToCenter(Math.PI*2):new c(0,0,0);i+=`A ${e.majorAxis/2} ${e.minorAxis/2} ${e.rotation*180/Math.PI} 0 1 ${P.vectorToSvg(P.vectorToPixelSize(o,this.Units))}`,this.WriteAttributeString("d",i),this.WriteAttributeString("fill","none"),this.WriteEndElement()}else{this.WriteStartElement("polyline"),this.writeEntityHeader(e,t);let i=e.polygonalVertexes?e.polygonalVertexes(256):[],s=this.svgPoints(i,t);this.WriteAttributeString("points",s),this.WriteAttributeString("fill","none"),this.WriteEndElement()}}writeEntityHeader(e,t,i=!0){let s=e.getActiveColor?e.getActiveColor():e.Color??B.Default;this.WriteAttributeString("vector-effect","non-scaling-stroke"),i?this.WriteAttributeString("stroke",this.colorSvg(s)):this.WriteAttributeString("stroke","none");let n=e.getActiveLineWeightType?e.getActiveLineWeightType():M.Default;this.WriteAttributeString("stroke-width",`${P.toSvgWithUnits(this.Configuration.GetLineWeightValue(n,this.Units),ie.Millimeters)}`),this.writeTransformObj(t);let a=e.getActiveLineType?e.getActiveLineType():null;a&&this.drawableLineType(a)&&this.writeDashesFromLineType(a,this.getPointSize(e))}writeHatch(e,t){this.WriteStartElement("g");let i=this.writePattern(e),s=[];for(let n of e.paths){let a=n.getPoints?n.getPoints(this.Configuration.ArcPoints):[],o=new tt(a);s.push(o)}this.WriteStartElement("path"),this.writeEntityHeader(e,t,!1),this.WriteAttributeString("d",this.createPath(...s)),this.WriteAttributeString("fill",`url(#${i})`),this.WriteEndElement(),this.WriteEndElement()}writePatternHeader(e){let t=`${e.pattern.name}_pattern`;return this.WriteStartElement("pattern"),this.WriteAttributeString("id",t),this.WriteAttributeString("patternUnits","userSpaceOnUse"),t}writeSolidPattern(e){let t=this.writePatternHeader(e);return this.WriteAttributeString("width","100%"),this.WriteAttributeString("height","100%"),this.WriteStartElement("rect"),this.WriteAttributeString("width","100%"),this.WriteAttributeString("height","100%"),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement(),this.WriteEndElement(),t}writePattern(e){if(e.isSolid)return this.writeSolidPattern(e);let t=new Map;for(let[a,o]of e.pattern.lines.entries()){let h=`${e.pattern.name}_${a}_line`;t.set(h,{Min:new c(0,0,0),Max:new c(o.lineOffset,o.lineOffset,0),Width:o.lineOffset,Height:o.lineOffset}),this.WriteStartElement("pattern"),this.WriteAttributeString("id",h),this.WriteAttributeString("patternUnits","userSpaceOnUse"),this.WriteAttributeString("width",P.toSvgWithUnits(o.lineOffset,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(o.lineOffset,this.Units)),this.writeTransformValues("patternTransform",P.vectorToPixelSize(new c(o.basePoint.x,o.basePoint.y,0),this.Units)),this.WriteStartElement("line");let f=Math.cos(o.angle)*10,b=Math.sin(o.angle)*10;this.WriteAttributeString("x1",P.toSvgWithUnits(0,this.Units)),this.WriteAttributeString("y1",P.toSvgWithUnits(0,this.Units)),this.WriteAttributeString("x2",P.toSvgWithUnits(f,this.Units)),this.WriteAttributeString("y2",P.toSvgWithUnits(b,this.Units)),this.WriteAttributeString("stroke",this.colorSvg(e.color)),this.WriteAttributeString("stroke-width",`${P.toSvgWithUnits(this.Configuration.GetLineWeightValue(e.lineWeight??M.Default,this.Units),ie.Millimeters)}`),o.dashLengths&&o.dashLengths.length>0&&this.writeDashes(o.dashLengths),this.WriteEndElement(),this.WriteEndElement()}let i=this.writePatternHeader(e),s=0,n=0;for(let[,a]of t)a.Width>s&&(s=a.Width),a.Height>n&&(n=a.Height);this.WriteAttributeString("width",P.toSvgWithUnits(s,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(n,this.Units));for(let[a,o]of t)this.WriteStartElement("rect"),this.WriteAttributeString("width",P.toSvgWithUnits(o.Width,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(o.Height,this.Units)),this.WriteAttributeString("fill",`url(#${a})`),this.WriteEndElement();return this.WriteEndElement(),i}writeInsert(e,t){let i=e.getTransform?e.getTransform():new el,s=new el(new c(t.Translation.x+i.Translation.x,t.Translation.y+i.Translation.y,t.Translation.z+i.Translation.z));this.WriteStartElement("g"),this.writeTransformObj(s);for(let n of e.block.entities)this.writeEntity(n);this.WriteEndElement()}writeLine(e,t){this.WriteStartElement("line"),this.writeEntityHeader(e,t),this.WriteAttributeString("x1",P.toSvgWithUnits(e.startPoint.x,this.Units)),this.WriteAttributeString("y1",P.toSvgWithUnits(e.startPoint.y,this.Units)),this.WriteAttributeString("x2",P.toSvgWithUnits(e.endPoint.x,this.Units)),this.WriteAttributeString("y2",P.toSvgWithUnits(e.endPoint.y,this.Units)),this.WriteEndElement()}writePoint(e,t){this.WriteStartElement("circle"),this.writeEntityHeader(e,t),this.WriteAttributeString("r",P.toSvgWithUnits(this.Configuration.PointRadius,ie.Unitless)),this.WriteAttributeString("cx",P.toSvgWithUnits(e.location.x,this.Units)),this.WriteAttributeString("cy",P.toSvgWithUnits(e.location.y,this.Units)),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement()}writePolyline(e,t){e.isClosed?this.WriteStartElement("polygon"):this.WriteStartElement("polyline"),this.writeEntityHeader(e,t);let i=this.getPolylinePoints(e),s=this.svgPoints(i,t);this.WriteAttributeString("points",s),this.WriteAttributeString("fill","none"),this.WriteEndElement()}writeText(e,t){let i;e instanceof Je&&(e.horizontalAlignment!==ht.Left||e.verticalAlignment!==ct.Baseline)&&!(e.horizontalAlignment===ht.Fit||e.horizontalAlignment===ht.Aligned)?i=e.alignmentPoint:i=e.InsertPoint,this.WriteStartElement("g"),this.writeTransformObj(t),this.WriteStartElement("text"),this.writeTransformValues("transform",P.vectorToPixelSize(i,this.Units),new c(1,-1,0),e.Rotation!==0?e.Rotation:void 0),this.WriteAttributeString("fill",this.colorSvg(e.Color??B.Default));let s="font:";if(s+=P.toSvgWithUnits(e.Height,this.Units),this.Units===ie.Unitless&&(s+="px"),e.Style?.TrueType!==void 0&&(e.Style.TrueType&Qs.Bold&&(s+="bold"),e.Style.TrueType&Qs.Italic&&(s+="italic")),s+=" ",e.Style?.Filename){let a=e.Style.Filename.replace(/\.[^/.]+$/,"");s+=a}if(this.WriteAttributeString("style",s),e instanceof Ne){let n=e;switch(n.attachmentPoint){case Oe.TopLeft:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","start");break;case Oe.TopCenter:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","middle");break;case Oe.TopRight:this.WriteAttributeString("alignment-baseline","hanging"),this.WriteAttributeString("text-anchor","end");break;case Oe.MiddleLeft:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","start");break;case Oe.MiddleCenter:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","middle");break;case Oe.MiddleRight:this.WriteAttributeString("alignment-baseline","middle"),this.WriteAttributeString("text-anchor","end");break;case Oe.BottomLeft:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","start");break;case Oe.BottomCenter:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","middle");break;case Oe.BottomRight:this.WriteAttributeString("alignment-baseline","baseline"),this.WriteAttributeString("text-anchor","end");break}let a=n.getPlainTextLines?n.getPlainTextLines():[n.value];for(let o of a)this.WriteStartElement("tspan"),this.WriteAttributeString("x","0"),this.WriteAttributeString("dy","1em"),this.WriteString(o),this.WriteEndElement();this.WriteStartElement("tspan"),this.WriteAttributeString("x","0"),this.WriteAttributeString("dy","1em"),this.WriteAttributeString("visibility","hidden"),this.WriteString("."),this.WriteEndElement()}else if(e instanceof Je){let n=e;switch(n.horizontalAlignment){case ht.Left:this.WriteAttributeString("text-anchor","start");break;case ht.Middle:case ht.Center:this.WriteAttributeString("text-anchor","middle");break;case ht.Right:this.WriteAttributeString("text-anchor","end");break}switch(n.verticalAlignment){case ct.Baseline:case ct.Bottom:this.WriteAttributeString("alignment-baseline","baseline");break;case ct.Middle:this.WriteAttributeString("alignment-baseline","middle");break;case ct.Top:this.WriteAttributeString("alignment-baseline","hanging");break}this.WriteString(e.value)}this.WriteEndElement(),this.WriteEndElement()}writeSolid(e,t){this.WriteStartElement("polygon"),this.writeEntityHeader(e,t);let i=this.svgPoints([e.firstCorner,e.secondCorner,e.thirdCorner,e.fourthCorner],t);this.WriteAttributeString("points",i),this.WriteAttributeString("fill",this.colorSvg(e.color)),this.WriteEndElement()}writeTransformObj(e){let t=e.Translation.x!==0||e.Translation.y!==0||e.Translation.z!==0?e.Translation:void 0,i=e.Scale.x!==1||e.Scale.y!==1?e.Scale:void 0,s=e.EulerRotation.z!==0?e.EulerRotation.z:void 0;this.writeTransformValues("transform",t,i,s)}writeTransformValues(e="transform",t,i,s){let n="";if(t&&(n+=`translate(${t.x.toString()},${t.y.toString()})`),i&&(n+=`scale(${i.x.toString()},${i.y.toString()})`),s!==void 0){let a=-(s*180/Math.PI);n+=`rotate(${a.toString()})`}n&&this.WriteAttributeString(e,n)}};var tc=class extends fn{EntitiesWriter=null;LineTypeWriters=new Map;constructor(e,t,i){super(e,t,i)}WriteLayout(e){this.Units=An.toUnits(e.paperUnits);let t=e.paperWidth,i=e.paperHeight;switch(e.paperRotation){case ni.Degrees90:case ni.Degrees270:t=e.paperHeight,i=e.paperWidth;break}let s=new c(0,0,0),n=new c(t,i,0),a={Min:s,Max:n,Width:t,Height:i},o=new c(e.unprintableMargin?.bottomLeftCorner?.x??0,e.unprintableMargin?.bottomLeftCorner?.y??0,0);this.startDocumentInternal(a);let h=P.vectorToPixelSize(o,this.Units),f=new c(e.printScale,e.printScale,e.printScale);for(let b of e.associatedBlock.Entities)this.writeEntity(b);this.endDocumentInternal()}startDocumentInternal(e){this.WriteStartDocument(),this.WriteStartElement("svg"),this.WriteAttributeString("xmlns","http://www.w3.org/2000/svg"),this.WriteAttributeString("width",P.toSvgWithUnits(e.Max.x-e.Min.x,this.Units)),this.WriteAttributeString("height",P.toSvgWithUnits(e.Max.y-e.Min.y,this.Units)),this.WriteStartAttribute("viewBox"),this.WriteValue(P.toSvgWithUnits(e.Min.x,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Min.y,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Max.x-e.Min.x,this.Units)),this.WriteValue(" "),this.WriteValue(P.toSvgWithUnits(e.Max.y-e.Min.y,this.Units)),this.WriteEndAttribute(),this.WriteAttributeString("transform","scale(1,-1)"),this.Layout!==null&&this.WriteAttributeString("style","background-color:white")}endDocumentInternal(){this.WriteEndElement(),this.WriteEndDocument(),this.Close()}createWriter(){let e=new fn(new Uint8Array(0),this.Configuration);return e.Formatting="Indented",e.OnNotification=(t,i)=>this.triggerNotification(t,i),e}};var rc=class extends Es{_writer;constructor(e,t){super(e,t)}createDefaultConfiguration(){return new Wd}Dispose(){}Write(){this.WriteBlock(this._document.modelSpace)}WriteBlock(e){this.createWriter(),this._writer.WriteBlock(e)}WriteLayout(e){this.createWriter(),this._writer.WriteLayout(e)}createWriter(){this._writer=new fn(this._stream,this._encoding,this.Configuration),this._writer.OnNotification=(e,t)=>this.triggerNotification(e,t)}};var ic;(function(r){r[r.AtLeast=1]="AtLeast",r[r.Exactly=2]="Exactly"})(ic||(ic={}));kr();var pe=class{onAdd=null;onRemove=null;get handle(){return this._dictionary.handle}_dictionary;constructor(e){if(!e)throw new Error("dictionary cannot be null");this._dictionary=e}add(e){this._dictionary.add(e)}clear(){this._dictionary.clear()}containsKey(e){return this._dictionary.containsKey(e)}remove(e){return this._dictionary.remove(e)}tryAdd(e){let t=this.tryGet(e.name);return t||(this.add(e),e)}tryGet(e){return this._dictionary.getEntry(e)}get(e){return this._dictionary.getEntry(e)}[Symbol.iterator](){let e=[];for(let t of this._dictionary)e.push(t);return e[Symbol.iterator]()}};var sc=class extends pe{constructor(e){super(e)}};var nc=class extends pe{constructor(e){super(e)}addOrUpdateVariable(e,t){let i=this.tryGet(e);i?i.value=t:this.add(new He(e,t))}addVariable(e,t){this.containsKey(e)||this.add(new He(e,t))}createDefaults(){this.addVariable(He.CurrentMultiLeaderStyle,$e.DefaultName),this.addVariable(He.CurrentAnnotationScale,Ge.DefaultName),this.addVariable(He.CurrentTableStyle,Ye.DefaultName),this.addVariable(He.WipeoutFrame,"0"),this.addVariable("CVIEWDETAILSTYLE","Metric50"),this.addVariable("CVIEWSECTIONSTYLE","Metric50")}getValue(e){let t=this.tryGet(e);return t?t.value:null}};var ac=class extends pe{constructor(e){super(e),this._dictionary=e}add(e){super.add(e)}createGroup(e,t=""){let i=new Ot(t);return this.add(i),i}};var oc=class extends pe{constructor(e){super(e)}};var lc=class extends pe{constructor(e){super(e),this._dictionary=e}remove(e){if(e.toLowerCase()===nt.ModelLayoutName.toLowerCase()||e.toLowerCase()===nt.PaperLayoutName.toLowerCase())throw new Error(`The Layout ${e} cannot be removed.`);return super.remove(e)}};var dc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(new at("Global")),this._dictionary.tryAdd(new at("ByLayer")),this._dictionary.tryAdd(new at("ByBlock"))}};var hc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd($e.default_)}};var cc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(wt.default_)}};var uc=class extends pe{constructor(e){super(e)}};var mc=class extends pe{constructor(e){super(e)}createDefaults(){let e=[{name:"1:1",paper:1,drawing:1,isUnit:!0},{name:"1:2",paper:1,drawing:2,isUnit:!1},{name:"1:4",paper:1,drawing:4,isUnit:!1},{name:"1:5",paper:1,drawing:5,isUnit:!1},{name:"1:8",paper:1,drawing:8,isUnit:!1},{name:"1:10",paper:1,drawing:10,isUnit:!1},{name:"1:16",paper:1,drawing:16,isUnit:!1},{name:"1:20",paper:1,drawing:20,isUnit:!1},{name:"1:30",paper:1,drawing:30,isUnit:!1},{name:"1:40",paper:1,drawing:40,isUnit:!1},{name:"1:50",paper:1,drawing:50,isUnit:!1},{name:"1:100",paper:1,drawing:100,isUnit:!1},{name:"2:1",paper:2,drawing:1,isUnit:!1},{name:"4:1",paper:4,drawing:1,isUnit:!1},{name:"8:1",paper:8,drawing:1,isUnit:!1},{name:"10:1",paper:10,drawing:1,isUnit:!1},{name:"100:1",paper:100,drawing:1,isUnit:!1}];for(let t of e){let i=new Ge;i.name=t.name,i.paperUnits=t.paper,i.drawingUnits=t.drawing,i.isUnitScale=t.isUnit,this._dictionary.tryAdd(i)}}};var fc=class extends pe{constructor(e){super(e)}createDefaults(){this._dictionary.tryAdd(Ye.default_)}};il();D();x();var pc=class extends Aa{get objectName(){return d.ObjectBlockBasePointParameter}get subclassMarker(){return l.BlockBasePointParameter}point1010=new c(0,0,0);point1012=new c(0,0,0)};x();var wc=class extends vs{get subclassMarker(){return l.BlockFlipGrip}value140=0;value141=0;value142=0;value93N=0};D();x();R();var _c=class extends Ws{get objectType(){return u.UNLISTED}get objectName(){return d.ObjectBlockLinearParameter}get subclassMarker(){return l.BlockLinearParameter}label="";description="";labelOffset=0};var bc;(function(r){r[r.None=0]="None",r[r.PathType=1]="PathType",r[r.LineColor=2]="LineColor",r[r.LineType=4]="LineType",r[r.LineWeight=8]="LineWeight",r[r.ArrowheadSize=16]="ArrowheadSize",r[r.Arrowhead=32]="Arrowhead"})(bc||(bc={}));J();var Hd=class{cache=new Map;constructor(e){}getProperty(e){return this.cache.get(e)}};(function(r){class e{getter=null;setter=null;attribute=null;propertyName=""}r.Prop=e})(Hd||(Hd={}));var gc;(function(r){r[r.BlockExtents=0]="BlockExtents",r[r.BasePoint=1]="BasePoint"})(gc||(gc={}));R();var xc=class extends Ce{get objectType(){return u.VP_ENT_HDR_CTRL_OBJ}get defaultEntries(){return[]}constructor(){super()}};var Dc;(function(r){r[r.None=0]="None",r[r.XrefDependent=16]="XrefDependent",r[r.XrefResolved=32]="XrefResolved",r[r.Referenced=64]="Referenced"})(Dc||(Dc={}));var Sc=class r{static parse(e){let t=[];if(!e)return{result:e,groups:t};let i="",s=0,n=!1;for(;s<e.length;){let a=s>0?e[s-1]:void 0,o=e[s],h=s+1<e.length?e[s+1]:void 0;if(o==="\\"&&h!==void 0)switch(h){case"}":case"{":case"\\":i+=h,s+=2;break;case"A":s=r.jump(e,s);break;case"c":case"C":s=r.processColor(e,s);break;case"f":case"F":s=r.processFont(e,s);break;case"h":case"H":s=r.processHeight(e,s);break;case"p":s=r.processJustification(e,s);break;case"P":case"n":i+=`
14
14
  `,s+=2;break;default:s++;break}else o==="{"&&a!=="\\"?(n=!0,s++):o==="}"&&a!=="\\"?(n=!1,s++):(i+=o,s++)}return{result:i,groups:t}}static unescape(e){if(!e)return e;let t="",i=0,s=!1;for(;i<e.length;){let n=e.indexOf("\\",i);if(n<=0){let b=e.substring(i);s&&b.includes("}")&&(b=b.replace(/}/g,""),s=!1),t+=b;break}let a=e[n-1],o=e[n],h=e[n+1];if(a==="{"&&(n--,s=!0),n>i){let b=e.substring(i,n);s&&b.includes("}")&&(b=b.replace(/}/g,""),s=!1),t+=b}let f;switch(h){case"f":case"F":f=r.processFont(e,n),n=f;break;case"c":case"C":f=r.processColor(e,n),n=f;break;case"P":case"n":t+=`
15
- `,n+=2;break;case"r":break;case"}":case"{":case"\\":t+=h;break}i=n}return t}static processFont(e,t){let i=e.indexOf(";",t);return i+=1,i}static jump(e,t){let i=e.indexOf(";",t);return i+=1,i}static processColor(e,t){let i=e.indexOf(";",t);return i+=1,i}static processHeight(e,t){let i=e.indexOf(";",t);return i+=1,i}static processJustification(e,t){let i=e.indexOf(";",t);return i+=1,i}};var Bc;(function(r){r[r.ParllelToLastLeaderLine=0]="ParllelToLastLeaderLine",r[r.Horizontal=1]="Horizontal",r[r.Optimized=2]="Optimized"})(Bc||(Bc={}));R();var yc;(function(r){r[r.Unitless=0]="Unitless",r[r.Millimeters=1]="Millimeters",r[r.Centimeters=2]="Centimeters",r[r.Meters=3]="Meters",r[r.Kilometers=4]="Kilometers",r[r.Inches=5]="Inches",r[r.Feet=6]="Feet",r[r.Yards=7]="Yards",r[r.Miles=8]="Miles"})(yc||(yc={}));var Rc;(function(r){r[r.NoDisplayOrPlotted=0]="NoDisplayOrPlotted",r[r.DisplayAndPlotted=1]="DisplayAndPlotted",r[r.DisplayNoPlotted=2]="DisplayNoPlotted"})(Rc||(Rc={}));mh();wn();fh();bt();export{m as ACadVersion,ci as AcdbPlaceHolder,Ys as AecBinRecord,Gs as AecCleanupGroup,$s as AecWallStyle,al as AngularDirection,_n as AngularUnitFormat,jr as AngularZeroHandling,Os as AnnotScaleObjectContextData,gt as AppId,Vr as AppIdsTable,Ft as Arc,qs as ArcLengthSymbolPosition,he as AssociativityFlags,Oe as AttachmentPointType,Dn as AttributeBase,es as AttributeDefinition,Dt as AttributeEntity,wo as AttributeFlags,Gr as AttributeType,ll as AttributeVisibilityMode,Oi as AutoTransformMethodFlags,rr as BackgroundFillFlags,ko as BigEndianConverter,Pr as Block,Aa as Block1PtParameter,Ws as Block2PtParameter,La as BlockAction,Ul as BlockActionBasePt,wc as BlockBasePointParameter,xc as BlockContentConnectionType,Ms as BlockElement,gs as BlockEnd,Ql as BlockFlipAction,_c as BlockFlipGrip,ed as BlockFlipParameter,vs as BlockGrip,zs as BlockGripExpression,bc as BlockLinearParameter,Ra as BlockParameter,U as BlockRecord,Ir as BlockRecordsTable,mi as BlockReferenceObjectContextData,Rr as BlockRepresentationData,Us as BlockRotationAction,Oa as BlockRotationGrip,Hs as BlockRotationParameter,ne as BlockTypeFlags,Va as BlockVisibilityGrip,Fs as BlockVisibilityParameter,Ea as BlockVisibilityState,ui as BookColor,$ as BorderOverrideFlags,qe as BoundaryPathFlags,rh as BoundingBox,Qd as BreakData,$d as BreakFlowDirection,Bl as BreakHeight,Yd as BreakOptionFlags,yl as BreakRowRange,ds as CRC,Tl as CRC32StreamHandler,wr as CRC8StreamHandler,ms as CadAnnotScaleObjectContextDataTemplate,Ns as CadAttributeTemplate,Fl as CadBlock1PtParameterTemplate,Ba as CadBlock2PtParameterTemplate,vl as CadBlockActionBasePtTemplate,Sa as CadBlockActionTemplate,Mn as CadBlockCtrlObjectTemplate,Is as CadBlockElementTemplate,Cd as CadBlockEntityTemplate,Wl as CadBlockFlipActionTemplate,Hl as CadBlockFlipParameterTemplate,Ma as CadBlockGripExpressionTemplate,ja as CadBlockGripTemplate,Ca as CadBlockParameterTemplate,br as CadBlockRecordTemplate,Pa as CadBlockRepresentationDataTemplate,ka as CadBlockRotationActionTemplate,Na as CadBlockRotationGripTemplate,Ta as CadBlockRotationParameterTemplate,Ia as CadBlockVisibilityGripTemplate,Wi as CadBlockVisibilityParameterTemplate,ts as CadBody,jt as CadCellStyleTemplate,xe as CadDictionary,Vs as CadDictionaryTemplate,Cr as CadDictionaryWithDefault,aa as CadDictionaryWithDefaultTemplate,Ii as CadDimensionAssociationTemplate,Hn as CadDimensionStyleTemplate,gr as CadDimensionTemplate,xs as CadDocument,En as CadDocumentBuilder,k as CadEntityTemplate,ke as CadEntityTemplateT,Da as CadEvaluationExpressionTemplate,Mi as CadEvaluationGraphTemplate,Ha as CadFieldListTemplate,Wa as CadFieldTemplate,da as CadGeoDataTemplate,ha as CadGroupTemplate,Li as CadHatchTemplate,lt as CadHeader,xr as CadInsertTemplate,Fn as CadLayerTemplate,Un as CadLayoutTemplate,vn as CadLeaderTemplate,ki as CadLineTypeTemplate,ai as CadMLeaderAnnotContextTemplate,Yn as CadMLeaderStyleTemplate,$n as CadMLeaderTemplate,Pi as CadMLineStyleTemplate,Xn as CadMLineTemplate,Zn as CadMaterialTemplate,Kn as CadMeshTemplate,K as CadNonGraphicalObjectTemplate,Me as CadNotSupportedException,I as CadObject,mo as CadObjectCollection,jh as CadObjectExtensions,bd as CadObjectHolder,Jn as CadOle2FrameTemplate,Vl as CadPlotSettingsTemplate,Kt as CadPolyLineTemplate,Ed as CadProxyObjectTemplate,Ln as CadReaderBase,kn as CadReaderConfiguration,qn as CadShapeTemplate,Qn as CadSolid3DTemplate,ca as CadSortensTableTemplate,Ad as CadSpatialFilterTemplate,ea as CadSplineTemplate,Or as CadSummaryInfo,bh as CadSystemVariable,vh as CadTableAttributeTemplate,ma as CadTableCellContentFormatTemplate,fa as CadTableCellContentTemplate,Uo as CadTableCellTemplate,Td as CadTableContentTemplate,ua as CadTableEntityTemplate,fe as CadTableEntryTemplate,pa as CadTableStyleTemplate,st as CadTableTemplate,Pt as CadTemplate,G as CadTemplateT,Sr as CadTextEntityTemplate,ta as CadToleranceTemplate,ra as CadUcsTemplate,ga as CadUnderlayTemplate,ba as CadUnknownEntityTemplate,_a as CadUnknownNonGraphicalObjectTemplate,Z as CadUtils,na as CadVPortTemplate,Ht as CadValue,Fa as CadValueTemplate,W as CadValueType,po as CadValueUnitType,Zs as CadVertexTemplate,ia as CadViewTemplate,Il as CadViewportEntityControlTemplate,Ml as CadViewportEntityHeaderTemplate,sa as CadViewportTemplate,zl as CadWallTemplate,Ss as CadWipeoutBase,mn as CadWipeoutBaseTemplate,Es as CadWriterBase,Ls as CadWriterConfiguration,wa as CadXRecordTemplate,Xd as CellAlignmentType,Ri as CellBorder,cn as CellContent,Ph as CellContentGeometry,yi as CellEdgeFlags,Eh as CellOverrideFlags,hn as CellRange,os as CellStyle,Zd as CellStyleClass,Kd as CellStyleType,Jd as CellType,dt as Circle,xi as ClipMode,$r as ClipType,y as CodePage,tr as CollectionChangedEventArgs,B as Color,nc as ColorCollection,oi as ColorMethod,rs as ColumnType,Bs as ContentFormat,kh as CustomDataEntry,fo as DefaultLightingType,Wo as DesignCoordinatesType,bs as DictionaryCloningFlags,He as DictionaryVariable,ac as DictionaryVariableCollection,me as Dimension,je as DimensionAligned,St as DimensionAngular2Line,Ct as DimensionAngular3Pt,dl as DimensionAssociation,Bt as DimensionDiameter,Qe as DimensionLinear,yt as DimensionOrdinate,Wn as DimensionPlaceholder,Rt as DimensionRadius,re as DimensionStyle,Wt as DimensionStylesTable,oo as DimensionTextBackgroundFillMode,lo as DimensionTextHorizontalAlignment,ho as DimensionTextVerticalAlignment,v as DimensionType,bo as DrawingDirectionType,El as Dwg21CompressedMetadata,$h as DwgAppInfoReader,sd as DwgAppInfoWriter,nd as DwgAuxHeaderWriter,rt as DwgCheckSumCalculator,kl as DwgClassesReader,ad as DwgClassesWriter,On as DwgDocumentBuilder,Eo as DwgException,Ai as DwgFileHeader,Ei as DwgFileHeaderAC15,hs as DwgFileHeaderAC18,Al as DwgFileHeaderAC21,od as DwgFileHeaderWriterAC15,Xs as DwgFileHeaderWriterAC18,Xh as DwgFileHeaderWriterAC21,Xa as DwgFileHeaderWriterBase,Pl as DwgHandleReader,hd as DwgHandleWriter,Pn as DwgHeaderHandlesCollection,Ol as DwgHeaderReader,cd as DwgHeaderWriter,ld as DwgLZ77AC18Compressor,Ga as DwgLZ77AC18Decompressor,dd as DwgLZ77AC21Compressor,$a as DwgLZ77AC21Decompressor,cs as DwgLocalSectionMap,us as DwgMergedReader,Za as DwgMergedStreamWriter,td as DwgObjectReader,md as DwgObjectWriter,tn as DwgPreview,rd as DwgPreviewReader,fd as DwgPreviewWriter,Gh as DwgReader,Po as DwgReaderConfiguration,w as DwgReferenceType,T as DwgSectionDefinition,_r as DwgSectionDescriptor,Kh as DwgSectionHash,Y as DwgSectionIO,ft as DwgSectionLocatorRecord,Nn as DwgStreamReaderAC12,Vn as DwgStreamReaderAC15,ks as DwgStreamReaderAC18,In as DwgStreamReaderAC21,Ll as DwgStreamReaderAC24,be as DwgStreamReaderBase,Ka as DwgStreamWriterAC12,Ja as DwgStreamWriterAC15,qa as DwgStreamWriterAC18,Qa as DwgStreamWriterAC21,pd as DwgStreamWriterAC24,ye as DwgStreamWriterBase,id as DwgSummaryInfoReader,wd as DwgSummaryInfoWriter,Zh as DwgWriter,_d as DwgWriterConfiguration,ud as DwgmMergedStreamWriterAC14,kd as DxfAsciiWriter,ws as DxfBinaryReader,Dd as DxfBinaryReaderAC1009,Pd as DxfBinaryWriter,Bd as DxfBlockSectionReader,Od as DxfBlocksSectionWriter,F as DxfClass,gi as DxfClassCollection,V as DxfClassMap,jd as DxfClassesSectionWriter,p as DxfCode,eo as DxfDocumentBuilder,yd as DxfEntitiesSectionReader,Nd as DxfEntitiesSectionWriter,si as DxfException,d as DxfFileToken,Vd as DxfHeaderSectionWriter,Ae as DxfMap,gn as DxfMapBase,Ld as DxfObjectsSectionReader,Id as DxfObjectsSectionWriter,xh as DxfProperty,pl as DxfPropertyBase,Jh as DxfReader,gd as DxfReaderConfiguration,Lr as DxfReferenceType,Ji as DxfSectionReaderBase,Nt as DxfSectionWriterBase,to as DxfStreamReaderBase,ro as DxfStreamWriterBase,l as DxfSubclassMarker,Sd as DxfTablesSectionReader,Md as DxfTablesSectionWriter,xd as DxfTextReader,ec as DxfWriter,Qo as DxfWriterConfiguration,$l as EdgeStyleModel,sr as EdgeType,Ut as Ellipse,A as Entity,Qi as EntityPlotStyleType,Sc as EntryFlags,ya as EvaluationExpression,yr as EvaluationGraph,zh as EvaluationGraphEdge,xa as EvaluationGraphNode,Xo as EvaluationOptionFlags,Zo as EvaluationStatusFlags,so as ExtendedData,Fi as ExtendedDataBinaryChunk,Pe as ExtendedDataControlString,Gi as ExtendedDataCoordinate,no as ExtendedDataDictionary,$i as ExtendedDataDirection,Ui as ExtendedDataDisplacement,vi as ExtendedDataDistance,za as ExtendedDataHandle,Yi as ExtendedDataInteger16,Xi as ExtendedDataInteger32,va as ExtendedDataLayer,Zi as ExtendedDataReal,io as ExtendedDataRecord,ae as ExtendedDataRecordT,Ua as ExtendedDataReference,zi as ExtendedDataScale,Hi as ExtendedDataString,Ki as ExtendedDataWorldCoordinate,Yr as Face3D,Yl as FaceColorMode,Xl as FaceLightingModelType,Zl as FaceLightingQualityType,Kl as FaceModifierType,fi as Field,pi as FieldList,Ko as FieldStateFlags,Jo as FilingOptionFlags,ql as Filter,Ih as FlowDirectionType,Qs as FontFlags,Rd as FormattedTableData,It as FractionFormat,Jt as GeoData,We as GeoDataVersion,oa as GeoMeshFace,la as GeoMeshPoint,Sn as GradientColor,bn as GridFlags,Ot as Group,Be as GroupCodeValue,_ as GroupCodeValueType,oc as GroupCollection,Tt as Hatch,_l as HatchBoundaryPath,Xr as HatchBoundaryPathArc,on as HatchBoundaryPathEdge,Zr as HatchBoundaryPathEllipse,Kr as HatchBoundaryPathLine,is as HatchBoundaryPathPolyline,Jr as HatchBoundaryPathSpline,go as HatchGradientPattern,an as HatchPattern,Cn as HatchPatternLine,xo as HatchPatternType,Do as HatchStyleType,Di as HookLineDirection,tc as HugeMemoryStream,Nh as INamedCadObjectExtensions,Tr as ImageDefinition,lc as ImageDefinitionCollection,li as ImageDefinitionReactor,ir as ImageDisplayFlags,Yo as ImageDisplayQuality,yc as ImageUnits,hl as IndexCreationFlags,Ee as Insert,nn as InvisibleEdgeFlags,Si as KnotParametrization,Se as Layer,ze as LayerFlags,Mr as LayersTable,nt as Layout,dc as LayoutCollection,No as LayoutFlags,nr as Leader,dn as LeaderContentType,So as LeaderCreationType,Io as LeaderDrawOrderType,zn as LeaderLine,gc as LeaderLinePropertOverrideFlags,Co as LeaderPathType,Gn as LeaderRoot,bl as LightingType,zt as Line,sc as LineSpacingStyle,sn as LineSpacingStyleType,H as LineType,nl as LineTypeSegment,Ze as LineTypeShapeFlags,Wr as LineTypesTable,M as LineWeightType,Rl as LineWeightTypeExtensions,Js as LinearUnitFormat,dh as LinkedData,hh as LinkedTableData,As as LittleEndianConverter,qr as LwPolyline,At as LwPolylineFlags,Ci as LwPolylineVertex,cc as MLeaderStyleCollection,or as MLine,Bi as MLineFlags,Bo as MLineJustification,Bn as MLineSegment,wt as MLineStyle,uc as MLineStyleCollection,js as MLineStyleElement,ge as MLineStyleFlags,yn as MLineVertex,Ne as MText,ps as MTextAttributeObjectContextData,ee as MapSource,Ch as MarginFlags,at as Material,hc as MaterialCollection,Q as MathHelper,it as Matrix4,cl as MeasurementUnits,ar as Mesh,ln as MeshEdge,Ds as ModelerGeometry,wl as ModelerGeometrySilhouette,_o as ModelerGeometryWire,lr as MultiLeader,gl as MultiLeaderBlockAttribute,Mo as MultiLeaderDrawOrderType,Dr as MultiLeaderObjectContextData,yo as MultiLeaderPathType,zd as MultiLeaderPropertyOverrideFlags,$e as MultiLeaderStyle,O as NonGraphicalObject,kt as NotificationEventArgs,g as NotificationType,Nl as ObjectContextData,pe as ObjectDictionaryCollection,vo as ObjectOsnapType,Mh as ObjectSnapMode,ul as ObjectSortingFlags,u as ObjectType,dr as Ole2Frame,xl as OleObjectType,sl as OnNameChangedArgs,Mt as OrthographicType,fs as OsnapPointRef,un as PaperMargin,mc as PdfDefinitionCollection,Qr as PdfUnderlay,hi as PdfUnderlayDefinition,Ps as PlotFlags,Lo as PlotPaperUnits,ni as PlotRotation,pt as PlotSettings,sh as PlotType,Gt as Point,ut as PolyfaceMesh,Et as PolygonMesh,ss as PolygonMeshVertex,hr as Polyline,et as Polyline2D,tt as Polyline3D,Vh as PolylineExtensions,Ve as PolylineFlags,ji as ProjectionMethod,Hd as PropertyExpression,Tn as ProxyEntity,E as ProxyFlags,Er as ProxyObject,ns as RasterImage,Ar as RasterVariables,ei as Ray,as as Region,en as RenderMode,$o as ResolutionUnit,zo as RotatedDimensionType,Ge as Scale,fc as ScaleCollection,Ho as ScaleEstimationType,nh as ScaledType,Le as Seqend,vt as SeqendCollection,Wh as ShadeEdgeType,Oo as ShadePlotMode,jo as ShadePlotResolutionMode,Sh as ShadowMode,ur as Shape,Cl as SmoothSurfaceType,$t as Solid,ti as Solid3D,Br as SortEntitiesTable,ah as Sorter,bi as SpaceLineTypeScaling,qt as SpatialFilter,mr as Spline,Ie as SplineFlags,mt as SplineFlags1,ml as SplineType,Vt as StandardFlags,Vo as StartEndPointPair,Nr as StyleFlags,Go as SubentType,Wd as SvgConfiguration,P as SvgConverter,rc as SvgDocumentBuilder,ic as SvgWriter,fn as SvgXmlWriter,Ce as Table,Lh as TableAttribute,Bh as TableBorderPropertyFlags,yh as TableCellContentLayoutFlags,qd as TableCellContentType,Rh as TableCellStateFlags,Th as TableCellStylePropertyFlags,eh as TableContent,Ti as TableEntity,Gd as TableEntityBorderType,ys as TableEntityCell,Rs as TableEntityColumn,Ts as TableEntityRow,Ah as TableEntityValueUnitType,De as TableEntry,Fo as TableFlowDirectionType,de as TableOverrideFlags,Ye as TableStyle,pc as TableStyleCollection,Ro as TextAlignmentType,Bc as TextAngleType,ol as TextArrowFitType,To as TextAttachmentDirectionType,Ao as TextAttachmentPointType,Cs as TextAttachmentType,Dh as TextColumnData,_i as TextDirection,Je as TextEntity,ht as TextHorizontalAlignment,rn as TextMirrorFlag,co as TextMovement,Cc as TextProcessor,te as TextStyle,Hr as TextStylesTable,ct as TextVerticalAlignmentType,Ni as TilingMethod,Yt as Tolerance,uo as ToleranceAlignment,ih as Transform,Ke as Transparency,ot as UCS,Fr as UCSTable,Jl as UnderlayDefinition,Dl as UnderlayDisplayFlags,Sl as UnderlayEntity,An as UnitExtensions,ao as UnitStyleFormat,ie as UnitsType,Lt as UnknownEntity,pr as UnknownNonGraphicalObject,vr as UscIconType,xt as VPort,zr as VPortsTable,Ue as Vertex,Xt as Vertex2D,cr as Vertex3D,ri as VertexFaceMesh,Zt as VertexFaceRecord,Rn as VertexFlags,Oh as VerticalAlignmentType,Vi as View,se as ViewModeType,fr as Viewport,Dc as ViewportEntityControl,Gl as ViewportEntityHeader,th as ViewportStatusFlags,Ur as ViewsTable,di as VisualStyle,xn as Wall,vd as WallJustification,ls as Wipeout,Rc as WipeoutFrameType,fl as XClipFrameType,ii as XLine,_t as XRecord,oh as XRecordEntry,C as XY,c as XYZ,Ac as XYZ_Zero,oe as ZeroHandling,lh as registerMergedWriter,jn as registerStreamReader,Ya as registerStreamWriter};
15
+ `,n+=2;break;case"r":break;case"}":case"{":case"\\":t+=h;break}i=n}return t}static processFont(e,t){let i=e.indexOf(";",t);return i+=1,i}static jump(e,t){let i=e.indexOf(";",t);return i+=1,i}static processColor(e,t){let i=e.indexOf(";",t);return i+=1,i}static processHeight(e,t){let i=e.indexOf(";",t);return i+=1,i}static processJustification(e,t){let i=e.indexOf(";",t);return i+=1,i}};var Cc;(function(r){r[r.ParllelToLastLeaderLine=0]="ParllelToLastLeaderLine",r[r.Horizontal=1]="Horizontal",r[r.Optimized=2]="Optimized"})(Cc||(Cc={}));R();var Bc;(function(r){r[r.Unitless=0]="Unitless",r[r.Millimeters=1]="Millimeters",r[r.Centimeters=2]="Centimeters",r[r.Meters=3]="Meters",r[r.Kilometers=4]="Kilometers",r[r.Inches=5]="Inches",r[r.Feet=6]="Feet",r[r.Yards=7]="Yards",r[r.Miles=8]="Miles"})(Bc||(Bc={}));var yc;(function(r){r[r.NoDisplayOrPlotted=0]="NoDisplayOrPlotted",r[r.DisplayAndPlotted=1]="DisplayAndPlotted",r[r.DisplayNoPlotted=2]="DisplayNoPlotted"})(yc||(yc={}));mh();wn();fh();bt();export{m as ACadVersion,ci as AcdbPlaceHolder,Ys as AecBinRecord,Gs as AecCleanupGroup,$s as AecWallStyle,al as AngularDirection,_n as AngularUnitFormat,jr as AngularZeroHandling,Os as AnnotScaleObjectContextData,gt as AppId,Vr as AppIdsTable,Ft as Arc,qs as ArcLengthSymbolPosition,he as AssociativityFlags,Oe as AttachmentPointType,Dn as AttributeBase,es as AttributeDefinition,Dt as AttributeEntity,wo as AttributeFlags,Gr as AttributeType,ll as AttributeVisibilityMode,Oi as AutoTransformMethodFlags,rr as BackgroundFillFlags,ko as BigEndianConverter,Pr as Block,Aa as Block1PtParameter,Ws as Block2PtParameter,La as BlockAction,Ul as BlockActionBasePt,pc as BlockBasePointParameter,gc as BlockContentConnectionType,Ms as BlockElement,gs as BlockEnd,Ql as BlockFlipAction,wc as BlockFlipGrip,ed as BlockFlipParameter,vs as BlockGrip,zs as BlockGripExpression,_c as BlockLinearParameter,Ra as BlockParameter,U as BlockRecord,Ir as BlockRecordsTable,mi as BlockReferenceObjectContextData,Rr as BlockRepresentationData,Us as BlockRotationAction,Oa as BlockRotationGrip,Hs as BlockRotationParameter,ne as BlockTypeFlags,Va as BlockVisibilityGrip,Fs as BlockVisibilityParameter,Ea as BlockVisibilityState,ui as BookColor,$ as BorderOverrideFlags,qe as BoundaryPathFlags,rh as BoundingBox,Qd as BreakData,$d as BreakFlowDirection,Bl as BreakHeight,Yd as BreakOptionFlags,yl as BreakRowRange,ds as CRC,Tl as CRC32StreamHandler,wr as CRC8StreamHandler,ms as CadAnnotScaleObjectContextDataTemplate,Ns as CadAttributeTemplate,Fl as CadBlock1PtParameterTemplate,Ba as CadBlock2PtParameterTemplate,vl as CadBlockActionBasePtTemplate,Sa as CadBlockActionTemplate,Mn as CadBlockCtrlObjectTemplate,Is as CadBlockElementTemplate,Cd as CadBlockEntityTemplate,Wl as CadBlockFlipActionTemplate,Hl as CadBlockFlipParameterTemplate,Ma as CadBlockGripExpressionTemplate,ja as CadBlockGripTemplate,Ca as CadBlockParameterTemplate,br as CadBlockRecordTemplate,Pa as CadBlockRepresentationDataTemplate,ka as CadBlockRotationActionTemplate,Na as CadBlockRotationGripTemplate,Ta as CadBlockRotationParameterTemplate,Ia as CadBlockVisibilityGripTemplate,Wi as CadBlockVisibilityParameterTemplate,ts as CadBody,jt as CadCellStyleTemplate,xe as CadDictionary,Vs as CadDictionaryTemplate,Cr as CadDictionaryWithDefault,aa as CadDictionaryWithDefaultTemplate,Ii as CadDimensionAssociationTemplate,Hn as CadDimensionStyleTemplate,gr as CadDimensionTemplate,xs as CadDocument,En as CadDocumentBuilder,k as CadEntityTemplate,ke as CadEntityTemplateT,Da as CadEvaluationExpressionTemplate,Mi as CadEvaluationGraphTemplate,Ha as CadFieldListTemplate,Wa as CadFieldTemplate,da as CadGeoDataTemplate,ha as CadGroupTemplate,Li as CadHatchTemplate,lt as CadHeader,xr as CadInsertTemplate,Fn as CadLayerTemplate,Un as CadLayoutTemplate,vn as CadLeaderTemplate,ki as CadLineTypeTemplate,ai as CadMLeaderAnnotContextTemplate,Yn as CadMLeaderStyleTemplate,$n as CadMLeaderTemplate,Pi as CadMLineStyleTemplate,Xn as CadMLineTemplate,Zn as CadMaterialTemplate,Kn as CadMeshTemplate,K as CadNonGraphicalObjectTemplate,Me as CadNotSupportedException,I as CadObject,mo as CadObjectCollection,Oh as CadObjectExtensions,bd as CadObjectHolder,Jn as CadOle2FrameTemplate,Vl as CadPlotSettingsTemplate,Kt as CadPolyLineTemplate,Ed as CadProxyObjectTemplate,Ln as CadReaderBase,kn as CadReaderConfiguration,qn as CadShapeTemplate,Qn as CadSolid3DTemplate,ca as CadSortensTableTemplate,Ad as CadSpatialFilterTemplate,ea as CadSplineTemplate,Or as CadSummaryInfo,bh as CadSystemVariable,Uh as CadTableAttributeTemplate,ma as CadTableCellContentFormatTemplate,fa as CadTableCellContentTemplate,Uo as CadTableCellTemplate,Td as CadTableContentTemplate,ua as CadTableEntityTemplate,fe as CadTableEntryTemplate,pa as CadTableStyleTemplate,st as CadTableTemplate,Pt as CadTemplate,G as CadTemplateT,Sr as CadTextEntityTemplate,ta as CadToleranceTemplate,ra as CadUcsTemplate,ga as CadUnderlayTemplate,ba as CadUnknownEntityTemplate,_a as CadUnknownNonGraphicalObjectTemplate,Z as CadUtils,na as CadVPortTemplate,Ht as CadValue,Fa as CadValueTemplate,W as CadValueType,po as CadValueUnitType,Zs as CadVertexTemplate,ia as CadViewTemplate,Il as CadViewportEntityControlTemplate,Ml as CadViewportEntityHeaderTemplate,sa as CadViewportTemplate,zl as CadWallTemplate,Ss as CadWipeoutBase,mn as CadWipeoutBaseTemplate,Es as CadWriterBase,Ls as CadWriterConfiguration,wa as CadXRecordTemplate,Xd as CellAlignmentType,Ri as CellBorder,cn as CellContent,kh as CellContentGeometry,yi as CellEdgeFlags,Ah as CellOverrideFlags,hn as CellRange,os as CellStyle,Zd as CellStyleClass,Kd as CellStyleType,Jd as CellType,dt as Circle,xi as ClipMode,$r as ClipType,y as CodePage,tr as CollectionChangedEventArgs,B as Color,sc as ColorCollection,oi as ColorMethod,rs as ColumnType,Bs as ContentFormat,Lh as CustomDataEntry,fo as DefaultLightingType,Wo as DesignCoordinatesType,bs as DictionaryCloningFlags,He as DictionaryVariable,nc as DictionaryVariableCollection,me as Dimension,je as DimensionAligned,St as DimensionAngular2Line,Ct as DimensionAngular3Pt,dl as DimensionAssociation,Bt as DimensionDiameter,Qe as DimensionLinear,yt as DimensionOrdinate,Wn as DimensionPlaceholder,Rt as DimensionRadius,re as DimensionStyle,Wt as DimensionStylesTable,oo as DimensionTextBackgroundFillMode,lo as DimensionTextHorizontalAlignment,ho as DimensionTextVerticalAlignment,v as DimensionType,bo as DrawingDirectionType,El as Dwg21CompressedMetadata,Gh as DwgAppInfoReader,sd as DwgAppInfoWriter,nd as DwgAuxHeaderWriter,rt as DwgCheckSumCalculator,kl as DwgClassesReader,ad as DwgClassesWriter,On as DwgDocumentBuilder,Eo as DwgException,Ai as DwgFileHeader,Ei as DwgFileHeaderAC15,hs as DwgFileHeaderAC18,Al as DwgFileHeaderAC21,od as DwgFileHeaderWriterAC15,Xs as DwgFileHeaderWriterAC18,Yh as DwgFileHeaderWriterAC21,Xa as DwgFileHeaderWriterBase,Pl as DwgHandleReader,hd as DwgHandleWriter,Pn as DwgHeaderHandlesCollection,Ol as DwgHeaderReader,cd as DwgHeaderWriter,ld as DwgLZ77AC18Compressor,Ga as DwgLZ77AC18Decompressor,dd as DwgLZ77AC21Compressor,$a as DwgLZ77AC21Decompressor,cs as DwgLocalSectionMap,us as DwgMergedReader,Za as DwgMergedStreamWriter,td as DwgObjectReader,md as DwgObjectWriter,tn as DwgPreview,rd as DwgPreviewReader,fd as DwgPreviewWriter,zh as DwgReader,Po as DwgReaderConfiguration,w as DwgReferenceType,T as DwgSectionDefinition,_r as DwgSectionDescriptor,Zh as DwgSectionHash,Y as DwgSectionIO,ft as DwgSectionLocatorRecord,Nn as DwgStreamReaderAC12,Vn as DwgStreamReaderAC15,ks as DwgStreamReaderAC18,In as DwgStreamReaderAC21,Ll as DwgStreamReaderAC24,be as DwgStreamReaderBase,Ka as DwgStreamWriterAC12,Ja as DwgStreamWriterAC15,qa as DwgStreamWriterAC18,Qa as DwgStreamWriterAC21,pd as DwgStreamWriterAC24,ye as DwgStreamWriterBase,id as DwgSummaryInfoReader,wd as DwgSummaryInfoWriter,Xh as DwgWriter,_d as DwgWriterConfiguration,ud as DwgmMergedStreamWriterAC14,kd as DxfAsciiWriter,ws as DxfBinaryReader,Dd as DxfBinaryReaderAC1009,Pd as DxfBinaryWriter,Bd as DxfBlockSectionReader,Od as DxfBlocksSectionWriter,F as DxfClass,gi as DxfClassCollection,V as DxfClassMap,jd as DxfClassesSectionWriter,p as DxfCode,eo as DxfDocumentBuilder,yd as DxfEntitiesSectionReader,Nd as DxfEntitiesSectionWriter,si as DxfException,d as DxfFileToken,Vd as DxfHeaderSectionWriter,Ae as DxfMap,gn as DxfMapBase,Ld as DxfObjectsSectionReader,Id as DxfObjectsSectionWriter,gh as DxfProperty,pl as DxfPropertyBase,Kh as DxfReader,gd as DxfReaderConfiguration,Lr as DxfReferenceType,Ji as DxfSectionReaderBase,Nt as DxfSectionWriterBase,to as DxfStreamReaderBase,ro as DxfStreamWriterBase,l as DxfSubclassMarker,Sd as DxfTablesSectionReader,Md as DxfTablesSectionWriter,xd as DxfTextReader,Qh as DxfWriter,Qo as DxfWriterConfiguration,$l as EdgeStyleModel,sr as EdgeType,Ut as Ellipse,A as Entity,Qi as EntityPlotStyleType,Dc as EntryFlags,ya as EvaluationExpression,yr as EvaluationGraph,vh as EvaluationGraphEdge,xa as EvaluationGraphNode,Xo as EvaluationOptionFlags,Zo as EvaluationStatusFlags,so as ExtendedData,Fi as ExtendedDataBinaryChunk,Pe as ExtendedDataControlString,Gi as ExtendedDataCoordinate,no as ExtendedDataDictionary,$i as ExtendedDataDirection,Ui as ExtendedDataDisplacement,vi as ExtendedDataDistance,za as ExtendedDataHandle,Yi as ExtendedDataInteger16,Xi as ExtendedDataInteger32,va as ExtendedDataLayer,Zi as ExtendedDataReal,io as ExtendedDataRecord,ae as ExtendedDataRecordT,Ua as ExtendedDataReference,zi as ExtendedDataScale,Hi as ExtendedDataString,Ki as ExtendedDataWorldCoordinate,Yr as Face3D,Yl as FaceColorMode,Xl as FaceLightingModelType,Zl as FaceLightingQualityType,Kl as FaceModifierType,fi as Field,pi as FieldList,Ko as FieldStateFlags,Jo as FilingOptionFlags,ql as Filter,Vh as FlowDirectionType,Qs as FontFlags,Rd as FormattedTableData,It as FractionFormat,Jt as GeoData,We as GeoDataVersion,oa as GeoMeshFace,la as GeoMeshPoint,Sn as GradientColor,bn as GridFlags,Ot as Group,Be as GroupCodeValue,_ as GroupCodeValueType,ac as GroupCollection,Tt as Hatch,_l as HatchBoundaryPath,Xr as HatchBoundaryPathArc,on as HatchBoundaryPathEdge,Zr as HatchBoundaryPathEllipse,Kr as HatchBoundaryPathLine,is as HatchBoundaryPathPolyline,Jr as HatchBoundaryPathSpline,go as HatchGradientPattern,an as HatchPattern,Cn as HatchPatternLine,xo as HatchPatternType,Do as HatchStyleType,Di as HookLineDirection,ec as HugeMemoryStream,jh as INamedCadObjectExtensions,Tr as ImageDefinition,oc as ImageDefinitionCollection,li as ImageDefinitionReactor,ir as ImageDisplayFlags,Yo as ImageDisplayQuality,Bc as ImageUnits,hl as IndexCreationFlags,Ee as Insert,nn as InvisibleEdgeFlags,Si as KnotParametrization,Se as Layer,ze as LayerFlags,Mr as LayersTable,nt as Layout,lc as LayoutCollection,No as LayoutFlags,nr as Leader,dn as LeaderContentType,So as LeaderCreationType,Io as LeaderDrawOrderType,zn as LeaderLine,bc as LeaderLinePropertOverrideFlags,Co as LeaderPathType,Gn as LeaderRoot,bl as LightingType,zt as Line,ic as LineSpacingStyle,sn as LineSpacingStyleType,H as LineType,nl as LineTypeSegment,Ze as LineTypeShapeFlags,Wr as LineTypesTable,M as LineWeightType,Rl as LineWeightTypeExtensions,Js as LinearUnitFormat,dh as LinkedData,hh as LinkedTableData,As as LittleEndianConverter,qr as LwPolyline,At as LwPolylineFlags,Ci as LwPolylineVertex,hc as MLeaderStyleCollection,or as MLine,Bi as MLineFlags,Bo as MLineJustification,Bn as MLineSegment,wt as MLineStyle,cc as MLineStyleCollection,js as MLineStyleElement,ge as MLineStyleFlags,yn as MLineVertex,Ne as MText,ps as MTextAttributeObjectContextData,ee as MapSource,Sh as MarginFlags,at as Material,dc as MaterialCollection,Q as MathHelper,it as Matrix4,cl as MeasurementUnits,ar as Mesh,ln as MeshEdge,Ds as ModelerGeometry,wl as ModelerGeometrySilhouette,_o as ModelerGeometryWire,lr as MultiLeader,gl as MultiLeaderBlockAttribute,Mo as MultiLeaderDrawOrderType,Dr as MultiLeaderObjectContextData,yo as MultiLeaderPathType,zd as MultiLeaderPropertyOverrideFlags,$e as MultiLeaderStyle,O as NonGraphicalObject,kt as NotificationEventArgs,g as NotificationType,Nl as ObjectContextData,pe as ObjectDictionaryCollection,vo as ObjectOsnapType,Ih as ObjectSnapMode,ul as ObjectSortingFlags,u as ObjectType,dr as Ole2Frame,xl as OleObjectType,sl as OnNameChangedArgs,Mt as OrthographicType,fs as OsnapPointRef,un as PaperMargin,uc as PdfDefinitionCollection,Qr as PdfUnderlay,hi as PdfUnderlayDefinition,Ps as PlotFlags,Lo as PlotPaperUnits,ni as PlotRotation,pt as PlotSettings,sh as PlotType,Gt as Point,ut as PolyfaceMesh,Et as PolygonMesh,ss as PolygonMeshVertex,hr as Polyline,et as Polyline2D,tt as Polyline3D,Nh as PolylineExtensions,Ve as PolylineFlags,ji as ProjectionMethod,Hd as PropertyExpression,Tn as ProxyEntity,E as ProxyFlags,Er as ProxyObject,ns as RasterImage,Ar as RasterVariables,ei as Ray,as as Region,en as RenderMode,$o as ResolutionUnit,zo as RotatedDimensionType,Ge as Scale,mc as ScaleCollection,Ho as ScaleEstimationType,nh as ScaledType,Le as Seqend,vt as SeqendCollection,Mh as ShadeEdgeType,Oo as ShadePlotMode,jo as ShadePlotResolutionMode,Dh as ShadowMode,ur as Shape,Cl as SmoothSurfaceType,$t as Solid,ti as Solid3D,Br as SortEntitiesTable,ah as Sorter,bi as SpaceLineTypeScaling,qt as SpatialFilter,mr as Spline,Ie as SplineFlags,mt as SplineFlags1,ml as SplineType,Vt as StandardFlags,Vo as StartEndPointPair,Nr as StyleFlags,Go as SubentType,Wd as SvgConfiguration,P as SvgConverter,tc as SvgDocumentBuilder,rc as SvgWriter,fn as SvgXmlWriter,Ce as Table,Eh as TableAttribute,Ch as TableBorderPropertyFlags,Bh as TableCellContentLayoutFlags,qd as TableCellContentType,yh as TableCellStateFlags,Rh as TableCellStylePropertyFlags,eh as TableContent,Ti as TableEntity,Gd as TableEntityBorderType,ys as TableEntityCell,Rs as TableEntityColumn,Ts as TableEntityRow,Th as TableEntityValueUnitType,De as TableEntry,Fo as TableFlowDirectionType,de as TableOverrideFlags,Ye as TableStyle,fc as TableStyleCollection,Ro as TextAlignmentType,Cc as TextAngleType,ol as TextArrowFitType,To as TextAttachmentDirectionType,Ao as TextAttachmentPointType,Cs as TextAttachmentType,xh as TextColumnData,_i as TextDirection,Je as TextEntity,ht as TextHorizontalAlignment,rn as TextMirrorFlag,co as TextMovement,Sc as TextProcessor,te as TextStyle,Hr as TextStylesTable,ct as TextVerticalAlignmentType,Ni as TilingMethod,Yt as Tolerance,uo as ToleranceAlignment,ih as Transform,Ke as Transparency,ot as UCS,Fr as UCSTable,Jl as UnderlayDefinition,Dl as UnderlayDisplayFlags,Sl as UnderlayEntity,An as UnitExtensions,ao as UnitStyleFormat,ie as UnitsType,Lt as UnknownEntity,pr as UnknownNonGraphicalObject,vr as UscIconType,xt as VPort,zr as VPortsTable,Ue as Vertex,Xt as Vertex2D,cr as Vertex3D,ri as VertexFaceMesh,Zt as VertexFaceRecord,Rn as VertexFlags,Ph as VerticalAlignmentType,Vi as View,se as ViewModeType,fr as Viewport,xc as ViewportEntityControl,Gl as ViewportEntityHeader,th as ViewportStatusFlags,Ur as ViewsTable,di as VisualStyle,xn as Wall,vd as WallJustification,ls as Wipeout,yc as WipeoutFrameType,fl as XClipFrameType,ii as XLine,_t as XRecord,oh as XRecordEntry,C as XY,c as XYZ,Tc as XYZ_Zero,oe as ZeroHandling,lh as registerMergedWriter,jn as registerStreamReader,Ya as registerStreamWriter};